if(polopoly){throw ("Initialized twice");}var polopoly={};polopoly.service={};polopoly.user={init:function(){this.data=this._initCookie("cata");this.sessionData=this._initCookie("data");},_initCookie:function(C){var A=polopoly.cookie.get(C);if(!A){return ;}var D=polopoly.base64.stringDecode(A);
if(!D){return ;}try{var B=polopoly.json.parse(D);}catch(E){return ;}return B;},getServiceSettings:function(B,A){if(!this.data||!this.data[B]){return ;}return this.data[B][A];},setServiceSettings:function(C,A,B){if(!this.data){this.data={};}if(!this.data[C]){this.data[C]={};
}this.data[C][A]=B;this._persistDataInCookie();},getSessionServiceSettings:function(B,A){if(!this.sessionData||!this.sessionData[B]){return ;}return this.sessionData[B][A];},setSessionServiceSettings:function(C,A,B){if(!this.sessionData){this.sessionData={};
}if(!this.sessionData[C]){this.sessionData[C]={};}this.sessionData[C][A]=B;this._persistSessionDataInCookie();},_persistDataInCookie:function(){var A=polopoly.json.stringify(this.data);var B=polopoly.base64.stringEncode(A);polopoly.cookie.set("cata",B);},_persistSessionDataInCookie:function(){var A=polopoly.json.stringify(this.sessionData);
var B=polopoly.base64.stringEncode(A);polopoly.cookie.setForSession("data",B);},isLoggedIn:function(){return polopoly.cookie.get("sessionKey")!=null&&polopoly.cookie.get("loginName")!=null&&polopoly.cookie.get("userId")!=null;},name:function(){return polopoly.base64.stringDecode(polopoly.cookie.get("loginName"));
},screenName:function(){return polopoly.base64.stringDecode(polopoly.cookie.get("screenName"));},popMessageCookie:function(A){var E=polopoly.cookie.get(A);var B=polopoly.base64.stringDecode(E);if(B.length){var C;try{C=polopoly.json.parse(B);}catch(D){}polopoly.cookie.clear(A);
return C;}},refreshUserData:function(B,A){jQuery.ajax({"cache":false,"error":B,"success":A,"timeout":3000,"type":"GET","url":"/membership/refresh"});}};polopoly.cookie={clear:function(A){document.cookie=A+"= ; expires=01 Jan 1970 00:00:00 UTC; path=/";},set:function(A,B){document.cookie=A+"="+B+"; expires=01 Jan 2038 00:00:00 UTC; path=/";
},setForSession:function(A,B){document.cookie=A+"="+B+"; expires=-1; path=/";},get:function(A){return polopoly.util.stringAsHashValue(A,document.cookie,";");}};polopoly.comments={get:function(B,D,A,C){jQuery.get(B,{"comments":D,"ajax":"true","ot":"example.AjaxPageLayout.ot"},function(E){$(A).html(E);
if(C){C(A);}},"html");}};polopoly.json={_cx:/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,_escapable:/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,_gap:null,_indent:null,_meta:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},_rep:null,_f:function(A){return A<10?"0"+A:A;
},init:function(){if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(A){return this.getUTCFullYear()+"-"+this._f(this.getUTCMonth()+1)+"-"+this._f(this.getUTCDate())+"T"+this._f(this.getUTCHours())+":"+this._f(this.getUTCMinutes())+":"+this._f(this.getUTCSeconds())+"Z";
};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(A){return this.valueOf();};}},_quote:function(A){this._escapable.lastIndex=0;return this._escapable.test(A)?'"'+A.replace(this._escapable,function(B){var C=this._meta[B];return typeof C==="string"?C:"\\u"+("0000"+B.charCodeAt(0).toString(16)).slice(-4);
})+'"':'"'+A+'"';},_str:function(H,E){var C,B,I,A,F=this._gap,D,G=E[H];if(G&&typeof G==="object"&&typeof G.toJSON==="function"){G=G.toJSON(H);}if(typeof this._rep==="function"){G=this._rep.call(E,H,G);}switch(typeof G){case"string":return this._quote(G);case"number":return isFinite(G)?String(G):"null";
case"boolean":case"null":return String(G);case"object":if(!G){return"null";}this._gap+=this._indent;D=[];if(Object.prototype.toString.apply(G)==="[object Array]"){A=G.length;for(C=0;C<A;C+=1){D[C]=this._str(C,G)||"null";}I=D.length===0?"[]":this._gap?"[\n"+this._gap+D.join(",\n"+this._gap)+"\n"+F+"]":"["+D.join(",")+"]";
this._gap=F;return I;}if(this._rep&&typeof this._rep==="object"){A=this._rep.length;for(C=0;C<A;C+=1){B=this._rep[C];if(typeof B==="string"){I=this._str(B,G);if(I){D.push(this._quote(B)+(this._gap?": ":":")+I);}}}}else{for(B in G){if(Object.hasOwnProperty.call(G,B)){I=this._str(B,G);
if(I){D.push(this._quote(B)+(this._gap?": ":":")+I);}}}}I=D.length===0?"{}":this._gap?"{\n"+this._gap+D.join(",\n"+this._gap)+"\n"+F+"}":"{"+D.join(",")+"}";this._gap=F;return I;}},stringify:function(D,B,C){var A;this._gap="";this._indent="";if(typeof C==="number"){for(A=0;
A<C;A+=1){this._indent+=" ";}}else{if(typeof C==="string"){this._indent=C;}}this._rep=B;if(B&&typeof B!=="function"&&(typeof B!=="object"||typeof B.length!=="number")){throw new Error("JSON.stringify");}return this._str("",{"":D});},parse:function(text,reviver){var j;
function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}return reviver.call(holder,key,value);}this._cx.lastIndex=0;
if(this._cx.test(text)){text=text.replace(this._cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4);});}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");
return typeof reviver==="function"?walk({"":j},""):j;}throw new SyntaxError("JSON.parse");}};polopoly.util={querystringValue:function(A){return this.stringAsHashValue(A,location.search.substr(1),"&");},stringAsHashValue:function(E,C,B){if(C&&C!=""){var A=C.split(B);
for(var D=0;D<A.length;D++){var F=jQuery.trim(A[D]);if(F.substring(0,E.length+1)==(E+"=")){return decodeURIComponent(F.substring(E.length+1));}}}}};polopoly.base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",stringDecode:function(A){return this._utf8_decode(this.decode(A));
},decode:function(D){try{if(D.length==0){return"";}}catch(C){return"";}D=this._padIfNecessary(D);var A="";var K,I,G;var J,H,F,E;var B=0;D=D.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{J=this._keyStr.indexOf(D.charAt(B++)||"=");H=this._keyStr.indexOf(D.charAt(B++)||"=");
F=this._keyStr.indexOf(D.charAt(B++)||"=");E=this._keyStr.indexOf(D.charAt(B++)||"=");K=(J<<2)|(H>>4);I=((H&15)<<4)|(F>>2);G=((F&3)<<6)|E;A=A+String.fromCharCode(K);if(F!=64){A=A+String.fromCharCode(I);}if(E!=64){A=A+String.fromCharCode(G);}}while(B<D.length);
return A;},_padIfNecessary:function(A){if((A.length%4)==0){return A;}var C=(4-(A.length%4));for(var B=0;B<C;B++){A+="=";}return A;},stringEncode:function(A){return this.encode(this._utf8_encode(A));},encode:function(C){var A="";var J,H,F,I,G,E,D;var B=0;while(B<C.length){J=C.charCodeAt(B++);
H=C.charCodeAt(B++);F=C.charCodeAt(B++);I=J>>2;G=((J&3)<<4)|(H>>4);E=((H&15)<<2)|(F>>6);D=F&63;if(isNaN(H)){E=D=64;}else{if(isNaN(F)){D=64;}}A=A+this._keyStr.charAt(I)+this._keyStr.charAt(G)+this._keyStr.charAt(E)+this._keyStr.charAt(D);}return A;},_utf8_encode:function(B){B=B.replace(/\r\n/g,"\n");
var A="";for(var D=0;D<B.length;D++){var C=B.charCodeAt(D);if(C<128){A+=String.fromCharCode(C);}else{if((C>127)&&(C<2048)){A+=String.fromCharCode((C>>6)|192);A+=String.fromCharCode((C&63)|128);}else{A+=String.fromCharCode((C>>12)|224);A+=String.fromCharCode(((C>>6)&63)|128);
A+=String.fromCharCode((C&63)|128);}}}return A;},_utf8_decode:function(A){var B="";var C=0;var D=c1=c2=0;while(C<A.length){D=A.charCodeAt(C);if(D<128){B+=String.fromCharCode(D);C++;}else{if((D>191)&&(D<224)){c2=A.charCodeAt(C+1);B+=String.fromCharCode(((D&31)<<6)|(c2&63));
C+=2;}else{c2=A.charCodeAt(C+1);c3=A.charCodeAt(C+2);B+=String.fromCharCode(((D&15)<<12)|((c2&63)<<6)|(c3&63));C+=3;}}}return B;}};polopoly.loginBox={_login:{"auth":"authError","perm":"permError","down":"downError","default":"defaultError"},init:function(){document.__ppUseDefLogin=false;
try{this.defLogin=p_l_i18n.defaultLoginName;}catch(B){this.defLogin="E-mail";}defLogin=this.defLogin;window.setTimeout(this._tryAutoFill,500);jQuery(".clearable").focus(function(){B=jQuery(this);if(document.__ppUseDefLogin&&B.val()==defLogin){B.val("");}});
jQuery(".clearable").blur(function(){B=jQuery(this);if(document.__ppUseDefLogin&&B.val()==""){B.val(defLogin);}});jQuery(".not-loggedin .submit").click(function(){var E=jQuery(this).parents(".not-loggedin");var F=E.find(".loginname");var D=E.find(".password");
if(F.val()==defLogin&&D.val()==defLogin){F.val("");D.val("");}});jQuery(".clearable").blur();var A=polopoly.cookie.get("loginName");var C=polopoly.cookie.get("sessionKey");if(polopoly.user.isLoggedIn()){jQuery(".loggedin").show();jQuery(".loggedin .user-name").append(polopoly.user.name());
}else{jQuery(".not-loggedin").show();}this._trySetError(".not-loggedin .form-error",polopoly.util.querystringValue("login_formerror"));if(polopoly.util.querystringValue("login_formerror")){jQuery("#loginForm").show();}},_trySetError:function(A,B){if(!B){return ;
}var C=p_l_i18n[this._login[B]]||p_l_i18n[this._login["default"]];jQuery(A).css("display","block").text(C);},_tryAutoFill:function(){if(jQuery(".loginname").val()==""&&jQuery(".password").val()==""){jQuery(".loginname").val(this.defLogin);jQuery(".password").val(this.defLogin);
document.__ppUseDefLogin=true;}}};polopoly.util.lrumap=function(B,A){if(B){myMap=B;}else{myMap=[];}if(!A){A=10;}return{map:myMap,size:A,get:function(E){var D=this._findId(E);if(D){var C=this.map[D][1];this._setLeader(D);return C;}},rawMap:function(){return this.map;
},put:function(E,D){var C=this._findId(E);if(C){this.map[C]=[E,D];}else{this.map.unshift([E,D]);}if(this.map.length>this.size){this.map.splice(this.size);}},remove:function(D){var C=this._findId(D);if(C){this.map.splice(C,1);}},_findId:function(C){for(key in this.map){if(this.map[key][0]==C){return key;
}}},_setLeader:function(D){var C=this.map[key];this.map.splice(key,1);this.map.unshift(C);}};};polopoly.newslist={create:function(G,A,B,F,E){var D=polopoly.newslist._getNameFromId(G,A);if(!polopoly.newslist.allListIds){polopoly.newslist.allListIds=[];}polopoly.newslist.allListIds[A]=B;
if(!polopoly.newslist.defaultListIds){polopoly.newslist.defaultListIds=[];}polopoly.newslist.defaultListIds[A]=F;jQuery("#edit_"+D+" .button").click(function(){jQuery("#"+D+" .settings").slideToggle(100);});var C=this.getSelection(G,A,E);jQuery("#"+D+" :checkbox").removeAttr("checked");
for(checked in C){checkedValue="#c"+A.replace(".","_")+"-"+C[checked].replace(".","_");jQuery("#"+D+" "+checkedValue).attr("checked","checked");}if(E&&polopoly.user.isLoggedIn()||!E){jQuery("#edit_"+D).show();}var H=jQuery("#"+D+" input.save");if(E){H.click(function(){polopoly.newslist.storeOnServer(G,A);
});}else{H.click(function(){polopoly.newslist.storeInCookie(G,A);});}this.updateList(G,A,E);},getSelection:function(C,A,D){var B;if(D){B=polopoly.user.getSessionServiceSettings(C,A);}else{B=polopoly.user.getServiceSettings(C,A);}return B?B:polopoly.newslist.defaultListIds[A];
},_storeInCookie:function(D,A,C){var E=jQuery("#"+C+" input:checkbox:checked");var B=[];jQuery.each(E,function(){B[B.length]=this.value;});polopoly.user.setServiceSettings(D,A,B);this.updateList(D,A,false);},_storeInSessionCookie:function(D,A,C){var E=jQuery("#"+C+" input:checkbox:checked");
var B=[];jQuery.each(E,function(){B[B.length]=this.value;});polopoly.user.setSessionServiceSettings(D,A,B);this.updateList(D,A,true);},storeInCookie:function(C,A){var B=polopoly.newslist._getNameFromId(C,A);polopoly.newslist._storeInCookie(C,A,B);jQuery("#"+B+" .settings").hide(100);
},storeOnServer:function(C,A){var B=polopoly.newslist._getNameFromId(C,A);jQuery("#error_"+B).hide();polopoly.newslist._storeInSessionCookie(C,A,B);jQuery.ajax({"cache":false,"data":{"sdid":C,"siid":A},"error":function(E,F,D){jQuery("#error_"+B+"").show();},"success":function(E,D){jQuery("#"+B+" .settings").hide(100);
},"timeout":2000,"type":"POST","url":"/membership/persist"});},updateList:function(D,K,A){var B=polopoly.newslist._getNameFromId(D,K);var J=this.getSelection(D,K,A);if(J.length==0){jQuery("#"+B+" .lists").html("");return ;}var F=polopoly.newslist.allListIds[K];
var C=[];for(var G=0;G<J.length;G++){if(polopoly.newslist._contains(F,J[G])){C.push(J[G]);}}var E=[];var I=C.length;for(var G=0;G<C.length;G++){var H=C[G];jQuery.get("/cws/"+K,{"topic":H,"mode":"ajax","etagpagefilter":"false","etagfilter":"false"},function(L,M,N){return function(Q){L[M]=Q;
var R=true;for(var O=0;O<N;O++){if(!L[O]){R=false;}}if(R){var P="";for(var O=0;O<N;O++){P+=L[O];}jQuery("#"+B+" .lists").html(P);}};}(E,G,I),"html");}},_contains:function(C,B){if(!C){return false;}for(var A=0;A<C.length;A++){if(C[A]==B){return true;}}return false;
},_getNameFromId:function(B,A){return"newsList_"+A.replace(".","_");}};polopoly.passwordMeter={_colors:["#FF0000","#FF0000","#FFCC00","#00CC00","#00FF00"],create:function(D,F){var B="is"+Math.ceil(Math.random()*3000);jQuery(F).html("<div id='"+B+"' style='height: 100%;'></div>");
var E=jQuery(F).width();var C=function A(G,H){return function(J){var L=jQuery(D).val();var K=G(L);var I=K>0?Math.ceil(K/4*E):(L.length>0?0.01*E:0);jQuery("#"+B).css("width",I+"px");jQuery("#"+B).css("background-color",H[K]);};}(this._testPassword,this._colors);
jQuery(D).keyup(C);},_testPassword:function(A){score=0;if(A.length<5){score+=3;}else{if(A.length>4&&A.length<8){score+=6;}else{if(A.length>7&&A.length<16){score+=12;}else{if(A.length>15){score+=18;}}}}if(A.match(/[a-z]/)){score+=1;}if(A.match(/[A-Z]/)){score+=5;
}if(A.match(/\d+/)){score+=5;}if(A.match(/(.*[0-9].*[0-9].*[0-9])/)){score+=5;}if(A.match(/.[!,@,#,$,%,^,&,*,?,_,~]/)){score+=5;}if(A.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)){score+=5;}if(A.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)){score+=2;
}if(A.match(/([a-zA-Z])/)&&A.match(/([0-9])/)){score+=2;}if(A.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/)){score+=2;}if(score<5){return 0;}else{if(score>=5&&score<15){return 1;}else{if(score>=15&&score<30){return 2;
}else{if(score>=30&&score<35){return 3;}else{return 4;}}}}}};jQuery().ready(function(){return function(B){for(var A=0;A<B.length;A++){for(key in B[A]){var C=B[A][key];if(typeof (C["init"])=="function"){C.init();}}}}([polopoly,polopoly.service]);});
