// JavaScript Document

var xmlHttp;
var vid;
function arrival()
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="/tracker.php?mode=arrival";

url += "&js_document_domain="+        encodeURIComponent(document.domain);
url += "&js_document_lastModified="+  encodeURIComponent(document.lastModified);
url += "&js_document_referrer="+      encodeURIComponent(document.referrer);
url += "&js_document_title="+         encodeURIComponent(document.title);
url += "&js_document_URL="+           encodeURIComponent(document.URL);
url += "&js_navigator_appCodeName="+  encodeURIComponent(navigator.appCodeName);
url += "&js_navigator_appName="+      encodeURIComponent(navigator.appName);
url += "&js_navigator_appVersion="+   encodeURIComponent(navigator.appVersion);
url += "&js_navigator_cookieEnabled="+encodeURIComponent(navigator.cookieEnabled);
url += "&js_navigator_platform="+     encodeURIComponent(navigator.platform);
url += "&js_navigator_userAgent="+    encodeURIComponent(navigator.userAgent);
url += "&js_navigator_javaEnabled="+  encodeURIComponent(navigator.javaEnabled());
url += "&js_navigator_taintEnabled="+ encodeURIComponent(navigator.taintEnabled());
url += "&js_location_href="+          encodeURIComponent(location.href);


url += "&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function departure(vid)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request");
return;
 }
var url="/tracker.php?mode=departure&vid="+vid+"&sid="+Math.random();
//xmlHttp.onreadystatechange=stateChanged2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
// alert('Arrival= '+xmlHttp.responseText);
 vid=xmlHttp.responseText;
 return xmlHttp.responseText;
}
}
/*
function stateChanged2()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
// alert('Departure = '+xmlHttp.responseText);
 vid=xmlHttp.responseText;
 return xmlHttp.responseText;
}
}
*/

function GetXmlHttpObject()
{
var xmlHttp=null;
try{
 //Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }catch (e)
 {
 //Internet Explorer
 try{
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
}
return xmlHttp;
}
arrival();
