
var copyright=" 上海安达通信息安全技术股份有限公司  版权所有 &copy; "+new Date().getYear();var www="http://www.adtsec.com";var LogoutAltPwd=false;var usb_verstion="";var vpn_verstion="";var tpn_verstion="";var web_verstion="";var release_time="";var bg_image="";var logo_image="";var head_image="images/head1.jpg";var ie_title="";var about_title="";var soft_title="";var tpnManager="TpnMangr.exe";var server_url=location.protocol+"//"+location.host;var server_url_=location.host;var auth_mode="";var LoginUserName="";var LoginUserPass="";var httpType="";var tcptType="";var quickSelIp="";var breakRconn="";var autoLogin="";var IsSavePassword="";var KeySeqNo="";var IfUsbKey=0;var cert="";var sig="";var mobile="";var statusNum=0;var usb_S;var ifUsbkey;var ifUserPwd;var ifCert;var ifMobile;var ifLocalLogin;var ifVpnLogin;var ifTcpt;var ipList;var verInfo;var ifVpn;var authMode="";var rootCertName="";var ifIpMac;function IfIpMac(flg){ifIpMac=flg;}
function IfVPNGateway(flg){ifVpn=flg;}
function IfUsbkey(flg){ifUsbkey=flg;}
function IfUserPwd(flg){ifUserPwd=flg;}
function IfCert(flg){ifCert=flg;}
function IfMobile(flg){ifMobile=flg;}
function IfLocalLogin(flg){ifLocalLogin=flg;}
function IfVpnLogin(flg){ifVpnLogin=flg;}
function IfTcpt(flg){ifTcpt=flg;}
function IpList(ls){ipList=ls;}
function RootCertName(name){rootCertName=name;}
function VerInfo(usb,vpn,tpn){tpn_verstion=tpn;usb_verstion=usb;vpn_verstion=vpn;}
var _AuthResult;var _FailReason;var _UserId="";var _UserName="";var _UserRealName="";var _AuthCode="";var _AccessCtl="";var _LastLoginTime="";var _LastLoginIP="";var _ClientLoginTime="";var _ClientLoginIP="";var _VirtualIP="";var _LanIP="";var _IfLogin=false;var _CurrentIP="";var _RequestResult="";var _hidewindow="";var _hotkey="";function hotkey(val){_hotkey=val;}
function hidewindow(val){_hidewindow=val;}
function RequestResult(val){_RequestResult=val;}
function CurrentIP(val){_CurrentIP=val;}
function IfLogin(val){_IfLogin=val;}
function AuthResult(val){_AuthResult=val}
function FailReason(val){_FailReason=val;}
function UserId(val){_UserId=val}
function UserName(val){_UserName=val}
function UserRealName(val){_UserRealName=val}
function AuthCode(val){_AuthCode=val}
function AccessCtl(val){_AccessCtl=val}
function LastLoginTime(val){_LastLoginTime=val}
function LastLoginIP(val){_LastLoginIP=val}
function ClientLoginTime(val){_ClientLoginTime=val}
function ClientLoginIP(val){_ClientLoginIP=val}
function VirtualIP(val){_VirtualIP=val}
function LanIP(val){_LanIP=val}
function IfSuccess(val){_IfSuccess=val;}
function UninstallPwd(val){}
function autologin(val){}
var resultValue;function Result(vl){resultValue=vl;}
String.prototype.replaceAll=function(s1,s2){return this.replace(new RegExp(s1,"gm"),s2);};function QueryString(){var name,value,i;var str=location.href;var num=str.indexOf("?")
str=str.substr(num+1);var arrtmp=str.split("&");for(i=0;i<arrtmp.length;i++){num=arrtmp[i].indexOf("=");if(num>0){name=arrtmp[i].substring(0,num);value=arrtmp[i].substr(num+1);this[name]=value;}}}
var Request=new QueryString();var original=Request["original"];var retUserNameStr;var retAuthCodeStr;var getcodeURI=function(s){var a=s.split('');var chineseRegex=/[^\x00-\xff]/;var str=[];for(var i=0;i<a.length;i++){var c=a[i].charAt(0);if((c>='A'&&c<='Z')||(c>='a'&&c<='z')||(c>='0'&&c<='9')||c=='.'||c=='-'||c=='_'){str.push(c)}
else if(c==" "){str.push('+');}else if(c=="*"){str.push('%2a');}else if(c=="@"){str.push('%40');}else if(c=="/"){str.push('%2f');}else if(c=="+"){str.push('%2b');}else if(chineseRegex.test(c)){str.push(c);}else{str.push(escape(c));}}
return str.join('');}
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=Base64._utf8_encode(input);while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
output=output+
this._keyStr.charAt(enc1)+this._keyStr.charAt(enc2)+
this._keyStr.charAt(enc3)+this._keyStr.charAt(enc4);}
return output;},decode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=this._keyStr.indexOf(input.charAt(i++));enc2=this._keyStr.indexOf(input.charAt(i++));enc3=this._keyStr.indexOf(input.charAt(i++));enc4=this._keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
if(enc4!=64){output=output+String.fromCharCode(chr3);}}
output=Base64._utf8_decode(output);return output;},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}}
if(server_url.indexOf("https")>-1){isHttps=true;}
var taoshi={taoshi:function(str){},runapp:function(str){}}
var regLoginEnter=function(){var obj=gi("HOLL");obj.onkeypress=function(evt){if(!evt)evt=event;var keycode=evt.keyCode||evt.which;var node=(evt.target)?evt.target:((evt.srcElement)?evt.srcElement:null);if(node.type=="button")return;if(keycode==10||keycode==13){if(document.getElementById("bgDiv1")==null){gi("LocalLoginButton").focus();setTimeout("AdtTpn.login()",500);}
return false;}}}
function clearLoginEnterEvt(){var obj=gi("HOLL");obj.onkeypress=null;}
function toCGIChangePwd(){msgBox.removeMsgBox();var iframe=document.getElementById("Iframe").contentWindow.document;var oldPwd=iframe.getElementById("oldPwd").value;var newPwd=iframe.getElementById("newPwd").value;var entPwd=iframe.getElementById("entPwd").value;if(getLastAuthType()==3){var er=AdtUsb.changePinPwd(oldPwd,newPwd);if(er!=""&&er!=null){alert(er);}}else{var action=server_url+"/goform/CGIChangePwd?1=1";action+="&user_name="+getUserName();action+="&cur_pwd="+oldPwd;action+="&new_pwd="+newPwd;action+="&auth_code="+getAuthCode();$.getScript(action,function(){if(_IfSuccess==false){alert("修改失败,原口令错误!");}else{alert("修改成功!");iframe.getElementById("oldPwd").value="";iframe.getElementById("newPwd").value="";iframe.getElementById("entPwd").value="";}});}}
var msgBox=function(){var msgw,msgh,bordercolor;msgw=300;if(navigator.userAgent.indexOf("Gecko")>-1){msgh=120;}else{msgh=100;}
titleheight=25
bordercolor="#007ECE";titlecolor="#99CCFF";return{createMsgBox:function(str,fun1,fun2,button1,button2){if(typeof(button1)=='undefined'){button1='  确 定  '}else{button1=button1;}
if(typeof(button2)=='undefined'){button2='  取 消  '}else{button2=button2;}
var sWidth=document.body.clientWidth;var sHeight=document.body.clientHeight;var bgObj=document.createElement("div");bgObj.setAttribute('id','bgDiv1');bgObj.style.cssText="position:absolute;left:0px;top:0px;width:"
+sWidth
+"px;height:"
+sHeight
+"px;filter:Alpha(Opacity=30);opacity:0.3;background-color:#000000;z-index:101;";document.body.appendChild(bgObj);var msgObj=document.createElement("div")
msgObj.setAttribute("id","msgDiv");msgObj.setAttribute("align","center");msgObj.style.background="aliceblue";msgObj.style.border="2px solid "+bordercolor;msgObj.style.position="absolute";msgObj.style.left="55%";msgObj.style.top=document.body.scrollTop
+document.body.clientHeight/2;msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";msgObj.style.marginLeft="-225px";msgObj.style.marginTop=-125+document.documentElement.scrollTop
+"px";msgObj.style.width=msgw+"px";msgObj.style.height=msgh+"px";msgObj.style.textAlign="center";msgObj.style.lineHeight="25px";msgObj.style.zIndex="10001";var title=document.createElement("h4");title.setAttribute("id","msgTitle");title.setAttribute("align","left");title.style.margin="0";title.style.padding="3px";title.style.background=bordercolor;title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";title.style.opacity="0.75";title.style.border="1px solid "+bordercolor;title.style.height="18px";title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";title.style.color="white";title.style.cursor="pointer";title.innerHTML="系统提示";title.onclick=function(){}
document.body.appendChild(msgObj);document.getElementById("msgDiv").appendChild(title);var txt=document.createElement("p");txt.style.margin="1em 0"
txt.setAttribute("id","msgTxt");txt.innerHTML=str+"<INPUT TYPE='button' id='submit' style='cursor:pointer' value='"+button1+"'>"
+"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"
+"<INPUT TYPE='button' id='cancel' style='cursor:pointer' value='"+button2+"'>";document.getElementById("msgDiv").appendChild(txt);var f1=new Function(fun1)
var f2=new Function(fun2)
if(navigator.userAgent.indexOf("Gecko")>-1){document.getElementById("submit").addEventListener('click',f1,false);document.getElementById("cancel").addEventListener('click',f2,false);}else{document.getElementById("submit").attachEvent('onclick',f1);document.getElementById("cancel").attachEvent('onclick',f2);}
document.getElementById("submit").focus();},removeMsgBox:function(str){document.body.removeChild(gi("bgDiv1"));document.body.removeChild(gi("msgDiv"));},removeMsgBox2:function(){document.body.removeChild(gi("bgDiv1"));document.body.removeChild(gi("msgDiv"));document.location.href='home.html';},installOcx:function(){msgBox.deleteMsgBox();document.location.href="setup/usb.exe";},deleteMsgBox:function(authNum){if(authNum==1){document.body.removeChild(gi("bgDiv1"));document.body.removeChild(gi("msgDiv"));gE("AuthMode").style.display="";gE("AuthMode").value=gi("AuthMode").options[0].value;}
if(authNum==2){document.body.removeChild(gi("bgDiv1"));document.body.removeChild(gi("msgDiv"));gE("hiddenText").style.display="none";gE("AuthMode").style.display="";gE("AuthMode").value=gi("AuthMode").options[0].value;gE("AuthLoginName").style.display="none";gE("CertName").style.display="";toGetCertList();}
if(authNum==3){document.body.removeChild(gi("bgDiv1"));document.body.removeChild(gi("msgDiv"));gE("hiddenText").style.display="none";gE("AuthMode").style.display="";gE("AuthMode").value=gi("AuthMode").options[0].value;gE("AuthLoginName").disabled=true;gE("AuthLoginName").className="disabled";}
if(authNum==4){document.body.removeChild(gi("bgDiv1"));document.body.removeChild(gi("msgDiv"));gE("hiddenText").style.display="none";gE("AuthMode").style.display="";gE("AuthMode").value=gi("AuthMode").options[0].value;gE("AuthLoginName").focus();}
if(authNum==5){document.body.removeChild(gi("bgDiv1"));document.body.removeChild(gi("msgDiv"));gE("AuthMode").style.display="";gE("AuthMode").value=5;}},backHome:function(){document.location.href='home.html';},hiddenMsg:function(authMode,authModeLength,authModeName){if(authMode=="1"){msgBox.removeMsgBox();gi("IsSavePassword").disabled=false;gE("AuthMode").value=gE("AuthMode").options[0].value;gE("hiddenText").style.display="none";gE("AuthMode").style.display="";gE("AuthMode").disabled=false;gE("AuthLoginName").style.display="";gE("CertName").style.display="none";gE("AuthLoginPass").disabled=false;gE("AuthLoginPass").className="";gE("AuthLoginName").disabled=false;gE("AuthLoginName").className="";gE("LoginNameDesc").innerHTML="用户名:";gE("LoginPassDesc").innerHTML="密"+"&nbsp"+"码:";gE("AuthLoginName").focus();return false}
if(authModeLength==1){if(authMode=="2"){msgBox.removeMsgBox();gE("AuthMode").disabled=false;gE("AuthLoginPass").className="";gi("selectAuthMode").style.display="";gE("hiddenText").style.display="none";gE("AuthMode").style.display="";gE("AuthMode").value=gi("AuthMode").options[0].value;gE("AuthLoginName").style.display="none";gE("CertName").style.display="";toGetCertList();}
if(authMode=="3"){msgBox.removeMsgBox();gE("AuthMode").disabled=false;gi("selectAuthMode").style.display="";gE("hiddenText").style.display="none";gE("AuthMode").style.display="";gE("AuthMode").value=gi("AuthMode").options[0].value;}}else{if(authMode=="2"){msgBox.removeMsgBox();gE("AuthMode").disabled=false;gE("LoginNameDesc").innerHTML="证书名:";gE("LoginPassDesc").innerHTML="密"+"&nbsp"+"码:";gE("hiddenText").style.display="none";gE("AuthMode").style.display="";gE("AuthMode").value=gi("AuthMode").options[0].value;gE("AuthLoginName").style.display="none";gE("CertName").style.display="";gE("AuthLoginPass").disabled=true;gE("AuthLoginPass").className="disabled";gE("AuthLoginPass").value="";toGetCertList();return false;}
if(authMode=="3"){gE("AuthMode").disabled=false;msgBox.removeMsgBox();return false;}}}}}();$(function(){var sUserAgent=navigator.userAgent;var isOpera=sUserAgent.indexOf("Opera")>-1;var isIE=sUserAgent.indexOf("compatible")>-1&&sUserAgent.indexOf("MSIE")>-1&&!isOpera;if(isIE){var reIE=new RegExp("MSIE (\\d+\\.\\d+);");reIE.test(sUserAgent);var fIEVersion=parseFloat(RegExp["$1"]);if(fIEVersion<6){alert("请升级至IE6.0或其后版本!");return false;}}
$("#LoginTitle").css("height","92px");var screenWidth=screen.width;var screenHeight=screen.height;$("#Center").css("height",(screenHeight/1.93))
$("#Footer").css("height",(screenHeight/10));AdtUsb.init();AdtTpn.chkStatus();InitPageConfig();regLoginEnter();if(AdtUsb.IsUSB()==true){$("#HigSetButton").css("display","")
$("#HigSetBoxBody").css("display","")}});var AdtTpn={init:function(){auth_mode=$("#AuthMode").val();LoginUserName=$("#AuthLoginName").val();LoginUserPass=$("#AuthLoginPass").val();httpType=location.protocol;httpType=location.protocol.indexOf("https")>-1?1:0;IsSavePassword=$("#IsSavePassword ").attr("checked");IsSavePassword=(IsSavePassword?1:0);tcptType=$("#IsEnableTcptSel").val();breakRconn=$("#IsKeepOnline").attr("checked");breakRconn=(breakRconn?1:0);quickSelIp=$("#IsSelectFastIp").attr("checked");quickSelIp=(quickSelIp?1:0);autoLogin=$("#IsAutoLogin").val();},toRedirect:function(){var str=location.href;var num=str.indexOf("?original=")
str=str.substr(num+10);if(original.length>35){original=original.substring(0,35)+"......"}
msgBox.createMsgBox('登录成功！是否继续打开：\r\r '+original+'<br>','AdtTpn.openwindow("'+str+'")','msgBox.removeMsgBox()');},openwindow:function(url,desc){msgBox.removeMsgBox();window.open(url);},blank:function(){$("#LoginStatusDiv").html("");},closeWinForUsbKey:function(){$("#AdtWin8").css("display","none")
$("#bgDiv").css("display","none")
$("#selectAuthMode").css("display","");gi("selectAuthMode").value=gi("AuthMode").options[0].value;gE("LoginNameDesc").innerHTML="用户名:";gE("LoginPassDesc").innerHTML="PIN"+"&nbsp"+"码:";gE("LoginNameDesc").disabled=true;gE("LoginPassDesc").focus();},closeWinForZhengShu:function(){gi("AdtWin7").style.display="none";gi("bgDiv").style.display="none";gi("selectAuthMode").style.display="";gi("selectAuthMode").value=gi("AuthMode").options[0].value;gE("LoginNameDesc").innerHTML="证书名:";gE("LoginPassDesc").innerHTML="密"+"&nbsp"+"码:";gE("AuthLoginName").style.display="none";gE("CertName").style.display="";gE("AuthLoginPass").disabled=true;gE("AuthLoginPass").className="disabled";gE("AuthLoginPass").value="";toGetCertList();},closeWin:function(){gi("AdtWin5").style.display="none";gi("bgDiv").style.display="none";gi("selectAuthMode").style.display="";gi("selectAuthMode").value="1";},dontChangPwd:function(){$("#AdtWin3").css("display","none");$("#bgDiv").css("display","none");},dontInstallOcx:function(){$("#AdtWin2").css("display","none");$("#bgDiv").css("display","none");$("#selectAuthMode").css("display","none");gi("AuthMode").value=gi("AuthMode").options[0].value;var sLoginNameDesc="用户名:";var sLoginPassDesc="密"+"&nbsp"+"码:";if(gi("AuthMode").options[0].value=="1"){gi("IsSavePassword").disabled=false;gE("AuthLoginName").style.display="";gE("CertName").style.display="none";gE("AuthLoginPass").disabled=false;gE("AuthLoginPass").className="";gE("AuthLoginPass").value="";gE("AuthLoginName").disabled=false;gE("AuthLoginName").className="";gE("LoginNameDesc").innerHTML="用户名:";gE("LoginPassDesc").innerHTML="密"+"&nbsp"+"码:";gE("AuthLoginName").focus();return false}
if(gi("AuthMode").options.length==1){if(gi("AuthMode").options[0].value=="2"){gi("AdtWin2").style.display="none";gi("bgDiv").style.display="none";gi("selectAuthMode").style.display="";gi("AuthMode").value=gi("AuthMode").options[0].value;gE("AuthLoginName").style.display="none";gE("CertName").style.display="";toGetCertList();}
if(gi("AuthMode").options[0].value=="3"){gi("AdtWin2").style.display="none";gi("bgDiv").style.display="none";gi("selectAuthMode").style.display="";gi("AuthMode").value=gi("AuthMode").options[0].value;}}else{if(gi("AuthMode").options[0].value=="2"){gi("AdtWin2").style.display="none";gi("bgDiv").style.display="none";gE("LoginNameDesc").innerHTML="证书名:";gE("LoginPassDesc").innerHTML="密"+"&nbsp"+"码:";gE("AuthLoginName").style.display="none";gE("CertName").style.display="";gE("AuthLoginPass").disabled=true;gE("AuthLoginPass").className="disabled";gE("AuthLoginPass").value="";toGetCertList();return false;}
if(gi("AuthMode").options[0].value=="3"){gi("AdtWin2").style.display="none";gi("bgDiv").style.display="none";return false;}}},dontLogout:function(){document.body.removeChild(gi("bgDiv1"));document.body.removeChild(gi("msgDiv"));},showVersion:function(){if(gi("VersionInfosVerBase").style.display=="none"){if(isUseOcx()==false){if(navigator.userAgent.indexOf("Gecko")>-1){gE("webOcx").style.width="390px";}else{gE("webOcx").style.width="360px";}
gi("LoginDiv").style.display="none";gi("localOcx").style.display="";gi("serverOcx").style.display="";gi("webOcx").style.display="";gi("WebVerSpan").innerHTML=" Ver "+web_verstion
+"&nbsp;&nbsp;&nbsp;&nbsp;"+update_time+"";gi("LocalOcxVerSpan").innerHTML=getLocalOcxVer();gi("ServerOcxVerSpan").innerHTML=getServerOcxVer();gi("VersionInfosVerBase").style.display="";}else{if(navigator.userAgent.indexOf("Gecko")>-1){gE("webOcx").style.width="390px";}else{gE("webOcx").style.width="360px";}
gi("LoginDiv").style.display="none";gi("WebVerSpan").innerHTML=" Ver "+web_verstion
+"&nbsp;&nbsp;&nbsp;&nbsp;"+update_time+"";gi("LocalOcxVerSpan").innerHTML=getLocalOcxVer();gi("ServerOcxVerSpan").innerHTML=getServerOcxVer();gi("VersionInfosVerBase").style.display="";}}else{if(gi("Master").style.display=="none"){gi("LoginDiv").style.display="";gi("VersionInfosVerBase").style.display="none";}else{gi("VersionInfosVerBase").style.display="none";}}},supportEnter:function(){if(window.event.keyCode==13){this.login();}},closVerWin:function(){if(gi("LoginDiv").style.display=="none"&&gi("Master").style.display=="none"){gi("VersionInfosVerBase").style.display="none";gi("LoginDiv").style.display="";}else{gi("VersionInfosVerBase").style.display="none";}},closeWeb:function(){window.opener=null;window.open('','_self');window.close();},chkStatus:function(){if(AdtUsb.IsUSB()==true){$("#HigSetBoxBody").css("display","")}
if(isUseOcx()==false){var user_name=Cookie.GetCookieVal("_UserName");user_name=getcodeURI(user_name);var auth_code=Cookie.GetCookieVal("_AuthCode");var action=server_url+"/goform/CGIGetLoginState?1=1";action+="&user_name="+user_name+"&auth_code="+auth_code;if(user_name==''&&auth_code==''){toGetAuthMode();toSetStartMonitor();}else{$.get(action,function(data){try{eval(data);}catch(e){}
if(_IfLogin==true){AdtTpn.setLoginMessage("已登录");AdtTpn.viewMain();}else{toGetAuthMode();toSetStartMonitor();}});}}
if(AdtUsb.IsUSB()==true){var s=AdtUsb.Status();if(s!=50){toGetAuthMode();toSetStartMonitor();}else if(s==50){this.checkedUsbResult();AdtTpn.viewMain();}}},login:function(){AdtTpn.init()
Cookie.DelCookieVal("_AuthCode");Cookie.DelCookieVal("_UserName");Cookie.DelCookieVal("_UserRealName");Cookie.DelCookieVal("_ClientLoginTime");Cookie.DelCookieVal("_ClientLoginIP");Cookie.DelCookieVal("_LastLoginIP");Cookie.DelCookieVal("_LastLoginTime");var enabletcptsel=$("#IsEnableTcptSel").val();if(auth_mode==1){LoginUserName=$("#AuthLoginName").val();LoginUserPass=$("#AuthLoginPass").val();if(LoginUserName==""){this.setLoginMessage("请输入登录名称，谢谢！");$("#AuthLoginName").focus();return false;}
if(LoginUserPass==""){this.setLoginMessage("请输入登录密码，谢谢！");$("#AuthLoginPass").focus();return false;}}else if(auth_mode==2){if(AdtUsb.IsUSB()==false){$("#CertName").css('display','none');$("#AuthLoginName").css('display','')
msgBox.createMsgBox('需要安装控件才能登录,点击"确定"<br>','msgBox.installOcx()','msgBox.deleteMsgBox(2)');$("#AuthMode").css("display","none");$("#hiddenText").css("display","none")
return false;}
LoginUserName=$("#CertName").val();if(LoginUserName==""||LoginUserName==0){alert("请选择证书!");$("#CertName").focus();return false;}
if(LoginUserName=="`"){this.setLoginMessage("请稍等，正在读取您的证书列表");$("#CertName").focus();return false;}}else if(auth_mode==3){if(AdtUsb.IsUSB()==false){if(AdtUsb.IsFireFox()){alert(notFF);return false;}
$("#CertName").css("display","none")
$("#AuthLoginName").css("display","")
msgBox.createMsgBox('需要安装控件才能登录,点击"确定"下载控件<br>','msgBox.installOcx()','msgBox.deleteMsgBox(3)');$("#AuthMode").css("display","none");$("#hiddenText").css("display","")
return false;}
LoginUserPass=$("#AuthLoginPass").val();IfUsbKey=1;if(LoginUserPass==""){alert("请输入您的USBKEY的PIN码!");$("#AuthLoginPass").focus();return false;}
if(!AdtUsb.UsbKeyExist()){alert("请插入KEY!")
return false;}}else if(auth_mode==4){mobile=$("#AuthLoginName").val();LoginUserName=$("#AuthLoginName").val();}else if(auth_mode==5){}else{alert("请选择认证方式!");return false;}
toSetStopMonitor();if(auth_mode==2&&AdtUsb.IsUSB()==true){taoshi.taoshi("数字认证登录");AdtTpn.toLoginUSB();return false;}
if(auth_mode==3&&AdtUsb.IsUSB()==true){taoshi.taoshi("USBKEY认证方式登录登录");AdtTpn.toLoginUSB();return false;}
taoshi.taoshi("不用数字认证和USBKEY登录");var action=server_url+"/goform/CGIGetAuthMode";$.ajax({type:"GET",url:action,success:function(msg){var rcn=msg.indexOf("RootCertName");eval(msg.substring(0,rcn));taoshi.taoshi("不用数字认证和USBKEY登录用名字和密码登录要先检查VPN");if(ifVpn==true){if(AdtUsb.IsUSB()==false){gE("AuthMode").style.display="none";msgBox.createMsgBox('需要安装控件才能登录,点击"确定"下载控件<br>','msgBox.installOcx()','msgBox.deleteMsgBox(4)');return false;}
taoshi.taoshi("是NC网关用USB登录");AdtTpn.toLoginUSB();return false;}
if(ifVpnLogin==true){if(AdtUsb.IsUSB()==false){gE("AuthMode").style.display="none";msgBox.createMsgBox('需要安装控件才能登录,点击"确定"下载控件<br>','msgBox.installOcx()','AdtTpn.closeWeb()');return false;}else{taoshi.taoshi("用户是VPN用USB登录");AdtTpn.toLoginUSB();}}else{var tpn_user_name=getcodeURI(gE("AuthLoginName").value);if(auth_mode==5){auth_mode=16;}
if(auth_mode==16){var action=server_url+"/goform/CGIAuth?1=1";action+="&conn_type="+(ifVpnLogin==false?"1":"2")
+"&auth_mode="+auth_mode+"&ifusbkey="+IfUsbKey
+"&mobile="+mobile+"&cert="+cert+"&sig="+sig
+"&user_name="+LoginUserName+"&pwd="+LoginUserPass
+"&key_seq_no="+KeySeqNo;$.get(action,function(msg){eval(msg);Cookie.SetCookieVal("_AuthCode",_AuthCode);Cookie.SetCookieVal("_UserName",_UserName);Cookie.SetCookieVal("_UserRealName",_UserRealName);Cookie.SetCookieVal("_ClientLoginTime",_ClientLoginTime);Cookie.SetCookieVal("_ClientLoginIP",_ClientLoginIP);Cookie.SetCookieVal("_LastLoginIP",_LastLoginIP);Cookie.SetCookieVal("_LastLoginTime",_LastLoginTime);Cookie.GetCookieVal("ifLocalLogin",ifLocalLogin);if(_AccessCtl){AdtTpn.toLoginUSB();}else{AdtTpn.toLoginCGI();}});}else{$.getScript(server_url+"/goform/CGIGetUserAccessCtl?user_name="+tpn_user_name,function(str){if(_AccessCtl==false&&ifVpnLogin==false){taoshi.taoshi("用户既不是VPN也不是TPN用CGI登录");Cookie.SetCookieVal("NOTTPNANDVPN",true);AdtTpn.toLoginCGI();}else{taoshi.taoshi("用户是TPN用USB登录");if(AdtUsb.IsUSB()==false){gE("AuthMode").style.display="none";gE("hiddenText").style.display="";gE("hiddenText").value="用户名/密码";msgBox.createMsgBox('需要安装控件才能登录,点击"确定"下载控件<br>','msgBox.installOcx()','msgBox.deleteMsgBox(4)');return false;}else{AdtTpn.toLoginUSB();}}});}}}});},HigSetButton:function(){var s=gE("HigSetBody").style.display;if(s=="none"){gE("HigSetBody").style.display="";}else{gE("HigSetBody").style.display="none";}},logout:function(){if(Cookie.GetCookieVal("_AuthCode")){var action=server_url+"/goform/CGILogout?1=1";var logoutName=getcodeURI(Cookie.GetCookieVal('_UserName'));action+="&user_name="+logoutName;action+="&auth_code="+Cookie.GetCookieVal("_AuthCode");$.get(action,function(data){try{eval(data)}catch(e){}
if(_IfSuccess==true){Cookie.DelCookieVal("_AuthCode");Cookie.DelCookieVal("_UserName");Cookie.DelCookieVal("_UserRealName");Cookie.DelCookieVal("_ClientLoginTime");Cookie.DelCookieVal("_ClientLoginIP");Cookie.DelCookieVal("_LastLoginIP");Cookie.DelCookieVal("_LastLoginTime");AdtTpn.BreakHome();}else{AdtTpn.BreakHome();}});}else{AdtUsb.Logout()
AdtTpn.BreakHome();}},BreakHome:function(){document.location.href="home.html";},toLoginUSB:function(){if(Cookie.DelCookieVal("_AuthCode")){Cookie.DelCookieVal("_AuthCode");Cookie.DelCookieVal("_UserName");Cookie.DelCookieVal("_UserRealName");Cookie.DelCookieVal("_ClientLoginTime");Cookie.DelCookieVal("_ClientLoginIP");Cookie.DelCookieVal("_LastLoginIP");Cookie.DelCookieVal("_LastLoginTime");};if(!AdtUsb.IsUSB()){$("#AuthMode").css("display","none");msgBox.createMsgBox('需要安装控件才能登录,点击"确定"下载控件<br>','msgBox.installOcx()','msgBox.deleteMsgBox(5)');return false;}else{Cookie.DelCookieVal("_AuthCode");AdtUsb.Login(tpnManager,server_url_,httpType,auth_mode,LoginUserName,LoginUserPass,autoLogin,tcptType,quickSelIp,breakRconn,IsSavePassword);var _this=this;usb_S=setInterval(function(){setDivTitleAltInfos(AdtUsb.GetLoginInfo());_this.checkedUsbResult();},2000)};},toLoginCGI:function(){if(auth_mode==16){AdtTpn.checkedCgiResult();}else{var action=server_url+"/goform/CGIAuth?1=1";action+="&conn_type="+(ifVpnLogin==false?"1":"2")
+"&auth_mode="+auth_mode+"&ifusbkey="+IfUsbKey
+"&mobile="+mobile+"&cert="+cert+"&sig="+sig
+"&user_name="+getcodeURI(LoginUserName)+"&pwd="+getcodeURI(LoginUserPass)
+"&key_seq_no="+KeySeqNo;$.get(action,function(data){try{eval(data);Cookie.SetCookieVal("_AuthCode",_AuthCode);Cookie.SetCookieVal("_UserName",_UserName);Cookie.SetCookieVal("_UserRealName",_UserRealName);Cookie.SetCookieVal("_ClientLoginTime",_ClientLoginTime);Cookie.SetCookieVal("_ClientLoginIP",_ClientLoginIP);Cookie.SetCookieVal("_LastLoginIP",_LastLoginIP);Cookie.SetCookieVal("_LastLoginTime",_LastLoginTime);Cookie.GetCookieVal("ifLocalLogin",ifLocalLogin);AdtTpn.checkedCgiResult();}catch(e){}
AdtTpn.checkedCgiResult();});}},toCheckDynamicPwd:function(dypwd){if(auth_mode==2||auth_mode==3){taoshi.taoshi("数字认证和USBKEY方式的动态口令进USB");gE("DynPwdButton").disabled=true;gE("DynClsButton").disabled=true;setDyncErrorInfo("正在验证密码");if(AdtUsb.ToLogin2(dypwd)){this.statusNum=0;setDivTitleAltInfos("正在验证密码");toHiddenDynPwd();setTimeout("AdtTpn.checkedUsbDynPwdSuccess();",500);}else{setDyncErrorInfo("验证动态密码失败！"+getStatusDesc());gE("DynPwdButton").disabled=false;gE("DynClsButton").disabled=false;}
return false;}
if(ifVpnLogin==false&&_AccessCtl==false){taoshi.taoshi(getUserName());var action=server_url+"/goform/CGICheckDynamicPwd?1=1";action+="&user_name="+getUserName();action+="&auth_code="+getAuthCode();action+="&dpwd="+dypwd;$.getScript(action,function(){checkedDynPwdSuccess();});}else{gE("DynPwdButton").disabled=true;gE("DynClsButton").disabled=true;setDyncErrorInfo("正在验证密码");if(AdtUsb.ToLogin2(dypwd)){this.statusNum=0;setDivTitleAltInfos("正在验证密码");toHiddenDynPwd();setTimeout("AdtTpn.checkedUsbDynPwdSuccess();",500);}else{setDyncErrorInfo("验证动态密码失败！"+getStatusDesc());gE("DynPwdButton").disabled=false;gE("DynClsButton").disabled=false;}}},usbloginBreakHome:function(){this.logout();this.BreakHome();},checkedUsbResult:function(){var fflag_;var tflag;if(AdtUsb.IsUSB()==true){var s=AdtUsb.Status();if(s==-1){AdtTpn.setLoginMessage("正在启动控件,请稍候...");return false;}
if(s==50){if(original!=null&&original!=''&&typeof(original)!='undefined'){AdtTpn.toRedirect();}
hiddenDivTitleAltInfos();clearInterval(usb_S)
this.viewMain();Cookie.SetCookieVal('IsUseOcx','1');}else if(s==6){clearInterval(usb_S);var i=5;tflag=setInterval(function(){i--;setDivTitleAltInfos(i+"秒后返回登录页面");AdtUsb.Logout();if(i==0){AdtTpn.BreakHome();clearInterval(tflag);clearInterval(fflag);}},1000);}}else if(s!=50){setDivTitleAltInfos(AdtUsb.GetLoginInfo());setTimeout("AdtTpn.BreakHome()",3000);}},CGIQueryAsynAuthResult:function(){var action=server_url
+"/goform/CGIQueryAsynAuthResult?1=1&user_name="
+getUserName()+"&auth_code="+getAuthCode();$.getScript(action,function(){try{setTimeout("AdtTpn.checkedCgiResult();",1000);}catch(e){}});},checkedCgiResult:function(){if(_AuthResult!="0"){AdtTpn.setLoginMessage("认证信息不正确");return false;}
Cookie.SetCookieVal("IsUseOcx","0");if(_AuthResult=="0"){AdtTpn.setLoginMessage("认证成功");if(original!=null&&original!=''&&typeof(original)!='undefined'){taoshi.taoshi("页面转向了")
AdtTpn.toRedirect();}
setTimeout("AdtTpn.viewMain()",100);return false;}},setLoginMessage:function(str){if(str!=""){gE("LoginStatusDiv").innerHTML=str;setTimeout("AdtTpn.blank()",3000);}
setTimeout("AdtTpn.setLoginMessage('')",3000);},viewMain:function(){clearLoginEnterEvt();$("#LoginDiv").css("display","none")
if(isUseOcx()==true){if(auth_mode==5||auth_mode==16){gE("MENU_PWD_LIST").style.display="none";gE("hid2").style.display="";}else{gE("MENU_PWD_LIST").style.display="";gE("hid2").style.display="";}}else{if(_UserName.toLowerCase()!=''&&_UserName.toLowerCase()!=null&&typeof(_UserName.toLowerCase())!="undefined"){if(_UserName.toLowerCase()!=gE("AuthLoginName").value.toLowerCase()){gE("MENU_PWD_LIST").style.display="none";gE("hid2").style.display="none";}else{gE("MENU_PWD_LIST").style.display="";gE("hid2").style.display="";}}else{if(Cookie.GetCookieVal("isAllCanUseUser")=='1'){gE("MENU_PWD_LIST").style.display="none";gE("hid2").style.display="none";}else{gE("MENU_PWD_LIST").style.display="";gE("hid2").style.display="";}}}
gE("MenuTR").style.display="";gE("Master").style.display="";AdtTpn.toSetViewUserInfo();showMainDiv("MENU_RES_LIST");toCheckedLoginSuccessStatus();isLogoutSuccess=false;},toSetViewUserInfo:function(){$("#UserNameB").css("display","")
$("#ClientLoginTimeB").css("display","")
$("#ClientLoginIPB").css("display","")
$("#LastLoginIPB").css("display","")
$("#LastLoginTimeB").css("display","")
$("#UserRealNameDIV").css("display","")
if(Cookie.GetCookieVal("_AuthCode")!=''){$("#UserNameDIV").html(Cookie.GetCookieVal("_UserName"));$("#UserRealNameDIV").html(Cookie.GetCookieVal("_UserRealName"))
$("#ClientLoginTimeDIV").html(Cookie.GetCookieVal("_ClientLoginTime"))
$("#ClientLoginIPDIV").html(Cookie.GetCookieVal("_ClientLoginIP"));$("#LastLoginIPDIV").html(Cookie.GetCookieVal("_LastLoginIP"));$("#LastLoginTimeDIV").html(Cookie.GetCookieVal("_LastLoginTime"));var conntype=Cookie.GetCookieVal("ifLocalLogin");conntype=conntype=="true"?"本地接入":"VPN接入"
$("#ConnTypeTpnDIV").html(conntype);return false;}else{if(AdtUsb.IsUSB()){$("#UserNameDIV").html(AdtUsb.GetValue("UserName"));$("#UserRealNameDIV").html(AdtUsb.GetRealName().replace(/"/g,""))
$("#ClientLoginTimeDIV").html(AdtUsb.GetClientLoginTime().replace(/"/g,""))
$("#ClientLoginIPDIV").html(AdtUsb.GetClientLoginIP().replace(/"/g,""));$("#LastLoginIPDIV").html(AdtUsb.GetLastLoginIP().replace(/"/g,""));$("#LastLoginTimeDIV").html(AdtUsb.GetLastLoginTime().replace(/"/g,""));var connType=AdtUsb.GetConnType()==1?"本地接入":"VPN接入";$("#ConnTypeTpnDIV").html(connType);}}},changePwd:function(curPwd,newPwd,func){if(AdtUsb.IsUSB()==true){var er=AdtUsb.changePinPwd(curPwd,newPwd);}else{var action=server_url+"/goform/CGIChangePwd?1=1";action+="&user_name="+getUserName();action+="&cur_pwd="+myescape(curPwd);action+="&new_pwd="+myescape(newPwd);action+="&auth_code="+getAuthCode();Ajax.request(action,function(str){if(str!="ERROR001"){try{func(str);}catch(e){}}});}}};function isUseOcx(){if(Cookie.GetCookieVal("IsUseOcx")=="0"||Cookie.GetCookieVal("IsUseOcx")==""||Cookie.GetCookieVal("IsUseOcx")==null||typeof(Cookie.GetCookieVal("IsUseOcx"))=="undefined"){return false;}else{return true;}}
function getUserInputName(){return AdtUsb.GetValue("UserName");}
function getUserGwName(){try{var role=AdtUsb.GetValue("superuser");var userName=AdtUsb.GetValue("UserGwName");if(role==1){return userName+"(特权用户)";}else if(role==0){return userName;}else{return userName;}}catch(e){}}
function getLastAuthType(){return AdtUsb.GetValue("AuthType");}
function getLinkType(){return AdtUsb.GetValue("LinkType");}
function getAuthResult(){return AdtUsb.GetValue("AuthResult");}
function getUserId(){return AdtUsb.GetValue("UserId");}
function getServerType(){return AdtUsb.GetValue("ServerType");}
function getUserName(){return AdtUsb.GetValue("UserName");}
function getUserRealName(){return AdtUsb.GetValue("UserRealName");}
function getAuthCode(){return AdtUsb.GetValue("AuthCode");}
function getAccessCtl(){return AdtUsb.GetValue("AccessCtl");}
function getFailReason(){return AdtUsb.GetFailReason("FailReason");}
function getLastLoginTime(){return AdtUsb.GetValue("LastLoginTime");}
function getLastLoginIP(){return AdtUsb.GetValue("LastLoginIP");}
function getClientLoginIP(){return AdtUsb.GetValue("ClientLoginIP");}
function getClientLoginTime(){return AdtUsb.GetValue("ClientLoginTime");}
function getVirtualIP(){return AdtUsb.GetValue("VirtualIP");}
function getLanIP(){return AdtUsb.GetValue("LanIP");}
function getSyncAuth(){return AdtUsb.GetValue("SyncAuth");}
function getV1(){return AdtUsb.GetValue("V1");}
function getV2(){return AdtUsb.GetValue("V2");}
function getAutoLogin(){return AdtUsb.GetValue("AutoLogin");}
function getPassWord(){return AdtUsb.GetValue("PassWord");}
function getSavePassword(){var s=AdtUsb.GetValue("SavePassword");if(null==s||s=="")
s=0;return s;}
function getSelectFastIp(){var s=AdtUsb.GetValue("SelectFastIp");if(null==s||s=="")
s=0;return s;}
function getStatusDesc(){return getFailReason();}
function getUSBVer(){return AdtUsb.GetValueFromUsb("usb");}
function getTPNVer(){return AdtUsb.GetValueFromUsb("tpn");}
function getVPNVer(){return AdtUsb.GetValueFromUsb("vpn");}
var AdtUsb={BaseUSB:null,IsInstallOCX:false,Tpn:null,isTpn:false,init:function(){try{var s=navigator.userAgent.toLowerCase();if(s.lastIndexOf("windows nt 6")>-1){try{this.BaseUSB=new ActiveXObject("UsbProxy.UsbProxy1");}catch(e){this.BaseUSB=new ActiveXObject("TpnLoginModule.TpnLoginCtrl.1");}}else{this.BaseUSB=new ActiveXObject("TpnLoginModule.TpnLoginCtrl.1");}
this.IsInstallOCX=true;}catch(e){this.IsInstallOCX=false;}
try{if(this.IsInstallOCX)
if(this.Tpn==null)
this.Tpn=new ActiveXObject("TpnClt.Tpn");}catch(e){}},IsFireFox:function(){var isMoz=navigator.userAgent.indexOf("Gecko")>-1;return isMoz;},IsUSB:function(){if(!this.IsFireFox()){return this.IsInstallOCX;}else{return false;}},GetRealName:function(){try{if(this.IsInstallOCX){return this.BaseUSB.UserRealName}}catch(e){}},IsTPN:function(){return this.isTpn;},Status:function(){try{if(this.IsInstallOCX){return this.BaseUSB.GetStatus()}}catch(e){}},GetClientLoginTime:function(){try{if(this.IsInstallOCX){return this.BaseUSB.ClientLoginTime}}catch(e){}},GetClientLoginIP:function(){try{if(this.IsInstallOCX){return this.BaseUSB.ClientLoginIP}}catch(e){}},GetLastLoginIP:function(){try{if(this.IsInstallOCX){return this.BaseUSB.LastLoginIP}}catch(e){}},GetLastLoginTime:function(){try{if(this.IsInstallOCX){return this.BaseUSB.LastLoginTime}}catch(e){}},Get_UsbVer:function(){try{if(this.IsInstallOCX){return this.BaseUSB.UsbVer}}catch(e){}},Get_TpnVer:function(){try{if(this.IsInstallOCX){return this.BaseUSB.TpnVer}}catch(e){}},Get_VpnVer:function(){try{if(this.IsInstallOCX){return this.BaseUSB.VpnVer}}catch(e){}},GetLoginInfo:function(){try{if(this.IsInstallOCX){return this.BaseUSB.GetLoginInfo()}}catch(e){}},GetConnType:function(){try{if(this.IsInstallOCX){return this.BaseUSB.ConnType}}catch(e){}},GetGateType:function(){try{if(this.IsInstallOCX){return this.BaseUSB.GateType}}catch(e){}},Login:function(tpn_manager,strServer,bHttps,nLoginType,strUserName,strPwd,autoLogin,tcpt,bSelectFastIP,reConn,savePass){if(this.IsInstallOCX){this.BaseUSB.exec(tpn_manager,'-x -a \"'+strServer+'\" \"'+bHttps+'\" \"'+nLoginType+'\" \"'+strUserName+'\" \"'+strPwd+'\" \"'+autoLogin+'\" \"'+tcpt+'\" \"'+bSelectFastIP+'\" \"'+reConn+'\" \"'+savePass+'\"');}},Logout:function(){try{if(this.IsInstallOCX){return this.BaseUSB.exec("TpnMangr.exe","-q");}}catch(e){}},GetCertList:function(filter){var lists=[];if(this.IsUSB()){var Cert=this.BaseUSB.CertList;Cert=Cert.split(';');for(var i=0;i<Cert.length;i++){lists.push(Cert[i])}}
return lists;},UsbKeyExist:function(){try{if(this.IsInstallOCX){return this.BaseUSB.IsUsbKeyExist();}}catch(e){}},GetResourceList:function(){try{if(this.IsInstallOCX){return this.BaseUSB.ResourceList}}catch(e){}},QueryRemoteid:function(id,ip){try{if(this.IsInstallOCX){return this.BaseUSB.QueryRemoteId(id,ip);}}catch(e){}},ChangePWD:function(oldPwd,newPwd){try{if(this.IsInstallOCX){return this.BaseUSB.ChangePassWord(oldPwd,newPwd);}}catch(e){}},GetValue:function(key){var rs="";try{if(this.IsUSB()){rs=this.BaseUSB.getValue(key);}else{rs=Cookie.GetCookieVal(key);}}catch(e){}
return rs;}}
var Cookie={getCookie:function(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1)
endstr=document.cookie.length;return unescape(document.cookie.substring(offset,endstr));},GetCookieVal:function(key){var name=key;var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen){var j=i+alen;if(document.cookie.substring(i,j)==arg)
return unescape(this.getCookie(j));i=document.cookie.indexOf(" ",i)+1;if(i==0)
break;}
return"";},FixCookieDate:function(expdate){var base=new Date(0);var skew=base.getTime();if(skew>0)
expdate.setTime(expdate.getTime()-skew);},SetCookieVal:function(key,value,expires,path,domain,secure){var name=key;expires=new Date();this.FixCookieDate(expires);expires.setTime(expires.getTime()+(2*24*60*60*1000));document.cookie=name+"="+escape(value)
+((expires)?"; expires="+expires.toGMTString():"");},DelCookieVal:function(name){var expdate=new Date(0);this.SetCookieVal(name,'',expdate);}}
function gE(id){return document.getElementById(id);}
function gi(id){if(id==null||id=='')
return null;return gE(id);}
function InitPageConfig(){gE("Head").style.backgroundImage="url("+head_image+")";gE("Center").style.backgroundImage="url(images/center.gif)";gE("Footer").style.backgroundImage="url(images/footer.gif)";gE("Footer").innerHTML=copyright
+"<br>技术支持：021-51697070，4008801233&nbsp;&nbsp;&nbsp;网站：<a href='#' style='text-decoration:none;' onclick=window.open('http://www.adtsec.com')>www.adtsec.com</a><br><span id='showVerChange' onclick='AdtTpn.showVersion()' style='cursor:pointer'>【Ver "
+web_verstion+"】</span>【"+update_time+"】";if(AdtUsb.IsUSB()==true){$("#HigSetBoxBody").css('display','');var al=$("#IsAutoLogin").val();if(al==2||al==1){document.getElementById("IsSavePassword").checked=true;document.getElementById("IsSavePassword").disabled=true;}else if(al==0){document.getElementById("IsSavePassword").disabled=false;}
initConfigEnableds();}}
function toGetAuthMode(){var action=server_url+"/goform/CGIGetAuthMode";$.ajax({type:"GET",url:action,success:function(msg){var rcn=msg.indexOf("RootCertName");var rcn=msg.indexOf("RootCertName");if(rcn>0){eval(msg.substring(0,rcn));Cookie.SetCookieVal("ifLocalLogin",ifLocalLogin);}else{eval(msg);Cookie.SetCookieVal("ifLocalLogin",ifLocalLogin);}
if(ifVpn==true){if(AdtUsb.IsFireFox()){alert(notFF);AdtTpn.closeWeb();return false;}else{if(AdtUsb.IsUSB()==false){configAuthMode();}else{configAuthMode();}}}else{if(ifVpnLogin==true&&AdtUsb.IsUSB()==false){if(AdtUsb.IsFireFox()){alert(notFF);AdtTpn.closeWeb();return false;}
configAuthMode();}else{configAuthMode();}}}});}
function toSelectLoginMode(flg){var sLoginNameDesc="用户名:";var sLoginPassDesc="密"+"&nbsp"+"码:";var removeMessage="";var authMode="";var authModeLength="";if(flg=="1"){if(gi("IsAutoLogin").checked==false){gi("IsSavePassword").disabled=false;}else{gi("IsSavePassword").disabled=true;}
sLoginNameDesc="用户名:";sLoginPassDesc="密"+"&nbsp"+"码:";gE("AuthLoginName").style.display="";gE("CertName").style.display="none";gE("AuthLoginPass").disabled=false;gE("AuthLoginPass").className="";gE("AuthLoginName").disabled=false;gE("AuthLoginName").className="";gE("AuthLoginName").focus();}
if(flg=="2"){if(AdtUsb.IsUSB()==false){if(AdtUsb.IsFireFox()){alert(notFF);if(gi("AuthMode").options[0].value!="1"){gE("LoginNameDesc").innerHTML="证书名:";gE("LoginPassDesc").innerHTML="密&nbsp码:";gE("AuthLoginName").disabled=true;gE("AuthLoginPass").disabled=true;}else{gi("AuthMode").value=gi("AuthMode").options[0].value;}
return false;}
this.authMode=gi("AuthMode").options[0].value;this.authModeLength=gi("AuthMode").options.length;msgBox.createMsgBox('需要安装控件才能登录,点击"确定"下载控件<br>','msgBox.installOcx()','msgBox.hiddenMsg(authMode,authModeLength)');gE("AuthMode").style.display="none";gE("AuthMode").disabled=true;gE("hiddenText").style.display="";gE("AuthLoginPass").className="disabled";sLoginNameDesc="证书名:";}else{gi("IsSavePassword").disabled=true;sLoginNameDesc="证书名:";gE("AuthLoginName").style.display="none";gE("CertName").style.display="";gE("AuthLoginPass").disabled=true;gE("AuthLoginPass").className="disabled";gE("AuthLoginPass").value="";toGetCertList();gE("CertName").focus();}}
if(flg=="3"){if(AdtUsb.IsUSB()==false){if(AdtUsb.IsFireFox()){alert(notFF);if(gi("AuthMode").options[0].value!="1"){gE("LoginNameDesc").innerHTML="用户名:";gE("LoginPassDesc").innerHTML="PIN码:";gE("AuthLoginName").disabled=true;gE("AuthLoginPass").disabled=true;}else{gi("AuthMode").value=gi("AuthMode").options[0].value;}
return false;}
this.authMode=gi("AuthMode").options[0].value;this.authModeLength=gi("AuthMode").options.length;msgBox.createMsgBox('需要安装控件才能登录,点击"确定"下载控件<br>','msgBox.installOcx()','msgBox.hiddenMsg(authMode,authModeLength)');gE("AuthMode").style.display="none";gE("hiddenText").style.display="";}
if(AdtUsb.GetValue("AutoLogin")==0){gi("IsSavePassword").disabled=false;}else{gi("IsSavePassword").disabled=true;}
sLoginNameDesc="用户名:";gE("AuthLoginName").style.display="";gE("CertName").style.display="none";gE("AuthLoginName").disabled=true;gE("AuthLoginName").className="disabled";gE("AuthLoginName").value="";gE("AuthLoginPass").disabled=false;gE("AuthLoginPass").className="";sLoginPassDesc="PIN码:";}
if(flg=="4"){sLoginNameDesc="手机号码:";gE("AuthLoginName").style.display="";gE("CertName").style.display="none";gE("AuthLoginPass").disabled=true;gE("AuthLoginPass").className="disabled";gE("AuthLoginName").disabled=false;gE("AuthLoginName").className="";gE("AuthLoginName").focus();}
if(flg=="5"){gE("AuthLoginName").disabled=true;gE("AuthLoginName").className="disabled";gE("AuthLoginPass").disabled=true;gE("AuthLoginPass").className="disabled";gE("IsSavePassword").disabled=true;gE("IsSavePassword").className=true;}
gE("LoginNameDesc").innerHTML=sLoginNameDesc;gE("LoginPassDesc").innerHTML=sLoginPassDesc;}
function configAuthMode(){gE("AuthLoginName").disabled=false;gE("AuthLoginPass").disabled=false;var authType=[];var lastAuthType=false;authType[authType.length]=new Array("UserID","用户名/密码","U",1);authType[authType.length]=new Array("CertID","数字证书","C",2);authType[authType.length]=new Array("KeyID","USBKEY","K",3);authType[authType.length]=new Array("AutoID","自动认证","A",5);var sAuthMode=gE("AuthMode");if(sAuthMode.options.length>0){for(var i=0;i<sAuthMode.options.length;i++){sAuthMode.options.remove(i);sAuthMode.options[i]=null;}}
for(var i=0;i<authType.length;i++){var oOption=document.createElement("OPTION");oOption.text=authType[i][1];oOption.value=authType[i][3];var optionValue="";if(authType[i][2]=="U")
optionValue=1;if(authType[i][2]=="C")
optionValue=2;if(authType[i][2]=="K")
optionValue=3;if(authType[i][2]=="A")
optionValue=5;if(optionValue==getLastAuthType()){oOption.selected=true;toSelectLoginMode(getLastAuthType());lastAuthType=true;}
sAuthMode.options.add(oOption);}
if(sAuthMode.options[0].value==2||AuthMode.options[0].value==3){if(lastAuthType!=true){toSelectLoginMode(sAuthMode.options[0].value);}}
AdtTpn.setLoginMessage("");if(AdtUsb.GetConnType()==2){document.title="欢迎您登录VPN系统";}else{document.title="欢迎您登录TPN系统";}
gE("Head").style.backgroundImage="url(images/head1.jpg)";if(AdtUsb.GetGateType()==2){gE("Head").style.backgroundImage="url(images/head1.jpg)";}else if(AdtUsb.GetGateType()==1){gE("Head").style.backgroundImage="url(images/headVPN.jpg)";}}
function getRootCertName(){return rootCertName;}
function toGetCertList(){var sCertName=gE("CertName");if(sCertName.options.length>0){for(var i=sCertName.options.length-1;i>=0;i--){sCertName.options[i]=null;}}
if(AdtUsb.IsUSB()==false){var oOption=document.createElement("OPTION");oOption.text="证书认证方式必须要安装控件";oOption.value="0";oOption.selected=true;sCertName.options.add(oOption);return false;}
var list=AdtUsb.GetCertList();for(var i=0;i<list.length-1;i++){var CertName=list[i];var oOption=document.createElement("OPTION");oOption.text=CertName;oOption.value=CertName;sCertName.options.add(oOption);if(oOption.value==getUserInputName()){oOption.selected=true;}}
if(list.length<=0){var oOption=document.createElement("OPTION");oOption.text="-- 无可用证书 --";oOption.value="0";oOption.selected=true;sCertName.options.add(oOption);}}
function md5(str){return hex_md5(str).toUpperCase();}
var hexcase=0;var b64pad="";var chrsz=8;function hex_md5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz));}
function b64_md5(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz));}
function str_md5(s){return binl2str(core_md5(str2binl(s),s.length*chrsz));}
function hex_hmac_md5(key,data){return binl2hex(core_hmac_md5(key,data));}
function b64_hmac_md5(key,data){return binl2b64(core_hmac_md5(key,data));}
function str_hmac_md5(key,data){return binl2str(core_hmac_md5(key,data));}
function md5_vm_test(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72";}
function core_md5(x,len){x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i<x.length;i+=16){var olda=a;var oldb=b;var oldc=c;var oldd=d;a=md5_ff(a,b,c,d,x[i+0],7,-680876936);d=md5_ff(d,a,b,c,x[i+1],12,-389564586);c=md5_ff(c,d,a,b,x[i+2],17,606105819);b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=md5_ff(a,b,c,d,x[i+4],7,-176418897);d=md5_ff(d,a,b,c,x[i+5],12,1200080426);c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=md5_ff(b,c,d,a,x[i+7],22,-45705983);a=md5_ff(a,b,c,d,x[i+8],7,1770035416);d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=md5_ff(c,d,a,b,x[i+10],17,-42063);b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=md5_ff(a,b,c,d,x[i+12],7,1804603682);d=md5_ff(d,a,b,c,x[i+13],12,-40341101);c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=md5_ff(b,c,d,a,x[i+15],22,1236535329);a=md5_gg(a,b,c,d,x[i+1],5,-165796510);d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=md5_gg(c,d,a,b,x[i+11],14,643717713);b=md5_gg(b,c,d,a,x[i+0],20,-373897302);a=md5_gg(a,b,c,d,x[i+5],5,-701558691);d=md5_gg(d,a,b,c,x[i+10],9,38016083);c=md5_gg(c,d,a,b,x[i+15],14,-660478335);b=md5_gg(b,c,d,a,x[i+4],20,-405537848);a=md5_gg(a,b,c,d,x[i+9],5,568446438);d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=md5_gg(c,d,a,b,x[i+3],14,-187363961);b=md5_gg(b,c,d,a,x[i+8],20,1163531501);a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=md5_gg(d,a,b,c,x[i+2],9,-51403784);c=md5_gg(c,d,a,b,x[i+7],14,1735328473);b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=md5_hh(a,b,c,d,x[i+5],4,-378558);d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=md5_hh(c,d,a,b,x[i+11],16,1839030562);b=md5_hh(b,c,d,a,x[i+14],23,-35309556);a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=md5_hh(d,a,b,c,x[i+4],11,1272893353);c=md5_hh(c,d,a,b,x[i+7],16,-155497632);b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=md5_hh(a,b,c,d,x[i+13],4,681279174);d=md5_hh(d,a,b,c,x[i+0],11,-358537222);c=md5_hh(c,d,a,b,x[i+3],16,-722521979);b=md5_hh(b,c,d,a,x[i+6],23,76029189);a=md5_hh(a,b,c,d,x[i+9],4,-640364487);d=md5_hh(d,a,b,c,x[i+12],11,-421815835);c=md5_hh(c,d,a,b,x[i+15],16,530742520);b=md5_hh(b,c,d,a,x[i+2],23,-995338651);a=md5_ii(a,b,c,d,x[i+0],6,-198630844);d=md5_ii(d,a,b,c,x[i+7],10,1126891415);c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=md5_ii(b,c,d,a,x[i+5],21,-57434055);a=md5_ii(a,b,c,d,x[i+12],6,1700485571);d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=md5_ii(c,d,a,b,x[i+10],15,-1051523);b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=md5_ii(a,b,c,d,x[i+8],6,1873313359);d=md5_ii(d,a,b,c,x[i+15],10,-30611744);c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=md5_ii(b,c,d,a,x[i+13],21,1309151649);a=md5_ii(a,b,c,d,x[i+4],6,-145523070);d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=md5_ii(c,d,a,b,x[i+2],15,718787259);b=md5_ii(b,c,d,a,x[i+9],21,-343485551);a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);}
return Array(a,b,c,d);}
function md5_cmn(q,a,b,x,s,t){return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b);}
function md5_ff(a,b,c,d,x,s,t){return md5_cmn((b&c)|((~b)&d),a,b,x,s,t);}
function md5_gg(a,b,c,d,x,s,t){return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t);}
function md5_hh(a,b,c,d,x,s,t){return md5_cmn(b^c^d,a,b,x,s,t);}
function md5_ii(a,b,c,d,x,s,t){return md5_cmn(c^(b|(~d)),a,b,x,s,t);}
function core_hmac_md5(key,data){var bkey=str2binl(key);if(bkey.length>16)
bkey=core_md5(bkey,key.length*chrsz);var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++){ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;}
var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128);}
function safe_add(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);}
function bit_rol(num,cnt){return(num<<cnt)|(num>>>(32-cnt));}
function str2binl(str){var bin=Array();var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz)
bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);return bin;}
function binl2str(bin){var str="";var mask=(1<<chrsz)-1;for(var i=0;i<bin.length*32;i+=chrsz)
str+=String.fromCharCode((bin[i>>5]>>>(i%32))&mask);return str;}
function binl2hex(binarray){var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++){str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)
+hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);}
return str;}
function binl2b64(binarray){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i<binarray.length*4;i+=3){var triplet=(((binarray[i>>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(var j=0;j<4;j++){if(i*8+j*6>binarray.length*32)
str+=b64pad;else
str+=tab.charAt((triplet>>6*(3-j))&0x3F);}}
return str;}
function setThClass(){gE("MENU_RES_LIST").className='Th1';gE("MENU_PWD_LIST").className='Th1';gE("MENU_ABULIST").className='Th1';gE("IMG1").className='Img1';gE("IMG3").className='Img1';gE("IMG4").className='Img1';}
function setMenuToOnMouseOver(obj,img){setThClass();gE(img).className="Img0"
obj.className='Th0';showMainDiv(obj.id);}
function showMainDiv(id){if(id=="MENU_ABULIST"){gE("Iframe").src="about.html";}
if(id=="MENU_PWD_LIST"){gE("Iframe").src="cpwd.html";}
if(id=="MENU_RES_LIST"){gE("Iframe").src="res.html";}}
var g_code=0;function myescape(str){var sRet='';var i;for(i=0;i<str.length;++i){g_code=0;var charAt=str.charAt(i);if(charAt=="'"){g_code=39;}else{execScript("g_code = Asc('"+charAt+"')","vbscript");}
if(g_code<0){g_code+=0x10000;sRet+="%"+(g_code>>8).toString(16)+"%"
+(g_code&0xff).toString(16);}else{sRet+="%"+g_code.toString(16);}}
return sRet;}
function toViewLogoutPwdPasswordDiv(){var obj=gE("LogoutPwdDIV");var left=(document.body.clientWidth-250)/2;var top=(document.body.clientHeight-100)/2;obj.style.left=left-250;obj.style.top=(100+(gE("Master").offsetHeight-obj.offsetHeight))/2/2+250;obj.style.visibility="visible";gE("LogoutPwdDIVBG").style.display="";}
function toHiddenLogoutPwdPasswordDiv(){var obj=gE("LogoutPwdDIV");obj.style.visibility="hidden";gE("LogoutPwdDIVBG").style.display="none";}
function toLogoutCancel(){gE("LoginEnterPassword").value="";toHiddenLogoutPwdPasswordDiv();}
function toCheckedLogoutPwds(){var pwd=gE("LoginEnterPassword").value;if(pwd==""){setLogoutPwdMessageInfo("请输入登录密码或PIN码！");return false;}
if(pwd!=null&&pwd!=""){if(getLastAuthType()=="3"){var s=AdtUsb.checkedPin(pwd);if(s=="成功"){this.logout();}else{alert("不能退出 "+s);}}else{var action=server_url+"/goform/CGICheckAuthInfo?1=1";action+="&user_name="+getUserName();action+="&auth_code="+getAuthCode();action+="&pwd="+myescape(pwd);Ajax.request(action,function(str){if(str!="ERROR001"){try{eval(str);}catch(e){}
if(_IfSuccess==true){AdtTpn.logout();}else{alert("密码错误，不能退出");}}});}}}
function setLogoutPwdMessageInfo(val){gE("LogoutPwdMessageDiv").innerHTML=val;if(Trim(val)!=''){setTimeout("setLogoutPwdMessageInfo('')",3000);}}
function toVeiwDynPassDiv(){gE("LoginDiv").style.display="none";gE("DivDyncPwdsDIV").style.display="";sf("DyncPwds");}
function toHiddenDynPwd(){gE("DivDyncPwdsDIV").style.display="none";sv("DyncPwds","");gE("DyncErrorinfos").innerHTML="";}
function toCloseDynPwd(){if(AdtUsb.IsUSB()==true){AdtUsb.BaseUSB.V2CancelDyncPwd();}
gE("DivDyncPwdsDIV").style.display="none";gE("LoginDiv").style.display="";sv("DyncPwds","");gE("DyncErrorinfos").innerHTML="";}
function toLoginDynPwd(){var dynpwd=gv("DyncPwds");if(dynpwd!=""){AdtTpn.toCheckDynamicPwd(dynpwd);}else{setDyncErrorInfo("请输入动态密码！");sf("DyncPwds");return false;}}
function toRsendPwd(){if(AdtUsb.IsUSB()==false||_AccessCtl==false){var action=server_url+"/goform/CGIReSendDynamicPwd?1=1";action+="&user_name="+getUserName();action+="&auth_code="+getAuthCode();try{$.getScript(action,function(){setDyncErrorInfo("重发成功");});}catch(e){setDyncErrorInfo("发送失败,请稍后再试");}}else{var s=AdtUsb.BaseUSB.V2ReSendPwd();if(s){setDyncErrorInfo("重发成功");}else{setDyncErrorInfo(getStatusDesc());}
sf("DyncPwds");return false;}}
function checkedDynPwdSuccess(){if(resultValue==0){AuthResult("0");setDyncErrorInfo("验证成功");AdtTpn.checkedCgiResult();toHiddenDynPwd();}else if(resultValue==2){alert(_FailReason+" 请重新登录");toCloseDynPwd();}else{setDyncErrorInfo(_FailReason);}}
function setDyncErrorInfo(val){if(gE("DivDyncPwdsDIV").style.display=="none")
return false;gE("DyncErrorinfos").innerHTML=val;if((val)!=''){setTimeout("setDyncErrorInfo('')",3000);sf("DyncPwds");}}
function getLocalOcxVer(){var str="";if(isUseOcx()==false){if(AdtUsb.GetConnType()==2){str="未启用安全控件<br><br>";}else{str="<br>未启用安全控件<br><br>";}}else{try{if(AdtUsb.GetConnType()==2){str="USB 版本: "+AdtUsb.Get_UsbVer()+" <BR>VPN 版本: "+AdtUsb.Get_VpnVer();}else{str="USB 版本: "+AdtUsb.Get_UsbVer()+" <BR>VPN 版本: "+AdtUsb.Get_VpnVer()+"  <BR>TPN 版本: "+AdtUsb.Get_TpnVer()+"";}}catch(e){if(AdtUsb.GetConnType()==2){str="未启用安全控件<br><br>";}else{str="<br>未启用安全控件<br><br>";}}}
return str;}
function getServerOcxVer(){if(AdtUsb.GetConnType()==2){return"USB 版本: "+usb_verstion_info+"  <BR>VPN 版本: "+vpn_verstion_info;}
if(AdtUsb.IsUSB()==true){if(AdtUsb.GetConnType()==2){return"USB 版本: "+usb_verstion_info+"  <BR>VPN 版本: "+vpn_verstion_info;}
if(AdtUsb.GetConnType()==1){return"USB 版本: "+usb_verstion_info+"  <BR>VPN 版本: "+vpn_verstion_info+"  <BR>TPN 版本: "+tpn_verstion_info+"";}else{return"USB 版本: "+usb_verstion_info+"  <BR>VPN 版本: "+vpn_verstion_info+"  <BR>TPN 版本: "+tpn_verstion_info+"";}}else{return"USB 版本: "+usb_verstion_info+"  <BR>VPN 版本: "+vpn_verstion_info+"  <BR>TPN 版本: "+tpn_verstion_info+"";}}
function setDivTitleAltInfos(infos){gE("LoginDIV").style.display="none";gi("DivTitleAltInfos").innerHTML=infos;gi("DivTitleAlt").style.display="";}
function hiddenDivTitleAltInfos(){gi("DivTitleAltInfos").innerHTML="";gi("DivTitleAlt").style.display="none";}
function toChangeConfig(obj,key){var al=document.getElementById("IsAutoLogin").value;if(al==2||al==1){gi("IsSavePassword").checked=true;gi("IsSavePassword").disabled=true;}else{gi("IsSavePassword").disabled=false;}
if(AdtUsb.IsUSB()==true){}}
function toSelectSavePassInput(){if(gi("AuthMode").value==2){}else{if(AdtUsb.GetValue("AutoLogin")==0){gi("IsSavePassword").disabled=false;}else{gi("IsSavePassword").disabled=true;}}}
function toChangeConfigEnableTcptSel(obj){if(AdtUsb.IsUSB()==true){if(obj.checked==true){AdtUsb.SetValueFromUsb("EnableTcptSel",obj.value);}}}
function initConfigEnableds(){if(AdtUsb.IsUSB()==true){var s=AdtUsb.GetValue("EnableTcptSel");var enableTcptSel=gE("IsEnableTcptSel");if(s*1==2)
enableTcptSel.options.item(0).selected=true;if(s*1==1)
enableTcptSel.options.item(1).selected=true;if(s*1==0)
enableTcptSel.options.item(2).selected=true;var s1=AdtUsb.GetValue("AutoLogin");var IsAutoLoginSel=gE("IsAutoLogin")
if(s1*1==2)
IsAutoLoginSel.options.item(0).selected=true;if(s1*1==1)
IsAutoLoginSel.options.item(1).selected=true;if(s1*1==0)
IsAutoLoginSel.options.item(2).selected=true;if(AdtUsb.GetValue("SavePassword")*1==1){gi("IsSavePassword").checked=true;gi("AuthLoginName").value=AdtUsb.GetValue("UserName");var psf=AdtUsb.GetValue("PassWord")
gi("AuthLoginPass").value=Base64.decode(psf);}else{gi("IsSavePassword").checked=false;}
if(AdtUsb.GetValue("SelectFastIp")*1==1){gi("IsSelectFastIp").checked=true;}else{gi("IsSelectFastIp").checked=false;}
if(AdtUsb.GetValue("KeepOnline")*1==1){gi("IsKeepOnline").checked=true;}else{gi("IsKeepOnline").checked=false;}
if(AdtUsb.GetValue("AutoLogin")*1==1){gi("IsAutoLogin").checked=true;}else{gi("IsAutoLogin").checked=false;}
toSelectSavePassInput();}}
function getLoginINputSelectFastIp(){var s=0;if(gi("IsSelectFastIp").checked==true){s=1;}
return s;}
function toGetLoginInputIsSavePassword(){var s=0;if(gi("IsSavePassword").checked==true){s=1;}
return s;}
var isLogoutSuccess=false;function toCheckedLoginSuccessStatus(){if(isUseOcx()==false){return false;}
if(isLogoutSuccess==true){return false;}
var s=AdtUsb.Status();if(s!=50){setDivTitleAltInfos("TPN断线 3秒后返回登录页！");setTimeout("AdtTpn.BreakHome()",3000);}else{setTimeout("toCheckedLoginSuccessStatus()",1000);}}
var isPageMonitFlg=false;function toSetStopMonitor(){isPageMonitFlg=true;}
function toSetStartMonitor(){isPageMonitFlg=false;toPageMonitor();}
function toGetServerVersion(){var action=server_url+"/version";$.get(action,function(str){try{eval(str);gE("ServerOcxVerSpan1").innerHTML="USB 版本: "+usb_verstion+"  <BR>VPN 版本: "+vpn_verstion+"  <BR>TPN 版本: "+tpn_verstion+"";}catch(e){}});}
function toPageMonitor(){var ft;if(isUseOcx()==false)
return false;if(isPageMonitFlg==false){var s=0;try{s=AdtUsb.Status();}catch(e){}
if(s==1){AdtTpn.checkedUsbResult();}else if(s==50){AdtTpn.viewMain();clearTimeout(ft);}else{ft=setTimeout("toPageMonitor();",1000);}}}
