var xmlHttp

function menu_submit(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="lookupsubmit.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=checkSubmit 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function menu_type(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

if(document.getElementById('customer_type').value == 'not selected')
{
	document.getElementById('Submit').disabled='disabled'
}


var url="provincelookup.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=checkProvince 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function menu_province(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 
//var prov = str
//
//if(prov == 'PEI')
//	{
//	var url="lookupsubmit.php"
//	url=url+"?r="+str
//	url=url+"&sid="+Math.random()
//	xmlHttp.onreadystatechange=checkCounty
//	xmlHttp.open("GET",url,true)
//	xmlHttp.send(null) 
//	}
//else if(prov == 'Maine')
//	{
//	var url="lookupsubmit.php"
//	url=url+"?r="+str
//	url=url+"&sid="+Math.random()
//	xmlHttp.onreadystatechange=checkCounty
//	xmlHttp.open("GET",url,true)
//	xmlHttp.send(null) 
//	}
//else
//	{
	var url="countylookup.php"
	url=url+"?r="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=checkCounty
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null) 
//	}
 

}

function menu_county(a,b)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="citylookup.php"
url=url+"?a="+a+"&b="+b
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=checkCity
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function menu_city(ctype, cprovince, ccounty, ccity)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="storelookup.php"
url=url+"?a="+ctype+"&b="+cprovince+"&c="+ccounty+"&d="+ccity
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=checkStores
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function menu_store_display(ctype, cprovince, ccounty, ccity)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="storelookupdisplay.php"
url=url+"?e="+ctype+"&f="+cprovince+"&g="+ccounty+"&h="+ccity
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=checkStoresLocations
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function menu_calculator(ctype, cprovince, ccounty, ccity)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="calculatorlookup.php"
url=url+"?i="+ctype+"&j="+cprovince+"&k="+ccounty+"&l="+ccity
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=checkCalculator
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


//______________________________________________________________________________________________________________________________________
function checkProvince() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("list_province").innerHTML=xmlHttp.responseText 
 } 
}

function checkSubmit() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("list_submit").innerHTML=xmlHttp.responseText 
 } 
}

function checkCounty() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("list_county").innerHTML=xmlHttp.responseText 
 } 
}

function checkCity() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("list_city").innerHTML=xmlHttp.responseText 
 } 
}

function checkStores() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("list_stores").innerHTML=xmlHttp.responseText 
 } 
}

function checkStoresLocations() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("list_stores_locations").innerHTML=xmlHttp.responseText 
 } 
}

function checkCalculator() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("list_calculator").innerHTML=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;
}