//用户登陆反馈信息
function getMsg(){
  var isURL  = this.location.href;	
   var result = isURL.split('=');	    
   if (result.length>1) {

     	if(result[1]=="0"){
			//几率相当低
		 alert('登录出错,请重新登陆！');	
		document.location="index.html";
		}
		else if(result[1]=="1"){
			//配置文件，数据库问题
			alert( '请重新登陆！');
		document.location="index.html";
		} 
		else if(result[1]=="2"){
			alert( '用户名或者密码错误');
		document.location="index.html";
		}
		else if(result[1]=="3"){
			alert('您的卡号过期！');
	document.location="index.html";
		}
		else if(result[1]=="5"){
			alert( '请重新登陆！'); 
		document.location="index.html";
		}else if(result[1]=="6"){
		 alert( '卡号未激活！');
	 document.location="index.html";
	  } 
		else if(result[1]=="7"){
		 alert( '请输入账号密码'); 	
		document.location="index.html";
		} 
	 	 
	}
}
 
	

	//效验登陆

	function validate1() {
	
		 
		var username= document.form1.username.value;

		var password= document.form1.password.value;
		
		var coverCode = username.substring(0,2);

		if(username== null || username=="") {
		   alert("用户名不能为空!");
			document.form1.username.focus();		 
		  document.form1.username.select();
		   return false;
		 }

		if(password==null || password=="") {
		   alert("密码不能为空!");
			document.form1.password.focus();		 
			document.form1.password.select();
		   return false ;		
		   }		

		//分配ip
	var coverCode = username.substring(0,2); 
	var url_jsp = "";//外网ip
	for(var i=0;i<serverList.length;i++) {
	  var object = serverList[i];	  
	  if(coverCode.toUpperCase()==object.code.toUpperCase()) {		   
		  url_jsp = object.url_jsp;//外网ip	 
		  break;
	   }
	  if(i==serverList.length-1){		
		url_jsp=defaultUrl_jsp;//外网ip
	  } 
	}		

	document.form1.action="http://"+url_jsp+"/InitStudy/chinese/login.jsp?from="+url_jsp;	 
 
}




	//效验登陆

	function validate2() {
	
		 
		var username= document.form1.username.value;

		var password= document.form1.password.value;
		
		var coverCode = username.substring(0,2);

		if(username== null || username=="") {
		   alert("用户名不能为空!");
			document.form1.username.focus();		 
		  document.form1.username.select();
		   return ;
		 }

		if(password==null || password=="") {
		   alert("密码不能为空!");
			document.form1.password.focus();		 
			document.form1.password.select();
		   return  ;		
		 }		

		//分配ip
	var coverCode = username.substring(0,2); 
	var url_jsp = "";//外网ip
	for(var i=0;i<serverList.length;i++) {
	  var object = serverList[i];	  
	  if(coverCode.toUpperCase()==object.code.toUpperCase()) {		   
		  url_jsp = object.url_jsp;//外网ip	 
		  break;
	   }
	  if(i==serverList.length-1){		
		url_jsp=defaultUrl_jsp;//外网ip
	  } 
	}		
	var fromURL=document.form1.from.value;
	document.form1.action="http://"+url_jsp+"/InitStudy/chinese/login.jsp?from="+fromURL;	 
	document.form1.submit();
}
function key(){	
			if(document.form1.password.focus()){	 
						validate1();
			}else{
			document.form1.username.focus();
			}
	 	 
}

 