var xmlHttp

function timeForm(l,p,m,d,y)
{
xmlHttp1=GetXmlHttpObject();
if (xmlHttp1==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="/timeform/"+l+"/"+p+"/"+y+"-"+m+"-"+d+"/";
xmlHttp1.onreadystatechange=timeStateChanged;
xmlHttp1.open("GET",url,true);
xmlHttp1.send(null);
showCalendar(l,p,y,m,d);
}

function unitForm(t)
{
xmlHttp2=GetXmlHttpObject();
if (xmlHttp2==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/unitform/"+t+"/";
xmlHttp2.onreadystatechange=unitStateChanged;
xmlHttp2.open("GET",url,true);
xmlHttp2.send(null);
}

function showCalendar(l,p,y,m,s)
{ 
xmlHttp3=GetXmlHttpObject();
if (xmlHttp3==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/calendar/"+l+"/"+p+"/"+y+"-"+m+"/";
if(s!='') {
	url=url+s+"/";
	document.getElementById("timeformdiv").innerHTML="&nbsp;";
	document.getElementById("unitformdiv").innerHTML="&nbsp;";
}
xmlHttp3.onreadystatechange=calStateChanged;
xmlHttp3.open("GET",url,true);
xmlHttp3.send(null);
}

function timeStateChanged() 
{ 
if (xmlHttp1.readyState==4)
{ 
document.getElementById("timeformdiv").innerHTML=xmlHttp1.responseText;
document.getElementById("timeselect").focus();
}
}

function unitStateChanged() 
{ 
if (xmlHttp2.readyState==4)
{ 
document.getElementById("unitformdiv").innerHTML=xmlHttp2.responseText;
}
}

function calStateChanged() 
{ 
if (xmlHttp3.readyState==4)
{ 
document.getElementById("calendardiv").innerHTML=xmlHttp3.responseText;
//document.getElementById("unitformdiv").innerHTML="&nbsp;";
}
}


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;
}