$=Ext.get;Ext.namespace("RP","RP.SPv2","RP.SPv2.Common");RP.SPv2.Common.CheckHost=function(a){if(a==undefined){a=$("txtHost").getValue()}if(!VType.alphanum(a)||a.length<3){$("txtHost").stickTip("\u60a8\u9009\u62e9\u7684Sending\u5730\u5740\u4e0d\u7b26\u5408\u89c4\u8303\uff0c<br/>\u6b63\u786e\u7684\u683c\u5f0f\u5fc5\u987b3\u4f4d\u4ee5\u4e0a\u6570\u5b57\u548c\u5b57\u6bcd\u7ec4\u6210\u3002","red");$("txtHost").focus();return}$("btnCheckHost").showTip("Sending\u5730\u5740\u68c0\u67e5\u4e2d\uff0c\u8bf7\u7a0d\u5019\u3002","green");Ext.Ajax.request({url:"/op.ashx",success:function(b){if(b.responseText=="taken"){$("txtHost").stickTip("\u60a8\u9009\u62e9\u7684Sending\u5730\u5740\u5df2\u7ecf\u88ab\u6ce8\u518c\u4e86\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002","yellow");$("txtHost").focus()}else{$("txtHost").showTip("\u7b49\u5f85\u7f51\u9875\u8f6c\u5165\u6ce8\u518c\u754c\u9762\uff0c\u8bf7\u7a0d\u5019\u3002","green");$("txtHost").focus();top.location.href="/reg.html?host="+a}},failure:function(b){$("txtHost").stickTip("\u60a8\u9009\u62e9\u7684Sending\u5730\u5740\u683c\u5f0f\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002","red");$("txtHost").focus()},params:{op:"checkhost",host:a}})};RP.SPv2.Common.Login=function(a,b){if(a==undefined||b==undefined){a=$("txtLoginName").getValue();b=$("txtPWD").getValue()}if(a==""||a.length<3){$("txtLoginName").showTip("\u60a8\u7684\u767b\u9646\u540d\u9519\u8bef","red");$("txtLoginName").focus();return}if(b==""||b.length<3){$("txtPWD").showTip("\u60a8\u7684\u5bc6\u7801\u683c\u5f0f\u9519\u8bef","red");$("txtPWD").focus();return}$("btnLogin").showTip("\u767b\u5f55\u4e2d\uff0c\u8bf7\u7a0d\u540e","green");$("lblLoginResp").update("<img src='/images/loading-icon.gif' />\u767b\u5f55\u4e2d");Ext.Ajax.request({url:"/op.ashx",success:function(c){$("lblLoginResp").update("\u8f6c\u5165\u4e2d\uff0c\u8bf7\u7a0d\u540e");top.location.href="/settings.html"},failure:function(c){$("lblLoginResp").update("");$("txtLoginName").showTip(c.responseText,"yellow")},params:{op:"login",host:a,pwd:b}})};Ext.namespace("RP.SPv2.Index");RP.SPv2.Index.init=function(){$("n-home").addClass("on");$("txtPWD").on("keypress",function(a){if(a.keyCode==13){RP.SPv2.Common.Login()}},this);$("txtLoginName").on("keypress",function(a){if(a.keyCode==13){$("txtPWD").focus()}},this);$("txtHost").on("keypress",function(a){if(a.keyCode==13){RP.SPv2.Common.CheckHost();$("btnCheckHost").focus()}},this)};Ext.namespace("RP.SPv2.Reg");RP.SPv2.Reg.init=function(){$("n-reg").addClass("on");RP.Util.CreateDropDownList("ddlTitle","txtTitle",[{value:"\u5148\u751f",text:"\u5148\u751f"},{value:"\u5973\u58eb",text:"\u5973\u58eb"},{value:"\u5c0f\u59d0",text:"\u5c0f\u59d0"}]);Ext.getBody().select("input").on("keypress",function(c){if($(c.target.id).hasClass("error")){$(c.target.id).removeClass("error")}});$("btnReg").on("click",function(){RP.SPv2.Reg.Submit()});if(top.location.search.indexOf("host")>=0){try{var a=Ext.urlDecode(top.location.search.substring(1)).host;$("txtHost").dom.value=a}catch(b){}}};RP.SPv2.Reg.SubmitID=-1;RP.SPv2.Reg.Submit=function(){if(RP.SPv2.Reg.SubmitID!=-1){return}if(!$("chkAgree").dom.checked){$("chkAgree").showTip("\u8bf7\u5148\u540c\u610fSending\u7684\u4f7f\u7528\u534f\u8bae\u540e\u518d\u7ee7\u7eed\u6ce8\u518c\u3002","red");return}var b={name:$("txtName").getValue(),title:$("txtTitle").getValue(),phone:$("txtPhone").getValue(),email:$("txtEmail").getValue(),host:$("txtHost").getValue(),pwd:$("txtPWD").getValue(),entName:$("txtEntName").getValue(),sign:$("txtSign").getValue(),amount:$("txtAmount").getValue(),reqInterface:$("chkInterface").dom.checked};Ext.getBody().select("input").removeClass("error");var a=false;var c=null;if(!VType.chsalpha(b.sign)||b.sign.length<2||b.sign.length>10){$("txtSign").stickTip("\u60a8\u9009\u62e9\u7684\u77ed\u4fe1\u7b7e\u540d\u683c\u5f0f\u9519\u8bef\uff0c<br/>\u6b63\u786e\u7684\u683c\u5f0f\u5fc5\u987b2\u4f4d\u81f310\u4f4d\u7684\u4e2d\u6587\u6216\u5b57\u6bcd\u7ec4\u6210\u3002","red");c=$("txtSign").addClass("error");a=true}if(b.entName.length<1){$("txtEntName").stickTip("\u8bf7\u8f93\u5165\u60a8\u7684\u4f01\u4e1a/\u5355\u4f4d\u540d\u79f0\u3002","red");c=$("txtEntName").addClass("error");a=true}if(b.pwd.length<4){$("txtPWD").stickTip("\u4e3a\u4e86\u4fdd\u8bc1\u60a8\u8d26\u53f7\u7684\u5b89\u5168\uff0c<br/>\u60a8\u7684\u5bc6\u7801\u81f3\u5c11\u9700\u89814\u4f4d\u3002","red");c=$("txtPWD").addClass("error");a=true}if(!VType.alphanum(b.host)||b.host.length<3){$("txtHost").stickTip("\u60a8\u9009\u62e9\u7684Sending\u5730\u5740\u4e0d\u7b26\u5408\u89c4\u8303\uff0c<br/>\u6b63\u786e\u7684\u683c\u5f0f\u5fc5\u987b3\u4f4d\u4ee5\u4e0a\u6570\u5b57\u548c\u5b57\u6bcd\u7ec4\u6210\u3002","red");c=$("txtHost").addClass("error");a=true}if(!VType.email(b.email)){$("txtEmail").stickTip("\u60a8\u8f93\u5165\u90ae\u4ef6\u5730\u5740\u9519\u8bef\uff0c<br/>\u6b63\u786e\u7684\u683c\u5f0f\u4f8b\u5982: <b>yourname@inany.net</b>","red");c=$("txtEmail").addClass("error");a=true}if(!VType.cellphone(b.phone)){$("txtPhone").stickTip("\u60a8\u8f93\u5165\u7684\u624b\u673a\u53f7\u7801\u683c\u5f0f\u9519\u8bef\uff0c<br/>\u6211\u4eec\u4ec5\u63a5\u53d7\u79fb\u52a8\u8054\u901a\u624b\u673a\u53f7\u4ee5\u53ca\u5c0f\u7075\u901a\u53f7\u7801\u3002<br/>\u4f8b\u5982: <b>13880630000</b>","red");c=$("txtPhone").addClass("error");a=true}if(b.name.length<=1){$("txtName").stickTip("\u8bf7\u8f93\u5165\u60a8\u7684\u79f0\u547c\u4ee5\u65b9\u4fbf\u6211\u4eec\u8054\u7cfb\u60a8\uff0c\u79f0\u547c\u81f3\u5c11\u6709\u4e24\u4e2a\u5b57\u3002","red");c=$("txtName").addClass("error");a=true}if(a){c.focus();return}$("lblSendRequest").show(true);$("btnReg").hide(true);RP.SPv2.Reg.SubmitID=Ext.Ajax.request({url:"/op.ashx",callback:function(){RP.SPv2.Reg.SubmitID=-1;$("lblSendRequest").hide(true);$("btnReg").show(true)},success:function(d){$("panForm").mask("");$("lblRspHost").update("http://"+b.host+".inany.net/");$("lblRspAdmin").update(b.host);$("lblRspPWD").update(b.pwd);$("panRegResponse").center(Ext.getBody()).show(true)},failure:function(d){switch(d.responseText){case"\u6b64\u57df\u540d\u5df2\u7ecf\u5b58\u5728":$("txtHost").stickTip("\u60a8\u9009\u62e9\u7684Sending\u5730\u5740\u5df2\u7ecf\u88ab\u6ce8\u518c\u4e86\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002","yellow");$("txtHost").focus().addClass("error");return;break;case"\u7528\u6237\u7684\u6ce8\u518c\u90ae\u7bb1\u540d\u5df2\u7ecf\u5b58\u5728":$("txtEmail").stickTip("\u60a8\u8f93\u5165\u90ae\u4ef6\u5730\u5740\u5df2\u7ecf\u5b58\u5728\u4e8e\u6211\u4eec\u7cfb\u7edf\u4e2d\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9","yellow");$("txtEmail").focus().addClass("error");return;break}$("btnReg").showTip("\u6ce8\u518c\u4e2d\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u4e0e\u7ba1\u7406\u5458\u8054\u7cfb\u3002","red")},params:{op:"reg",data:Ext.encode(b)}})};Ext.namespace("RP.SPv2.Settings");RP.SPv2.Settings.txtContact=null;RP.SPv2.Settings.txtTitle=null;RP.SPv2.Settings.txtPhone=null;RP.SPv2.Settings.txtEmail=null;RP.SPv2.Settings.txtEntName=null;RP.SPv2.Settings.init=function(){$("n-my-sending").addClass("on");Ext.select(".tab-buttons-panel").on("click",function(b,a){Ext.fly(a).radioClass("tab-show");Ext.get("content"+a.id.slice(-1)).radioClass("tab-content-show")},null,{delegate:"li"});if(!Ext.isIE){$("lblNotIE").show(false)}RP.SPv2.Settings.txtContact=new redpill.ToolBox.MSTextbox("sptxtContact","/op.ashx",ExtraInfo.Name,"ChangeContact",/^[a-zA-Z\u4e00-\u9fa5]{2,}$/,"\u60a8\u8f93\u5165\u7684\u8054\u7cfb\u4eba\u683c\u5f0f\u9519\u8bef");RP.SPv2.Settings.txtTitle=new redpill.ToolBox.MSTextbox("sptxtTitle","/op.ashx",ExtraInfo.Title,"ChangeTitle",/^[a-zA-Z\u4e00-\u9fa5]{1,}$/,"\u8bf7\u8f93\u5165\u60a8\u7684\u79f0\u547c");RP.SPv2.Settings.txtPhone=new redpill.ToolBox.MSTextbox("sptxtPhone","/op.ashx",ExtraInfo.Phone,"ChangePhone",VType.cellphoneReg,"\u60a8\u8f93\u5165\u7684\u8054\u7cfb\u4eba\u683c\u5f0f\u9519\u8bef");RP.SPv2.Settings.txtEmail=new redpill.ToolBox.MSTextbox("sptxtEmail","/op.ashx",ExtraInfo.Email,"ChangeEmail",VType.emailReg,"\u60a8\u8f93\u5165\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u683c\u5f0f\u9519\u8bef");RP.SPv2.Settings.txtEntName=new redpill.ToolBox.MSTextbox("sptxtEntName","/op.ashx",HostInfo.ApplicationName,"ChangeEntName",/^[a-zA-Z\u4e00-\u9fa5]{2,}$/,"\u4f01\u4e1a\u540d\u5fc5\u987b\u662f\u5927\u4e8e\u4e24\u4f4d\u7684\u4e2d\u6587\u6216\u82f1\u6587\u7ec4\u6210");$("lblAdminLoginName").update(ExtraInfo.Host.substr(0,ExtraInfo.Host.indexOf("."))+"admin");$("lblVersion").update(HostInfo.Version);$("lblSign").update(HostInfo.AppSign);$("lblHost").update("http://"+ExtraInfo.Host+'/ <a href="http://'+ExtraInfo.Host+'/" target="_blank">\u8bbf\u95ee</a>');$("lblLeftMoney").update(HostInfo.LeftMoney)};RP.SPv2.Settings.Charge=function(a){$("txtAmount").removeClass("inputlr");if(a==undefined){a=$("txtAmount").getValue(true)}if(isNaN(a)||a<=1){$("txtAmount").stickTip("\u6700\u5c0f\u5145\u503c\u91d1\u989d\u4e3a1\u5143\u4eba\u6c11\u5e01","yellow");$("txtAmount").focus().addClass("inputlr");return}$("txtAmount").dom.value=a;$("lblSendRequest").update("<img src='/images/loading-icon.gif' />\u6b63\u5728\u8bf7\u6c42\u4e2d\u8bf7\u7a0d\u5019...");Ext.Ajax.request({url:"/op.ashx",success:function(b){$("lblSendRequest").update("<a href='"+b.responseText+"' target='_blank'>\u70b9\u8fd9\u91cc\u4f1a\u8f6c\u5165\u652f\u4ed8\u5b9d\u754c\u9762\u7ee7\u7eed\u5b8c\u6210\u64cd\u4f5c</a>")},failure:function(b){switch(b.responseText){case"inv:amount":$("txtAmount").stickTip("\u5145\u503c\u91d1\u989d\u9519\u8bef","red");$("txtAmount").focus().addClass("inputlr");break}$("lblSendRequest").update("")},params:{op:"genchargeurl",amount:a}})};Ext.onReady(function(){Ext.Ajax.request({url:"/extra.ashx?i="+Math.random().toString(),success:function(e){eval(e.responseText)},failure:function(e){}})});var Start=function(){if(Ext.isIE6){top.$=function(b){return Ext.get(b)}}var a=top.location.pathname.toLowerCase();if(top.HostInfo==undefined){if(a=="/settings.html"){top.location.href="/index.html"}if($("n-my-sending")!=null){$("n-my-sending").hide(false)}}else{if($("n-my-sending")!=null){$("n-my-sending").show(false)}}switch(a){case"/":case"/index.html":RP.SPv2.Index.init();break;case"/reg.html":RP.SPv2.Reg.init();break;case"/settings.html":RP.SPv2.Settings.init();break;case"/productinfo.html":$("n-msg").addClass("on");break;case"/case.html":$("n-case").addClass("on");break;case"/order.html":$("n-price").addClass("on");break}};Ext.namespace("RP.Util");RP.Util.CreateDropDownList=function(d,f,e){var g=d+"Box";var b='<div id="'+g+'" class="listBox" style="width:'+($(d).getWidth()-6)+'px; position:absolute;"><ul>';for(var c=0;c<e.length;c++){b+="<li value='"+e[c].value+"'>"+e[c].text+"</li>"}b+="</ul></div>";Ext.DomHelper.append(Ext.getBody(),b);$(f).dom.value=e[0].value;$(d).update(e[0].text);$(g).hide(false);var a=function(i){var h=i.target;if(h.value!=undefined&&h.nodeName=="LI"){$(d).update(h.innerHTML);$(f).dom.value=h.getAttribute("value")}Ext.getBody().un("mousedown",a);$(g).hide(true);$(d).removeClass("winputhover")};$(d).on("click",function(h){if($(g).isVisible()){return}$(g).show(true);$(g).alignTo(d,"bl");$(d).addClass("winputhover");Ext.getBody().on("mousedown",a)},$(d))};VType=function(){var e=/^[a-zA-Z_]+$/;var f=/^[a-zA-Z0-9_]+$/;var b=/^([\w]+)(\.[\w]+)*@([\w\-]+\.){1,5}([A-Za-z]){2,4}$/;var a=/(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;var c=/^(1[358][0-9]{9})$|^(0[0-9]{10,11})$/;var d=/^[a-zA-Z\u4e00-\u9fa5]+$/;return{emailReg:b,cellphoneReg:c,email:function(g){return b.test(g)},cellphone:function(g){return c.test(g)},chsalpha:function(g){return d.test(g)},emailText:'This field should be an e-mail address in the format "user@domain.com"',emailMask:/[a-z0-9_\.\-@]/i,url:function(g){return a.test(g)},urlText:'This field should be a URL in the format "http://www.domain.com"',alpha:function(g){return e.test(g)},alphaText:"This field should only contain letters and _",alphaMask:/[a-z_]/i,alphanum:function(g){return f.test(g)},alphanumText:"This field should only contain letters, numbers and _",alphanumMask:/[a-z0-9_]/i}}();
