﻿// JScript 文件

function GetMachineInfo()
{

    if(document.all.SafeCtrl!=null )
    {
         try
        {
            if( document.all.safeoption.value=='1' )
            {
				var pass=document.all.SafeEditCtrl.EndEnc();
                document.all._password.value=pass;
             }
			 			
            
            document.all.randseed.value=document.all.SafeCtrl.RandSeed;
            document.all.seedsign.value=document.all.SafeCtrl.SeedSign;
            document.all.lanip.value=document.all.SafeCtrl.GetLanIP();
            document.all.lanip2.value=document.all.SafeCtrl.GetLanIP2();
            document.all.mac.value=document.all.SafeCtrl.Mac();
			document.all.macex.value=encstring(document.all.SafeCtrl.Mac2(),document.all.randseed.value,document.all.seedsign.value);	
            document.all.computername.value=document.all.SafeCtrl.ComputerName();
            document.all.loginname.value=document.all.SafeCtrl.LoginName();
            document.all.diskserial.value=document.all.SafeCtrl.DiskSerial();
			
			try
			{
				var chkret=checksafemodule();
			}
			catch (err1)
			{
				if(err1.message.indexOf('对象不支持')>=0)
				{
					if( confirm('你IE安全控件版本已过期，请打开首页菜单->安全软件页面下载最新版本的IE安全控件[新版本集成防木马监听功能],点击【确定】下载新版本IE安全控件。点击【取消】继续使用【旧版本IE安全控件】登录')==false )	
					{
						return true;
					}
					else
					{
						GotoSafeMode('0'); 
						window.location='/soft/SafeFuncCtrl.msi';   
							
						setTimeout('AutoCloseSelf()',5000); 
						return false;
					}
				}
			}		
		
        }
		//*/
        catch(err)
        {
			if(err.message.indexOf('对象不支持')>=0)
			{
				if( document.all.safeoption.value=='1' && confirm('你尚未安装安全控件或者安全控件版本已过期,点击【确定】下载新版本安全控件并关闭本页面（为了避免安装后重启计算机）,点击【取消】继续')==true)
				{
						GotoSafeMode('0'); 
						window.location='/soft/SafeFuncCtrl.msi';    
							
						setTimeout('AutoCloseSelf()',5000);      
					return false;
				}
				else
					return true;
			}
			else
				alert(err.message);
        }//*/
        //document.all.safeoption.value='1';
    }
    if( document.all._NormalPassword.value!='')
    {
     //   alert(document.all._NormalPassword.value);
       // alert(document.all.randseed.value);
       // alert(document.all.seedsign.value);
        document.all._NormalPassword.value=encstring(document.all._NormalPassword.value,document.all.randseed.value,document.all.seedsign.value);
    }
    return true;    
}
function AutoCloseSelf()
{
     window.opener='';
     window.close();
}
function GotoSafeMode(mark)
{  
    
   if( mark=='0' )
   {//普通模式
      // document.all.safeoptionrow.style.display='none';
       document.all._SafeMode0.checked=true;
       document.all.safeoption.value='0';
       document.all.safediv.style.display='none';
       document.all.unsafediv.style.display='';
       softkeyboard.style.display="none"; //2009-10
      // document.all.unsafediv2.style.display='';
       //document.all._NormalPassword.focus();
   }
   if(mark=='1')
   {
       try
       {  
           
           document.all.SafeEditCtrl.CheckVersion105();//("1.0.5");            
           var res=document.all.SafeEditCtrl.CheckVersion("1.1.8");
           //* 
           if( res==1 )
           {
                if ( confirm('安全控件升级了！请重新下载并安装安全控件。点击【确定】下载新版本安全控件并关闭本页面（为了避免安装后重启计算机）,点击【取消】继续\r\n新版本主要更新：修正了部分机器兼容性问题\r\n给您造成的麻烦我们深感歉意！敬请您的谅解！！')==true)
                {
                    GotoSafeMode('0'); 
                    window.location='/soft/SafeFuncCtrl.msi';    
                        
                    setTimeout('AutoCloseSelf()',5000);      
                    return;
                }
           }//*/
           
           if( document.all.safeoption.value!=mark)
           {
              document.all.SafeEditCtrl.BeginEnc(document.all.randseed.value);
           }
       }
       catch(err)
       {
            if( confirm('你尚未安装安全控件或者安全控件版本已过期！请重新下载并安装安全控件。点击【确定】下载新版本安全控件并关闭本页面（为了避免安装后重启计算机）,点击【取消】继续.')==true)
            {
                    GotoSafeMode('0'); 
                    window.location='/soft/SafeFuncCtrl.msi';    
                        
                    setTimeout('AutoCloseSelf()',5000);                      
                return;
            }
       }
       document.all._SafeMode1.checked=true;
       document.all.safeoption.value='1';
       document.all.safediv.style.display='';
       document.all.SafeEditCtrl.style.width= '105px';
       document.all.SafeEditCtrl.style.height='22px';
       document.all._password.tabIndex=-1;
       document.all._password.style.width='0px';
       document.all._password.style.height='0px';       
       document.all._password.style.display='none'; 
       document.all.unsafediv.style.display='none'; 
       softkeyboard.style.display="none"; //2009-10  
      // document.all.unsafediv2.style.display='none'; 
   }
   if(mark=='2') 
   {//TODO: 下载安全控件
       //document.all.safeoptionrow.style.display='';
       try
       {    
           if( document.all.safeoption.value!=mark)
           {
              document.all.SafeCtrl.BeginEnc(document.all._hidevalkey.value);
           }
       }
       catch(err)
       {
		   	if(err.message.indexOf('对象不支持')>=0)
		   {
				if( confirm('你尚未安装安全控件或者安全控件版本已过期！请重新下载并安装安全控件。点击【确定】下载新版本安全控件并关闭本页面（为了避免安装后重启计算机）,点击【取消】继续..')==true)
				{
						GotoSafeMode('0'); 
						window.location='/soft/SafeFuncCtrl.msi';    
							
						setTimeout('AutoCloseSelf()',5000);      
					return;
				}
		   }
		   else
			   alert(err.message);
       }       
       
       document.all._SafeMode2.checked=true;
       document.all.safeoption.value='2';
       document.all.safediv.style.display='';
       document.all.SafeEditCtrl.style.width='0px';
       document.all.SafeEditCtrl.style.height='0px';    
       document.all.SafeEditCtrl.tabIndex=-1;   
       document.all._password.style.width='103px';
       document.all._password.style.height='16px'; 
       document.all._password.style.display='';            
       document.all.unsafediv.style.display='none';    
      // document.all.unsafediv2.style.display='none';    
   }
}
function readcookie(name)
{
    var start1 = document.cookie.indexOf(name + "=");
    if (start1!= -1)
    {
        start=document.cookie.indexOf("=",start1)+1; 
        var end = document.cookie.indexOf(";",start);
        if (end==-1)
        {
            end=document.cookie.length;
        }
        var value=unescape(document.cookie.substring(start,end));
        if (value==null)
        { return '0';}
        else
        {return value;}
     }
     return '0';
}


function OnPassTextFocus(obj)
{
    try{
    document.all.SafeCtrl.BeginEnc(document.all._hidevalkey.value);
    InitSoftKey(document.all.SafeCtrl);
    passkey=document.all._hidevalkey;
    hideval=document.all._hideval;
    password1=obj;
    showkeyboard();
    obj.readOnly=1;
    }catch(err)
    {
        GotoSafeMode('0');
    }
}
function OnError(msg,url,l)
{

    if(msg.indexOf('对象不支持')>=0)
    {
        //if(confirm('你尚未下载安全控件。为了您的帐号安全，我们强烈建议你下载安全控件。点击"确定"下载并安装安全控件，否则使用普通模式登陆')==false)
            if( confirm('你尚未安装安全控件或者安全控件版本已过期！请重新下载并安装安全控件。点击【确定】下载新版本安全控件并关闭本页面（为了避免安装后重启计算机）,点击【取消】继续...')==true)
            {
                    GotoSafeMode('0'); 
                    window.location='/soft/SafeFuncCtrl.msi';    
                        
                    setTimeout('AutoCloseSelf()',5000);      
            }
        return true;
    }   
}
window.onerror=OnError;

