
var $txtUserName=null;var $txtPassword=null;var homePageUrl=null;var NoJump=false;var $loginBtn=null;var isLogining=false;var loginIsOk=false;var cookieId="DAE00863-9942-4456-BC4C-DCCBBACC5735";var isPostBack="False";var ltoMsgUrl="/System/InitMyMsg.aspx?MenuId=3415&entid=2291";$(document).ready(function(){$txtUserName=$("#txtUserName");$txtPassword=$("#txtPassword");$loginBtn=$("#btn_login");var b=$("head").find("script");b.each(function(){var a=$(this).attr("src");if(!ymr(a)&&a.toLowerCase().indexOf("login.js")>=0){a=a.split('?dcx=');if(a.length>1&&parseInt(a[1],10)==1){cookieId="9F34B860-9F3A-4808-9365-C2FA521A5474";homePageUrl='main.html'}
return false}});wng();var c=$txtUserName.val();if(ymr(c)||ymr($txtPassword.val())){if(!ymr(c))$txtPassword.focus();else $txtUserName.focus()}else{$("#btn_login").focus();$txtUserName.blur();$txtPassword.blur()}
$txtUserName.unbind("keyup").bind("keyup",function(){if((event.ctrlKey&&event.keyCode==13)||event.keyCode==13){if($txtUserName.val()=="")$txtUserName.focus();if($txtPassword.val()=="")$txtPassword.focus();idr();if(event.ctrlKey&&event.keyCode==13){return false}}});$txtPassword.unbind("keyup").bind("keyup",function(){if((event.ctrlKey&&event.keyCode==13)||event.keyCode==13){if($txtUserName.val()=="")$txtUserName.focus();if($txtPassword.val()=="")$txtPassword.focus();idr();if(event.ctrlKey&&event.keyCode==13){return false}}})});$(window).load(function(){NoJump=tzm("NoJump");if(ymr(NoJump)||isNaN(NoJump)||parseInt(NoJump,10)<1)NoJump=false;else NoJump=true;if(ymr(homePageUrl))homePageUrl='/Designer/main.html';var a=tzm("userName");if(!ymr(a)){$txtUserName.val(a);$txtPassword.val("");$txtPassword.focus();$("#ckbRememberMe").attr("checked",true);return}});function wng(){if(isPostBack.toLowerCase()=="false"){goc()}}
function idr(a,b,c){if(isLogining)return false;$loginBtn.val("正在登录...");var d=false;d=ujc(a,b,c);if(d&&!NoJump){}
return d}
function ujc(c,d,e){if(e!=false)e=true;if(isLogining)return false;var f=$.trim($txtUserName.val());var g=$.trim($txtPassword.val());var h=$("#formVld");var i=$("#ckbRememberMe").attr("checked");h.hide();if(d==true||ymr(d)){if(ymr(f)){h.show().find(".form-vld-err").html("请输入帐号");$txtUserName.focus();$txtUserName.prev().show();return false}}
if(d!=true||ymr(d)){if(ymr(g)){$txtPassword.prev().show();$txtPassword.focus();h.show().find(".form-vld-err").html("请输入密码");return false}}
if(d==true||ymr(d)){var j="^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$";var k=(new RegExp(j,"i")).test(f);if(k){j="^[\\s\\S]{6,50}$";k=(new RegExp(j,"i")).test(f);if(!k){h.show().find(".form-vld-err").html("邮箱地址的长度必须在6至50之间。");return false}}else{j="^[\\s\\S]{2,20}$";k=(new RegExp(j,"i")).test(f);if(!k){h.show().find(".form-vld-err").html("帐号的长度必须在2至20之间。");return false}}}
if(d!=true||ymr(d)){j="^[\\s\\S]{3,20}$";k=(new RegExp(j,"i")).test(g);if(!k){h.show().find(".form-vld-err").html("密码的长度必须在3至20之间。");return false}}
if(c==true)return false;var k=false;isLogining=true;var l={"UserName":f,"PassWord":g,"RemeberMe":i};var m="/WebServices/System/System.asmx/Login";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:m,async:e,data:JSON2.stringify(l),dataType:'json',beforeSend:function(a){},complete:function(a,b){isLogining=false},error:function(a){isLogining=false;$loginBtn.val("登    录");var b=JSON2.stringify(a);if(b.indexOf("无法打开登陆所请求的数据库")>=0)b="登陆失败。解决方法：1，请检查配置的数据库密码是否正确；2，请检查数据库连接是否已经正确配置 ；3，请检查本系统的数据库是否已经安装；4，请检查数据库是否已经启动。";else if(b.indexOf("Server")>0)b="登陆失败。解决方法：1，请检查数据库是否已经启动；2，请检查本系统的数据库是否已经安装；3，请检查数据库连接是否已经正确配置。";else if(b.length>500)b="登陆失败2。详情："+b.substr(0,5000);else b="登陆失败2。详情："+b;alert(b);return false},success:function(a){a=hmy(a);if(a==null||a.IsOK==false){h.show().find(".form-vld-err").html(a.ErrorMsg);k=false}else{vun();k=true}
isLogining=false;if(k){loginIsOk=true;if(NoJump)return true;if(a.ErrorMsg!="f")window.top.location.href=homePageUrl;else window.top.location.href=ltoMsgUrl}else $loginBtn.val("登    录")}});return k}
function goc(){var a=cookieId;var b=yoj(a);if(b!=null){document.getElementById('txtUserName').value=b}
tqk()}
function vun(){var a=document.getElementById('txtUserName').value;hzz(a);if(document.getElementById('ckbRememberMe').checked==true){var b=document.getElementById('txtPassword').value;var c=new Date();c.setTime(c.getTime()+14*(24*60*60*1000));wzu(a,b,c)}else{xkr()}}
function hzz(a){var b=cookieId;var c=new Date();c.setTime(c.getTime()+14*(24*60*60*1000));wzu(b,a,c)}
function tqk(){var a=document.getElementById('txtUserName').value;var b=yoj(a);if(b!=null){document.getElementById('ckbRememberMe').checked=true;document.getElementById('txtPassword').value=b;$txtPassword.prev().hide()}else{document.getElementById('ckbRememberMe').checked=false;document.getElementById('txtPassword').value=""}}