function removeHash(a){return Object.isString(a)&&a.startsWith("#")?a.substring(1):a}function serverChangeHandler(){if(change_smtphost){$("smtphost").setValue($F("server"))}}function updatePort(){var a=$F("protocol");if(protocols[a]){$("port").setValue(protocols[a])}}function selectLang(){if(!$F("imapuser")&&!$F("pass")){var a={new_lang:$F("new_lang")};if(lang_url!==null){a.url=lang_url}self.location="login.php?"+Object.toQueryString(a)}}function submit_login(){if(show_list&&$F("server").startsWith("_")){return false}if(!$F("imapuser")){alert(IMP.text.login_username);$("imapuser").focus();return false}else if(!$F("pass")){alert(IMP.text.login_password);$("pass").focus();return false}else{$("loginButton").disable();if(ie_clientcaps){try{$("ie_version").setValue(objCCaps.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid"))}catch(a){}}punycode_login_domain();$("imp_login").submit();return true}}function imp_reload(){window.top.document.location=autologin_url+$F("server_key")}function setFocus(){if(!$F("imapuser")){$("imapuser").focus()}else{$("pass").focus()}}function punycode_login_domain(){if($F("imapuser")=="")return;try{var a=$F("imapuser");var b=a.split("@");var c=b[1];var d=punycode.ToASCII(c);b[1]=d;Form.Element.Methods.setValue("imapuser",b.join("@"))}catch(e){}}var punycode=new function a(){function m(a,b){a-=(a-97<26)<<5;return a+((!b&&a-65<26)<<5)}function l(a,b,c){var i;a=c?Math.floor(a/e):a>>1;a+=Math.floor(a/b);for(i=0;a>(d-f)*g>>1;i+=d){a=Math.floor(a/(d-f))}return Math.floor(i+(d-f+1)*a/(a+h))}function k(a,b){return a+22+75*(a<26)-((b!=0)<<5)}function j(a){return a-48<10?a-22:a-65<26?a-65:a-97<26?a-97:d}this.utf16={decode:function(a){var b=[],c=0,d=a.length,e,f;while(c<d){e=a.charCodeAt(c++);if((e&63488)===55296){f=a.charCodeAt(c++);if((e&64512)!==55296||(f&64512)!==56320){throw new RangeError("UTF-16(decode): Illegal UTF-16 sequence")}e=((e&1023)<<10)+(f&1023)+65536}b.push(e)}return b},encode:function(a){var b=[],c=0,d=a.length,e;while(c<d){e=a[c++];if((e&63488)===55296){throw new RangeError("UTF-16(encode): Illegal UTF-16 value")}if(e>65535){e-=65536;b.push(String.fromCharCode(e>>>10&1023|55296));e=56320|e&1023}b.push(String.fromCharCode(e))}return b.join("")}};var a=128;var b=72;var c="-";var d=36;var e=700;var f=1;var g=26;var h=38;var i=2147483647;this.decode=function(e,h){var k=[];var m=[];var n=e.length;var o,p,q,r,s,t,u,v,w,x,y,z,A;o=a;q=0;r=b;s=e.lastIndexOf(c);if(s<0)s=0;for(t=0;t<s;++t){if(h)m[k.length]=e.charCodeAt(t)-65<26;if(e.charCodeAt(t)>=128){throw new RangeError("Illegal input >= 0x80")}k.push(e.charCodeAt(t))}for(u=s>0?s+1:0;u<n;){for(v=q,w=1,x=d;;x+=d){if(u>=n){throw RangeError("punycode_bad_input(1)")}y=j(e.charCodeAt(u++));if(y>=d){throw RangeError("punycode_bad_input(2)")}if(y>Math.floor((i-q)/w)){throw RangeError("punycode_overflow(1)")}q+=y*w;z=x<=r?f:x>=r+g?g:x-r;if(y<z){break}if(w>Math.floor(i/(d-z))){throw RangeError("punycode_overflow(2)")}w*=d-z}p=k.length+1;r=l(q-v,p,v===0);if(Math.floor(q/p)>i-o){throw RangeError("punycode_overflow(3)")}o+=Math.floor(q/p);q%=p;if(h){m.splice(q,0,e.charCodeAt(u-1)-65<26)}k.splice(q,0,o);q++}if(h){for(q=0,A=k.length;q<A;q++){if(m[q]){k[q]=String.fromCharCode(k[q]).toUpperCase().charCodeAt(0)}}}return this.utf16.encode(k)};this.encode=function(e,h){var j,n,o,p,q,r,s,t,u,v,w,x;if(h){x=this.utf16.decode(e)}e=this.utf16.decode(e.toLowerCase());var y=e.length;if(h){for(r=0;r<y;r++){x[r]=e[r]!=x[r]}}var z=[];j=a;n=0;q=b;for(r=0;r<y;++r){if(e[r]<128){z.push(String.fromCharCode(x?m(e[r],x[r]):e[r]))}}o=p=z.length;if(p>0)z.push(c);while(o<y){for(s=i,r=0;r<y;++r){w=e[r];if(w>=j&&w<s)s=w}if(s-j>Math.floor((i-n)/(o+1))){throw RangeError("punycode_overflow (1)")}n+=(s-j)*(o+1);j=s;for(r=0;r<y;++r){w=e[r];if(w<j){if(++n>i)return Error("punycode_overflow(2)")}if(w==j){for(t=n,u=d;;u+=d){v=u<=q?f:u>=q+g?g:u-q;if(t<v)break;z.push(String.fromCharCode(k(v+(t-v)%(d-v),0)));t=Math.floor((t-v)/(d-v))}z.push(String.fromCharCode(k(t,h&&x[r]?1:0)));q=l(n,o+1,o==p);n=0;++o}}++n,++j}return z.join("")};this.ToASCII=function(a){var b=a.split(".");var c=[];for(var d=0;d<b.length;++d){var e=b[d];c.push(e.match(/[^A-Za-z0-9-]/)?"xn--"+punycode.encode(e):e)}return c.join(".")};this.ToUnicode=function(a){var b=a.split(".");var c=[];for(var d=0;d<b.length;++d){var e=b[d];c.push(e.match(/^xn--/)?punycode.decode(e.slice(4)):e)}return c.join(".")}};document.observe("dom:loaded",function(){if(imp_auth){if(parent.frames.horde_main){if(nomenu){parent.location=self.location}else{document.imp_login.target="_parent"}}}if(location.hash){$("anchor_string").setValue(removeHash(location.hash))}})

