function dropLoca(drop,val)
{
	dropObj = document.getElementById(drop);
	if( dropObj ==  null )
		dropObj = document.all(drop);

	if(dropObj != null)
	{
		for(i=0;i<=dropObj.options.length-1;i++)
		{
			if(dropObj.options[i].value == val)
			{
				dropObj.options[i].selected = true;
				break;
			}
		}
	}
}

var city=[];
var town=[];

function getlevelA()  {
   if (document.getElementById("select1").value==0) {
       document.getElementById("select2").length=1;
	   document.getElementById("select3").length=1;
	   return;
   }	 
   document.getElementById("select3").length=1;
   town="";
   town=[];
   if (!city[document.getElementById("select1").selectedIndex]) {
       var xmlhttp;
       if (window.ActiveXObject) {
	      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	   }else if (window.XMLHttpRequest) {
	       xmlhttp=new XMLHttpRequest();
	   }
	   if (xmlhttp) {	
	       xmlhttp.onreadystatechange=function() {
		       if (4==xmlhttp.readyState) {
			       if(200==xmlhttp.status) {
				       city[document.getElementById("select1").selectedIndex]=eval("("+unescape(xmlhttp.responseText)+")");
					   showcity(city[document.getElementById("select1").selectedIndex]);
					}else {
					    alert("error");
					}
			    }
			}   	
			xmlhttp.open("get","carinc/contactA_execute.asp?Pid="+document.getElementById("select1").value);
			xmlhttp.send(null);
		}
	}else {
	  showcity(city[document.getElementById("select1").selectedIndex]);
	}  	
}


function getlevelB()  {
   if (document.getElementById("select2").value==0) {
	   document.getElementById("select3").length=1;
	   return;
   }	
   
   if (!town[document.getElementById("select2").selectedIndex]) {
       var xmlhttp;
       if (window.ActiveXObject) {
	      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	   }else if (window.XMLHttpRequest) {
	       xmlhttp=new XMLHttpRequest();
	   }
	   if (xmlhttp) {	
	       xmlhttp.onreadystatechange=function() {
		       if (4==xmlhttp.readyState) {
			       if(200==xmlhttp.status) {
				       town[document.getElementById("select2").selectedIndex]=eval("("+unescape(xmlhttp.responseText)+")");
					   showtown(town[document.getElementById("select2").selectedIndex]);
					}else {
					    alert("error");
					}
			    }
			}   	
			xmlhttp.open("get","carinc/contactA_execute.asp?Cid="+document.getElementById("select2").value);
			xmlhttp.send(null);
		}
	}else {
	  showtown(town[document.getElementById("select2").selectedIndex]);
	}  	
}

function showcity(SC) {
  document.getElementById("select2").length=1;
  var arrcity=SC;
  for (var i=0;i<arrcity.length-1;i+=2) {
     document.getElementById("select2").options[document.getElementById("select2").length]=new Option(arrcity[i+1],arrcity[i]);
  } 
}


function showtown(ST) {
  document.getElementById("select3").length=1;
  var arrcity=ST;
  for (var i=0;i<arrcity.length-1;i+=2) {
     document.getElementById("select3").options[document.getElementById("select3").length]=new Option(arrcity[i+1],arrcity[i]);
  } 
}