function GetXmlHttpObject(handler)
{ 
	var objXMLHttp=null
		if (window.XMLHttpRequest)
		{
			objXMLHttp=new XMLHttpRequest()
		}
		else if (window.ActiveXObject)
		{
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
	return objXMLHttp
}

var xmlHttp;
var _xt;
var _div_id;

function show_data(param,xt,_div)
{
//alert("from this field " + param);
var obj = document.getElementById(param);
var str = obj.value;
//alert(obj.options[obj.selectedIndex].text);
_div_id = _div;
//alert("This value passed " + str);
_xt = xt;
//alert("Task number : " + _xt);
//alert("going to effect this : " + _div_id);
	loading_splash(_div_id);
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
		//var url="https://secure.bct-transfers.com/xjax/xjax.php";
		var url=location.protocol + "//" + location.hostname +"/xjax/xjax.php";
		url=url+"?xt="+xt
		url=url+"&var="+str
		url=url+"&sid="+sid
		url=url+"&xid="+Math.random()
		//alert(url);
		xmlHttp.onreadystatechange=stateChanged
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		
} 



function send_data(param,xt,_div)
{
//alert(param);
//var obj = document.getElementById(param);
var str = param;
//alert(str);
_xt = xt;
_div_id = _div;
//alert(_xt);
	loading_splash(_div_id);
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
		//var url="https://secure.bct-transfers.com/xjax/xjax.php";
		var url=location.protocol + "//" + location.hostname +"/xjax/xjax.php";
		url=url+"?xt="+xt
		url=url+"&var="+str
		url=url+"&sid="+sid
		url=url+"&xid="+Math.random()
		xmlHttp.onreadystatechange=stateChanged
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		
} 



function stateChanged() 
{ 
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	//alert(_xt);
	//alert(xmlHttp.responseText);
	//alert(_div_id);
	

			if(_xt==10){
				document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
				if (document.getElementById('return_check').checked==true){ t2_changed('t2') }
			}else if(_xt==17){
				document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
				show_city();
			}else if(_xt==12){
				document.getElementById(_div_id).style.display="";
				document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
				var check_len = xmlHttp.responseText;
				if (check_len.length< 1050){ document.getElementById(_div_id).style.height="auto"; }else{ document.getElementById(_div_id).style.height="100px"; }
			}else if(_xt==14){
				//document.getElementById(_div_id).style.display="";
				//document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
				//var res = xmlHttp.responseText;
				//alert(res);
				//var resx = res.split("~");
				/*document.getElementById('t1_details').innerHTML = resx[0];
				document.getElementById('t2_details').innerHTML = resx[1];
				var t1_st = resx[2];
					if (t1_st=="airport2suburb"){ 
						document.getElementById('t1_pickup').value = resx[3];
					}else{
						document.getElementById('t1_dropping').value = resx[3];
					}
				
				var t2_st = resx[4];
					if (t2_st!="false"){
						if (t2_st=="airport2suburb"){ 
							document.getElementById('t2_pickup').value = resx[5];
						}else{
							document.getElementById('t2_dropping').value = resx[5];
						}
					}*/
			}else{
				document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
			}

	} 
} 

function loading_splash(_div){
var str = "<table border=0 cellpadding=0 cellspacing=0 style=WIDTH:100%;HEIGHT:100% align=center><tr><td align=center valign=middle><table border=0 cellpadding=4 cellspacing=0 width=150 height=40 style=BORDER-RIGHT:#888888 2px solid; BORDER-TOP:#888888 2px solid; BORDER-LEFT:#888888 2px solid; CURSOR:default; BORDER-BOTTOM:#888888 2px solid; BACKGROUND-COLOR:#ffffff><tr><td align=center class=text11><IMG src=/images/loading/spinner.gif>&nbsp;&nbsp;<b>Loading ...</b></td></tr></table></td></tr></table>";
document.getElementById(_div_id).innerHTML = str;
}