// JavaScript Document
function $(ids){ return document.getElementById(ids);}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function BuildXmlHttp(){
		if (window.XMLHttpRequest) {                 //Mozilla, Safari  
			var	 BuildXmlHttps = new XMLHttpRequest(); 
				 if(BuildXmlHttps.overrideMimeType){ 
					 BuildXmlHttps.overrideMimeType('text/xml'); 
				 }
		　　 }else if (window.ActiveXObject) {            //Microsoft IE
		　　     BuildXmlHttps = new ActiveXObject("Microsoft.XMLHTTP"); 
				 try{ 
					 BuildXmlHttps = new ActiveXObject("Msxml2.XMLHTTP"); 
				 }catch (e) { 
					 try{ 
						 BuildXmlHttps = new ActiveXObject("Microsoft.XMLHTTP"); 
					 }catch (e){} 
				 }
		　　 }
		return BuildXmlHttps
}
//johnny,2008-6 增加,AJAX
var ajax=BuildXmlHttp();
function getvalue(x){//这里传递中文的信息要用escape转换字符,对应的是:unescape
 ajax.open("GET","area.asp?ac="+escape(x)+"&num="+Math.random(),true);
 ajax.send(null);
 ajax.onreadystatechange=getmessage;
}
function getmessage(){
	 if(ajax.readyState==4){
		  if(ajax.status==200){
		   var html=ajax.responseText;
		   //alert(html);
		   document.getElementById("subclass").innerHTML=html;
		  }else{
		  alert("status is:"+ajax.status);
		  }
	 }
	 else{
	  document.getElementById("subclass").innerHTML="<img src='../images/loading.gif' /><select><option>数据读取中...</option></select>";
	 }
}
function chk(){//这里传递中文的信息要用escape转换字符,对应的是:unescape
var uname=document.getElementById("username").value;
var upwd=document.getElementById("password").value;
var usertypes=$("usertypes").value;
	if (uname=="" || upwd==""){
	alert('F4提醒您:用户名或密码错误,请和管理员联系5756153(上班时间5天*8小时)');
	$("msg").style.display="block";
	document.getElementById("msg").innerHTML="<span onclick='javascript:CloseErrMsg();'>&times;</span><li>F4提醒您:用户名或密码错误,请和管理员联系5756153(上班时间5天*8小时)</li>";$("username").focus();return false;
	}
	else if(usertypes==""){
	alert('请选择类型');
	$("msg").style.display="block";
	$("msg").innerHTML="<span onclick='javascript:CloseErrMsg();'>&times;</span><li>请选择类型!</li>";$("usertypes").focus();return false;
	}
	else{
	ajax.open("GET","../house/chkAjax.asp?action=login&uname="+escape(uname)+"&upwd="+escape(upwd)+"&usertypes="+escape(usertypes)+"&num="+Math.random(),true);
	ajax.send(null);
	ajax.onreadystatechange=showLoginInfo;
	}
}

function showLoginInfo(){
	 if(ajax.readyState==4){
		  if(ajax.status==200){
		   var html=ajax.responseText;
		   //alert(html);
		   $("msg").style.display="block";//提示标签
		   document.getElementById("msg").innerHTML=html;
		    //if(html=="ok"){document.getElementById("msg").innerHTML="登陆成功！<img src='../images/loading.gif' />...";setTimeout(gotourl,3000);}
			if(html=="ok"){
				window.location.href='http://www.xmf4.com/house/house.asp';
				//window.location.reload();
				}
				else if(html=="xmrc"){
					window.location.href='http://www.xmf4.com/xmrc/control.asp';
					//alert('登陆成功oooooooooook!');
					}
					 else {alert('F4提醒您:\n\n'+html);}

		  }else{
		  alert("×登陆失败:"+ajax.status+" \n请再登陆一次或从首页登陆! \n谢谢!");
		  window.location.href='http://www.xmf4.com/xmrc/';
		  }
	 }
	 else{
	  $("msg").style.display="block";
	  document.getElementById("msg").innerHTML="<div id='logininfo'><img src='../images/loading.gif' />数据验证中...</div>";
	 }
}
//获取showHouseTextInfo
function showHouseTextInfo(){
	ajax.open("GET","function.asp?action=get&num="+Math.random(),true);
	ajax.send(null);
	ajax.onreadystatechange=HouseTextInfo;
}
function HouseTextInfo(){
	 if(ajax.readyState==4){
		  if(ajax.status==200){
		   var html=ajax.responseText;
		   //alert(html);
		   document.getElementById("endtime").innerHTML=html.split("|")[0];
		   document.getElementById("num").innerHTML=html.split("|")[1];
		   document.getElementById("num2").innerHTML=html.split("|")[2];
		   document.getElementById("num3").innerHTML=html.split("|")[3];
		   document.getElementById("num4").innerHTML=html.split("|")[4];
		   document.getElementById("num5").innerHTML=html.split("|")[5];
		  }else{
		  alert("status is:"+ajax.status);
		  }
	 }
	 else{
	  document.getElementById("endtime").innerHTML="<img src='../images/loading.gif' />数据读取中...";
	 }
}

//跳转某个页面
//function gotourl(){
//window.location.href="index.asp";
//}
//注册，弹出层
function getpwd(){$("getpwds").style.display="block";setTimeout(function(){$("getpwds").style.display="none";},5000);}

function Doreg(){
	$("regdivs").style.display="block";
}
function DoresetReg()
{
	$("regdivs").style.display="none"
}
//登陆错误提示
//function ErrMsg(){
//	$("errmsg").style.display="block";
//}
function CloseErrMsg()
{
	$("msg").style.display="none"
}

function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
