function GetXmlHTTP()
{
	if(typeof XMLHttpRequest!="undefined")
	{
		return new XMLHttpRequest();
	}
	else if(typeof ActiveXObject != "undefined")
	{
		var xmlhttp = null;
		try
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");			
		}
		catch(e)
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e2)
			{
				return null;
			}
		}
		return xmlhttp;
	}
	return null;
}

function GetDataOnDemand(LoginName, Password)
{
	var xmlHTTP = GetXmlHTTP();
	//异步取数据
	xmlHTTP.open("get", "http://www.jxjygs.cn/hcrsweb/LoginHandle.aspx?LoginName=" + LoginName + "&Password=" + Password, false);
	xmlHTTP.setRequestHeader("Cache-Control","no-cache");   
    xmlHTTP.setRequestHeader("Pragma","no-cache");
    xmlHTTP.setRequestHeader('If-Modified-Since', '0');
	xmlHTTP.send(null);

	//返回成功处理
	if(xmlHTTP.readyState == 4)
	{
		if(xmlHTTP.status == 200)
		{
			var returnTxt = xmlHTTP.responseText;
			if(returnTxt == "undefined" || returnTxt == null)
			{
			    return;
			}
			LoginPost(returnTxt);
		}
	}
}

function OpenMain()
{
    window.open("http://www.jxjygs.cn/hcrsweb/main.aspx", "", "toolbar=no,status=yes,scrollbars=yes,top=0,left=0,menubar=no, resizable=yes,location=no");
    window.opener = null;
    window.close();
}

function LoginPost(ValideStatus)
{
    if(ValideStatus == "OK")
    {
        OpenMain();
    }
    else
    {
        alert(ValideStatus);
        //document.getElementById("Password").select();
        //document.getElementById("Password").focus();
    }
}
