// JavaScript Document



var Departures = new Array();

var Destinations = new Array();





function MobileRequest() {

	Departures['depPort'] = document.getElementById('depPort');

	Departures['depRail'] = document.getElementById('depRail');

	Departures['depCity'] = document.getElementById('depCity');

	Destinations['desPort'] = document.getElementById('desPort');

	Destinations['desRail'] = document.getElementById('desRail');

	Destinations['desCity'] = document.getElementById('desCity');

}



function SetPoint(id, value) {

	var obj = document.getElementById(id);

	alert("reg");

	//obj.value = value;

	//document.forms['MobileTransportRequest'].submit();

}



function getPoint() {

	var obj = document.getElementById("depPoint");

	alert("obj");

	//alert(obj);

}





function MobileTransportRequest() {

	//alert("object");

	this.Departures = new Array();

	this.Departures['depPort'] = document.getElementById('depPort');

	this.Departures['depRail'] = document.getElementById('depRail');

	this.Departures['depCity'] = document.getElementById('depCity');

	

	this.Destinations = new Array();

	this.Destinations['desPort'] = document.getElementById('desPort');

	this.Destinations['desRail'] = document.getElementById('desRail');

	this.Destinations['desCity'] = document.getElementById('desCity');

	

	this.Departure = new Object();

	this.Destination = new Object();

	this.Departure.type = null;

	this.Destination.type = null;

	this.Departure.obj = document.getElementById('depPoint');

	this.Destination.obj = document.getElementById('destPoint');

}



function SetDeparture(obj) {

	var type = null;

	var point = document.MobileTransportRequest.depPoint;

	

}



function SetDestination() {

	var type = null;

	var point = document.MobileTransportRequest.desPoint;

}



MobileTransportRequest.prototype.SetDeparture = function(obj) {

	//alert("SetDeparture();");

	this.Departure.type = obj.id;

	this.Departure.obj.value = obj.value;

	for (var n in this.Departures) {

		if (n != obj.id) {

			this.Departures[n].selectedIndex = 0;

		}

	}

}



MobileTransportRequest.prototype.SetDestination = function(obj) {

	//alert("SetDestination();");

	this.Destination.type = obj.id;

	this.Destination.obj.value = obj.value;

	for (var n in this.Destinations) {

		if (n != obj.id) {

			this.Destinations[n].selectedIndex = 0;

		}

	}

}



function make_ajax(url, func) {

	var request = null;

	

	if(window.XMLHttpRequest) {

		request = new XMLHttpRequest();

		request.overrideMimeType('text/xml');

	} else {

		if (window.ActiveXObject) {

			request = new ActiveXObject("Microsoft.XMLHTTP");

		}

	}

	alert(request);

}



function FillDropDownBox(obj, xml) {

	alert(xml);

}



function FillDepPort(req) { alert(req.responseXML);/* var port = document.getElementById('depPort'); */ /* FillDropDownBox(port, req.responseXML); */ /* alert(req.responseText); */ }

function FillDepRail() {}

function FillDepCity() {}



function FillDesPort() {}

function FillDesRail() {}

function FillDesCity() {}



function getDeparturePoints(obj) {

	/*

	alert("fakju nx");

	var ports = new AJAX();

	ports.OnStateChange(FillDepPort);

	ports.Open("GET","ajax/getPorts.php?id="+obj.value, true);

	ports.SetContentType("application/x-www-form-urlencoded; charset=UTF-8");

	ports.Send(null);

	*/

	//make_ajax("ajax/getPorts.php?id="+obj.value, null);

	var port = document.MobileTransportRequest.depPort;

	var rail = document.MobileTransportRequest.depRail;

	var city = document.MobileTransportRequest.depCity;

}



function clearPoint(id) {

	var point = document.MobileTransportRequest.id;

	alert(point);

	//point.selectedIndex = 0;

}



function onOver(obj) {

	obj.style.backgroundColor = '#EEEEEE';

}



function onOut(obj) {

	obj.style.backgroundColor = '#FFFFFF';

}



function selectRow(id, value, direction) {

	var obj = document.ReturnPoint[id];

	obj.value = value;

	if (direction!=null) {

		var point = document.ReturnPoint[direction];

		point.value = value;

	}

	document.ReturnPoint.submit();

	//alert(obj);

}








