var ajax;
var as;
function getajax(){
try{
   ajax = new ActiveXObject("Microsoft.XMLHTTP");
   as = 1;
}catch(e){
   try{
    ajax = new ActiveXObject("Msxml2.XMLHTTP");
    as = 1;
   }catch(e){
    try{
     ajax = new XMLHttpRequest();
     as = 2;
    }catch(e){
     ajax = null;
     as = 0;
    }
   }
}
}

function doXMLHTTP(method, url, pars, runfunc){
getajax();
if(as == 0){
   alert("您的浏览器不支持XMLHTTP，无法完成此操作");
}else{
   ajax.open(method, url, false);
   if(method == "POST"){
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   }else{
    ajax.setRequestHeader("Content-Type", "text/xml;charset=utf-8");
   }
   if(as == 1){
    ajax.onreadystatechange = runfunc;
   }else{
    ajax.onload = runfunc;
    ajax.onerror = runfunc;
   }
   ajax.send(pars);
}
}

function doShow(){
	var htmlcode;
	var obj = document.getElementById("loginStatediv");
	if(as == 1){
  		if(ajax.readyState == 4){
   			htmlcode = ajax.responseText;
   	 		obj.innerHTML = htmlcode;
  	 	}
	}else{
   		htmlcode = ajax.responseText;
   		obj.innerHTML = htmlcode;
	}
}
window.onload = function(){
	doXMLHTTP("POST", "/source/login.php", "a=1", doShow)
}