byId=function(a){return document.getElementById(a)
};
function createCookie(c,e,f,d){if(d){var b=new Date();
b.setTime(b.getTime()+(d*1000));
var a="; expires="+b.toGMTString()
}else{if(f){var b=new Date();
b.setTime(b.getTime()+(f*24*60*60*1000));
var a="; expires="+b.toGMTString()
}else{var a=""
}}document.cookie=c+"="+encodeURIComponent(e)+a+"; path=/"
}function readCookie(b){var e=b+"=";
var a=document.cookie.split(";");
for(var d=0;
d<a.length;
d++){var f=a[d];
while(f.charAt(0)==" "){f=f.substring(1,f.length)
}if(f.indexOf(e)==0){return decodeURIComponent(f.substring(e.length,f.length))
}}return null
}function randomize_box(){var b=window.location.host.replace("www.","");
var a=Math.floor(Math.random()*100);
if(b=="poczta.o2.pl"||b=="poczta10.o2.pl"||b=="mail.o2.pl"||b=="poczta.tlen.pl"){domain=(a%2)?"poczta10.o2.pl":"poczta.o2.pl"
}else{return b
}return domain
}var domain=randomize_box();
if(window.location.search){domain=window.location.host
}var ssl=readCookie("ssl");
if(ssl||window.location.protocol=="https"){var ssl_element=byId("ssl");
if(ssl_element){byId("ssl").checked="checked"
}}if(domain){var p=byId("preload");
if(p){window.setTimeout(function(){p.src=window.location.protocol+"//"+domain+WEBMAIL_PATH+"preload.html"
},1000)
}}if(byId("ssl")&&ssl==="0"){byId("ssl").checked=false
}if(byId("login")){window.setTimeout(function(){byId("login").focus()
},500)
}function onLogin(){createCookie("login_query",window.location.search);
var c=byId("login_form").getAttribute("action");
if(byId("ssl")){var b=byId("ssl").checked;
if(b){if(c.indexOf("http")==-1){if(c.indexOf("http")==-1){byId("login_form").action="https://"+domain+"/"+c
}}createCookie("ssl","1",1)
}else{if(domain!=document.location.host.replace("www.","")&&c.indexOf("http")==-1){byId("login_form").action=document.location.protocol+"//"+domain+"/"+c
}createCookie("ssl","0",1)
}}else{if(domain!=document.location.host.replace("www.","")&&c.indexOf("http")==-1){byId("login_form").action=document.location.protocol+"//"+domain+"/"+c
}createCookie("ssl","0",1)
}var a=parseInt(readCookie("logcount_2")||0);
createCookie("logcount_2",a+1,7);
if(byId("login").value!==""&&byId("pass").value!==""){createCookie("login_stats",1,0,5);
return true
}return false
}function onUserDomainLogin(){var b=byId("login_form").getAttribute("action");
if(byId("ssl")){var a=byId("ssl").checked;
if(a){byId("login_form").action="https://"+domain+b;
createCookie("ssl","1",1)
}else{byId("login_form").action=window.location.protocol+"//"+domain+b;
createCookie("ssl","0",1)
}}}var ls=byId("language-select");
if(ls){var lang=readCookie("lang")||WEBMAIL_LANG;
if(lang){var o=ls.options;
for(var i=0;
i<o.length;
i++){if(o[i].value==lang){ls.selectedIndex=i;
break
}}}ls.onchange=function(){onLangSelect();
byId("lang-form").submit()
}
}function onLangSelect(){var a=byId("language-select").value;
createCookie("lang",a)
}function clear_input(a,b){if(a.value==b){a.value=""
}}function default_input(a,b){if(a.value==""){a.value=b
}}function isMobileWebkit(){return RegExp(" AppleWebKit/").test(navigator.userAgent)&&RegExp(" Mobile").test(navigator.userAgent)
};
