var http_request=false;
   function send_request(url){
     http_request=false;
         
         if(window.XMLHttpRequest){
          http_request=new XMLHttpRequest();
          if(http_request.overrideMimeType){
            http_request.overrideMimeType("text/xml");
          }
         }
         else if(window.ActiveXObject){
          try{
           http_request=new ActiveXObject("Msxml2.XMLHttp");
          }catch(e){
           try{
           http_request=new ActiveXobject("Microsoft.XMLHttp");
           }catch(e){}
          }
     }
         if(!http_request){
          window.alert("XMLHttp object to create a failure!");
          return false;
         }
         http_request.onreadystatechange=processrequest;
		 url=encodeURI(encodeURI(url));
         http_request.open("GET",url,true);
		 http_request.setRequestHeader("If-Modified-Since","0"); 
         http_request.send(null);
   }
   function processrequest(){
    if(http_request.readyState==4){
      if(http_request.status==200){
           document.getElementById(reobj).innerHTML=http_request.responseText;
          }
          else{
           alert("The page you requested is not normal!");
          }
    }
   }
   function jiudiancheck(obj){
    var f=document.form1;
    var j_id=f.jingdian.value;
    if(j_id!=""){
		//document.getElementById(obj).innerHTML="Data is reading...";
    send_request('../code/checkjiudian.php?j_id='+j_id);
    reobj=obj;
    }
   }
   
function upxlbj(bid){
	var bid=bid;
    var riqia=document.getElementById("bjrqa"+bid).value;
	var riqib=document.getElementById("bjrqb"+bid).value;
	var jiage=document.getElementById("bjjg"+bid).value;
	obj="bja"+bid;
    if(bid!=""){
		//document.getElementById(obj).innerHTML="Data is reading...";
    send_request('../code/addchufa.php?adc=upxlbaojia&bid='+bid+'&riqia='+riqia+'&riqib='+riqib+'&jiage='+jiage);
    reobj=obj;
    }
	document.getElementById("tcdiv"+bid).style.display="none";
   }
   
function delxlbj(bid){
	var bid=bid;
	obj="deldiv"+bid;
    if(bid!=""){
		//document.getElementById(obj).innerHTML="Data is reading...";
    send_request('../code/addchufa.php?adc=delxlbaojia&bid='+bid);
    reobj=obj;
    }
	document.getElementById("deldiv"+bid).style.display="none";
   }
   
function addxljg(){
	var oxid=document.getElementById("o_xid").value;
    var riqia=document.getElementById("addbjrqa").value;
	var riqib=document.getElementById("addbjrqb").value;
	var jiage=document.getElementById("abjjga").value;
	obj="ajiagea";
    if(jiage!=""){
		//document.getElementById(obj).innerHTML="Data is reading...";
    send_request('../code/addchufa.php?adc=addxlbaojia&oxid='+oxid+'&riqia='+riqia+'&riqib='+riqib+'&jiage='+jiage);
    reobj=obj;
    }
	document.getElementById("tcdivadd").style.display="none";
   }
   
function chgb(){
	var xlid=document.getElementById("xlid").value;
    var riqi=document.getElementById("riqi").value;
	var chengren=document.getElementById("chengren").value;
	
	obj="chengrenjga";
    if(riqi!=""){
		//document.getElementById(obj).innerHTML="Data is reading...";
    send_request('../../code/addchufa.php?adc=jisuana&xlid='+xlid+'&riqi='+riqi+'&chengren='+chengren);
    reobj=obj;
    }
	document.getElementById("riqia").innerHTML=riqi;
	document.getElementById("chengrena").innerHTML=chengren;
	
   }
   
function sendsms(){
	var smscont=document.getElementById("smscont").value;
	var uip=document.getElementById("uip").value;
    var shoujia=document.getElementById("shoujia").value;
	var shoujib=document.getElementById("shoujib").value;
	var shoujic=document.getElementById("shoujic").value;
	var shoujid=document.getElementById("shoujid").value;
	var shoujie=document.getElementById("shoujie").value;
	var codea=document.getElementById("codea").value;
	obj="rsendsms";
	if (shoujia=="" || shoujia.length<11 || isNaN(shoujia))
     {
        alert("请输入有效手机号码！");
		document.getElementById("shoujia").focus();
        return false;
     }
	 if (shoujib!="" && ( shoujib.length<11 || isNaN(shoujib)))
     {
        alert("请输入有效手机号码！");
		document.getElementById("shoujib").focus();
        return false;
     }if (shoujic!="" && ( shoujic.length<11 || isNaN(shoujic)))
     {
        alert("请输入有效手机号码！");
		document.getElementById("shoujic").focus();
        return false;
     }if (shoujid!="" && ( shoujid.length<11 || isNaN(shoujid)))
     {
        alert("请输入有效手机号码！");
		document.getElementById("shoujid").focus();
        return false;
     }if (shoujie!="" && ( shoujie.length<11 || isNaN(shoujie)))
     {
        alert("请输入有效手机号码！");
		document.getElementById("shoujie").focus();
        return false;
     }
    if (codea=="")
     {
        alert("请输入验证码！");
		document.getElementById("codea").focus();
        return false;
     }
		//document.getElementById(obj).innerHTML="Data is reading...";
    send_request('http://www.citschina.com/code/sendsms.php?adc=addsmsa&smscont='+smscont+'&uip='+uip+'&shoujia='+shoujia+'&shoujib='+shoujib+'&shoujic='+shoujic+'&shoujid='+shoujid+'&shoujie='+shoujie+'&codea='+codea);
    reobj=obj;
    
	document.getElementById("sendsmsa").style.display="none";
	
   }
   
function changerili(lx){
	var lx=lx;
	var oxid=document.getElementById("o_xid").value;;
	obj="srili";
    //if(oxid!=""){
		//document.getElementById(obj).innerHTML="Data is reading...";
    send_request('/code/ajcode.php?adc=chrili&lx='+lx+'&o_xid='+oxid);
    reobj=obj;
    //}
   }
   
function opyddiva(){
	var widtha = screen.width;
	widthb = (widtha - 600) / 2;
 document.getElementById("ydxldiva").style.display = "block";
 document.getElementById("ydxldivb").style.left = widthb + "px";
 document.getElementById("ydxldivb").style.top=( mpy - 30 ) +"px";
}

function opyddivb(rqb,jgb){
	var widtha = screen.width;
	widthb = (widtha - 600) / 2;
 document.getElementById("riqi").value= rqb;
 document.getElementById("chengrenjga").innerHTML='￥'+jgb;
 document.getElementById("ydxldiva").style.display = "block";
 document.getElementById("ydxldivb").style.left = widthb + "px";
 document.getElementById("ydxldivb").style.top=( mpy - 30 ) +"px";
}

function changesheng(){
var sha=document.getElementById("sheng").value;	
var obj="sjingqu";
    send_request('/code/ajcode.php?adc=changesheng&sheng='+sha);
    reobj=obj;
}

function changepx() {
px=document.getElementById("paixu").value;
window.location.href='?px='+px;
}

function chehomepage(){
var homepage=document.getElementById("homepage").value;

if (homepage == 1){
openNewDiv();	
}
}

function changehomepage(){

	var obj="homepagea";
    send_request('/code/ajcode.php?adc=changehomepage');
    reobj=obj;

 document.body.removeChild(docEle("newDiv"));
 document.body.removeChild(docEle("mask"));
}
