(function(){window.Inpl=typeof(Inpl)==="undefined"?{}:Inpl;window.Inpl.User=new function(){var e={};e.data={esid:{cookieName:"ESID",prepare:function(h){return h},filterExp:/[0-9]/g,loggedIn:true},signature:{cookieName:"USIGN",prepare:function(h){return h},filterExp:/[\x00-\x7FęóąśłżźćńĘÓĄŚŁŻŹĆŃ]/g,loggedIn:false},nick:{cookieName:"UID",prepare:function(h){return h},filterExp:/[a-zA-Z0-9\-]/g,loggedIn:true},email:{cookieName:"UEMAIL",prepare:function(h){return h},filterExp:/[a-zA-Z0-9\-\+\.@]/g,loggedIn:false},avatar:{cookieName:"UAVATAR",prepare:function(h){return h},filterExp:/[a-zA-Z0-9\.]/g,loggedIn:false},avatarId:{cookieName:"UAVATAR",prepare:function(h){return h.substring(0,h.lastIndexOf("."))},filterExp:/[a-zA-Z0-9]/g,loggedIn:false},avatarExt:{cookieName:"UAVATAR",prepare:function(h){return h.substring(h.lastIndexOf(".")+1).toLowerCase()},filterExp:/[a-zA-Z0-9]/g,loggedIn:false}};e.specialChars=[{exp:/&/g,replace:"&amp;"},{exp:/</g,replace:"&lt;"},{exp:/>/g,replace:"&gt;"},{exp:/"/g,replace:"&quot;"},{exp:/'/g,replace:"&quot;"},{exp:/ę/g,replace:"&#281;"},{exp:/Ę/g,replace:"&#280;"},{exp:/ó/g,replace:"&#243;"},{exp:/Ó/g,replace:"&#211;"},{exp:/ą/g,replace:"&#261;"},{exp:/Ą/g,replace:"&#260;"},{exp:/ś/g,replace:"&#347;"},{exp:/Ś/g,replace:"&#346;"},{exp:/ł/g,replace:"&#322;"},{exp:/Ł/g,replace:"&#321;"},{exp:/ż/g,replace:"&#380;"},{exp:/Ż/g,replace:"&#379;"},{exp:/ź/g,replace:"&#378;"},{exp:/Ź/g,replace:"&#377;"},{exp:/ć/g,replace:"&#263;"},{exp:/Ć/g,replace:"&#262;"},{exp:/ń/g,replace:"&#324;"},{exp:/Ń/g,replace:"&#323;"}];var b={};b.avatarLink=(document.location.toString().search(/^https/i)===0?"https":"http")+"://i.iplsc.com/-/{avatarId}-{photoClass}.{avatarExt}";b.avatarVariables={photoClass:"C2"};b.isLoggedInAjaxUrl="/ajax/user-ping";var g=function(){if(typeof(jQuery)==="undefined"){throw"Session exception: jQuery not found."}if(typeof(jQuery.cookie)==="undefined"){throw"Session exception: jQuery.cookie not found."}};var c=function(l,m){if(typeof(l)!=="string"){return""}var k="";for(var j=0;j<l.length;j++){var h=l.charAt(j).match(m);if(h!==null){k+=h[0]}}return k};var d=function(k){if(typeof(k)!=="string"){return""}var j=k;for(var h in e.specialChars){j=j.replace(e.specialChars[h].exp,e.specialChars[h].replace)}return j};var a=function(h){var i=jQuery.cookie(e.data[h].cookieName);if(i===null){return null}i=e.data[h].prepare(i);i=c(i,e.data[h].filterExp);i=d(i);return i};var f=function(){for(var h in e.data){if(e.data[h].loggedIn===true&&a(h)===null){return false}}return true};this.getEsid=function(){return a("esid")};this.getSignature=function(){return a("signature")};this.getNick=function(){return a("nick")};this.getEmail=function(){return a("email")};this.getAvatar=function(k){k=typeof(k)!=="undefined"?k:{};if(a("avatar")===null){return null}k=jQuery.extend(b.avatarVariables,k);var h=b.avatarLink;for(var j in e.data){h=h.replace("{"+j+"}",a(j))}for(var i in k){h=h.replace("{"+i+"}",k[i])}return h};this.isLoggedIn=function(){var j=parseInt(a("esid"));var i=parseInt(new Date().getTime()/1000);if(j!==null&&j<i){return false}if(f()===false){return false}var h=null;jQuery.ajax({async:false,type:"GET",url:b.isLoggedInAjaxUrl,dataType:"json",success:function(k,l){h=k.response===1?true:false},error:function(k,m,l){h=false}});if(h===false){this.destroy()}return h};this.destroy=function(){for(var h in e.data){jQuery.cookie(e.data[h].cookieName,null)}};jQuery(document).ready(g)}})();