var xmlHttp

var divId;

function getProvince(countryList,provinceId,cityId)
{
	divId =provinceId;
	
if (countryList.length==0)
  { 
  document.getElementById(provinceId).innerHTML="";
  return;
  }
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	var url="getProvince.php?countryList=";
	url=url+countryList+"&divName="+provinceId+"&cityDivName="+cityId;
	
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	
	xmlHttp.send(null);
} 


function getCategory(provinceList,cityId)
{
	divId =cityId; 
	if (provinceList.length==0)
	{ 
		document.getElementById(cityId).innerHTML="";
		return;
	}
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	var url="getCategory.php?provinceList=";
	url=url+provinceList+"&divName="+cityId;

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function getSubCategory(catId,subCategoryId)
{
	divId =subCategoryId; 
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	var url="getCategory.php?catId=";
	url=url+catId+"&divName="+divId;

	
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 


function stateChanged() 
{ 
	
if (xmlHttp.readyState==4)
{
	//alert(document.getElementById(divId).innerHTML);
	//alert(xmlHttp.responseText);
	document.getElementById(divId).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;
}