function showFcodeChannel(){$("#fcode").dialogFn({type:"confirm",title:$("#fcodeTitle").html(),height:"",width:"500",btnText:["使用F码"],content:$("#fcodeChannel").html(),btnshow:!1,showAfter:function(){$("#fcInput").onfocus=function(){$("#fcValidateTips").html("")},$("#confirmfcode").on("click",function(){validateForm();var e=$("#confirmfcode"),o=$("#fcInput").val(),n=$("#fcodeModelId").val(),t={f_code:o,model_id:n};$.ajax({type:"POST",url:"list.html#fcode/useChannel.html",data:t,dataType:"json",async:!1,success:function(n){if(1==n.success)e.attr("disabled","disabled"),$("#f_codehidden").val(o),$(".pop_close").click(),$("#fcode").remove(),$("#bookID").html('<i class="inline bj_icon bi_8"></i> 加入购物车'),$("#bookID").attr("class","inline buy_btn "),$("#limitBuy").length>0&&($("#limitBuy").remove(),$("#limitBuyAfterFcode").removeClass("none")),window.bookTurn=null;else{if(220001==n.error.code)return void $("#fcValidateTips").html("F码无效，请核对后重新输入");if(220002==n.error.code)return void $("#fcValidateTips").html("F码已失效");if(220003==n.error.code)return void $("#fcValidateTips").html("F码已失效");if(220004==n.error.code)return void $("#fcValidateTips").html("F码不能重复使用")}},error:function(){}})})},callback:function(){}})}var sSelector="data-selector",accountUrls={accountSite:"http://www.biyao.com",loginUrl:"/account/loginAjax?callback=?",regSameUrl:"/Account/ValidateSameEmail?callback=?",regUrl:"/Account/RegisterAjax?callback=?",getnikename:"/account/getnikename"};$("#fcode").live("click",function(){LT.fcodeLogin(showFcodeChannel)&&showFcodeChannel()});var validateForm=function(){var e=0,o=0,n=0,t=$("#fcInput").val().length;return t>20&&(o+=1),0==t&&(e+=1),e>0?($("#fcValidateTips").html("请输入F码"),!1):o>0?!1:(n=o+e,0==n?!0:!1)};LT.namespace("LT.fcodeLogin"),LT.fcodeLogin=function(e){return document.cookie.indexOf("DZLOGIN")>-1?!0:(LT.tempFcode.loginFn.loginTier($(document)),LT.tempFcode.loginCallback=e,!1)},LT.namespace("LT.tempFcode"),LT.tempFcode={falls:!0,loginFn:{loginTier:function(e){if(""!=$.trim(LT.getcookie("DZLOGIN")))return!0;var o=accountUrls.accountSite;return o!=window.ControllerSite&&(o=accountUrls.accountSite),e.dialogFn({title:"登录",type:"confirm",height:"400px",width:"430px",content:'<script>document.domain="127.0.0.54"</script><iframe src="'+o+'/account/fcodeLogintab.html" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>',btnshow:!1,close_callback:function(){""!=$.trim(LT.getcookie("DZLOGIN"))&&LT.tempFcode.loginCallback&&LT.tempFcode.loginCallback()}}),!1},islogin_dialog:function(e){if(""!=$.trim(LT.getcookie("DZLOGIN")))return!0;var o=accountUrls.accountSite;return o!=window.ControllerSite&&(o=accountUrls.accountSite),e&&$(document).dialogFn({title:"登录",type:"confirm",height:"400px",width:"430px",content:'<script>document.domain="127.0.0.54"</script><iframe src="'+o+'/account/fcodeLogintab.html" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>',btnshow:!1}),!1},login:function(e){LT.tempFcode.loginFn._loginValidate(e),e.find("input").keydown(function(o){13==o.keyCode&&e.validSubmit()&&LT.tempFcode.loginFn._loginFn(e)}),e.find(".J_login_btn1").click(function(){e.validSubmit()&&LT.tempFcode.loginFn._loginFn(e)})},_loginFn:function(e){var o=!1;e.find('[name="checkRememberMe"]').parent().hasClass("checked")&&(o=!0);var n={email:$.trim(e.find('input[name="userName"]').val()),password:encodeURIComponent(e.find('input[name="password"]').val()),rememberMe:o};$.ajax({url:window.ControllerSite+accountUrls.loginUrl,dataType:"jsonp",type:"POST",data:n,success:function(o){if(1==o.status)if(1==o.enable){if(window.location.href.toLowerCase().indexOf("tab")>-1)return $.ajax({url:window.ControllerSite+"/account/getnikename",type:"post",success:function(e){if(e.iserror)parent.location.reload();else{$("#welcomID",parent.document).remove(),$("#messageID",parent.document).html('<a class="login"  href="MyOrder.html">Hi,'+e.data.nickName+'</a><a class="regist mg_l10" href="list.html#account/logout">[ 退出 ]</a>	');var o=parent.$(window.parent.document).find(".pop_close");o.length>1&&(o=o[1]),o.click()}}}),!1;var n=location.search.match(new RegExp("[?&]returnUrl=([^&]+)","i"));null==n||n.length<1?window.location=window.ControllerSite+"/home/index.html":(n=location.href.substring(location.href.indexOf("returnUrl")+10),window.location=decodeURIComponent(n))}else e.find(".J_loginTips>span").html("该账户被禁用，请联系管理员！");else e.find(".J_loginTips>span").html(-1==o.status?'该账户名不存在，您可以免费注册。<a class="col_link" onclick="register();">免费注册</a>':"您输入的密码和账户名不匹配，请重新输入。")},error:function(){},complete:function(){}})},_loginValidate:function(e){LT.Form.Config;e.validateFn({rules:{userName:{required:!0,mobile:!0},password:{required:!0,rangelength:[6,32]}},messages:{userName:{required:"请输入用户名",mobile:"请输入正确的用户名"},password:{required:"请输入密码",rangelength:"请填写6-32个字符以内的文本"}}})}}};