﻿var ustr="";
function postRequest(strURL){ 
var xmlHttp; 
if(window.XMLHttpRequest){ // For Mozilla, Safari, ... 
var xmlHttp = new XMLHttpRequest(); 
} 
else if(window.ActiveXObject){ // For Internet Explorer 
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
} 
xmlHttp.open('POST', strURL, true); 
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
xmlHttp.onreadystatechange = function(){ 
if (xmlHttp.readyState == 4){ 
updatepage(xmlHttp.responseText); 
} 
} 
xmlHttp.send(strURL); 
} 
function updatepage(str){ 
if ((str=="")||(str=="0")){ 
//alert("用户名/密码错误,请重新登录!"); 
//ustr='';
}
else{ 
//alert(str); 
var f1 = document.getElementById("f1");
var f2 = document.getElementById("f2");
f1.style.display="none";
f2.style.display="block";
ustr=str;
} 
} 
function call_login(){ 
var username = window.document.f1.username.value; 
var password = window.document.f1.password.value; 
var url = "login.php?username=" + username + "&password=" +password ; 
postRequest(url); 
} 


function Show(ele,sn,size)
{var i=1;
   for(i=1;i<=size;i++)
   {
   
   	if (sn==i){
   	
    document.getElementById(ele+"_"+sn).style.display="block";
	document.getElementById(ele+"stat"+i).className="current";}
	else{
	
     document.getElementById(ele+"_"+i).style.display="none";
	 document.getElementById(ele+"stat"+i).className="";}
	 
   }
  
}

function show(id){
	var w0=document.getElementById("w0");
	var w1=document.getElementById("w1");
	var w2=document.getElementById("w2");
	var w00=document.getElementById("w00");
	var w11=document.getElementById("w11");
	var w22=document.getElementById("w22");
	w00.style.backgroundImage="url(/images/wt2.jpg)";
	w11.style.backgroundImage="url(/images/wt2.jpg)";
	w22.style.backgroundImage="url(/images/wt2.jpg)";
	if (id==0){
	w00.style.backgroundImage="url(/images/wt1.jpg)";
	w0.style.display="block";
	w1.style.display="none";
	w2.style.display="none";}
	if (id==1){
	w11.style.backgroundImage="url(/images/wt1.jpg)";
	w0.style.display="none";
	w1.style.display="block";
	w2.style.display="none";}
	if (id==2){
	w22.style.backgroundImage="url(/images/wt1.jpg)";
	w0.style.display="none";
	w1.style.display="none";
	w2.style.display="block";}
}

function change(id){
 var stxianlu=document.getElementById("stxianlu");
 var stjingdian=document.getElementById("stjingdian");
 var sbox1 = document.getElementById("sbox1");
 var sbox2 = document.getElementById("sbox2");
  if (id==stxianlu)
  {
    sbox1.style.display="block";
	stxianlu.style.backgroundColor="#DFD9A7";
	stjingdian.style.backgroundColor="#F2FFBF";
    sbox2.style.display="none";
   }
  if (id==stjingdian)
  {
    sbox2.style.display="block";
	stjingdian.style.backgroundColor="#DFD9A7";
	stxianlu.style.backgroundColor="#F2FFBF";
    sbox1.style.display="none";
   }
}    

function getjingdian(){
	var v = document.getElementById("jingdian_s").value;
        if(v&&v.length>0)
        {
          var jingdianUrl='/search.php?jingdian='+v;
          window.open(jingdianUrl);		  
        }
        else
        {
            alert("请检查输入!");
        }
}

function getcity(){
		var v = document.getElementById("city_s").value;
        if(v&&v.length>0)
        {
          var cityUrl='/search.php?city='+v;
          window.open(cityUrl);		  
        }
        else
        {
            alert("请检查输入!");
        }
}
