    var on_focus_obj="";
   function on_focus(){
   eval("document.getElementById('"+on_focus_obj+"').focus();");
   }
   function J_ISIE(){
     if(window.navigator.userAgent.indexOf("MSIE")>=1){ 
	    return true;//IE
        }else{
          m_show(1,"系统信息","本系统部分功能未能支持其他浏览器，为了避免给您带来不便，请使用IE内核浏览器");
        return false;
       }  
   }
   function J_get_button_value(sta){
       if (sta==0) {//登陆中
           $('H_button_login').disabled=false;
           $('H_button_login').value=' 登 录 ';
       }else{
          $('H_button_login').disabled=true;
         $('H_button_login').value='登录中';
       }   
   }
 function CheckInput(){
	     if(J_ISIE()==false){
	       return false;
	     }
	        var user_name=document.getElementById("user_name");
	        var user_pass=document.getElementById("user_pass");
	        var company_id=document.getElementById("company_id");
	        var select_id_2=document.getElementById("select_id_2");
	     	if(document.getElementById("company_id").value==""){
	          on_focus_obj="company_id";
	          try{
				i07_show_title_userid('i07_title_userid','您输入有误，企业ID不能为空。');
				 on_focus();
			  }catch(e){
				m_show(1,"系统信息","企业ID不能为空。","on_focus()");
			  }
	          return false;
	        }
	       var filter=/^\s*[0-9]{5,10}\s*$/;
           if (!filter.test(document.getElementById("company_id").value)) {
                           	on_focus_obj="company_id"; 
            try{
		   		i07_show_title_userid('i07_title_userid','您输入有误，企业ID不正确。');
	        	on_focus();
	        	}catch(e){
				m_show(1,"系统信息","您输入有误，企业ID不正确。","on_focus()");
			  }
            	return false; 
           }
	        if(document.getElementById("user_name").value==""){
	            on_focus_obj="user_name";
	          try{
				i07_show_title_user('i07_title_user','您输入有误，用户名不能为空。');
				 on_focus();
			  }catch(e){
				m_show(1,"系统信息","您输入有误，用户名不能为空","on_focus()");
			  }
	          	return false;
	        }
	        var filter=/^\s*[.A-Za-z0-9_@-]{2,30}\s*$/;
           if (!filter.test(document.getElementById("user_name").value)){ 
				on_focus_obj="user_name";
			  try{
		   		i07_show_title_user('i07_title_user','您输入有误，用户名不正确。');
		   		on_focus();
			  }catch(e){
				m_show(1,"系统信息","您输入有误，用户名不正确。","on_focus()");
			  }
             	return false; 
           } 
	        if(document.getElementById("user_pass").value==""){
				on_focus_obj="user_pass";
				try{
				i07_show_title_pass('i07_title_pass','您输入有误，密码不能为空。');
	         	on_focus();
	         	}catch(e){
				m_show(1,"系统信息","您输入有误，密码不能为空。","on_focus()");
			    }
	         	return false;
	        }
	         var filter= /^.{6,16}$/;
            if (!filter.test(document.getElementById("user_pass").value)){ 
                on_focus_obj="user_pass";
                try{
             		i07_show_title_pass('i07_title_pass','您输入有误，密码不正确。');
	         		on_focus();
	         	}catch(e){
					m_show(1,"系统信息","您输入有误，密码不能为空。","on_focus()");
			    }
	         	J_get_button_value(0);
	         	return false;
             }
             J_get_button_value(1);

             

             Stu_System.login.find_user(company_id.value,user_name.value,user_pass.value,select_id_2.checked,login);
		 }
		function login(find_user){
           switch(find_user.value) {
           case 9:
              window.location.href='/Video_RZ/Video_Login.aspx';
              return false;
           	break;
           case 1:
              window.location.href='/Main.aspx';

              return false;
           	break;
           case 0:
              on_focus_obj="user_name";
              m_show(1,'系统信息','登录失败！<br>企业ID、用户名或者密码有误，请检查！',"on_focus()");  
           	break;
           	case 2:
           	  m_show(1,'系统信息','你不是本企业人员,请通过其它登陆口登陆!');
           	break;
           	case -1:
           	  m_show(1,'系统信息','您的用户还在<font color=red>审核中</font>，请联系客服人员。'); 
           	break;
           	case -2:
           	  m_show(1,'系统信息','您的用户已被冻结，请联系企业主管或客服专员激活。');
           	break;
           	case -3:
           	  m_show(1,'系统信息','您的账户已到期，请联系客服人员。');
           	break;
           	case -4:
           	 m_show(1,'系统信息','您企业账户已到期，到期后学员将不能学习，请联系客服专员。');  
           	break;
           	case -5:
           	m_show(1,'系统信息','您所在的企业已被冻结，冻结后学员将不能学习，请联系客服人员。'); 
           	break;
           	case -6:
           	    on_focus_obj="user_name";
                m_show(1,'系统信息','登录失败！<br>企业ID、用户名或者密码有误，请检查！',"on_focus()");  
           	break;
           	case -7:
           	    on_focus_obj="user_name";
                m_show(1,'系统信息','您的企业还未给您分配岗位,暂无法登陆,请联系企业主管',"on_focus()");  
           	break;
           default:
            m_show(1,'系统信息','系统出现错误：错误代码为'+find_user.value+',请联系我们的客服专员',"get_url();");  
			//i07_show_title_userid('i07_title_userid','系统出现错误：错误代码为：'+find_user.value+'请联系我们的客服专员',"location.href='http://www.ektom.cn/about/contact.aspx'");
			//on_focus_obj="company_id";
			//on_focus();
			break;
           }
           J_get_button_value(0);
           return false;
		}
		function get_url(){
		    location.href='http://www.ektom.cn/about/contact.aspx'
		}
		function page_enter(){
			if(J_ISIE()==false){
		       return false;
		     }
		   if(event.keyCode==13){
		        var user_name=document.getElementById("user_name");
		        var user_pass=document.getElementById("user_pass");
		        var company_id=document.getElementById("company_id");
		        var select_id_2=document.getElementById("select_id_2");
		     	if(document.getElementById("company_id").value==""){
		          on_focus_obj="company_id";
		          m_show(1,"系统信息","企业ID不能为空。","on_focus()");
		          return false;
		        }
		       var filter=/^\s*[0-9]{5,10}\s*$/;
               if (!filter.test(document.getElementById("company_id").value)){ 
                on_focus_obj="company_id";
		          m_show(1,'系统信息','您的企业ID填写不正确,请重新填写！',"on_focus()");
                 return false; 
               } 
		        if(document.getElementById("user_name").value==""){
		         on_focus_obj="user_name";
		          m_show(1,'系统信息','用户名不能为空。',"on_focus()");
		          return false;
		        }
		        var filter=/^\s*[.A-Za-z0-9_@-]{2,30}\s*$/;
               if (!filter.test(document.getElementById("user_name").value)){ 
                on_focus_obj="user_name";
		          m_show(1,'系统信息','您的用户名填写不正确,请重新填写！',"on_focus()");
                 return false; 
               } 
		        if(document.getElementById("user_pass").value==""){
		         on_focus_obj="user_pass";
		          m_show(1,'系统信息','密码不能为空。',"on_focus()");
		          return false;
		        }
		         var filter= /^.{6,16}$/;
                if (!filter.test(document.getElementById("user_pass").value)){ 
                  on_focus_obj="user_pass";
		          m_show(1,'系统信息','您的密码填写不正确,请重新填写！',"on_focus()");
		          J_get_button_value(0);
                 return false; 
                 }
                 J_get_button_value(1);
                 Stu_System.login.find_user(company_id.value,user_name.value,user_pass.value,select_id_2.checked,login);
		   }
		}
	function search_pass(){
	  msg="<b>第1步 请输入您的用户名</b><br> 用户名：<input id='user_name_1' type='text' class='p_input_1'  name='user_name_1' style='margin-top:10px' onKeyDown='if(event.keyCode==13)event.keyCode=9;'>";
	  user_name_1=document.getElementById('user_name_1');
       m_show(2,'找回密码',msg,"return check_user_name(user_name_1.value);");
	}
	function check_user_name(user_name){
	    if(user_name!=''){
			var sta=Stu_System.login.check_username_is_exists(user_name).value;
			if(sta=='1'){//存在
			msg="<b>第2步 请输入您注册时用的邮箱</b><br> 邮箱：<input id='Email_1' type='text' class='p_input_1'  name='Email_1' style='margin-top:10px' onKeyDown='if(event.keyCode==13)event.keyCode=9;'>";
			Email_1=document.getElementById('Email_1');
			username=user_name;
			m_show(2,'找回密码',msg,"return check_email(username,Email_1.value);");
			}
			else{
			msg="<b>第1步 请输入您的用户名</b><br> 用户名：<input id='user_name_1' type='text' class='p_input_1'  name='user_name_1' style='margin-top:10px' oonKeyDown='if(event.keyCode==13)event.keyCode=9;'><br><font color='red' style='line-height:22px'>您输入的用户名不存在。</font>";
			user_name_1=document.getElementById('user_name_1');
			m_show(2,'找回密码',msg,"return check_user_name(user_name_1.value);");
			return false;
			}
	    }
	    else{
	        msg="<b>第1步 请输入您的用户名</b><br> 用户名：<input id='user_name_1' type='text' class='p_input_1'  name='user_name_1' style='margin-top:10px' onKeyDown='if(event.keyCode==13)event.keyCode=9;'><br><font color='red' style='line-height:22px'>请输入您的用户名。</font>";
			user_name_1=document.getElementById('user_name_1');
			m_show(2,'找回密码',msg,"return check_user_name(user_name_1.value);");
			return false;
	    }
	}
	function CharCheck(RegExpStr){//验证表达式
		var InputChar = String.fromCharCode(event.keyCode);
		if(RegExpStr.test(InputChar)){
			return true;
		}
		else{
			return false;
		}
	}
	function check_email(user_name_2,email){
      username=user_name_2;
      if(email!=''){
			var sta=Stu_System.login.check_email_is_exists(user_name_2,email).value;
			if(sta=='1'){
				var send_sta=Stu_System.login.send_email(user_name_2,email).value;
				if(send_sta=='1'){
					msg="<span style='line-height:22px;'><b>操作成功，邮箱确认函已发送到您的邮箱,请登陆后查收,进行设置</b></span>";
					m_show(1,'找回密码',msg);
			    }
				else{
				    m_show(1,'找回密码','邮件发送失败，请稍候再试，或者联系客服人员！');
				}
			}
			else{//电子邮件不存在
				msg="<b>第2步 请输入您注册时用的邮箱</b><br> 邮箱：<input id='Email_1' type='text' class='p_input_1'  name='Email_1' style='margin-top:10px' onKeyDown='if(event.keyCode==13)event.keyCode=9;'><br> <font color='red' style='line-height:22px'>您输入的邮箱地址不正确。</font>";
				Email_1=document.getElementById('Email_1');
				m_show(2,'找回密码',msg,"return check_email(username,Email_1.value);");
			}
	  }
	  else{
	             msg="<b>第2步 请输入您注册时用的邮箱</b><br> 邮箱：<input id='Email_1' type='text' class='p_input_1'  name='Email_1' style='margin-top:10px' onKeyDown='if(event.keyCode==13)event.keyCode=9;'><br> <font color='red' style='line-height:22px'>请输入邮箱地址。</font>";
				Email_1=document.getElementById('Email_1');
				m_show(2,'找回密码',msg,"return check_email(username,Email_1.value);");
	  }
	}	
	function get_focus(){
	  on_focus_obj="user_name";
	  on_focus();
	}
	function Study_Course(course_id){
	    top.location.href='/study/index.aspx?select_id='+course_id;
	}
	function Auto_Switch(){
	    setTimeout("Auto_Switch_1();",5000);
	    T_Sta=0;
	}
	function Auto_Switch_1(sta){
	    if ($('ppo_1').style.display=='none'||sta==1) {
	        $('ppo_1').style.display='';
	        $('ppo_2').style.display='none'
	        $('mm_bg').className='mm_bg_1';
	    }else{
	    	$('ppo_1').style.display='none';
	        $('ppo_2').style.display=''
	        $('mm_bg').className='mm_bg_2';
	    }
	    if (sta==undefined&&T_Sta==0) {
	         Auto_Switch();
	    }else{
	         T_Sta=1;
	    }
	   
	}
