function createXMLHttp(){
	if(typeof XMLHttpRequest!="undefined"){
		xmlhttp=new XMLHttpRequest();
		return xmlhttp;
	}else{
		var Version=[
			"MSXML2.XMLHTTP.5.0",
			"MSXML2.XMLHTTP.4.0",
			"MSXML2.XMLHTTP.3.0",
			"MSXML2.XMLHTTP",
			"Microsoft.XMLHTTP"
		];
		for(var i=0;i<Version.length;i++){
			try{
				xmlhttp=new ActiveXObject(Version[i]);
				return xmlhttp;
			}
			catch(e){
				xmlhttp=null;
			}
		}
	}
}

function loginUser(){
	xmlhttpL = createXMLHttp();
	if(!xmlhttpL){ return; }
	xmlhttpL.open("POST","../../../top/topLog.php",true);
	xmlhttpL.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlhttpL.onreadystatechange = function(){
		if(xmlhttpL.readyState == 4){
			document.getElementById("top_user_reg").innerHTML=xmlhttpL.responseText;
		}
	}
	xmlhttpL.send("user="+document.getElementById('regUser').value+"&pass="+document.getElementById('regPass').value);
}

function outUser(){
	xmlhttpO = createXMLHttp();
	if(!xmlhttpO){ return; }
	xmlhttpO.open("POST","../../../top/topOut.php",true);
	xmlhttpO.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlhttpO.onreadystatechange = function(){
		if(xmlhttpO.readyState == 4){
			document.getElementById("top_user_reg").innerHTML=xmlhttpO.responseText;
		}
	}
	xmlhttpO.send();
}

function backUser(){
	var loginWord = "";
	loginWord += "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
	loginWord += "<tr>";
	loginWord += "<td><img src=\"http:\/\/www.kaosheng.com\/top_images\/01-1.gif\" \/>";
	loginWord += "<td><input name=\"regUser\" type=\"text\" id=\"regUser\" size=\"13\" \/>&nbsp;<\/span><\/td>";
	loginWord += "<td><img src=\"http:\/\/www.kaosheng.com\/top_images\/02-2.gif\" \/> <\/td>";
	loginWord += "<td><input name=\"regPass\" type=\"password\" id=\"regPass\" size=\"13\" \/><\/td>";
	loginWord += "<td><a href=\"javascript:void(0)\" onclick=\"javascript:loginUser();\"><img src=\"http:\/\/www.kaosheng.com\/top_images\/dr.gif\" border=\"0\" \/><\/a><\/td>";
	loginWord += "<\/tr>";
	loginWord += "<\/table>";
	document.getElementById("top_user_reg").innerHTML=loginWord;
}

function checkUser(){
	xmlhttpC = createXMLHttp();
	if(!xmlhttpC){ return; }
	xmlhttpC.open("POST","../../../top/topCheck.php",true);
	xmlhttpC.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlhttpC.onreadystatechange = function(){
		if(xmlhttpC.readyState == 4){
			document.getElementById("top_user_reg").innerHTML=xmlhttpC.responseText;
		}
	}
	xmlhttpC.send();
}

document.write("<div id=\"top_user_reg\"></div>");
checkUser();
