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");
	}
	strURL=encodeURI(strURL);
	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)
{
	//alert(str);
	if(str=="1")
	{
		document.getElementById("loginname").innerHTML= window.document.Login.username.value;
		var divid_1=document.getElementById("login_1");
		var divid_2=document.getElementById("login_2");
		//var divid_2=document.getElementById("username");
		divid_2.style.display="block";
		divid_1.style.display="none";
	}
	else
	{
		alert("用户名或密码错误！");
	}
}
function call_login()
{
	var username = window.document.Login.username.value;
	var password = window.document.Login.psw.value;
	if(username=="")
	{
		alert('用户名不能为空！');
		return false;
	}
	else if(password=="")
	{
		alert('密码不能为空！');
		return false;
	}
	var url = "login.php?UserName=" + username + "&PassWord=" +password ;
	postRequest(url);
}
