var kk,Xmlhttp;

function requestData(url)
{
	var ss=document.getElementById('pro').value;
	if (ss!="")
	{
		var data='pro='+ ss;
		Xmlhttp=createXmlhttp();
		Xmlhttp.open("POST",url,true);
	  Xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	  Xmlhttp.send(data);
	  Xmlhttp.onreadystatechange=resultStr;
	}
}

function requestData_lakala(url)
{
	//var cityid=document.getElementById('cityid').value;
	//if (cityid!="")
	//{
		//var data='cityid='+ cityid;
		var data="";
		//url=url+"?cityid="+cityid;

		Xmlhttp=createXmlhttp();
		//alert(url);
		Xmlhttp.open("GET",url,true);
	  Xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	  Xmlhttp.send(data);
	  Xmlhttp.onreadystatechange=getAreas;
	//}
}

function createXmlhttp()
{
	var objhttp=null;
	try 
	{
		objhttp=new ActiveXObject('Microsoft.XMLHTTP') ;
	} 
	catch(oc)
	{ 
		objhttp=null ;
	}
	if ( !objhttp && typeof XMLHttpRequest != 'undefined' ) { 
		objhttp=new XMLHttpRequest();
	}
	return objhttp;
}

function resultStr()
{
	var str;
    if (Xmlhttp.readyState==4) 
    {
        if(Xmlhttp.status!=200)
        {
	   	    alert('<span style="color:red">ÍøÂç¹ÊÕÏ' + Xmlhttp.status+ '£¬ÇëÉÔºóÔÙÊÔ£¡</span>');
		}
		else
		{
	        result = Xmlhttp.responseText;
	        
	        var cy=document.getElementById("city");
	        var ops=result.split('#');
	        var le=ops.length;
	        cy.options.length=le-1;
	       
	        for(var i=0 ;i<le-1;i++)
	        { if (ops[i]!='')
	        	{
	            nop=cy.options[i]
	            kd=ops[i].split('|');
	            if (kd.length==2)
	            {		
		            nop.value=ops[i].split('|')[0];  
	              nop.text=ops[i].split('|')[1];  
	              //cy.options.add(nop); 
            	}
				if (kd.length==3)
	            {		
		            nop.value=ops[i].split('|')[0];  
	              nop.text=ops[i].split('|')[1];  
				  if (ops[i].split('|')[2]=="true")
				  {
						nop.selected=true;  
				  }
				  
	              //cy.options.add(nop); 
            	}
            }  
	        }
        }
    }
}


function getAreas()
{
	var str;
    if (Xmlhttp.readyState==4) 
    {
        if(Xmlhttp.status!=200)
        {
			alert(Xmlhttp.responseText);
	   	    alert('<span style="color:red">ÍøÂç¹ÊÕÏ' + Xmlhttp.status+ '£¬ÇëÉÔºóÔÙÊÔ£¡</span>');
		}
		else
		{
	        result = Xmlhttp.responseText;
	       
	        var area=document.getElementById("areaid");
	        var ops=result.split('#');
	        var le=ops.length;
	        area.options.length=le-1;
	        area.options[0].selected=true;
	        for(var i=0 ;i<le-1;i++)
	        { if (ops[i]!='')
	        	{
	            nop=area.options[i];
	            kd=ops[i].split('|');
	            if (kd.length==2)
	            {		
		            nop.value=ops[i].split('|')[0];  
	              nop.text=ops[i].split('|')[1];  
	              //cy.options.add(nop); 
            	}
				if (kd.length==3)
	            {	

		            nop.value=ops[i].split('|')[0];  
	              nop.text=ops[i].split('|')[1];  
				  if (ops[i].split('|')[2]=="true")
				  {
						nop.selected=true;  
					
				  }
	              //cy.options.add(nop); 
            	}
            }  
	        }
        }
    }
}
