var $=function (obj){return document.getElementById(obj)}
var isLog=0;
function GoUrl(url)
{
	location.href=url;	
}
function GoBoke()
{
	if(isLog)location.href="Addboke.asp";
	else
	{
	$("UserName").value="";
	$("Password").value="";
	$("UsedNum").value="";
	$("Login1").style.top="30%";
	$("Login1").style.left="40%";
	$("Login2").style.height=document.body.scrollHeight;
	$("Login").style.display="";
	Rcode();
	}
}
function Rcode(){$("scode").src="code.asp?"+Math.random();}
function tabDiv(a,b,c)
{
	$("nav_"+b+"_1").className="";	
	$("nav_"+b+"_2").className="";	
	$("nav_"+b+"_"+a).className=c;	
	$("ph_"+b+"_1").style.display="none";	
	$("ph_"+b+"_2").style.display="none";	
	$("ph_"+b+"_"+a).style.display="";	
	
}
function setTab2(m,n){
	var tli=document.getElementById("menu"+m).getElementsByTagName("dl");
	var mli=document.getElementById("main"+m).getElementsByTagName("ul");
	for(i=0;i<tli.length;i++){
		tli[i].className=i==n?"current":"";
		mli[i].style.display=i==n?"block":"none";
	}
}

function AJavaPost(url){
	
	var xmlhttp;
	try{
		xmlhttp= new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(e){
			try{
				xmlhttp= new XMLHttpRequest();
			}catch(e){}
		}
	}			
			xmlhttp.onreadystatechange=function(){
				if(xmlhttp.readyState==4)
				{
					if(xmlhttp.status==200){
						//postErr(xmlhttp.responseText);
						CLogin(xmlhttp.responseText);
					}else{
						alert("Post Data Error!");
					}
				}				
			}
	xmlhttp.open("post",url,true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	xmlhttp.send(null);
}
function CheckLogin()
{
	if($("UserName").value=="")
	{
		alert("Input your name please!")	;
		$("UserName").focus();
		return false;
	}
	if($("Password").value=="")
	{
		alert("Input the password please!")	;
		$("Password").focus();
		return false;
	}
	if($("UsedNum").value.length!=4)
	{
		alert("Input the safe code please!")	;
		$("UsedNum").value="";
		$("UsedNum").focus();
		return false;
	}
	$("Login").style.display="none";
	AJavaPost("Login.asp?u="+$("UserName").value+"&p="+$("Password").value+"&s="+$("UsedNum").value);
	return false;
}
function CLogin(x)
{
	if (x==1){
	$("islogin").style.display="none";
	isLog=1;
	$("loginout").style.display="";
	//for (var i=0;i<=30;i++)if($("Dlogin"+i))$("Dlogin"+i).style.display="";
	location.href=location.href;
	}
	else if(x!=0)
	{
		Rego(x);
	}
	else
	{
		location.href=location.href;	
	}
}
function Cout()
{
	AJavaPost("Loginout.asp");
}
