var OB_voterWidgetObjArray=typeof(OB_voterWidgetObjArray)!='undefined'?OB_voterWidgetObjArray:new Array();var cssFile_Loaded=false;var outbrain_browsers=(typeof(outbrain_browsers)=='object')?outbrain_browsers:new function(){this.browserListVersion="2.0";this.ready=false;this.agt=(navigator.userAgent.toLowerCase());this.opera=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);this.avant=(navigator.userAgent.toLowerCase().indexOf("avant")!=-1);this.chrome=(navigator.userAgent.toLowerCase().indexOf("chrome")!=-1);this.ie=(!this.opera&&navigator.appName.indexOf("Microsoft")!=-1);this.safari=(!this.ie&&navigator.userAgent.toLowerCase().indexOf("safari")!=-1);this.mozilla=(!this.opera&&!this.ie&&!this.safari&&!this.chrome);this.is_major=(parseInt(navigator.appVersion));this.ie5=((this.ie)&&(this.is_major==4)&&(this.agt.indexOf("msie 5.")!=-1));this.ie55=((this.ie)&&(this.is_major==4)&&(this.agt.indexOf("msie 5.5")!=-1));this.ie6=((this.ie)&&(this.is_major==4)&&(this.agt.indexOf("msie 6.")!=-1));this.sc=(this.safari||this.chrome);this.os=(navigator.platform.toLowerCase());this.osMac=(this.os.indexOf("mac")!=-1);this.osWin=(this.os.indexOf("win")!=-1);this.osLinux=(this.os.indexOf("linux")!=-1);this.ready=true;}
var outbrain_settings=(typeof(outbrain_settings)=='object')?outbrain_settings:new function(){var self=this;this.PLATFORM_TYPE_TYPEPAD=0;this.PLATFORM_TYPE_BLOGGER_SIDEBAR=1;this.PLATFORM_TYPE_TUMBLR=2;this.platformType=null
this.versions=new function(){this.numVer=420;this.rater="4.2.0";this.mp="4.2.0.8";this.raterFull="4.2.0.13";this.css="3.7.5";this.whatIs="3.7.5";this.language="3.2.0";this.odb="0.6";}
this.demoMode=false;this.globals=new function(){this.scriptType="text/javascript";this.cssType="text/css";this.cssRel="stylesheet";}
this.domains=new function(){this.odb="odb.outbrain.com/";this.outbrain="http://www.outbrain.com/";this.js=((!this.demoMode)?'http://widgets.outbrain.com/':'http://s3.amazonaws.com/outbraintest.com/');this.traffic='http://$IS_TESTtraffic.outbrain.com/network/redir';}
this.keys_and_users=new function(){this.odbKey="AYQHSUWJ8576";this.agentId="blog_JS";this.partnerName=null;this.outbrainKey=null;this.userName=null;this.partnerKey=this.odbKey;}
this.odb=new function(){this.odbRatesRecorder='http://$IS_TESTrate.outbrain.com/rate.do';this.odbGetDataUrlGlobal='http://$IS_TEST'+self.domains.odb+'utils/odb?key=$KEY&agent=$AGENT&method=$METHOD&url=$PERMA_LINK&format=json&callback=outbrain_rater.returnedOdbData(${json},$VOTER_INDEX,$IS_REC)&timeframe=none$SELF_POSTS&lang=$LANGUAGE$ADDITIONAL';this.odbGetDataUrlRegular=this.odbGetDataUrlGlobal;this.odbGetDataUrlRec=this.odbGetDataUrlGlobal+'&urltyp=$URLTYPE';this.odbGetDataUrlRegular=this.odbGetDataUrlRegular.replace(/\$METHOD/g,'get_score');this.odbGetDataUrlRegular=this.odbGetDataUrlRegular.replace(/\$IS_REC/g,'false');this.odbGetDataUrlRegular=this.odbGetDataUrlRegular.replace(/\$SELF_POSTS/g,'');this.odbGetDataUrlRegular=this.odbGetDataUrlRegular.replace(/\$ADDITIONAL/g,'&idx=$VOTER_INDEX');this.odbGetDataUrlRec=this.odbGetDataUrlRec.replace(/\$METHOD/g,'get_score_rec');this.odbGetDataUrlRec=this.odbGetDataUrlRec.replace(/\$IS_REC/g,'true');this.odbGetDataUrlRec=this.odbGetDataUrlRec.replace(/\$URLTYPE/g,"redirect");this.odbGetDataUrlRec=this.odbGetDataUrlRec.replace(/\$ADDITIONAL/g,'&idx=$VOTER_INDEX$NUM$FRAMECONTROL$SRVPC$VISIBLE_RECS');this.MPRequest='http://'+self.domains.odb+'utils/odb?key=$KEY&method=source_documents&format=$FORMAT&num=$ITEMS_COUNT&source_url=$SOURCE_URL&callback=$CALLBACK&timeframe=none&min_count=$MIN_COUNT&urltyp=redirect';this.MPRequest=this.MPRequest.replace(/\$MIN_COUNT/g,2);this.MPRequest=this.MPRequest.replace(/\$CALLBACK/g,"outbrain_MP.setData(${json},$MP_INDEX)");this.MPRequest=this.MPRequest.replace(/\$FORMAT/g,"json");this.MPwlRequest='http://'+self.domains.odb+'utils/odb?key=$KEY&method=wl_most_popular&format=$FORMAT&num=$ITEMS_COUNT&callback=$CALLBACK&timeframe=none&min_count=$MIN_COUNT$MP_PWL&src_id=$SOURCE_ID&urltyp=redirect';this.MPwlRequest=this.MPwlRequest.replace(/\$MIN_COUNT/g,2);this.MPwlRequest=this.MPwlRequest.replace(/\$CALLBACK/g,"outbrain_MP.setData(${json},$MP_INDEX)");this.MPwlRequest=this.MPwlRequest.replace(/\$FORMAT/g,"json");this.topPaddingThreshold=0.1;this.bottomPaddingThreshold=1.3;this.eagerOdbCalls=1;this.isOdbCallsSerial=false;this.isSemafor=true;this.OUTSIDEFOLD=0;this.INSIDEFOLD=1;this.NEARFOLD=2;this.EAGER=10;this.ERRED=-1;}
this.blogUtils=new function(){this.baseUrl='http://'+self.domains.odb+'blogutils/';this.getBlogSettings=this.baseUrl+'BlogSettings.action?apiKey=$USER_KEY&surl=$SOURCE_URL&localUrl=$LOCAL_URL&sig=$SIG$BLG_TEMPLATE&r='+Math.random()+"&version="+self.versions.raterFull;this.submitBlogSettings=this.baseUrl+'submitBlogSettings.action?apiKey=$USER_KEY&surl=$SOURCE_URL&localUrl=$LOCAL_URL';this.cancelRecs=this.baseUrl+'ExcludeRec.action?bocr=$BOCR&index=$VOTER_INDEX&templateIndex=$TEMPLATE_INDEX';this.errorManager=self.domains.outbrain+'WidgetsErrorManager?localUrl=$LOCAL_URL&err_code=$ERROR_CODE&err_desc=$ERROR_DESC&err_severity=$ERROR_SEVERITY&err_tmpl=$ERROR_TEMPLATE&err_browser=$ERROR_BROSWER&err_machine=$ERROR_OS&err_source_id=$ERROR_SOURCE';this.blogHrefLocation=encodeURIComponent(location.href);this.sourceId=null;}
this.ping=new function(){this.id="odbPingIframeId";this.url="http://odb.outbrain.com/utils/ping.html";this.maxTime=10;}
this.language=new function(){this.defaultLangName="deflang";this.id="outbrainLanguageJs";this.url=self.domains.js+"lang_en.js";this.retrayMilliSeconds=100;this.retrayMaxTimes=10;this.retrayGradualTimeout=false;}
this.rater=new function(){this.cssId="cssLinkID";this.cssUrl=self.domains.js+"OutbrainRater-"+self.versions.css+".css";this.globalElementClass="outbrainGlobalClass";this.firstRaterPositionElementId="outbrainCurrentPosition";this.isDisqus=true;this.isStars=true;this.isThumbs=false;this.cleanPermalink=false;this.windowName=null;this.recommendations=new function(){this.agentId="blog_JS";this.type="popular";this.maxCalls=10;this.always=false;this.showFramePage=true;this.openNewTab=true;this.defaultRecNumber=1;this.recNumberToFetch=3;this.displaySameSiteTitle=true;this.isPcEnabled=false;}
this.statuses=new function(){this.RATER_PRE_RATE_MODE=0;this.RATER_RATE_MODE=1;this.RATER_POST_RATE_MODE=2;}
this.odb=new function(){this.getScoreId="outbrainPostRankRequestID";this.getScoreRecId="outbrainPostRecRankRequestID";this.getCancelRecId="outbrainPostCancelRecRequestID";}}
this.MP=new function(){this.id="outbrainMPJs";this.url=self.domains.js+"outbrainMP.js?v="+self.versions.mp;this.cssId="outbrainMPCss";this.css=self.domains.js+'outbrainMP-'+self.versions.css+'.css';this.ids=new function(){this.parentContainerDiv="";this.containerDiv="outbrainMPDiv";this.requestElement="outbrainTopPostsDataScript";this.odbRequest=self.odb.MPRequest;}
this.classes=new function(){this.item="OB_MP_item";this.itemOver="OB_MP_item_hover";this.itemOdd="OB_MP_item_odd";this.itemEven="OB_MP_item_even";this.itemFirst="OB_MP_item_first";this.itemLast="OB_MP_item_last";}
this.others=new function(){this.hideTitle=false;this.widgetTitle="MPP";this.titleMaxChar=100;this.titleTagName="h2";this.titleClassName="outbrain_MP_title";}}
this.whatIs=new function(){this.id="whatIsOutbrainJs";this.url=self.domains.js+'OutbrainWhatIsIt-'+self.versions.whatIs+'.js';}
this.customSettings=new function(){this.id="outbrainCustomSettings";this.keyTagName="OBKey";this.enabled=true;}
this.templateOptions=["stars","firstLine","secondLine","recommendations"];this.templateDefaults=[false,false,false,false];this.defaultTemplateName="general";this.defaultTemplate="bottom;"+this.defaultTemplateName+";false;stars firstLine secondLine;"+this.defaultTemplateName;this.templateGlobalSplit=";";this.templateItemsSplit=" ";this.templateItemsJoin="-";this.defaultMatrixInfos='{"matrixInfos":{"general":{"matrixSource":"http://widgets.outbrain.com/matrix.png","matrixYpositionThanks":"60","matrixYHeight":"30","matrixXlength":"96","matrixAllXlength":"960","matrixAllYlength":"106","starWidth":"19","starHeight":"30","shadowYoffset":"5"}}}';this.timestampDef=new function(){this.installTimestamp=null;this.activeRecTimestamp=1211443547000;this.activeV354Timestamp=1220960663848;this.activeV355Timestamp=1221362041000;this.activeV361Timestamp=1222575308000;this.activeV400Timestamp=1233100799000;}}
var rater_global_settings=(typeof(rater_global_settings)=='object')?rater_global_settings:new function(){this.redirectUrlMethod="redirect";outbrain_settings.rater.recommendations.selfPost=null;this.versionOfSetting=function(path){if(path.indexOf("&version")==-1){path=path+"&version="+"4.2.0.13";}
return path;}
this.pathValidator=function(path,lookFor,replaceWith){if(path.indexOf(lookFor)==-1){path=path+replaceWith;}
return path;}
outbrain_settings.odb.odbGetDataUrlRec=this.versionOfSetting(outbrain_settings.odb.odbGetDataUrlRec);outbrain_settings.odb.odbGetDataUrlRegular=this.versionOfSetting(outbrain_settings.odb.odbGetDataUrlRegular);outbrain_settings.blogUtils.getBlogSettings=this.versionOfSetting(outbrain_settings.blogUtils.getBlogSettings);outbrain_settings.odb.odbGetDataUrlRec=this.pathValidator(outbrain_settings.odb.odbGetDataUrlRec,"$SRVPC$VISIBLE_RECS","$SRVPC$VISIBLE_RECS");outbrain_settings.versions.numVer=420;}
var outbrain_matrix_info=typeof(outbrain_matrix_info)=="function"?outbrain_matrix_info:function(){this.matrixYHeight=30;this.matrixYpositionThanks=60;this.matrixXlength=96;this.matrixAllXlength=960;this.matrixAllYlength=106;this.starHeight=30;this.starWidth=19;this.shadowYoffset=0;this.matrixSource=outbrain_settings.domains.js+"matrix"+".png";this.matrixSourceRTL=outbrain_settings.domains.js+"matrix"+"_rtl"+".png";this.init=function(templateMatrixInfo){if(templateMatrixInfo==null)
return;if((typeof(templateMatrixInfo.matrixSource)!='undefined')&&(templateMatrixInfo.matrixSource!=null))
{this.matrixSource=templateMatrixInfo.matrixSource;}
if((typeof(templateMatrixInfo.matrixSourceRTL)!='undefined')&&(templateMatrixInfo.matrixSourceRTL!=null))
{this.matrixSourceRTL=templateMatrixInfo.matrixSourceRTL;}
if((typeof(templateMatrixInfo.matrixYHeight)!='undefined')&&(templateMatrixInfo.matrixYHeight!=null))
{this.matrixYHeight=templateMatrixInfo.matrixYHeight;}
if((typeof(templateMatrixInfo.matrixYpositionThanks)!='undefined')&&(templateMatrixInfo.matrixYpositionThanks!=null))
{this.matrixYpositionThanks=templateMatrixInfo.matrixYpositionThanks;}
if((typeof(templateMatrixInfo.matrixXlength)!='undefined')&&(templateMatrixInfo.matrixXlength!=null))
{this.matrixXlength=templateMatrixInfo.matrixXlength;}
if((typeof(templateMatrixInfo.matrixAllXlength)!='undefined')&&(templateMatrixInfo.matrixAllXlength!=null))
{this.matrixAllXlength=templateMatrixInfo.matrixAllXlength;}
if((typeof(templateMatrixInfo.matrixAllYlength)!='undefined')&&(templateMatrixInfo.matrixAllYlength!=null))
{this.matrixAllYlength=templateMatrixInfo.matrixAllYlength;}
if((typeof(templateMatrixInfo.starWidth)!='undefined')&&(templateMatrixInfo.starWidth!=null))
{this.starWidth=templateMatrixInfo.starWidth;}
if((typeof(templateMatrixInfo.starHeight)!='undefined')&&(templateMatrixInfo.starHeight!=null))
{this.starHeight=templateMatrixInfo.starHeight;}
if((typeof(templateMatrixInfo.shadowYoffset)!='undefined')&&(templateMatrixInfo.shadowYoffset!=null))
{this.shadowYoffset=templateMatrixInfo.shadowYoffset;}}}
var outbrain_error_manager_object=typeof(outbrain_error_manager_object)=="function"?outbrain_error_manager_object:function(){var self_errorMng=this;this.isAlreadySent=false;this.errorList=new Array();this.init=function(){new outbrain_timeout(function(){return self_errorMng.checkIsError()},function(){self_errorMng.sendError();},null,null,20000,4,false)}
this.isPassFilterError=function(errorSeverity){var result=true;if(outbrain_settings.blogUtils.blogHrefLocation.toLowerCase().indexOf("search")>0)result=false;if(outbrain_settings.blogUtils.blogHrefLocation.toLowerCase().indexOf("translate")>0)result=false;if(outbrain_settings.blogUtils.blogHrefLocation.toLowerCase().indexOf("archives.html")>0)result=false;if(typeof(OB_error_level)=='number'&&OB_error_level>errorSeverity)result=false;return result;}
this.addError=function(errorId,errorDesc,errorSeverity){if(this.isPassFilterError(errorSeverity)){this.errorList[this.errorList.length]=new this.error_obj(errorId,errorDesc,errorSeverity);}
if(typeof(OB_error_output)=='string'&&OB_error_output=='console'){console.log(this.getErrorString(errorSeverity)+":"+errorDesc)}}
this.checkIsError=function(){if(self_errorMng.errorList.length==0)return false;return true;}
this.sendError=function(){if(self_errorMng.isAlreadySent)return;self_errorMng.isAlreadySent=true;var errorToSend=null;var maxSeverity=0;for(var t=0;t<self_errorMng.errorList.length;t++){if(self_errorMng.errorList[t].error_severity>maxSeverity)errorToSend=this.errorList[t];}
if(errorToSend)self_errorMng.createErrorRequest(errorToSend);}
this.whatBroswer=function(){}
this.createErrorRequest=function(errorToSend){if(errorToSend==null)return;outbrain_settings.blogUtils.errorManager=outbrain_settings.blogUtils.errorManager.replace(/\$ERROR_CODE/g,errorToSend.error_id);outbrain_settings.blogUtils.errorManager=outbrain_settings.blogUtils.errorManager.replace(/\$ERROR_DESC/g,encodeURIComponent(errorToSend.error_desc));outbrain_settings.blogUtils.errorManager=outbrain_settings.blogUtils.errorManager.replace(/\$ERROR_SEVERITY/g,errorToSend.error_severity);outbrain_settings.blogUtils.errorManager=outbrain_settings.blogUtils.errorManager.replace(/\$ERROR_TEMPLATE/g,errorToSend.error_tmpl);outbrain_settings.blogUtils.errorManager=outbrain_settings.blogUtils.errorManager.replace(/\$ERROR_BROSWER/g,outbrain_browsers.agt);outbrain_settings.blogUtils.errorManager=outbrain_settings.blogUtils.errorManager.replace(/\$ERROR_OS/g,outbrain_browsers.os);outbrain_settings.blogUtils.errorManager=outbrain_settings.blogUtils.errorManager.replace(/\$ERROR_SOURCE/g,outbrain_settings.blogUtils.sourceId);outbrain_settings.blogUtils.errorManager=outbrain_settings.blogUtils.errorManager.replace(/\$LOCAL_URL/g,outbrain_settings.blogUtils.blogHrefLocation);self_errorMng.addErrorRequest(outbrain_settings.blogUtils.errorManager);}
this.addErrorRequest=function(OBpath){var OB_SE=document.createElement("script");OB_SE.setAttribute('id','OBErrorCall');OB_SE.setAttribute('type','text/javascript');OB_SE.setAttribute('src',OBpath);var heads=document.getElementsByTagName("head");if(heads.length>0){heads[0].insertBefore(OB_SE,heads[0].firstChild);}}
this.error_obj=function(errorId,errorDesc,errorSeverity){this.error_id=errorId;this.error_desc=errorDesc;this.error_severity=errorSeverity;this.error_tmpl=(typeof(OB_Template)=='string')?OB_Template:'NA';}
this.getErrorString=function(errorNum){switch(errorNum){case 1:return"Debug";break;case 2:return"Error";break;case 3:return"Fatal";break;default:return"unknown";break;}}
this.DEBUG=1;this.ERROR=2;this.FATAL=3;this.init();}
var outbrain_customSettings_object=typeof(outbrain_customSettings_object)=="function"?outbrain_customSettings_object:function(){var self_custom=this;this.ready=false;this.pageLoaded=false;this.itemInserted=false;this.fullSettingReady=false;this.isReadyMP=false;this.hasSettings=false;this.stopRater=false;this.insertCustomSettingsScriptIntoDom=function(scriptElement){new outbrain_timeout(function(){var returnValue=false;if(OB_odb_life!=null){returnValue=((OB_odb_life.getStatus()==OB_odb_life.STAT_OK)&&(document.getElementsByTagName("head").length>0));}
return returnValue;},function(){var heads=document.getElementsByTagName("head");heads[0].appendChild(scriptElement);},null,null,100,15,false)}
this.waitToOdbLifeSign=function(){new outbrain_timeout(function(){return(OB_odb_life.getStatus()==OB_odb_life.STAT_OK);},function(){self_custom.setUserCustomSettings();},null,null,100,15,false)}
this.getWindowName=function(){if(outbrain_settings.windowName==null){var randomstring='';var string_length=8;for(var i=0;i<string_length;i++){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var rnum=Math.floor(Math.random()*chars.length);randomstring+=chars.substring(rnum,rnum+1);}
if((typeof(window.name)=='string')&&((window.name=="")||(window.name.indexOf("frame")>-1))){window.name=randomstring;outbrain_settings.rater.windowName=window.name;}else{if((typeof(window.name)=='string')&&((window.name!=""))){outbrain_settings.rater.windowName=window.name;}else{outbrain_settings.rater.windowName=randomstring;}}}}
this.getBlogTemplateName=function(){if((typeof(OB_platformType)=='number')&&(OB_platformType==outbrain_settings.PLATFORM_TYPE_BLOGGER_SIDEBAR)){var pageSkin=document.getElementById('page-skin-1');if(pageSkin){var allLines=pageSkin.innerHTML;var nameLine=allLines.match("([Tt]emplate|[Nn]ame).*: *(.+)");if(nameLine!=null&&nameLine.length==3){var tnameStr=nameLine[2];OB_Template='BS:'+encodeURIComponent(tnameStr);}}}}
this.getSearchReferrer=function(){var sRef="";var regexS="";var engine="";try{var documentRef=document.referrer;if(documentRef!=''){if(documentRef.indexOf("google")>0){regexS="[\\?&]q=([^&#]*)";engine="goo:";}else if(documentRef.indexOf("search.yahoo")>0){regexS="[\\?&]p=([^&#]*)";engine="yho:";}else if(documentRef.indexOf("search.live")>0||documentRef.indexOf("search.msn")>0){regexS="[\\?&]q=([^&#]*)";engine="mic:";}}
var regex=new RegExp(regexS);var results=regex.exec(documentRef);if(results==null||results=='undefined'){sRef="";}else{sRef=results[1];if(sRef!=null&&sRef!='undefined'&&sRef.length>0)sRef=engine+encodeURIComponent(sRef);}}
catch(ex){return("");}
return(sRef);}
this.loadUserCustomSettings=function(){this.getBlogTemplateName();this.getWindowName();outbrain_settings.blogUtils.getBlogSettings=outbrain_settings.blogUtils.getBlogSettings.replace(/\$SIG/g,outbrain_settings.rater.windowName);outbrain_settings.blogUtils.getBlogSettings=outbrain_settings.blogUtils.getBlogSettings.replace(/\$BLG_TEMPLATE/g,(typeof(OB_Template)=='string')?"&tmpl="+OB_Template:'');var script=document.createElement("script");script.type=outbrain_settings.globals.scriptType;script.id=outbrain_settings.customSettings.id;script.src=outbrain_settings.blogUtils.getBlogSettings;this.insertCustomSettingsScriptIntoDom(script);}
this.setMPUserCustomSettings=function(){var testString=((outbrain_settings.demoMode)?'test.':'');var partnerKey=outbrain_settings.keys_and_users.partnerKey;outbrain_settings.odb.MPRequest=outbrain_settings.odb.MPRequest.replace(/\$KEY/g,partnerKey);outbrain_settings.odb.MPwlRequest=outbrain_settings.odb.MPwlRequest.replace(/\$KEY/g,partnerKey);if(typeof(OB_MP_cssLinkUrl)=='string'){outbrain_settings.MP.css=OB_MP_cssLinkUrl;}
if(typeof(OB_MP_hideTitle)=='boolean'){outbrain_settings.MP.others.hideTitle=OB_MP_hideTitle;}
if(typeof(OB_MP_title)=='string'){outbrain_settings.MP.others.widgetTitle=OB_MP_title;}
if(typeof(OB_MP_postTitleMaxChar)=='number'){outbrain_settings.MP.others.titleMaxChar=OB_MP_postTitleMaxChar;}
if(typeof(OB_MP_titleTagName)=='string'){outbrain_settings.MP.others.titleTagName=OB_MP_titleTagName;}
if(typeof(OB_MP_titleClassName)=='string'){outbrain_settings.MP.others.titleClassName=OB_MP_titleClassName;}
if(typeof(OB_MP_listItemType)=='string'){if(OB_MP_listItemType.toLowerCase()=="ordered"||OB_MP_listItemType.toLowerCase()=="unordered"){MP_global_settings.design.listItemType=OB_MP_listItemType.toLowerCase();}}
this.isReadyMP=true;}
this.blogSettingsCB=function(blogHasSettings){self_custom.hasSettings=blogHasSettings;self_custom.setUserCustomSettings();}
this.setUserCustomSettings=function(){if(typeof(OB_srcId)=='number'){outbrain_settings.blogUtils.sourceId=OB_srcId;}
if(typeof(OB_platformType)=='number'){outbrain_settings.platformType=OB_platformType;}
if(typeof(OB_demoMode)=='boolean'){outbrain_settings.demoMode=false;}
if(typeof(OB_agentId)=='string'){outbrain_settings.keys_and_users.agentId=OB_agentId;}
if(typeof(OB_partnerName)=='string'){outbrain_settings.keys_and_users.partnerName=OB_partnerName;}
if(typeof(OB_user)=='string'){outbrain_settings.keys_and_users.userName=OB_user;}
if(typeof(OB_partnerKey)=='string'){outbrain_settings.keys_and_users.partnerKey=OB_partnerKey;}
if(typeof(OB_showFramePage)=='boolean'){outbrain_settings.rater.recommendations.showFramePage=OB_showFramePage;}
if(typeof(OB_openNewTab)=='boolean'){outbrain_settings.rater.recommendations.openNewTab=OB_openNewTab;}
if(typeof(OB_self_posts)=='boolean'){outbrain_settings.rater.recommendations.selfPost=OB_self_posts;}
if(typeof(OB_stop_rater)=='boolean'){this.stopRater=OB_stop_rater;}
if(typeof(OB_defaultRecNumber)=='number'){if(OB_defaultRecNumber>0)
outbrain_settings.rater.recommendations.defaultRecNumber=OB_defaultRecNumber;}
if(typeof(OB_MP_parentContainer)=='string'){outbrain_settings.MP.ids.parentContainerDiv=OB_MP_parentContainer;}
if(typeof(OB_isDisqus)=='boolean'){outbrain_settings.rater.isDisqus=OB_isDisqus;}
if(typeof(OB_isStars)=='boolean'){outbrain_settings.rater.isStars=OB_isStars;}
if(typeof(OB_topPaddingThreshold)=='number'){outbrain_settings.odb.topPaddingThreshold=OB_topPaddingThreshold;}
if(typeof(OB_bottomPaddingThreshold)=='number'){outbrain_settings.odb.bottomPaddingThreshold=OB_bottomPaddingThreshold;}
if(typeof(OB_eagerOdbCalls)=='number'){outbrain_settings.odb.eagerOdbCalls=OB_eagerOdbCalls;}
if(typeof(OB_isOdbCallsSerial)=='boolean'){outbrain_settings.odb.isOdbCallsSerial=OB_isOdbCallsSerial;}
if(typeof(OB_displaySameSiteTitle)=='boolean'){outbrain_settings.rater.recommendations.displaySameSiteTitle=OB_displaySameSiteTitle;}
if(typeof(OB_cleanPermalink)=='boolean'){outbrain_settings.rater.cleanPermalink=OB_cleanPermalink;}
if(typeof(OB_PC_enable)=='boolean'){outbrain_settings.rater.recommendations.isPcEnabled=OB_PC_enable;}
if(typeof(OB_user_template)!='undefined'){var templateToSearch="thumbs_template";if(OB_user_template.length>0){for(var t=0;t<OB_user_template.length;t++){if(OB_user_template[t].indexOf(templateToSearch)>0){if(typeof(outbrain_settings.rater.isThumbs)=='boolean'){outbrain_settings.rater.isThumbs=true;}}}}}
var recNumParam="";if(typeof(OB_RecNumberFetch)=='number'){if(OB_RecNumberFetch>0){outbrain_settings.rater.recommendations.recNumberToFetch=OB_RecNumberFetch;recNumParam="&num="+OB_RecNumberFetch;}}
outbrain_settings.odb.odbGetDataUrlRec=outbrain_settings.odb.odbGetDataUrlRec.replace(/\$NUM/g,recNumParam);var testString=((outbrain_settings.demoMode)?'test.':'');outbrain_settings.domains.traffic=outbrain_settings.domains.traffic.replace(/\$IS_TEST/g,testString);outbrain_settings.odb.odbRatesRecorder=outbrain_settings.odb.odbRatesRecorder.replace(/\$IS_TEST/g,testString);outbrain_settings.odb.odbGetDataUrlGlobal=outbrain_settings.odb.odbGetDataUrlGlobal.replace(/\$IS_TEST/g,testString);outbrain_settings.odb.odbGetDataUrlRec=outbrain_settings.odb.odbGetDataUrlRec.replace(/\$IS_TEST/g,testString);outbrain_settings.odb.odbGetDataUrlRegular=outbrain_settings.odb.odbGetDataUrlRegular.replace(/\$IS_TEST/g,testString);outbrain_settings.odb.odbGetDataUrlRec=outbrain_settings.odb.odbGetDataUrlRec.replace(/\$SELF_POSTS/g,((typeof(outbrain_settings.rater.recommendations.selfPost)=='boolean')?"&blog_posts="+outbrain_settings.rater.recommendations.selfPost:""));if(outbrain_settings.keys_and_users.userName!=null){outbrain_settings.odb.odbGetDataUrlRegular+="&user="+outbrain_settings.keys_and_users.userName;}
if(outbrain_settings.keys_and_users.partnerName!=null){outbrain_settings.odb.odbGetDataUrlRegular+="&type=both";}
if(typeof(OB_langJS)=='string'&&OB_langJS!=''){outbrain_settings.language.url=OB_langJS;}
if(outbrain_settings.rater.recommendations.showFramePage==false){outbrain_settings.odb.odbGetDataUrlRec=outbrain_settings.odb.odbGetDataUrlRec.replace(/\$FRAMECONTROL/g,"&hideFP=true");}else{outbrain_settings.odb.odbGetDataUrlRec=outbrain_settings.odb.odbGetDataUrlRec.replace(/\$FRAMECONTROL/g,"");}
var partnerKey=outbrain_settings.keys_and_users.partnerKey;outbrain_settings.odb.odbGetDataUrlGlobal=outbrain_settings.odb.odbGetDataUrlGlobal.replace(/\$KEY/g,partnerKey);outbrain_settings.odb.odbGetDataUrlRegular=outbrain_settings.odb.odbGetDataUrlRegular.replace(/\$KEY/g,partnerKey);outbrain_settings.odb.odbGetDataUrlRec=outbrain_settings.odb.odbGetDataUrlRec.replace(/\$KEY/g,partnerKey);if(!this.stopRater){this.ready=true;}}
this.sendInlineCS=function(OBBSpath){var OBBS_SE=document.createElement("script");OBBS_SE.setAttribute('id','OBBSCall');OBBS_SE.setAttribute('type','text/javascript');OBBS_SE.setAttribute('src',OBBSpath);var heads=document.getElementsByTagName("head");if(heads.length>0){heads[0].insertBefore(OBBS_SE,heads[0].firstChild);}}
this.postSettings=function(){var langId=outbrain_template_manager.templates[0].getLanguageId();var isSrvPc=outbrain_language_manager.languages_list[langId].OPTIONAL_ADDONS.pc;if(isSrvPc!=null&&isSrvPc==true&&(typeof(outbrain_settings.rater.recommendations.isPcEnabled)=='boolean'&&outbrain_settings.rater.recommendations.isPcEnabled==true)){outbrain_settings.odb.odbGetDataUrlRec=outbrain_settings.odb.odbGetDataUrlRec.replace(/\$SRVPC/g,'&srv_pc=true');}else{outbrain_settings.odb.odbGetDataUrlRec=outbrain_settings.odb.odbGetDataUrlRec.replace(/\$SRVPC/g,'');}
outbrain_settings.odb.odbGetDataUrlGlobal=outbrain_settings.odb.odbGetDataUrlGlobal.replace(/\$AGENT/g,outbrain_settings.rater.recommendations.agentId);outbrain_settings.odb.odbGetDataUrlRegular=outbrain_settings.odb.odbGetDataUrlRegular.replace(/\$AGENT/g,outbrain_settings.rater.recommendations.agentId);outbrain_settings.odb.odbGetDataUrlRec=outbrain_settings.odb.odbGetDataUrlRec.replace(/\$AGENT/g,outbrain_settings.rater.recommendations.agentId+"_rec");var numberVisible='&num_visible='+outbrain_settings.rater.recommendations.defaultRecNumber;outbrain_settings.odb.odbGetDataUrlRec=outbrain_settings.odb.odbGetDataUrlRec.replace(/\$VISIBLE_RECS/g,numberVisible);}
this.inlineCSUrlOnLoad=function(){new outbrain_timeout(function(){return self_custom.ready;},function(){var OBBSEpochTime=1210838298671;var OBBSSExpiration=777600000;var OBBStmpDate=new Date();var OBBSNow=OBBStmpDate.getTime();var customfeedUrl=self_custom.extractFeedUrl();var customAPIkey=null;OBCTm=typeof(OBCTm)!='undefined'?OBCTm:OBBSEpochTime;if(self_custom.hasSettings!=true){if(((OBBSEpochTime<OBCTm)&&(OBBSNow-OBCTm<OBBSSExpiration))||((OBBSEpochTime>=OBCTm)&&(OBBSEpochTime+OBBSSExpiration>OBBSNow))){if(outbrain_settings.keys_and_users.outbrainKey==null){outbrain_settings.keys_and_users.outbrainKey=self_custom.getOutbrainKey();customAPIkey=outbrain_settings.keys_and_users.outbrainKey;}
if(customAPIkey!=null||customfeedUrl!=null||outbrain_settings.blogUtils.blogHrefLocation.length>0){var obSettings=new Array();obSettings[0]=['OB_ITm',typeof(OBITm)!='undefined'?OBITm:null];obSettings[1]=['OB_showRec',typeof(OB_showRec)!='undefined'?OB_showRec:null];obSettings[2]=['OB_langJS',typeof(OB_langJS)!='undefined'?(OB_langJS!=''?OB_langJS:null):null];obSettings[3]=['OB_MP_itemsCount',typeof(OB_MP_itemsCount)!='undefined'?OB_MP_itemsCount:null];obSettings[4]=['OB_self_posts',typeof(OB_self_posts)!='undefined'?OB_self_posts:null];obSettings[5]=['OB_MP_title',typeof(OB_MP_title)!='undefined'?encodeURIComponent(OB_MP_title):null];if(customfeedUrl==null){customfeedUrl="";}else{customfeedUrl=encodeURIComponent(customfeedUrl);}
if(customAPIkey==null){customAPIkey="";}else{customAPIkey=customAPIkey;}
outbrain_settings.blogUtils.submitBlogSettings=outbrain_settings.blogUtils.submitBlogSettings.replace(/\$USER_KEY/g,customAPIkey);outbrain_settings.blogUtils.submitBlogSettings=outbrain_settings.blogUtils.submitBlogSettings.replace(/\$SOURCE_URL/g,customfeedUrl);outbrain_settings.blogUtils.submitBlogSettings=outbrain_settings.blogUtils.submitBlogSettings.replace(/\$LOCAL_URL/g,outbrain_settings.blogUtils.blogHrefLocation);var OBBSpath=outbrain_settings.blogUtils.submitBlogSettings;var isDoSubmit=false;for(i=0;i<obSettings.length;i++){if(obSettings[i][1]!=null&&obSettings[i][1]!='undefined'){OBBSpath+='&'+obSettings[i][0]+'='+obSettings[i][1];isDoSubmit=true;}}
if(isDoSubmit)
self_custom.sendInlineCS(OBBSpath);}}}},null,null,500,20,true);}
this.registerSubmitSettings=function(){if(self_custom.pageLoaded==true)self_custom.inlineCSUrlOnLoad();if(window.addEventListener){window.addEventListener("load",function(){self_custom.inlineCSUrlOnLoad();},false)}else if(window.attachEvent){window.attachEvent("onload",function(){self_custom.inlineCSUrlOnLoad();})}else if(document.getElementById){var oldOnLoad=window.onload;window.onload=function(){oldOnLoad();self_custom.inlineCSUrlOnLoad();}}}
this.isElementExist=function(tagName,attrName,attrValue){var allObjs=document.getElementsByTagName(tagName);if(typeof(allObjs)=='undefined')return false;for(var i=0;i<allObjs.length;i++){var attr=allObjs[i].getAttribute(attrName);if(attr==attrValue){return true;}}
return false;}
this.getElementByData=function(tagName,attrName,attrValue){try{var allObjs=document.getElementsByTagName(tagName);if(typeof(allObjs)=='undefined')return null;for(var i=0;i<allObjs.length;i++){var attr=allObjs[i].getAttribute(attrName);if(attr==attrValue){return allObjs[i];}}}
catch(ex){return null;}
return null;}
this.getOutbrainKey=function(){var key=null;var keyTags=document.getElementsByName(outbrain_settings.customSettings.keyTagName);if(keyTags.length>0){if(keyTags[0].value!=null){key=keyTags[0].value;}else
key=keyTags[0].content;key=encodeURIComponent(key);}else if(typeof(OB_outbrainKey)=='string'){key=encodeURIComponent(OB_outbrainKey);}
return key;}
this.extractFeedUrl=function(){if(typeof(OB_MP_feed)=='string'){return OB_MP_feed;}
var head=document.getElementsByTagName("head");var url=null;if((head)&&(head.length>0)){var linkTags=head[0].getElementsByTagName("link");var currLink=null;for(var index=0;(index<linkTags.length&&url==null);++index){currLink=linkTags[index];if((currLink.type!=null)&&((currLink.type=="application/rss+xml")||(currLink.type=="application/atom+xml"))&&(currLink.href!=null)&&(currLink.href!='')){url=currLink.href;}}}
return url;}
this.callSubmitSettingsAndGetSettings=function(apiKey,feedUrl,localUrl){outbrain_settings.blogUtils.getBlogSettings=outbrain_settings.blogUtils.getBlogSettings.replace(/\$USER_KEY/g,apiKey!=null?apiKey:'');outbrain_settings.blogUtils.getBlogSettings=outbrain_settings.blogUtils.getBlogSettings.replace(/\$SOURCE_URL/g,feedUrl!=null?feedUrl:'');outbrain_settings.blogUtils.getBlogSettings=outbrain_settings.blogUtils.getBlogSettings.replace(/\$LOCAL_URL/g,localUrl!=null?localUrl:'');self_custom.registerSubmitSettings();self_custom.loadUserCustomSettings();}
this.getSetByLocalUrlMode=function(){if(typeof(OB_settingsByLocalUrlMode)=='number'){return OB_settingsByLocalUrlMode;}
return 0;}
this.init=function(){var apiKey=null;var feedUrl=null;var localUrl=outbrain_settings.blogUtils.blogHrefLocation;new outbrain_timeout(function(){var isSuccess=false;if(outbrain_settings.customSettings.enabled){outbrain_settings.keys_and_users.outbrainKey=self_custom.getOutbrainKey();if(outbrain_settings.keys_and_users.outbrainKey!=null){apiKey=outbrain_settings.keys_and_users.outbrainKey;isSuccess=true;}
feedUrl=self_custom.extractFeedUrl();if(feedUrl!=null){feedUrl=encodeURIComponent(feedUrl);isSuccess=true;}
if(self_custom.getSetByLocalUrlMode()==2){localUrl="";}
if(self_custom.getSetByLocalUrlMode()==1&&localUrl.length>0){isSuccess=true;}}
return isSuccess;},function(){self_custom.callSubmitSettingsAndGetSettings(apiKey,feedUrl,localUrl);},null,function(){if((localUrl.length>0)&&(self_custom.getSetByLocalUrlMode()==0||self_custom.getSetByLocalUrlMode()==1)){self_custom.callSubmitSettingsAndGetSettings("","",localUrl);}else{self_custom.waitToOdbLifeSign();}},500,10,true,function(){return(self_custom.pageLoaded==true);});}
this.init();}
var outbrain_timeout=function(checkFunction,onSuccess,onFailed,onTotalFailed,milliSeconds,maxTimes,gradualTimeout,isBreak){var self=this;var reTried=0;this.start=function(){reTried++;if(checkFunction()){onSuccess();}else{if((typeof(isBreak)=='function'&&isBreak())||((reTried==maxTimes)&&(maxTimes!=1000))){if(typeof(onTotalFailed)=='function'){onTotalFailed();}else{return;}}else{if(typeof(onFailed)=='function'){onFailed();}
if(gradualTimeout){setTimeout(function(){self.start()},milliSeconds);}else{setTimeout(function(){self.start()},reTried*milliSeconds);}}}}
this.start();}
var outbrain_odb_life_object=typeof(outbrain_odb_life_object)=='function'?outbrain_odb_life_object:function(maxSec,source,id){this.STAT_OK=1;this.STAT_NO_LOAD_EVENT=2;this.STAT_TIME_ELAPSED=3;this.odbLife=false;this.frameSrc=source;this.frameId=id;this.startTime=null;this.finishTime=null;this.timeDiff=null;this.maxOkTimeDiff=maxSec;this.responseTimeout=null;this.noResponseTimeout=null;this.staticMode=(typeof(OB_odb_static_mode)=='boolean')?OB_odb_static_mode:false;var self=this;this.init=function(){if(!self.staticMode){this.addRandomNumber();var odbIframe="<iframe id="+this.frameId+" frameBorder='0' name='odbFrame' style='width:0px;height:0px;display:none;'></iframe>";this.insert(odbIframe);this.start();}}
this.addRandomNumber=function(){var index=this.frameSrc.indexOf("?");var random=Math.random();var randomStr="random="+random;if(index>-1){this.frameSrc+="&"+randomStr;}else{this.frameSrc+="?"+randomStr;}}
this.getIframeElement=function(){return document.getElementById(this.frameId);}
this.insert=function(str){document.write(str);}
this.redirect=function(strLocation){var odbIframe=self.getIframeElement();if(odbIframe){this.startTime=new Date();window.frames['odbFrame'].location.replace(strLocation);}}
this.start=function(){var odbIframe=self.getIframeElement();if(odbIframe){if(document.addEventListener)
odbIframe.addEventListener("load",function(){self.frameReady();},false);else if(document.attachEvent)
odbIframe.attachEvent("onload",function(){self.frameReady();});else if(document.getElementById)
odbIframe.onload=function(){self.frameReady();}
self.redirect(self.frameSrc);this.noResponseTimeout=setTimeout(function(){self.noResponseAfterMaxTime();},self.maxOkTimeDiff*1000);}else{this.responseTimeout=setTimeout(self.start,1000);}}
this.frameReady=function(){this.finishTime=new Date();clearTimeout(this.noResponseTimeout);this.getTimeDiff();this.odbLife=true;}
this.noResponseAfterMaxTime=function(){clearTimeout(this.responseTimeout);this.removeFrame();}
this.getTimeDiff=function(){this.timeDiff=((this.finishTime.getTime()-this.startTime.getTime())/1000);}
this.removeFrame=function(){var element=this.getIframeElement();if(element){window.frames['odbFrame'].location.replace('about:blank');element.parentNode.removeChild(element);}}
this.getStatus=function(){var retStatus=this.STAT_OK;if(!self.staticMode){if(!this.odbLife){retStatus=this.STAT_NO_LOAD_EVENT;}
else if(this.timeDiff>this.maxOkTimeDiff){retStatus=this.STAT_TIME_ELAPSED;}}
return retStatus;}
this.init();}
var outbrain_PositionCalc=function(){var self_loc_calc=this;this.topThreshold=0;this.bottomThreshold=0;this.isSerial=false;this.topY=0;this.vpHeight=0;this.setSerialMode=function(isSerialMode){this.isSerial=isSerialMode;}
this.reCalc=function(){this.topY=this.getTopY();this.vpHeight=this.getViewportHeight();}
this.getTopY=function(){var topHeightY
try{if(typeof(window.pageYOffset)!='undefined'){topHeightY=(window.pageYOffset);}
if(document.documentElement.scrollTop){topHeightY=(document.documentElement.scrollTop);}
else{topHeightY=(document.body.scrollTop);}}
catch(ex){return outbrain_settings.odb.ERRED;}
return topHeightY;}
this.getElementY=function(obj){var curtop=0;try{if(typeof(obj)=='undefined')
return outbrain_settings.odb.ERRED;if(obj.offsetParent){while(1){curtop+=obj.offsetTop;if(typeof(obj.offsetParent)==null)
return outbrain_settings.odb.ERRED;if(!obj.offsetParent){break;}
obj=obj.offsetParent;}}else{if(obj.y){curtop+=obj.y;}}}
catch(ex){return outbrain_settings.odb.ERRED;}
return curtop;}
this.getViewportHeight=function(){try{if(typeof window.innerWidth!='undefined'){viewportheight=window.innerHeight;}
else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientHeight!='undefined'&&document.documentElement.clientHeight!=0){viewportheight=document.documentElement.clientHeight;}else{viewportheight=document.getElementsByTagName('body')[0].clientHeight;}}catch(ex){return outbrain_settings.odb.ERRED;}
return viewportheight;}
this.checkIfElementInViewPort=function(element){if(element==null)
return outbrain_settings.odb.OUTSIDEFOLD;var y=this.getElementY(element);var top=this.topY;var vpH=this.vpHeight;var coverage=parseInt(vpH+top);if(y==outbrain_settings.odb.ERRED||top==outbrain_settings.odb.ERRED||vpH==outbrain_settings.odb.ERRED){return outbrain_settings.odb.ERRED;}else if(coverage>=y&&((top<y)||this.isSerial)){return outbrain_settings.odb.INSIDEFOLD;}else if(parseInt(coverage+this.bottomThreshold)>=y&&((top-this.topThreshold<y)||this.isSerial)){return outbrain_settings.odb.NEARFOLD;}else{return outbrain_settings.odb.OUTSIDEFOLD;}}}
var outbrain_dom_object=(typeof(outbrain_dom_object)=='function')?outbrain_dom_object:function(){this.$=function(id){return document.getElementById(id);}
this.elementInsertion=function(mainElement,newElement,top,inside){if(typeof(newElement)=='string'){var newElementNode=document.createElement("div");newElementNode.innerHTML=newElement;newElement=newElementNode;}
if(top==true){if(inside){newElement=this.insertBefore(newElement,mainElement.firstChild);}else{newElement=this.insertBefore(newElement,mainElement);}}else{if(inside){newElement=mainElement.appendChild(newElement);}else{newElement=this.insertAfter(newElement,mainElement);}}
return[newElement,mainElement];}
this.insertBefore=function(newNode,beforeNode){return beforeNode.parentNode.insertBefore(newNode,beforeNode);}
this.insertInside=function(newNode,mainElement){if(this.uncleFinder(mainElement)){return mainElement.appendChild(newNode);}else{return null;}}
this.extractFooter=function(parentDiv,footerClassName){var footerDiv=null;if(typeof(parentDiv)=='undefined')
return null;var divArray=parentDiv.getElementsByTagName("DIV");for(var i=0;i<divArray.length;i++)
{var div=divArray[i];if(div.className==footerClassName)
{footerDiv=div;}}
return footerDiv;}
this.uncleFinder=function(node){try{node=node.parentNode;while(typeof(node)!=null){if(node.nextSibling!=null){return true;}
node=node.parentNode;}
return false;}catch(error){return false;}}
this.insertAfter=function(newNode,afterNode){var newCreatedChild=null;var OB_pmd=outbrain_rater.pmd;if((outbrain_settings.platformType==outbrain_settings.PLATFORM_TYPE_BLOGGER_SIDEBAR)&&(outbrain_browsers.ie==true)){if(OB_pmd.postFooterDivClassname!=null){for(var footerTagIdx=0;footerTagIdx<OB_pmd.postFooterDivClassname.length;footerTagIdx++){var footerDiv=this.extractFooter(afterNode.parentNode,OB_pmd.postFooterDivClassname[footerTagIdx]);if(footerDiv!=null){try{newCreatedChild=afterNode.parentNode.insertBefore(newNode,afterNode.nextSibling);}catch(error){try{newCreatedChild=afterNode.nextSibling.parentNode.insertBefore(newNode,afterNode.nextSibling);}catch(innerError){newCreatedChild=null;}}
break;}}}}
else{newCreatedChild=afterNode.parentNode.insertBefore(newNode,afterNode.nextSibling);}
return newCreatedChild;}
this.setInnerHTML=function(currNode,newHTML){try{currNode.innerHTML=newHTML;}catch(error){var clonedNode=currNode.cloneNode(false);clonedNode.innerHTML=newHTML;currNode.parentNode.replaceChild(clonedNode,currNode);}}
this.extractFeedUrl=function(){if(typeof(OB_MP_feed)=='string'){return OB_MP_feed;}
var head=document.getElementsByTagName("head");var url=null;if((head)&&(head.length>0)){var linkTags=head[0].getElementsByTagName("link");var currLink=null;for(var index=0;(index<linkTags.length&&url==null);++index){currLink=linkTags[index];if((currLink.type!=null)&&((currLink.type=="application/rss+xml")||(currLink.type=="application/atom+xml"))&&(currLink.href!=null)&&(currLink.href!='')){url=currLink.href;}}}
return url;}}
var OB_lang_object=function(){this.isInit=false;var self=this;this.id="EN";this.name="LANGUAGE_NAME";this.RATE_DESCRIPTION=["BAD_STR","BORING_STR","OK_STR","GOOD_STR","EXCELLENT_STR"];this.PERSONAL_RATE_DESC=["DISLIKED_{X.xx}_BY_{Y}_PEOPLE_LIKE_YOU","RATED_{X.xx}_BY_{Y}_PEOPLE_LIKE_YOU","RECOMMENDED_{X.xx}_BY_{Y}_PEOPLE_LIKE_YOU"];this.RATE_POST_RATE=["YOU_HATED_STRING","DIDNT_LIKE_STRING","WAS_OK_STRING","LIKED_STRING","LOVE_STRING"];this.RATE_POST_RATE_FOR_RECOMMENDATIONS=["OUR_READERS_ALSO_LIKE:","YOU_HATED_THIS_POST_({starsImage}),_YOU_MIGHT_LIKE:","YOU_DIDN'T_LIKE_THIS_POST_({starsImage}),_YOU_MIGHT_LIKE:","YOU_THOUGHT_THIS_WAS_OK_({starsImage}),_YOU_MIGHT_LIKE:","YOU_LIKED_THIS_POST_({starsImage}),_YOU_MIGHT_ALSO_LIKE:","YOU_LOVED_THIS_POST_({starsImage}),_YOU_MIGHT_ALSO_LIKE:"];this.THANKS_STR="THANKS....";this.BE_THE_FIRST_STR="BE_THE_FIRST_TO_RATE_THIS";this.UNABLE_TO_SUBMIT_STR="UNABLE_TO_SUBMIT_YOUR_RATE_PLEASE_CHECK_YOUR_INTERNET_CONNECTION.";this.RATED_X_BY_Y_PEOPLE="RATED_{X.xx}_BY_{Y}_PEOPLE";this.RATED_X_BY_1_PERSON="RATED_{X.xx}_BY_1_PERSON";this.AVERAGE_RATING_X_BY_Y_PEOPLE="AVERAGE_RATING_X.xx_BY_Y_PEOPLE";this.RATED_X_BY_YOU="RATED_{X.xx}_BY_Y0U";this.RATED_X_BY_YOU_AND_1_OTHER="RATED_{X.xx}_BY_Y0U_AND_1_OTHER";this.RATED_X_BY_YOU_AND_Y_OTHERS="RATED_{X.xx}_BY_Y0U_AND_{Y}_OTHERS";this.HOW="HOW?";this.BY="BY";this.WHATS_THIS="WHATS_THIS";this.THIS_SITE="THIS_SITE";this.MOST_POPULAR="Most_Popular_Posts";this.MIGHT_ALSO_LIKE="YOU_MIGHT_ALSO_LIKE";this.MORE_RECOMMENDED_SINGLE="MORE_RECOMMENDED_SINGLE";this.MORE_RECOMMENDED_PLURAL="MORE_RECOMMENDED_POSTS";this.MORE_RECOMMENDED_CLOSE_SINGLE="HIDE_MORE_RECOMMENDED_POST";this.MORE_RECOMMENDED_CLOSE_PLURAL="HIDE_MORE_RECOMMENDED_POSTS";this.PC_LEGEND_TITLE="BROUGHT_TO_YOU_BY_{PC}";this.COMMENT="COMMENT";this.IS_RTL=false;this.THUMBS_SUPPORT=new function(){this.THUMBS_RATE_POST_RATE_FOR_RECOMMENDATIONS=["You might be interested in:","You recommended this post. you might be interested in:"];this.THUMBS_THANKS_STR="Thanks....";this.THUMBS_RECOMMEND_THIS="Recommend this?";this.THUMBS_PERSONAL_RATE_DESC="Recommended by {Y} people <em>like you</em>";this.THUMBS_RATED_X_BY_Y_PEOPLE="Recommended by {Y} people";this.THUMBS_RATED_X_BY_1_PERSON="Recommended by 1 person";this.THUMBS_AVG_RATE_X_BY_Y_PEOPLE="Recommended by {Y} people";this.THUMBS_RATED_X_BY_YOU="<b>Recommended by you</b>";this.THUMBS_RATED_X_BY_YOU_AND_1_OTHER="<b>Recommended by you</b> and 1 other";this.THUMBS_RATED_X_BY_YOU_AND_Y_OTHERS="<b>Recommended by you</b> and {Y} others";this.THUMBS_CANCEL_RECOMMENDATION="Cancel Recommendation";this.THUMBS_AFTER_CANCEL="You do not recommend this post";this.THUMBS_COMMENT="comment";}
this.OPTIONAL_ADDONS=new function(){this.mostPopular=false;this.recommendations=false;this.disqus=false;this.pc=false;this.thumbs=false;}
this.initLang=function(lang){var i;if((typeof(lang.id)!='undefined')&&(lang.id!=null)){this.id=lang.id;}else{this.id="en";}
if((typeof(lang.name)!='undefined')&&(lang.name!=null)){this.name=lang.name;}else{this.name="en";}
for(i=0;i<this.RATE_DESCRIPTION.length;i++){if(lang.RATE_DESCRIPTION[i]!=null){this.RATE_DESCRIPTION[i]=lang.RATE_DESCRIPTION[i];}}
for(i=0;i<this.PERSONAL_RATE_DESC.length;i++){if(lang.PERSONAL_RATE_DESC[i]!=null){this.PERSONAL_RATE_DESC[i]=lang.PERSONAL_RATE_DESC[i];}}
for(i=0;i<this.RATE_POST_RATE.length;i++){if(lang.RATE_POST_RATE[i]!=null){this.RATE_POST_RATE[i]=lang.RATE_POST_RATE[i];}}
if(typeof(lang.RATE_POST_RATE_FOR_RECOMMENDATIONS)!='undefined'){for(i=0;i<this.RATE_POST_RATE_FOR_RECOMMENDATIONS.length;i++){if(lang.RATE_POST_RATE_FOR_RECOMMENDATIONS[i]!=null){this.RATE_POST_RATE_FOR_RECOMMENDATIONS[i]=lang.RATE_POST_RATE_FOR_RECOMMENDATIONS[i];}}}
if((typeof(lang.THANKS_STR)!='undefined')&&(lang.THANKS_STR!=null))
{this.THANKS_STR=lang.THANKS_STR;}
if((typeof(lang.MIGHT_ALSO_LIKE)!='undefined')&&(lang.MIGHT_ALSO_LIKE!=null))
{this.MIGHT_ALSO_LIKE=lang.MIGHT_ALSO_LIKE;}
if((typeof(lang.MORE_RECOMMENDED_SINGLE)!='undefined')&&(lang.MORE_RECOMMENDED_SINGLE!=null))
{this.MORE_RECOMMENDED_SINGLE=lang.MORE_RECOMMENDED_SINGLE;}
if((typeof(lang.MORE_RECOMMENDED_PLURAL)!='undefined')&&(lang.MORE_RECOMMENDED_PLURAL!=null))
{this.MORE_RECOMMENDED_PLURAL=lang.MORE_RECOMMENDED_PLURAL;}
if((typeof(lang.MORE_RECOMMENDED_CLOSE_SINGLE)!='undefined')&&(lang.MORE_RECOMMENDED_CLOSE_SINGLE!=null))
{this.MORE_RECOMMENDED_CLOSE_SINGLE=lang.MORE_RECOMMENDED_CLOSE_SINGLE;}
if((typeof(lang.MORE_RECOMMENDED_CLOSE_PLURAL)!='undefined')&&(lang.MORE_RECOMMENDED_CLOSE_PLURAL!=null))
{this.MORE_RECOMMENDED_CLOSE_PLURAL=lang.MORE_RECOMMENDED_CLOSE_PLURAL;}
if((typeof(lang.PC_LEGEND_TITLE)!='undefined')&&(lang.PC_LEGEND_TITLE!=null))
{this.PC_LEGEND_TITLE=lang.PC_LEGEND_TITLE;}
if((typeof(lang.BE_THE_FIRST_STR)!='undefined')&&(lang.BE_THE_FIRST_STR!=null))
{this.BE_THE_FIRST_STR=lang.BE_THE_FIRST_STR;}
if((typeof(lang.UNABLE_TO_SUBMIT_STR)!='undefined')&&(lang.UNABLE_TO_SUBMIT_STR!=null))
{this.UNABLE_TO_SUBMIT_STR=lang.UNABLE_TO_SUBMIT_STR;}
if((typeof(lang.HOW)!='undefined')&&(lang.HOW!=null))
{this.HOW=lang.HOW;}
if((typeof(lang.WHATS_THIS)!='undefined')&&(lang.WHATS_THIS!=null))
{this.WHATS_THIS=lang.WHATS_THIS;}
if((typeof(lang.BY)!='undefined')&&(lang.BY!=null))
{this.BY=lang.BY;}
if((typeof(lang.THIS_SITE)!='undefined')&&(lang.THIS_SITE!=null))
{this.THIS_SITE=lang.THIS_SITE;}
if((typeof(lang.MOST_POPULAR)!='undefined')&&(lang.MOST_POPULAR!=null))
{this.MOST_POPULAR=lang.MOST_POPULAR;}
if((typeof(lang.AVERAGE_RATING_X_BY_Y_PEOPLE)!='undefined')&&(lang.AVERAGE_RATING_X_BY_Y_PEOPLE!=null)&&(lang.AVERAGE_RATING_X_BY_Y_PEOPLE.indexOf('{X.xx}')>-1))
{this.AVERAGE_RATING_X_BY_Y_PEOPLE=lang.AVERAGE_RATING_X_BY_Y_PEOPLE;}
if((typeof(lang.RATED_X_BY_1_PERSON)!='undefined')&&(lang.RATED_X_BY_1_PERSON!=null)&&(lang.RATED_X_BY_1_PERSON.indexOf('{X.xx}')>-1))
{this.RATED_X_BY_1_PERSON=lang.RATED_X_BY_1_PERSON;}else if((typeof(lang.RATED_X_BY_1_PERSON)!='undefined')&&(lang.RATED_X_BY_1_PERSON!=null)&&(lang.RATED_X_BY_1_PERSON.indexOf('X.xx')>-1)){this.RATED_X_BY_1_PERSON=lang.RATED_X_BY_1_PERSON;}
if((typeof(lang.RATED_X_BY_Y_PEOPLE)!='undefined')&&(lang.RATED_X_BY_Y_PEOPLE!=null)&&(lang.RATED_X_BY_Y_PEOPLE.indexOf('{X.xx}')>-1))
{this.RATED_X_BY_Y_PEOPLE=lang.RATED_X_BY_Y_PEOPLE;}
if((typeof(lang.RATED_X_BY_YOU_AND_1_OTHER)!='undefined')&&(lang.RATED_X_BY_YOU_AND_1_OTHER!=null)&&(lang.RATED_X_BY_YOU_AND_1_OTHER.indexOf('{X.xx}')>-1))
{this.RATED_X_BY_YOU_AND_1_OTHER=lang.RATED_X_BY_YOU_AND_1_OTHER;}else if((typeof(lang.RATED_X_BY_YOU_AND_1_OTHER)!='undefined')&&(lang.RATED_X_BY_YOU_AND_1_OTHER!=null)&&(lang.RATED_X_BY_YOU_AND_1_OTHER.indexOf('{X.xx}')>-1)){this.RATED_X_BY_YOU_AND_1_OTHER=lang.RATED_X_BY_YOU_AND_1_OTHER;}
if((typeof(lang.RATED_X_BY_YOU_AND_Y_OTHERS)!='undefined')&&(lang.RATED_X_BY_YOU_AND_Y_OTHERS!=null)&&(lang.RATED_X_BY_YOU_AND_Y_OTHERS.indexOf('{X.xx}')>-1))
{this.RATED_X_BY_YOU_AND_Y_OTHERS=lang.RATED_X_BY_YOU_AND_Y_OTHERS;}
if((typeof(lang.RATED_X_BY_YOU)!='undefined')&&(lang.RATED_X_BY_YOU!=null)&&(lang.RATED_X_BY_YOU.indexOf('{X.xx}')))
{this.RATED_X_BY_YOU=lang.RATED_X_BY_YOU;}else if((typeof(lang.RATED_X_BY_YOU)!='undefined')&&(lang.RATED_X_BY_YOU!=null)&&(lang.RATED_X_BY_YOU.indexOf('X.xx'))){this.RATED_X_BY_YOU=lang.RATED_X_BY_YOU;}
if((typeof(lang.USERS_LIKE_YOU)!='undefined')&&(lang.USERS_LIKE_YOU!=null))
{this.USERS_LIKE_YOU=lang.USERS_LIKE_YOU;}
if(typeof(lang.COMMENT)!='undefined'){this.COMMENT=lang.COMMENT;}
if(typeof(lang.IS_RTL)=='boolean'){this.IS_RTL=lang.IS_RTL;}
if(typeof(lang.THUMBS_SUPPORT)!='undefined'){if(typeof(lang.THUMBS_SUPPORT.THUMBS_RATE_POST_RATE_FOR_RECOMMENDATIONS)!='undefined'){for(i=0;i<this.THUMBS_SUPPORT.THUMBS_RATE_POST_RATE_FOR_RECOMMENDATIONS.length;i++){if(lang.THUMBS_SUPPORT.THUMBS_RATE_POST_RATE_FOR_RECOMMENDATIONS[i]!=null){this.THUMBS_SUPPORT.THUMBS_RATE_POST_RATE_FOR_RECOMMENDATIONS[i]=lang.THUMBS_SUPPORT.THUMBS_RATE_POST_RATE_FOR_RECOMMENDATIONS[i];}}}
if((typeof(lang.THUMBS_SUPPORT.THUMBS_THANKS_STR)!='undefined')&&(lang.THUMBS_SUPPORT.THUMBS_THANKS_STR!=null))
{this.THUMBS_SUPPORT.THUMBS_THANKS_STR=lang.THUMBS_SUPPORT.THUMBS_THANKS_STR;}
if((typeof(lang.THUMBS_SUPPORT.THUMBS_RECOMMEND_THIS)!='undefined')&&(lang.THUMBS_SUPPORT.THUMBS_RECOMMEND_THIS!=null))
{this.THUMBS_SUPPORT.THUMBS_RECOMMEND_THIS=lang.THUMBS_SUPPORT.THUMBS_RECOMMEND_THIS;}
if((typeof(lang.THUMBS_SUPPORT.THUMBS_PERSONAL_RATE_DESC)!='undefined')&&(lang.THUMBS_SUPPORT.THUMBS_PERSONAL_RATE_DESC!=null))
{this.THUMBS_SUPPORT.THUMBS_PERSONAL_RATE_DESC=lang.THUMBS_SUPPORT.THUMBS_PERSONAL_RATE_DESC;}
if((typeof(lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_Y_PEOPLE)!='undefined')&&(lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_Y_PEOPLE!=null))
{this.THUMBS_SUPPORT.THUMBS_RATED_X_BY_Y_PEOPLE=lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_Y_PEOPLE;}
if((typeof(lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_1_PERSON)!='undefined')&&(lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_1_PERSON!=null))
{this.THUMBS_SUPPORT.THUMBS_RATED_X_BY_1_PERSON=lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_1_PERSON;}
if((typeof(lang.THUMBS_SUPPORT.THUMBS_AVG_RATE_X_BY_Y_PEOPLE)!='undefined')&&(lang.THUMBS_SUPPORT.THUMBS_AVG_RATE_X_BY_Y_PEOPLE!=null))
{this.THUMBS_SUPPORT.THUMBS_AVG_RATE_X_BY_Y_PEOPLE=lang.THUMBS_SUPPORT.THUMBS_AVG_RATE_X_BY_Y_PEOPLE;}
if((typeof(lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU)!='undefined')&&(lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU!=null))
{this.THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU=lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU;}
if((typeof(lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU_AND_1_OTHER)!='undefined')&&(lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU_AND_1_OTHER!=null))
{this.THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU_AND_1_OTHER=lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU_AND_1_OTHER;}
if((typeof(lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU_AND_Y_OTHERS)!='undefined')&&(lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU_AND_Y_OTHERS!=null))
{this.THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU_AND_Y_OTHERS=lang.THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU_AND_Y_OTHERS;}
if((typeof(lang.THUMBS_SUPPORT.THUMBS_CANCEL_RECOMMENDATION)!='undefined')&&(lang.THUMBS_SUPPORT.THUMBS_CANCEL_RECOMMENDATION!=null))
{this.THUMBS_SUPPORT.THUMBS_CANCEL_RECOMMENDATION=lang.THUMBS_SUPPORT.THUMBS_CANCEL_RECOMMENDATION;}
if((typeof(lang.THUMBS_SUPPORT.THUMBS_AFTER_CANCEL)!='undefined')&&(lang.THUMBS_SUPPORT.THUMBS_AFTER_CANCEL!=null))
{this.THUMBS_SUPPORT.THUMBS_AFTER_CANCEL=lang.THUMBS_SUPPORT.THUMBS_AFTER_CANCEL;}
if((typeof(lang.THUMBS_SUPPORT.THUMBS_COMMENT)!='undefined')&&(lang.THUMBS_SUPPORT.THUMBS_COMMENT!=null))
{this.THUMBS_SUPPORT.THUMBS_COMMENT=lang.THUMBS_SUPPORT.THUMBS_COMMENT;}}
if(typeof(lang.OPTIONAL_ADDONS)!='undefined'){if(typeof(lang.OPTIONAL_ADDONS.mostPopular)=='boolean'){this.OPTIONAL_ADDONS.mostPopular=lang.OPTIONAL_ADDONS.mostPopular;}
if(typeof(lang.OPTIONAL_ADDONS.recommendations)=='boolean'){this.OPTIONAL_ADDONS.recommendations=lang.OPTIONAL_ADDONS.recommendations;}
if(typeof(lang.OPTIONAL_ADDONS.disqus)=='boolean'){this.OPTIONAL_ADDONS.disqus=lang.OPTIONAL_ADDONS.disqus;}
if(typeof(lang.OPTIONAL_ADDONS.pc)=='boolean'){this.OPTIONAL_ADDONS.pc=lang.OPTIONAL_ADDONS.pc;}
if(typeof(lang.OPTIONAL_ADDONS.thumbs)=='boolean'){this.OPTIONAL_ADDONS.thumbs=lang.OPTIONAL_ADDONS.thumbs;}}
this.isInit=true;}};var outbrain_language_manager_object=function(){this.languages_list=[];var language_manager_self=this;this.addLanguage=function(name,file){if(typeof(this.languages_list[name])=='object'){return this.languages_list[name];}else{var jsDomain=outbrain_settings.domains.js;var langJS=file;var langId=outbrain_settings.language.id;if(langJS.indexOf(jsDomain)>-1){langJS=langJS.replace(/.js/g,"-"+outbrain_settings.versions.language+".js");}
var langScriptElement=document.createElement('script');langScriptElement.setAttribute('id',langId+"_"+name);langScriptElement.setAttribute('type',outbrain_settings.globals.scriptType);langScriptElement.setAttribute('src',langJS);var heads=document.getElementsByTagName("head");if(heads.length>0){heads[0].appendChild(langScriptElement);}else{document.write('<script id="'+langId+'" src="'+langJS+'" type="'+outbrain_settings.globals.scriptType+'"></script>');}}}
this.initLang=function(lang){lang.id=outbrain_settings.language.defaultLangName;this.languages_list[lang.id]=new OB_lang_object();this.languages_list[lang.id].initLang(lang);}
this.isLanguageReady=function(lang){return this.isInit(lang);}
this.isInit=function(lang){return((typeof(this.languages_list[lang])!='undefined')&&(typeof(this.languages_list[lang].isInit)!='undefined')&&(this.languages_list[lang].isInit));}
this.getName=function(lang){return(this.languages_list[lang].name);}
this.isRtl=function(lang){return(this.languages_list[lang].IS_RTL);}
this.changeX=function(str,num){num=Math.round(num*100)/100;var num_as_str=num+"";num_as_str=(num_as_str.length==1)?num_as_str+".0":num_as_str;num=num_as_str;if(str==null){return num;}else{var finalValue='';finalValue=str;finalValue=finalValue.replace(/{X.xx}/g,'<span class="outbrain-bold" style="font-weight:bold;">'+num+'</span>');finalValue=finalValue.replace(/X.xx/g,'<span class="outbrain-bold" style="font-weight:bold;">'+num+'</span>');return finalValue;}}
this.changeY=function(variable,variable2){var finalValue='';finalValue=variable;var num_as_str=variable2+"";num_as_str=(num_as_str.length>3)?num_as_str.substring(0,num_as_str.length-3)+","+num_as_str.substring(num_as_str.length-3,num_as_str.length):num_as_str;if(finalValue.indexOf("{Y}")>-1){finalValue=finalValue.replace(/{Y}/g,num_as_str);}else{finalValue=finalValue.replace(/ Y /g,' '+num_as_str+' ');}
return finalValue;}
this.rateGetAverageStr=function(lang,average,countAll){var str='';str=this.changeX(this.languages_list[lang].AVERAGE_RATING_X_BY_Y_PEOPLE,average);str=this.changeY(str,countAll);str='('+str+')';return str;}
this.rateGetLikeYou=function(msg,rank,countAll){var str='';str=this.changeX(msg,rank);str=this.changeY(str,' '+countAll+' ');return str;}
this.rateGetAggregate=function(lang,rank,countAll,withMe){var str='';if(withMe){if(countAll==1){str=this.changeX(this.languages_list[lang].RATED_X_BY_YOU,rank);}else if(countAll==2){str=this.changeX(this.languages_list[lang].RATED_X_BY_YOU_AND_1_OTHER,rank);}else{countAll--;str=this.changeX(this.languages_list[lang].RATED_X_BY_YOU_AND_Y_OTHERS,rank);str=this.changeY(str,countAll);}}else{if(countAll==1){str=this.changeX(this.languages_list[lang].RATED_X_BY_1_PERSON,rank);}else{str=this.changeX(this.languages_list[lang].RATED_X_BY_Y_PEOPLE,rank);str=this.changeY(str,countAll);}}
return str;}
this.getRateDescription=function(lang,num){return(this.languages_list[lang].RATE_DESCRIPTION[num]);}
this.getPersonalRateDesc=function(lang,num){var str='';str=this.languages_list[lang].PERSONAL_RATE_DESC[num];return str;}
this.getRatePostRate=function(lang,num){return this.languages_list[lang].RATE_POST_RATE[num];}
this.getRatePostRateForRecommendations=function(lang,rate){var value;value=this.languages_list[lang].RATE_POST_RATE_FOR_RECOMMENDATIONS[rate];return value;}
this.getThanksString=function(lang){return(this.languages_list[lang].THANKS_STR);}
this.getBeTheFirstString=function(lang){return(this.languages_list[lang].BE_THE_FIRST_STR);}
this.getUnableToSubmitString=function(lang){return(this.languages_list[lang].UNABLE_TO_SUBMIT_STR);}
this.getHowString=function(lang){return(this.languages_list[lang].HOW);}
this.getByString=function(lang){return(this.languages_list[lang].BY);}
this.getThisSiteString=function(lang){return(this.languages_list[lang].THIS_SITE);}
this.whatsThis=function(lang){return(this.languages_list[lang].WHATS_THIS);}
this.getMoreRecommendedLinkText=function(lang,count){var str='';str=((count==1)?this.languages_list[lang].MORE_RECOMMENDED_SINGLE:this.languages_list[lang].MORE_RECOMMENDED_PLURAL)+" &raquo;";str=str.replace(/{N}/g,count);return str;}
this.getPcLegendText=function(lang,pcName,elementToInsert){var str='';str=this.languages_list[lang].PC_LEGEND_TITLE;str=str.replace(/{PC}/g,pcName);return str;}
this.getMoreRecommendedCloseLinkTest=function(lang,count){var str='';str="&laquo; "+((count==1)?this.languages_list[lang].MORE_RECOMMENDED_CLOSE_SINGLE:this.languages_list[lang].MORE_RECOMMENDED_CLOSE_PLURAL);str=str.replace(/{N}/g,count);return str;}
this.GetMostPopular=function(lang){return(this.languages_list[lang].MOST_POPULAR);}
this.isMostPopularAvailable=function(lang){return(this.languages_list[lang].OPTIONAL_ADDONS.mostPopular);}
this.isRecommendationsAvailable=function(lang){return(this.languages_list[lang].OPTIONAL_ADDONS.recommendations);}
this.rateThumbsGetAggregate=function(lang,rank,countAll,withMe){var str='';if(withMe){if(countAll==1){str=this.languages_list[lang].THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU;}else if(countAll==2){str=this.languages_list[lang].THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU_AND_1_OTHER;}else{countAll--;str=this.languages_list[lang].THUMBS_SUPPORT.THUMBS_RATED_X_BY_YOU_AND_Y_OTHERS;str=this.changeY(str,countAll);}}else{if(countAll==1){str=this.languages_list[lang].THUMBS_SUPPORT.THUMBS_RATED_X_BY_1_PERSON;}else{str=this.languages_list[lang].THUMBS_SUPPORT.THUMBS_RATED_X_BY_Y_PEOPLE;str=this.changeY(str,countAll);}}
return str;}
this.getThumbsPersonalRateDesc=function(lang,num){var str='';str=this.languages_list[lang].THUMBS_SUPPORT.THUMBS_PERSONAL_RATE_DESC;return str;}
this.getThumbsRatePostRateForRecommendations=function(lang,rate){var value;value=this.languages_list[lang].THUMBS_SUPPORT.THUMBS_RATE_POST_RATE_FOR_RECOMMENDATIONS[rate];return value;}
this.getThumbsThanksString=function(lang){return(this.languages_list[lang].THUMBS_SUPPORT.THUMBS_THANKS_STR);}
this.getThumbsRecommendThisString=function(lang,link){var str="";if(link!=null&&typeof(link)!='undefined'&&link.length>0){str=link.replace("${TEXT}",this.languages_list[lang].THUMBS_SUPPORT.THUMBS_RECOMMEND_THIS);}else{str=this.languages_list[lang].THUMBS_SUPPORT.THUMBS_RECOMMEND_THIS;}
return(str);}};var OB_lang=(typeof(OB_lang)=='object')?OB_lang:new function(){this.initLang=function(lang){outbrain_language_manager.initLang(lang);}}
var outbrain_template_object=(typeof(outbrain_template_object)=="function")?outbrain_template_object:function(templateIndex,position,inside,elements,matrixInfoJson){var self=this;this.templateIndex=templateIndex;this.templateArrayInit=false;this.templateDOMInit=false;this.templateReplacedOnce=false;this.templateHaveOdbAndLang=false;this.templateHaveImages=false;this.languageName=outbrain_settings.language.defaultLangName;this.dom=new outbrain_dom_object();this.all_optional_elements=outbrain_settings.templateOptions;this.all_user_elements=[];this.matrixInfo=new outbrain_matrix_info();if(matrixInfoJson!=null&&matrixInfoJson!='undefined')this.matrixInfo.init(matrixInfoJson);this.elements=outbrain_settings.templateItemsJoin+elements.split(outbrain_settings.templateItemsSplit).join(outbrain_settings.templateItemsJoin)+outbrain_settings.templateItemsJoin;this.top=(position=='top');this.position=(position=="top")?"top":"bottom";this.inside=((inside==true)||(inside=='true'));this.templateDOM=null;this.constants=null;this.smallImageSufix='png';this.rateYarray=new Array(0,this.matrixInfo.matrixYHeight,0);this.lastRate=-1;this.positionsStars=0;this.positionFirstLine=1;this.positionSecondLine=2;this.positionRec=3;this.matrixImage=null;this.isMatrixReady=false;this.mouseOutTimer=null;this.isPcHidden=false;this.pluginsArray=[];this.closeInTooltip='<div class=outbrain_tooltip_close><img alt=\\\'Close\\\' width=\\\'13\\\' height=\\\'13\\\' src=\\\''+outbrain_settings.domains.js+'spacer.gif\\\' onclick=\\\'javascript:UnTip()\\\'/></div>';this.txtInTooltip='<b>Sponsored but good</b><br><br>All of the links within this box are recommended stories that have been independently written. Distribution of the marked $ICON link was paid for by an advertiser. To the best of our knowledge, the author of the marked story was not compensated by the advertiser for the content or the opinions expressed. <a href=\\\'http://outbrain.com\\\' target=\\\'_blank\\\'>Outbrain</a> reviews all sponsored recommendations to make sure we only bring you quality stories that are interesting and well written. Our goal is to provide you with links to great content, whether sponsored or not. <br><br>Please give us feedback on how we are doing! Drop us a line at <a href=\\\'mailto:feedback@outbrain.com\\\'>feedback@outbrain.com</a>'
this.waitImageUrl=outbrain_settings.domains.js+"/spinner-gray.gif";this.waitBackgroundClass="outbrain_waiting_background";this.cancelRecommendationId="CancelRecommendation";this.isOwnerNotLoading=true;this.recommendationLocationStr='<span class="rec-src-link"> (<span class="rec-src-at">@</span>$SOURCE_NAME)</span>'
this.createInfoIcon=function(width,height,clsOff,clsOn,isClick,isMove,index){var backgroundInfoStyle="background-image:url("+outbrain_settings.domains.js+"outbrain_info."+((self.fixPngOnThisBrowser())?'gif':'png')+")";var onClickStr=(isClick)?" onClick=\"javascript:"+this.callForToolTip('this')+"\"":"";var onMoveStr=(isMove)?" onmouseout=\"this.className=\'"+clsOff+"\'\" onmouseover=\"this.className=\'"+clsOn+"\'\"":"";var onIndex=(index!=null&&!index.isNaN)?"id=\"outbrain_toolTip_img_"+index+"\"":"";var infoImage='<img '+onIndex+' src=\''+outbrain_settings.domains.js+'spacer.gif\' width=\''+width+'\' height=\''+height+'\' class=\''+clsOff+'\' '+onMoveStr+' '+onClickStr+' style=\''+backgroundInfoStyle+'\'>';return infoImage}
this.addPlugin=function(newPlugin){for(var pluginIDX=0;pluginIDX<self.pluginsArray.length;++pluginIDX){if(self.pluginsArray[pluginIDX].ID==newPlugin.ID)
return;}
self.pluginsArray[self.pluginsArray.length]=newPlugin;self.pluginsArray[self.pluginsArray.length-1].init();}
this.getPlugin=function(pluginId){for(var pluginIDX=0;pluginIDX<self.pluginsArray.length;++pluginIDX){if(self.pluginsArray[pluginIDX].ID==pluginId)
return self.pluginsArray[pluginIDX];}
return null;}
this.getElementWithFullName=function(ele,index){return this.dom.$(ele+"_"+index+"_"+this.position)}
this.fixPngOnThisBrowser=function(){return((outbrain_browsers.ie5)||(outbrain_browsers.ie55)||(outbrain_browsers.ie6));}
this.isSomeSecondLine=function(){return((this.all_user_elements[this.positionSecondLine])||(this.all_user_elements[this.positionRec]));}
this.getStarXPosition=function(itemData){var tempRank=itemData.rankInfo.vote!=0?itemData.rankInfo.getComputedRank(true):itemData.rankInfo.getComputedRank();var x=(Math.round(tempRank*2)-1)*this.matrixInfo.matrixXlength;return x>0?x:0;}
this.fixPng=function(index,x,y){var element=this.getElementWithFullName(this.constants.ratesDivId,index);if(element){var filterString='DXImageTransform.Microsoft.AlphaImageLoader';if((outbrain_language_manager.isLanguageReady(self.languageName))&&(outbrain_language_manager.isRtl(self.languageName))){var bgSrc=self.matrixInfo.matrixSourceRTL;}else{var bgSrc=self.matrixInfo.matrixSource;}
element.style.left=x+"px";element.style.top=y+"px";element.style.filter='progid:'+filterString+'(src="'+bgSrc+'",sizingMethod="crop")';}}
this.changeMatrixByXY=function(index,x,y){var rates=this.getElementWithFullName(this.constants.ratesDivId,index);var returnValue=false;if(rates){if(this.fixPngOnThisBrowser()){returnValue=this.fixPng(index,(x*(-1)),(y*(-1)));}else{if(outbrain_browsers.ie){rates.style.backgroundPosition="-"+x+"px -"+y+"px";}else{rates.style.backgroundPosition=(x==0?"left ":"-"+x+"px ")+(y==0?"top":"-"+y+"px");}
returnValue=true;}}
return returnValue;}
this.changeMatrix=function(index,itemData,rateMode){if(itemData.rankInfo==null){return false;}
if(outbrain_rater.lockRater(index)){return false;}
var localRateMode=(rateMode!=null)?rateMode:itemData.rateMode;var x=0;switch(localRateMode){case outbrain_settings.rater.statuses.RATER_RATE_MODE:x=(itemData.currentRateValue-1)*this.matrixInfo.matrixXlength;break;case outbrain_settings.rater.statuses.RATER_PRE_RATE_MODE:x=this.getStarXPosition(itemData);break;case outbrain_settings.rater.statuses.RATER_POST_RATE_MODE:x=this.getStarXPosition(itemData);break;}
if(x<0){return;}
var y=this.rateYarray[localRateMode];this.changeMatrixByXY(index,x,y);}
this.toggleMoreRecommendations=function(index){var LinkElement=this.getElementWithFullName(this.constants.recommendationsMoreDivId,index).getElementsByTagName("a")[0];var ulElement=this.getElementWithFullName(this.constants.recommendationsUlId,index);var Lis=ulElement.getElementsByTagName("li");var defaultRecNum=outbrain_settings.rater.recommendations.defaultRecNumber;if((typeof(ulElement.opened)=='boolean')&&(ulElement.opened)){for(var i=defaultRecNum;i<Lis.length;i++){Lis[i].style.display="none";}
ulElement.opened=false;self.dom.setInnerHTML(LinkElement,outbrain_language_manager.getMoreRecommendedLinkText(self.languageName,Lis.length-defaultRecNum));var currElement=this.getElementWithFullName(this.constants.recommendationsPcLegendId,index);if(typeof(OB_voterWidgetObjArray[index].isPcHidden)=='boolean'&&OB_voterWidgetObjArray[index].isPcHidden&&currElement!=null)
currElement.style.display="none";}else{LinkElement.onclick=function(){self.toggleMoreRecommendations(index);};for(i=defaultRecNum;i<Lis.length;i++){Lis[i].style.display="";}
ulElement.opened=true;self.dom.setInnerHTML(LinkElement,outbrain_language_manager.getMoreRecommendedCloseLinkTest(self.languageName,Lis.length-defaultRecNum));var currElement=this.getElementWithFullName(this.constants.recommendationsPcLegendId,index);if(typeof(OB_voterWidgetObjArray[index].isPcHidden)=='boolean'&&OB_voterWidgetObjArray[index].isPcHidden&&currElement!=null)
currElement.style.display="block";}}
this.getMyRatingImage=function(rate,brackets){if((rate==0)||(rate==null)){return'';}
var dirStr='';if((typeof(outbrain_language_manager)!='undefined')&&(typeof(outbrain_language_manager.languages_list[self.languageName])!='undefined')&&(outbrain_language_manager.isLanguageReady(self.languageName))&&(outbrain_language_manager.isRtl(self.languageName))){dirStr='_rtl';}else{dirStr='';}
var src=outbrain_settings.domains.js+'my_rating_'+rate+dirStr+'.'+this.smallImageSufix;var filterString='DXImageTransform.Microsoft.AlphaImageLoader';var valign=(outbrain_browsers.mozilla&&!outbrain_browsers.osMac)?"sub":"middle";if(this.fixPngOnThisBrowser()){img='<img src="http://widgets.outbrain.com/blank.gif" style="width:60px;height:12px;border:none;float:none;margin:0 0 0 0;padding:0 0 0 0;background:none;display:inline;vertical-align:'+valign+';filter:progid:'+filterString+'(src=\''+src+'\', sizingMethod=\'scale\');" />';}else{img='<img style="border:none;float:none;margin:0 0 0 0;padding:0 0 0 0;background:none;display:inline;vertical-align:'+valign+';" src="'+src+'" />';}
return img;}
this.changeStarsTextToImage=function(title,rate,brackets){if(typeof(title)!='string'){return false;}
if(rate==null){title=title.replace("({starsImage})","");}else{title=title.replace("{starsImage}",this.getMyRatingImage(rate,brackets));}
return title;}
this.showMoreRecommendations=function(index){var itemData=outbrain_template_manager.getDataPerPost(this.templateIndex,index);var jsonObj=itemData.jsonObj;var title=itemData.recTitle;var rateMode=itemData.rateMode;var recommendedUl=this.getElementWithFullName(this.constants.recommendationsUlId,index);var isAllSameSource=((typeof(jsonObj.response.documents.isAllSameSource))!='boolean')?false:jsonObj.response.documents.isAllSameSource;var idx=outbrain_settings.rater.recommendations.defaultRecNumber;for(;idx<jsonObj.response.documents.doc.length;++idx){this.renderOneRecommendation(index,recommendedUl,jsonObj.response.documents.doc[idx],idx,isAllSameSource);}
recommendedUl.opened=false;this.toggleMoreRecommendations(index);}
this.callForToolTip=function(targetElementName){if(targetElementName!='this')targetElementName="\'"+targetElementName+"\'";var ttText=this.txtInTooltip;var ttIMG=this.createInfoIcon(16,16,'ob_bigInfo_off','ob_bigInfo_off',false,false);ttIMG=ttIMG.replace(/\'/g,"\\'");ttIMG=ttIMG.replace(/\"/g,"\\'");var ttText=ttText.replace(/\$ICON/g,ttIMG);var ttClose=this.closeInTooltip;var ttHOffset='-7';var toolTipTxt='UnTip();Tip(\''+ttClose+ttText+'\', BALLOON, true, ABOVE, true,FIX,['+targetElementName+','+ttHOffset+',-7],EXCLUSIVE,true)';return toolTipTxt;}
this.createLinkOfPC=function(index,pcName){var elementToInsert=this.createInfoIcon(14,14,'ob_smallInfo_off','ob_smallInfo_on',true,true,index);var elementName="outbrain_toolTip_img_"+index;var balloonItem=this.callForToolTip(elementName);var pcTextLink="<a href=\"javascript:void(0)\" onmouseout=\"javascript:document.getElementById(\'"+elementName+"\').className=\'ob_smallInfo_off\'\" onmouseover=\"javascript:document.getElementById(\'"+elementName+"\').className=\'ob_smallInfo_on\'\" onClick=\"javascript:"+balloonItem+"\">";var pcText=outbrain_language_manager.getPcLegendText(self.languageName,pcName);var pcText="("+pcTextLink+pcText+"</a>&nbsp;"+elementToInsert+")";return pcText;}
this.createRecommendationLi=function(index,docIdx,isSameSource,postLink,linkText,target,sourceName,isAllSameSource,isAdId,bocr){var displaySameSiteTitle=outbrain_settings.rater.recommendations.displaySameSiteTitle;var recommendedLi=document.createElement("li");var isSelfPost=((typeof(outbrain_settings.rater.recommendations.selfPost)=='boolean')&&outbrain_settings.rater.recommendations.selfPost==true);var target='_blank';if(typeof(outbrain_settings.rater.recommendations.openNewTab)=='boolean'&&!outbrain_settings.rater.recommendations.openNewTab){target='_self';}
if(isSameSource&&displaySameSiteTitle){var fontWeight=(!isSelfPost&&isAllSameSource)?"normal":"bold";sourceName='<span style="font-weight:'+fontWeight+';">'+outbrain_language_manager.getThisSiteString(self.languageName)+'</span>';}
if(isSameSource&&!isAdId){target='_self';}
if(isAdId){var infoImage=this.createInfoIcon(16,16,'ob_bigInfo_off','ob_bigInfo_on',true,true)+" ";}else{var infoImage='';}
var ownerJSApproval="true";if(typeof(bocr)=='string'&&bocr.length>0&&typeof(OB_user_mode)=='number'&&OB_user_mode==1){ownerJSApproval="outbrain_template_manager.templates["+self.templateIndex+"].checkWaitStatus()";}
var content=''+infoImage+'<a class="rec-link" target="'+target+'" href="'+postLink+'" onClick="javascript:return('+ownerJSApproval+')">'+
linkText+'</a>';if(!isAllSameSource||(typeof(OB_same_source_visible)=='boolean'&&OB_same_source_visible==true)){content+=self.buildLocationString(sourceName);}
if(typeof(bocr)=='string'&&bocr.length>0&&typeof(OB_user_mode)=='number'&&OB_user_mode==1){content+=self.renderRecCancelation(index,docIdx,bocr);}
recommendedLi.innerHTML=content;return recommendedLi;}
this.buildLocationString=function(sourceName){var str=self.recommendationLocationStr;if(typeof(OB_location_string)=='string'&&OB_location_string.length>0){str=OB_location_string;}
str=str.replace("$SOURCE_NAME",sourceName)
return str;}
this.renderOneRecommendation=function(index,recommendedUl,docRecommendation,docIdx,isAllSameSource){var recommendedLi=document.createElement("li");var currentRecommendationData=outbrain_template_manager.getRecommendationDataPerDoc(this.templateIndex,index,docRecommendation,docIdx);var postLink=currentRecommendationData[0];var linkText=currentRecommendationData[1];var sourceName=currentRecommendationData[2];var authorName=currentRecommendationData[3];var pubDate=currentRecommendationData[4];var isSameSource=currentRecommendationData[5];var isAdId=currentRecommendationData[7];var bocr=currentRecommendationData[8];var target='target="_blank"';if((postLink==null)||(linkText==null)||(sourceName==null)||(authorName==null)||(isSameSource==null)){return false;}
if(recommendedUl){recommendedLi=self.createRecommendationLi(index,docIdx,isSameSource,postLink,linkText,target,sourceName,isAllSameSource,isAdId,bocr);recommendedUl.appendChild(recommendedLi);}else{return false;}}
this.recommendationsLegendUpdate=function(index,title){var fieldsetElement=this.getElementWithFullName(this.constants.fieldsetId,index);if(!fieldsetElement){}else{var legendElement=fieldsetElement.getElementsByTagName("legend")[0];if((legendElement)&&(legendElement.innerHTML!=title)){legendElement.className=this.constants.recommendationsLegendClass;self.dom.setInnerHTML(legendElement,title);}}}
this.recommendationsShowBefore=function(index){var value=false;var element=this.getElementWithFullName(this.constants.fieldsetId,index);if(!element){value=false;}else{value=(this.getElementWithFullName(this.constants.fieldsetId,index).style.display!="none");}
if(value==true&&typeof(OB_user_mode)=='number'&&OB_user_mode==1){this.removeWaitClock(index);value=false;}
return value;}
this.showRecommendations=function(index,itemData,rateMode){var rate=itemData.rankInfo.vote;var title=itemData.recTitle;var jsonObj=itemData.jsonObj;title=this.changeStarsTextToImage(title,rate,true);if(!this.all_user_elements[this.positionRec]){return false;}
var currElement=null;if(!this.recommendationsShowBefore(index)){var recommendationsUL=this.getElementWithFullName(this.constants.recommendationsUlId,index)
this.recommendationsLegendUpdate(index,title);if(typeof(jsonObj.response.documents.doc.length)=='undefined'){this.renderOneRecommendation(index,recommendationsUL,jsonObj.response.documents.doc,0,false);}else{var IsAllSameSource=outbrain_template_manager.isAllSameSource(jsonObj.response.documents);var jsonRecs=jsonObj.response.documents.doc.length;var defaultRecs=outbrain_settings.rater.recommendations.defaultRecNumber;var defaultRecNum=(defaultRecs<=jsonRecs)?defaultRecs:jsonRecs;var moreCount=(jsonRecs-defaultRecNum);var currentFieldsetOpen=(recommendationsUL&&typeof(recommendationsUL.opened)=='boolean'&&recommendationsUL.opened==true);if(typeof(OB_user_mode)=='number'&&OB_user_mode==1){if(currentFieldsetOpen){var defaultRecNum=jsonRecs;}
this.clearRecommendations(index,moreCount);}
for(var t=0;t<defaultRecNum;t++)
this.renderOneRecommendation(index,recommendationsUL,jsonObj.response.documents.doc[t],t,IsAllSameSource);if(moreCount>0&&!currentFieldsetOpen){var moreText=outbrain_language_manager.getMoreRecommendedLinkText(self.languageName,moreCount);currElement=this.getElementWithFullName(this.constants.recommendationsMoreDivId,index);if(currElement){self.dom.setInnerHTML(currElement,"<a href='javascript:void(0);' onclick='outbrain_template_manager.templates["+this.templateIndex+"].showMoreRecommendations("+index+");'> "+moreText+"</a>");currElement.style.display="block";}}
var pcName=this.getpcName(index,jsonObj.response.documents);if(pcName.length>0){outbrain_rater.loadToolTip();pcText=this.createLinkOfPC(index,pcName);currElement=this.getElementWithFullName(this.constants.recommendationsPcLegendId,index);if(currElement){self.dom.setInnerHTML(currElement,pcText);if(!(typeof(OB_voterWidgetObjArray[index].isPcHidden)=='boolean'&&OB_voterWidgetObjArray[index].isPcHidden))
currElement.style.display="block";}}}
currElement=this.getElementWithFullName(this.constants.rateStatusInfoTableId,index);if(currElement){currElement.style.display="none";}
currElement=this.getElementWithFullName(this.constants.rateStatusInfoTdId,index);if(currElement){currElement.style.display="none";}
currElement=this.getElementWithFullName(this.constants.fieldsetId,index);if(currElement){currElement.style.display="block";OB_voterWidgetObjArray[index].hasRecommendations=true;}
currElement=this.getElementWithFullName(this.constants.recommendationsMoreDivId,index);if(currElement){currElement.style.display="block";}}else{this.recommendationsLegendUpdate(index,title);}}
this.getpcName=function(index,documents){var pcName="";for(var t=0;t<documents.doc.length;t++){if(typeof(documents.doc[t].adv_name)!='undefined'){pcName=documents.doc[t].adv_name;if(t>=outbrain_settings.rater.recommendations.defaultRecNumber)
OB_voterWidgetObjArray[index].isPcHidden=true;}}
return pcName;}
this.clearRecommendations=function(index,moreRecNum){var recommendationsUL=this.getElementWithFullName(this.constants.recommendationsUlId,index);if(recommendationsUL!=null){recommendationsUL.innerHTML="";}
var moreRecommendationsUL=this.getElementWithFullName(this.constants.recommendationsMoreDivId,index);if(moreRecommendationsUL!=null&&moreRecNum<1){moreRecommendationsUL.innerHTML="";}}
this.changeRateInfoSingleLine=function(data,rate,rateMode){if((rate>0)&&((rateMode==outbrain_settings.rater.statuses.RATER_PRE_RATE_MODE)||(rateMode==outbrain_settings.rater.statuses.RATER_POST_RATE_MODE))){var extraWord='';if(rate==1){extraWord="hated";}else if(rate==2){extraWord="didn't like";}else if(rate==3){extraWord="rated";}else if(rate==4){extraWord="liked";}else if(rate==5){extraWord="loved";}
data+=' (you '+extraWord+' this '+this.getMyRatingImage(rate,false)+')';}
return data;}
this.firstLineTextReplacer=function(itemData,rateMode){var rateInfo=itemData.rateInfo;var rate=itemData.rankInfo.vote;if(typeof(rateMode)!='number'){rateMode=itemData.rateMode;}
if(!this.isSomeSecondLine()){rateInfo=rateInfo.replace(/RECOMMENDED/g,'<span class="outbrain-bold">RECOMMENDED</span>');var signIndex=rateInfo.indexOf("[");if(signIndex>-1){var endSignIndex=rateInfo.indexOf("]",signIndex);rateInfo=rateInfo.substr(0,signIndex-1)+rateInfo.substr(endSignIndex+1,rateInfo.length);}
rateInfo=this.changeRateInfoSingleLine(rateInfo,rate,rateMode);}
return rateInfo;}
this.setFirstLineInnerHTML=function(index,text){var rateInfoDiv=this.getElementWithFullName(this.constants.rateInfoDivId,index);if(rateInfoDiv){self.dom.setInnerHTML(rateInfoDiv,text);return true;}
return false;}
this.updateRateInfo=function(index,itemData,rateMode,isHover){var rateInfo=itemData.rateInfo;var rateStatus="";if(!outbrain_rater.lockRater(index)){if(itemData.rankInfo==null){rateStatus=this.changeStarsTextToImage(itemData.rateStatus,null);}else{rateStatus=this.changeStarsTextToImage(itemData.rateStatus,itemData.rankInfo.vote);}
var recommendationsTitle=itemData.recTitle;itemData.rateInfo=rateInfo;rateInfo=this.firstLineTextReplacer(itemData,rateMode);var changedText=this.setFirstLineInnerHTML(index,rateInfo);if(isHover!=true){var voterDiv=this.getElementWithFullName(this.constants.voterDivName,index);if(voterDiv){if(outbrain_browsers.ie6||outbrain_browsers.ie55||outbrain_browsers.ie55){waitForCss=window.setInterval(function(){if(cssFile_Loaded){voterDiv.style.display="block";window.clearInterval(waitForCss);}},1);}
else{voterDiv.style.display="block";}}
if(this.recommendationsShowBefore(index)){this.showRecommendations(index,itemData,rateMode);}else{if(this.all_user_elements[this.positionSecondLine]){var singleSecondLine=this.getElementWithFullName(this.constants.rateStatusInfoTdId,index);var updateLine=false;if(!singleSecondLine){}else{if(outbrain_rater.lastOdbRotationReturnedItem<index){updateLine=true;}else if(this.all_user_elements[this.positionRec]){if(OB_voterWidgetObjArray[index].vote>=3){if((typeof(OB_voterWidgetObjArray[index].jsonObj.response.documents)!='undefined')&&(typeof(OB_voterWidgetObjArray[index].jsonObj.response.documents.total_count)!='undefined')&&((OB_voterWidgetObjArray[index].jsonObj.response.documents.total_count)>0)){updateLine=false;}else{updateLine=true;}}else{updateLine=true;}}else{updateLine=true;}}
if(updateLine){self.dom.setInnerHTML(singleSecondLine,rateStatus);}}}}}}
this.changeView=function(index,itemData,rateMode){return this.changeMatrix(index,itemData,rateMode);}
this.thanksMode=function(index,vote){var itemData=outbrain_template_manager.getDataPerPost(templateIndex,index);itemData.frezz=true;var rateInfo="<strong>"+outbrain_language_manager.getThanksString(self.languageName)+"</strong>";itemData.rateInfo=rateInfo;rateInfo=this.firstLineTextReplacer(itemData);var changedText=this.setFirstLineInnerHTML(index,rateInfo);this.changeMatrixByXY(index,((vote-1)*this.matrixInfo.matrixXlength),this.matrixInfo.matrixYpositionThanks);for(var pluginIDX=0;pluginIDX<self.pluginsArray.length;++pluginIDX){self.pluginsArray[pluginIDX].onRate(index);}}
this.endThanksMode=function(index){outbrain_template_manager.setStatus(this.templateIndex,index,outbrain_settings.rater.statuses.RATER_POST_RATE_MODE);for(var pluginIDX=0;pluginIDX<self.pluginsArray.length;++pluginIDX){self.pluginsArray[pluginIDX].onPostRate(index);}}
this.mouseClicked=function(spanObj,index){outbrain_template_manager.setStatus(this.templateIndex,index,outbrain_settings.rater.statuses.RATER_RATE_MODE,spanObj.getAttribute("_vote"));this.thanksMode(index,spanObj.getAttribute("_vote"));setTimeout(function(){self.endThanksMode(index)},1000);}
this.mouseOverSpan=function(templateIndex,spanObj,index){var status=outbrain_settings.rater.statuses.RATER_RATE_MODE;OB_voterWidgetObjArray[index].currentRateValue=spanObj.getAttribute("_vote");var itemData=outbrain_template_manager.getDataPerPost(templateIndex,index,status);clearTimeout(this.mouseOutTimer);this.changeView(index,itemData,status);this.updateRateInfo(index,itemData,status,true);}
this.mouseOutSpan=function(templateIndex,index){var status=outbrain_settings.rater.statuses.RATER_PRE_RATE_MODE;OB_voterWidgetObjArray[index].currentRateValue=0;var itemData=outbrain_template_manager.getDataPerPost(templateIndex,index,status);this.mouseOutTimer=setTimeout(function(){self.changeView(index,itemData,status);self.updateRateInfo(index,itemData,status,true);},10);}
this.imageLoadEvent=function(){this.isMatrixReady=true;}
this.imagesPreload=function(){var isStars=(typeof(outbrain_settings.rater.isStars)=='boolean')?outbrain_settings.rater.isStars:true;new outbrain_timeout(function(){return((typeof(outbrain_language_manager[self.languageName])!='object')&&(outbrain_language_manager.isLanguageReady(self.languageName)));},function(){if(document.images&&outbrain_settings.rater.isStars){var OB_starsImages=[];this.matrixImage=new Image();this.matrixImage.onLoad=self.imageLoadEvent();this.matrixImage.src=(outbrain_language_manager.isRtl(self.languageName)==true?self.matrixInfo.matrixSourceRtl:self.matrixInfo.matrixSource);for(i=0;i<5;i++){OB_starsImages[i]=new Image(60,12);OB_starsImages[i].src=outbrain_settings.domains.js+'my_rating_'+(i+1)+"."+self.smallImageSufix;}
self.templateHaveImages=true;}},null,null,500,1000,true);}
this.initTemplate=function(){for(i=0;i<this.all_optional_elements.length;i++){if(this.elements.indexOf(outbrain_settings.templateItemsJoin+this.all_optional_elements[i]+outbrain_settings.templateItemsJoin)>-1){this.all_user_elements[i]=true;}else{this.all_user_elements[i]=false;}}
if(!this.all_user_elements[this.positionsStars]){this.all_user_elements[this.positionFirstLine]=false;this.all_user_elements[this.positionSecondLine]=false}
this.templateArrayInit=true;}
this.supportRecommendations=function(){return this.all_user_elements[this.positionRec];}
this.buildDomMainWrapperStart=function(){str=''+'<div id="$CONTAINER_DIV_ID_$INDEX_$POSITION" class="$GLOBAL_CLASS" style="$DIV_WRAPPER_STYLE" >'+'$upperBR'+'<div class="$VOTER_DIV_CLASS" style="display:none;"  id="$VOTER_DIV_NAME_$INDEX_$POSITION"  >';return str;}
this.buildDomMainWrapperEnd=function(){for(var pluginIDX=0;pluginIDX<self.pluginsArray.length;++pluginIDX){self.pluginsArray[pluginIDX].initDOM(self.templateIndex);}
var str='$PLUGINS'+'</div>'+'$lowerBR'+'</div> ';return str;}
this.buildDomStarsWrapperStart=function(){var str=''+'<table class="table-css" cellpadding="0" cellspacing="0" border="0" style="$TABLE_STYLEwidth:100%;">'+'<tbody style="border:none;width:100%;" class="$TBODY_CLASS">'+'<tr style="$TABLE_STYLEwidth:100%;vertical-align:middle;">'+'<td style="$TD_STYLE$WIDTH_STARS_TD;vertical-align:middle;">';return str;}
this.buildDomStarsFixPng=function(){var str=''+'<div id="$PNGFIX_HELPER_DIV_ID_$INDEX_$POSITION" style="overflow:hidden;position:relative;height:$STARS_Y_HEIGHTpx;width:$MATRIX_ONE_ITEM_LENGTHpx;margin-bottom:0px;">'+'<div id="$PNGFIX_DIVS_CONTAINER_$INDEX_$POSITION" style="width:100%;height:100%;">'+'<div class="$PNGFIX_STARS_DIV_CLASS" style="$PNGFIX_DIV_STYLE" _vote="1" onmouseout="outbrain_template_manager.templates['+this.templateIndex+'].mouseOutSpan('+this.templateIndex+',$INDEX);" onclick="outbrain_template_manager.templates['+this.templateIndex+'].mouseClicked(this,$INDEX);" onmouseover="outbrain_template_manager.templates['+this.templateIndex+'].mouseOverSpan('+this.templateIndex+',this,$INDEX);">&nbsp;</div>'+'<div class="$PNGFIX_STARS_DIV_CLASS" style="$PNGFIX_DIV_STYLE" _vote="2" onmouseout="outbrain_template_manager.templates['+this.templateIndex+'].mouseOutSpan('+this.templateIndex+',$INDEX);" onclick="outbrain_template_manager.templates['+this.templateIndex+'].mouseClicked(this,$INDEX);" onmouseover="outbrain_template_manager.templates['+this.templateIndex+'].mouseOverSpan('+this.templateIndex+',this,$INDEX);">&nbsp;</div>'+'<div class="$PNGFIX_STARS_DIV_CLASS" style="$PNGFIX_DIV_STYLE" _vote="3" onmouseout="outbrain_template_manager.templates['+this.templateIndex+'].mouseOutSpan('+this.templateIndex+',$INDEX);" onclick="outbrain_template_manager.templates['+this.templateIndex+'].mouseClicked(this,$INDEX);" onmouseover="outbrain_template_manager.templates['+this.templateIndex+'].mouseOverSpan('+this.templateIndex+',this,$INDEX);">&nbsp;</div>'+'<div class="$PNGFIX_STARS_DIV_CLASS" style="$PNGFIX_DIV_STYLE" _vote="4" onmouseout="outbrain_template_manager.templates['+this.templateIndex+'].mouseOutSpan('+this.templateIndex+',$INDEX);" onclick="outbrain_template_manager.templates['+this.templateIndex+'].mouseClicked(this,$INDEX);" onmouseover="outbrain_template_manager.templates['+this.templateIndex+'].mouseOverSpan('+this.templateIndex+',this,$INDEX);">&nbsp;</div>'+'<div class="$PNGFIX_STARS_DIV_CLASS" style="$PNGFIX_DIV_STYLE" _vote="5" onmouseout="outbrain_template_manager.templates['+this.templateIndex+'].mouseOutSpan('+this.templateIndex+',$INDEX);" onclick="outbrain_template_manager.templates['+this.templateIndex+'].mouseClicked(this,$INDEX);" onmouseover="outbrain_template_manager.templates['+this.templateIndex+'].mouseOverSpan('+this.templateIndex+',this,$INDEX);">&nbsp;</div>'+'</div>'+'<div id="$RATES_DIV_ID_$INDEX_$POSITION" class="$STARS_CLASS" style="width:$MATRIX_All_WIDTHpx;height:$MATRIX_ALL_HEIGHTpx;position:absolute;z-index:-1;vertical-align:absmiddle;">'+'</div>'+'</div>';return str;}
this.buildDomStars=function(){var str=''+'<div id="$RATES_DIV_ID_$INDEX_$POSITION" class="$STARS_CLASS" style="margin:0 0 0 0;padding:0 0 0 0;vertical-align:absmiddle;height:$STARS_Y_HEIGHTpx;width:$MATRIX_ONE_ITEM_LENGTHpx;$SOURCE_URL">'+'<div class="$STARS_SPAN_CLASS" style="$PNGFIX_DIV_STYLE" _vote="1" onmouseout="outbrain_template_manager.templates['+this.templateIndex+'].mouseOutSpan('+this.templateIndex+',$INDEX);" onclick="outbrain_template_manager.templates['+this.templateIndex+'].mouseClicked(this,$INDEX);" onmouseover="outbrain_template_manager.templates['+this.templateIndex+'].mouseOverSpan('+this.templateIndex+',this,$INDEX);">&nbsp;</div>'+'<div class="$STARS_SPAN_CLASS" style="$PNGFIX_DIV_STYLE" _vote="2" onmouseout="outbrain_template_manager.templates['+this.templateIndex+'].mouseOutSpan('+this.templateIndex+',$INDEX);" onclick="outbrain_template_manager.templates['+this.templateIndex+'].mouseClicked(this,$INDEX);" onmouseover="outbrain_template_manager.templates['+this.templateIndex+'].mouseOverSpan('+this.templateIndex+',this,$INDEX);">&nbsp;</div>'+'<div class="$STARS_SPAN_CLASS" style="$PNGFIX_DIV_STYLE" _vote="3" onmouseout="outbrain_template_manager.templates['+this.templateIndex+'].mouseOutSpan('+this.templateIndex+',$INDEX);" onclick="outbrain_template_manager.templates['+this.templateIndex+'].mouseClicked(this,$INDEX);" onmouseover="outbrain_template_manager.templates['+this.templateIndex+'].mouseOverSpan('+this.templateIndex+',this,$INDEX);">&nbsp;</div>'+'<div class="$STARS_SPAN_CLASS" style="$PNGFIX_DIV_STYLE" _vote="4" onmouseout="outbrain_template_manager.templates['+this.templateIndex+'].mouseOutSpan('+this.templateIndex+',$INDEX);" onclick="outbrain_template_manager.templates['+this.templateIndex+'].mouseClicked(this,$INDEX);" onmouseover="outbrain_template_manager.templates['+this.templateIndex+'].mouseOverSpan('+this.templateIndex+',this,$INDEX);">&nbsp;</div>'+'<div class="$STARS_SPAN_CLASS" style="$PNGFIX_DIV_STYLE" _vote="5" onmouseout="outbrain_template_manager.templates['+this.templateIndex+'].mouseOutSpan('+this.templateIndex+',$INDEX);" onclick="outbrain_template_manager.templates['+this.templateIndex+'].mouseClicked(this,$INDEX);" onmouseover="outbrain_template_manager.templates['+this.templateIndex+'].mouseOverSpan('+this.templateIndex+',this,$INDEX);">&nbsp;</div>'+'</div>'+'';return str;}
this.buildDomFirstPos=function(){var str=''+'</td><td class="$RATE_INFO_TD_CLASS" style="$TABLE_STYLEwidth:auto;vertical-align:middle;">'+'<div id="$RATE_INFO_DIV_ID_$INDEX_$POSITION" style="$TABLE_STYLE vertical-align:absmiddle;">'+'</div>'+'</td>';return str;}
this.buildDomStarsWrapperEnd=function(){var str=''+'</tr>'+'</tbody>'+'</table>';return str;}
this.buildDomSecondPos=function(){var str=''+'<table id="$RATE_STATUS_INFO_TABLE_ID_$INDEX_$POSITION" class="table-css" cellspacing="0" cellpadding="0" border="0" style="$TABLE_STYLEwidth:100%;">'+'<tbody class="$TBODY_CLASS" style="$TABLE_STYLEwidth:100%;">'+'<tr style="$TABLE_STYLEwidth:auto;">'+'<td id="$RATE_STATUS_INFO_TD_ID_$INDEX_$POSITION" style="$TABLE_STYLEwidth:100%;" class="outbrain_my_rating"> </td>'+'</tr>'+'</tbody>'+'</table>';return str;}
this.buildDomRecommendations=function(){var str=''+'<fieldset style="display:none;$FIELDSET_STYLE" id="$FIELDSET_ID_$INDEX_$POSITION" class="$FIELDSET_CLASS" >'+'      <div id="$RECOMMENDATIONS_WAIT_ID_outer_$INDEX" class="$RECOMMENDATIONS_WAIT_CLASS_outer" style="display:none;"><div class="$RECOMMENDATIONS_WAIT_CLASS_inner">'+'               <p ><img style="border:0px !important"/></p>'+'       </div></div>'+' <legend class="$RECOMMENDATIONS_LEGEND_CLASS"></legend>'+'   <ul id="$RECOMMENDATIONS_UL_ID_$INDEX_$POSITION" class="$RECOMMENDATIONS_UL_CLASS">'+'   </ul>'+'</fieldset>'+'<table class="outbrain-table-recommendations-bottom"><tr><td>'+' <div id="$RECOMMENDATIONS_PC_LEGEND_$INDEX_$POSITION" class="$RECOMMENDATIONS_PC_LEGENED_CLS" style="display:none;"></div>'+'</td><td>'+' <div id="$RECOMMENDATIONS_MORE_DIV_ID_$INDEX_$POSITION" class="$RECOMMENDATIONS_MORE_LINK_DIV_CLASS" style="display:none;"></div>'+'</td></tr></table>';return str;}
this.buildDOMOnce=function(){var isStars=(typeof(outbrain_settings.rater.isStars)=='boolean')?outbrain_settings.rater.isStars:true;if(this.templateDOMInit){return this.templateDOM;}
if(!this.templateArrayInit){setTimeout(self.buildDOMOnce,1000);return;}
this.templateDOM='';this.templateDOM+=this.buildDomMainWrapperStart();if(isStars&&this.all_user_elements[this.positionsStars]){this.templateDOM+=this.buildDomStarsWrapperStart();if(self.fixPngOnThisBrowser()){this.templateDOM+=this.buildDomStarsFixPng();}else{this.templateDOM+=this.buildDomStars();}}
if(isStars&&this.all_user_elements[this.positionFirstLine]){this.templateDOM+=this.buildDomFirstPos();}
if(isStars&&this.all_user_elements[this.positionsStars]){this.templateDOM+=this.buildDomStarsWrapperEnd();}
if(isStars&&this.all_user_elements[this.positionSecondLine]){this.templateDOM+=this.buildDomSecondPos();}
if(this.all_user_elements[this.positionRec]){this.templateDOM+=this.buildDomRecommendations();}
this.templateDOM+=this.buildDomMainWrapperEnd();this.templateDOMInit=true;}
this.constants=new function(){var constants_self=this;this.init=function(){constants_self.upperBR=(typeof(OB_extraBR)!='undefined'||typeof(OB_extraBRType)!='undefined'&&(OB_extraBRType==1||OB_extraBRType==2))?"<br />":"";constants_self.lowerBR=(typeof(OB_extraBRType)!='undefined'&&(OB_extraBRType==2||OB_extraBRType==3))?"<br />":"";constants_self.divWrapperStyle=constants_self.divWrapperStyle.replace(/\$CLEAR_STR/g,((typeof(OB_userClear)=='boolean')?((OB_userClear)?'':'clear:both;'):'clear:both;'));if(self.fixPngOnThisBrowser()){constants_self.divWrapperStyle=constants_self.divWrapperStyle.replace(/\$COLOR_STR/g,"");if(self.isSomeSecondLine()){constants_self.divWrapperStyle=constants_self.divWrapperStyle.replace(/\$ONE_LINE/g,"height:100%;");}else{constants_self.divWrapperStyle=constants_self.divWrapperStyle.replace(/\$ONE_LINE/g,"");}}else{constants_self.divWrapperStyle=constants_self.divWrapperStyle.replace(/\$COLOR_STR/g,"");constants_self.divWrapperStyle=constants_self.divWrapperStyle.replace(/\$ONE_LINE/g,"");}
var backGroundUrl="background: url(";if((outbrain_language_manager.isLanguageReady(self.languageName))&&(outbrain_language_manager.isRtl(self.languageName))){backGroundUrl+=self.matrixInfo.matrixSourceRTL;}else{backGroundUrl+=self.matrixInfo.matrixSource;}
backGroundUrl+=");";constants_self.matrixUrl=backGroundUrl;constants_self.recommendationsUlClass="recommendations_ul"+((outbrain_browsers.ie)?"_ie":"");constants_self.starsClassname=(self.fixPngOnThisBrowser())?"ratesIE6":"rates";if(!self.isSomeSecondLine()){constants_self.globalClass=constants_self.globalClass.replace(/\$ONE_LINE/g," outbrain_frame_page");constants_self.starsClassname=constants_self.starsClassname.replace(/\$ONE_LINE/g," rates_frame_page");}else{constants_self.globalClass=constants_self.globalClass.replace(/\$ONE_LINE/g,"");constants_self.starsClassname=constants_self.starsClassname.replace(/\$ONE_LINE/g,"");}
var floatValue="float:";if((outbrain_language_manager.isLanguageReady(self.languageName))&&(outbrain_language_manager.isRtl(self.languageName))){floatValue+="right";}else{floatValue+="left";}
floatValue+=";";var pngfixDivsSt="position:static;"+floatValue+"padding:0 0 0 0;margin:0 0 0 0;border:none;border-spacing:0px;font-size:normal;background: none;cursor: pointer;cursor: hand;width:"+self.matrixInfo.starWidth+"px;height:"+self.matrixInfo.matrixYHeight+"px;line-height:"+self.matrixInfo.matrixYHeight+"px;";constants_self.pngfixDivsStyle=pngfixDivsSt;}
this.starsTextDistance=4;this.divWrapperStyle="$CLEAR_STR";this.divWrapperStyle+="padding:0 0 5px 0;";this.tableStyle='padding:0 0 0 0;margin:0 0 0 0;border:none;background:none;border-spacing:0px;';this.divWrapperStyle+="$COLOR_STR";this.divWrapperStyle+="$ONE_LINE";this.tableStyle="padding:0 0 0 0;margin:0 0 0 0;border:none;background:none;border-spacing:0px;";this.tdStyle="padding:"+self.matrixInfo.shadowYoffset+"px 0 0 0;margin:0 0 0 0;border:none;background:none;border-spacing:0px;";this.starDivStyle="height:"+self.matrixInfo.starHeight+"px;width:"+self.matrixInfo.starWidth+"px;";this.widthStarsTd="width:"+(parseInt(self.matrixInfo.matrixXlength)+parseInt(this.starsTextDistance))+"px;";this.starsClassname="";this.fieldsetClass=(outbrain_browsers.ie)?"outbrain-recommendationsFieldset-ie":"outbrain-recommendationsFieldset";this.fieldsetClass=(outbrain_browsers.sc)?"outbrain-recommendationsFieldset-sc":this.fieldsetClass;this.fieldsetStyle=(outbrain_browsers.ie)?"padding-left:0px;;padding-right:8px;":"padding-left:8px;;padding-right:8px;";this.globalClass="div-wrapper";this.voterDivClass="voterDiv";this.tbodyClass="outbrain-tbody-css";this.rateInfoTdClass="rateInfo";this.recommendationsUlClass="";this.recommendationsMoreLinkId="moreRecommendationsLinkDiv";this.recommendationsWaitId="recommendationsWait";this.recommendationsWaitClass="Outbrain_recommendationsWait";this.recommendationsLegendClass="Outbrain_recommendations_legend";this.recommendationsPcLegendId="recommendationsPcLegend";this.recommendationsPcLegendCls="Outbrain_recommendations_pc_legend";this.starsSpanClass="star-span";this.globalClass+="$ONE_LINE";this.starsClassname+="$ONE_LINE";this.upperBR="";this.lowerBR="";this.voterDivName="OutbrainVoterDiv";this.containerId="outbrain_container";this.ratesDivId="rates";this.fieldsetId="recommendationsFieldset";this.recommendationsUlId="recommendationsList";this.recommendationsMoreDivId="recommendationsMoreDiv";this.rateStatusInfoTableId="rateStatusInfoTable";this.rateStatusInfoTdId="rateStatusInfo";this.rateInfoDivId="rateInfo";this.pngfixRatesHelper="pngfixRatesMatrixHelper";this.pngfixMatrix="pngfixMatrix";this.pngfixStarsDivClass="pngfixStarsDivs";this.pngfixDivsContainer="pngfixDivs";}
this.replacerOnce=function(){this.templateDOM=this.templateDOM.replace(/\$POSITION/g,this.position);this.templateDOM=this.templateDOM.replace(/\$DIV_WRAPPER_STYLE/g,this.constants.divWrapperStyle);this.templateDOM=this.templateDOM.replace(/\$TABLE_STYLE/g,this.constants.tableStyle);this.templateDOM=this.templateDOM.replace(/\$TD_STYLE/g,this.constants.tdStyle);this.templateDOM=this.templateDOM.replace(/\$VOTER_DIV_NAME/g,this.constants.voterDivName);this.templateDOM=this.templateDOM.replace(/\$VOTER_DIV_CLASS/g,this.constants.voterDivClass);this.templateDOM=this.templateDOM.replace(/\$CONTAINER_DIV_ID/g,this.constants.containerId);this.templateDOM=this.templateDOM.replace(/\$TBODY_CLASS/g,this.constants.tbodyClass);this.templateDOM=this.templateDOM.replace(/\$RATES_DIV_ID/g,this.constants.ratesDivId);this.templateDOM=this.templateDOM.replace(/\$STARS_CLASS/g,this.constants.starsClassname);this.templateDOM=this.templateDOM.replace(/\$STARS_SPAN_CLASS/g,this.constants.starsSpanClass);this.templateDOM=this.templateDOM.replace(/\$STAR_DIV_STYLE/g,this.constants.starDivStyle);this.templateDOM=this.templateDOM.replace(/\$RATE_INFO_TD_CLASS/g,this.constants.rateInfoTdClass);this.templateDOM=this.templateDOM.replace(/\$RATE_INFO_DIV_ID/g,this.constants.rateInfoDivId);this.templateDOM=this.templateDOM.replace(/\$WIDTH_STARS_TD/g,this.constants.widthStarsTd);this.templateDOM=this.templateDOM.replace(/\$STARS_Y_HEIGHT/g,this.matrixInfo.matrixYHeight);this.templateDOM=this.templateDOM.replace(/\$MATRIX_ONE_ITEM_LENGTH/g,this.matrixInfo.matrixXlength);this.templateDOM=this.templateDOM.replace(/\$MATRIX_All_WIDTH/g,this.matrixInfo.matrixAllXlength);this.templateDOM=this.templateDOM.replace(/\$MATRIX_ALL_HEIGHT/g,this.matrixInfo.matrixAllYlength);this.templateDOM=this.templateDOM.replace(/\$SOURCE_URL/g,this.constants.matrixUrl);this.templateDOM=this.templateDOM.replace(/\$upperBR/g,this.constants.upperBR);this.templateDOM=this.templateDOM.replace(/\$lowerBR/g,this.constants.lowerBR);this.templateDOM=this.templateDOM.replace(/\$FIELDSET_CLASS/g,this.constants.fieldsetClass);this.templateDOM=this.templateDOM.replace(/\$FIELDSET_STYLE/g,this.constants.fieldsetStyle);this.templateDOM=this.templateDOM.replace(/\$FIELDSET_ID/g,this.constants.fieldsetId);this.templateDOM=this.templateDOM.replace(/\$RECOMMENDATIONS_UL_ID/g,this.constants.recommendationsUlId);this.templateDOM=this.templateDOM.replace(/\$RECOMMENDATIONS_UL_CLASS/g,this.constants.recommendationsUlClass);this.templateDOM=this.templateDOM.replace(/\$RECOMMENDATIONS_WAIT_ID/g,this.constants.recommendationsWaitId);this.templateDOM=this.templateDOM.replace(/\$RECOMMENDATIONS_WAIT_CLASS/g,this.constants.recommendationsWaitClass);this.templateDOM=this.templateDOM.replace(/\$RECOMMENDATIONS_MORE_DIV_ID/g,this.constants.recommendationsMoreDivId);this.templateDOM=this.templateDOM.replace(/\$RECOMMENDATIONS_MORE_LINK_DIV_CLASS/g,this.constants.recommendationsMoreLinkId);this.templateDOM=this.templateDOM.replace(/\$RECOMMENDATIONS_LEGEND_CLASS/g,this.constants.recommendationsLegendClass);this.templateDOM=this.templateDOM.replace(/\$RECOMMENDATIONS_PC_LEGEND/g,this.constants.recommendationsPcLegendId);this.templateDOM=this.templateDOM.replace(/\$RECOMMENDATIONS_PC_LEGENED_CLS/g,this.constants.recommendationsPcLegendCls);this.templateDOM=this.templateDOM.replace(/\$RATE_STATUS_INFO_TABLE_ID/g,this.constants.rateStatusInfoTableId);this.templateDOM=this.templateDOM.replace(/\$RATE_STATUS_INFO_TD_ID/g,this.constants.rateStatusInfoTdId);this.templateDOM=this.templateDOM.replace(/\$GLOBAL_CLASS/g,this.constants.globalClass);this.templateDOM=this.templateDOM.replace(/\$PNGFIX_HELPER_DIV_ID/g,this.constants.pngfixRatesHelper);this.templateDOM=this.templateDOM.replace(/\$pngfixMatrix/g,this.constants.pngfixMatrix);this.templateDOM=this.templateDOM.replace(/\$PNGFIX_STARS_DIV_CLASS/g,this.constants.pngfixStarsDivClass);this.templateDOM=this.templateDOM.replace(/\$PNGFIX_DIVS_CONTAINER/g,this.constants.pngfixDivsContainer);this.templateDOM=this.templateDOM.replace(/\$PNGFIX_DIV_STYLE/g,this.constants.pngfixDivsStyle);this.templateReplacedOnce=true;}
this.getLanguageId=function(){return self.languageName;}
this.changeContainerClassWhenExists=function(index){var element=this.getElementWithFullName(this.constants.containerId,index);if(element){element.className=this.constants.globalClass;}}
this.changeWhenHaveStars=function(index){new outbrain_timeout(function(){return((typeof(outbrain_language_manager[self.languageName])!='object')&&(outbrain_language_manager.isLanguageReady(self.languageName)));},function(){if(!self.fixPngOnThisBrowser()){var starsElement=self.getElementWithFullName(self.constants.ratesDivId,index);}else{var starsElement=self.getElementWithFullName(self.constants.pngfixDivsContainer,index);}
if(starsElement){var divsElements=starsElement.getElementsByTagName("div");for(var i=0;i<divsElements.length;i++){if(!self.fixPngOnThisBrowser()){divsElements[i].style.cssFloat='right';}else{divsElements[i].style.styleFloat="right";}}}else{setTimeout(function(){self.changeWhenHaveStars(index)},100);}},null,null,500,1000,true);}
this.replaceWhenHaveLang=function(index){new outbrain_timeout(function(){return((typeof(outbrain_language_manager[self.languageName])!='object')&&(outbrain_language_manager.isLanguageReady(self.languageName)));},function(){if(outbrain_language_manager.isRtl(self.languageName)){self.constants.globalClass=self.constants.globalClass.replace("div-wrapper","div-wrapper-right");self.templateDOM=self.templateDOM.replace('div-wrapper"','div-wrapper-right"');self.templateDOM=self.templateDOM.replace(self.matrixInfo.matrixSource,self.matrixInfo.matrixSourceRTL);self.templateDOM=self.templateDOM.replace('padding-left:0px;;padding-right:8px;','padding-left:8px;;padding-right:0px;');self.changeContainerClassWhenExists(index);self.changeWhenHaveStars(index);}},null,null,500,1000,true);}
this.resetTemplate=function(index){if(typeof(OB_user_mode)=='number'&&OB_user_mode==1){currElement=this.getElementWithFullName(this.constants.fieldsetId,index);if(currElement){currElement.style.display="none";}
currElement=this.getElementWithFullName(this.constants.recommendationsPcLegendId,index);if(currElement){currElement.style.display="none";}}}
this.waitForImages=function(){new outbrain_timeout(function(){return(self.isMatrixReady);},function(){return true},null,null,500,1000,true);}
this.replaceEveryTime=function(index){if(!this.templateHaveImages){this.imagesPreload();}
this.replaceWhenHaveLang(index);var thisRater=this.templateDOM;thisRater=thisRater.replace(/\$INDEX/g,index);thisRater=thisRater.replace(/\$GLOBAL_CLASS/g,this.constants.globalClass);var plugIns='';for(var pluginIDX=0;pluginIDX<self.pluginsArray.length;++pluginIDX){plugIns+=self.pluginsArray[pluginIDX].initPost(index);}
thisRater=thisRater.replace(/\$PLUGINS/g,plugIns);return thisRater;}
this.isTemplateReady=function(){return this.templateReplacedOnce;}
this.getDomPerPost=function(index){return this.replaceEveryTime(index);}
this.insertRaterElement=function(newDom,a){var returnValue=null;newDom=newDom.firstChild;returnValue=this.dom.elementInsertion(a,newDom,this.top,this.inside);return returnValue;}
this.addCssFile=function(){var cssElement=document.createElement("link");cssElement.rel=outbrain_settings.globals.cssRel;cssElement.type=outbrain_settings.globals.cssType;cssElement.id=outbrain_settings.rater.cssId;cssElement.href=outbrain_settings.rater.cssUrl;cssElement.onload=function(){cssFile_Loaded=true;}
var heads=document.getElementsByTagName("head");if(heads.length>0){heads[0].appendChild(cssElement);}else{outbrain_template_manager.addElementToManagerHelper(cssElement);}}
this.getRateModeInfoText=function(language,currentRateValue){var rateInfo="<strong>"+outbrain_language_manager.getRateDescription(language,currentRateValue)+"</strong>";return rateInfo}
this.getRateModeStatusText=function(language,index,compRank,rateBy){var rateStatus=outbrain_language_manager.rateGetAverageStr(language,compRank,rateBy);return rateStatus}
this.getPreModeInfoText=function(language,index){rateInfo="";var rateInfo=outbrain_language_manager.getBeTheFirstString(language);rateInfo+='$COMMENT';return rateInfo;}
this.getPostModeInfoText=function(language,index,compRank,rateBy,isRated){var withMe=isRated;rateInfo="";rateInfo=outbrain_language_manager.rateGetAggregate(language,compRank,rateBy,withMe);rateInfo+='$COMMENT';return rateInfo;}
this.getPersonalizedModeInfoText=function(language,index,compRank,personalIndex,personalRatedBy){var rateInfo="";var personalLabel=outbrain_language_manager.getPersonalRateDesc(language,personalIndex);rateInfo=outbrain_language_manager.rateGetLikeYou(personalLabel,compRank,personalRatedBy);rateInfo+=' $COMMENT';return rateInfo;}
this.getRatedStatusText=function(language,vote){var rateStatus=outbrain_language_manager.getRatePostRate(language,vote-1)+' ({starsImage})';return rateStatus;}
this.getDisqusText=function(language,rateInfo){if(outbrain_rater.isDisqusOn(language)){rateInfo=rateInfo.replace(/\$COMMENT/g,' | <span class="ob_commentOut" onmouseout="javascript:this.className=\'ob_commentOut\'" onmouseover="javascript:this.className=\'ob_commentOver\'" onClick="javascript:location.href=\''+outbrain_rater.cleanLink(location.href)+'#'+outbrain_rater.getDisqusLink()+'\'" style="cursor:hand;">'+outbrain_language_manager.languages_list[language].COMMENT+'</span>');}else{rateInfo=rateInfo.replace(/\$COMMENT/g,'');}
return rateInfo;}
this.getRecTitle=function(language,vote){var recTitle=outbrain_language_manager.getRatePostRateForRecommendations(language,vote);return recTitle;}
this.getRateInfo=function(index,rateMode){if(outbrain_rater.lockRater(index)){return false;}
if(OB_voterWidgetObjArray[index].rankInfo==null){return false;}
var language=self.getLanguageId();var currentVoterWidget=OB_voterWidgetObjArray[index];var vote=currentVoterWidget.rankInfo.vote;var localRateMode=(rateMode!=null)?rateMode:OB_voterWidgetObjArray[index].rateMode;var rateInfo="";var rateData="";var rateStatus="";var score=0;var recommendationsTitle="";var replaced=0;var jsonObj=null;if(localRateMode==outbrain_settings.rater.statuses.RATER_RATE_MODE){rateInfo=this.getRateModeInfoText(language,OB_voterWidgetObjArray[index].currentRateValue-1);rateStatus=this.getRateModeStatusText(language,index,currentVoterWidget.rankInfo.getComputedRank(true),currentVoterWidget.rankInfo.ratedBy);}else{if(!OB_voterWidgetObjArray[index].isPersonalized||vote!=0){if(currentVoterWidget.rankInfo.ratedBy==0){rateInfo=this.getPreModeInfoText(language,index);}else{rateInfo=this.getPostModeInfoText(language,index,currentVoterWidget.rankInfo.getComputedRank(true),currentVoterWidget.rankInfo.ratedBy,currentVoterWidget.rated);}}else{var personalIndex=currentVoterWidget.rankInfo.getPersonalRateIndex();rateInfo=this.getPersonalizedModeInfoText(language,index,currentVoterWidget.rankInfo.getComputedRank(),personalIndex,currentVoterWidget.rankInfo.personalRatedBy);rateStatus=this.getRateModeStatusText(language,index,currentVoterWidget.rankInfo.getComputedRank(true),currentVoterWidget.rankInfo.ratedBy);}}
rateInfo=this.getDisqusText(language,rateInfo);if(!currentVoterWidget.rated){if(!OB_voterWidgetObjArray[index].isPersonalized){rateStatus='';}}else{rateStatus=this.getRatedStatusText(language,vote);}
recommendationsTitle=this.getRecTitle(language,vote);return[currentVoterWidget,rateInfo,rateStatus,localRateMode,recommendationsTitle];}
this.renderRecCancelation=function(index,docIdx,bocr){var fieldsetName=(self.getElementWithFullName(self.constants.fieldsetId,index)).id;var value=" <span class='"+self.cancelRecommendationId+"Div' id='"+self.cancelRecommendationId+"_"+index+"_"+docIdx+"'><a href='javascript:void(0);' alt='Cancel this recommendation' onclick='javasctipt:outbrain_template_manager.templates["+self.templateIndex+"].checkWaitStatus();outbrain_template_manager.templates["+self.templateIndex+"].doWaiting(\""+fieldsetName+"\","+index+","+docIdx+");outbrain_rater.setRecCancellationOdbScript("+index+","+self.templateIndex+",\""+encodeURIComponent(bocr)+"\"); return false;') style='text-decoration:none;color:red;font-weight:bold'>[x]</a></span>";return value;}
this.checkWaitStatus=function(){if(!self.isOwnerNotLoading)
return false;}
this.doWaiting=function(fieldsetElementName,index,docIdx){self.addWaitClock(fieldsetElementName,index);self.waitTimer(index,docIdx);}
this.waitTimer=function(index,docIdx){new outbrain_timeout(function(){return(self.checkWaitStatus()!=false);},function(){},null,function(){self.noMoreWaitting(index)},1000,60,true)}
this.addWaitClock=function(fieldsetElementName,waitId,index){var fieldsetElement=document.getElementById(fieldsetElementName);var waitDiv=document.getElementById(self.constants.recommendationsWaitId+"_outer_"+index);if(waitDiv){waitDiv.style.display="block";self.isOwnerNotLoading=false;var waitImg=waitDiv.getElementsByTagName("img")[0];if(waitImg){waitImg.src=self.waitImageUrl;if(fieldsetElement){if(fieldsetElement.className.indexOf(self.waitBackgroundClass)<0)
fieldsetElement.className+=" "+self.waitBackgroundClass;}}}}
this.removeWaitClock=function(index){var fieldsetElement=self.getElementWithFullName(self.constants.fieldsetId,index);var waitDiv=document.getElementById(self.constants.recommendationsWaitId+"_outer_"+index);self.isOwnerNotLoading=true;if(waitDiv){waitDiv.style.display="none";if(fieldsetElement){fieldsetElement.className=fieldsetElement.className.replace(self.waitBackgroundClass,"");}}}
this.noMoreWaitting=function(index,errorMsg){if(errorMsg==null||typeof(errorMsg)!='string'||errorMsg.length<=0){errorMsg="There was unknown error while sending data"}
var whatToDo="\nPress OK to reload the page or Cancel to abort. ";if(confirm(errorMsg+whatToDo)){window.location.reload();}else{self.removeWaitClock(index);}}
this.initPlugins=function(){}
this.startTemplate=function(){this.addCssFile();outbrain_language_manager.addLanguage(self.languageName,outbrain_settings.language.url);this.initTemplate();this.constants.init();this.initPlugins();this.buildDOMOnce();this.replacerOnce();this.waitForImages();}}
var outbrain_template_manager_object=function(){this.ready=false;var self_manager=this;this.globalElementId="outbrain_template_element_";this.helperElementId="outbrain_manager_helper_div";this.isRecOnly=true;this.optionalTemplates=[];this.userTemplatesFileUrl="";this.userTemplatesFileReturned=false;this.templatesListInit=false;this.allTemplatesWasReadyBefore=false;this.templates=[];this.templateSTR=null;this.dom=null;this.templatesLoop=function(func){for(var i=0;i<this.templates.length;i++){func();}}
this.getDataAllPosts=function(){return OB_voterWidgetObjArray;}
this.getDataPerPost=function(templateIndex,postIndex,rateMode){var obj=OB_voterWidgetObjArray[postIndex];if(typeof(rateMode)!='number'){rateMode=obj.rateMode;}
var moreInfo=this.templates[templateIndex].getRateInfo(postIndex,rateMode);obj.rateInfo=moreInfo[1];obj.rateStatus=moreInfo[2];obj.rateMode=moreInfo[3];obj.recTitle=moreInfo[4];return obj;}
this.getRecommendationDataPerDoc=function(templateIndex,index,doc,docIdx){var isRedirectUrlOdbGen=(rater_global_settings.redirectUrlMethod=="redirect");var urlLink=null;var paramLink="";var postLink=null;if(typeof(doc.content)=='string'){var json=this.getDataPerPost(templateIndex,index).jsonObj;var refDID=(typeof(json.response.request.did)=='string')?json.response.request.did:null;if(typeof(doc.url)=='string'&&isRedirectUrlOdbGen&&doc.url.indexOf("key")>0){urlLink=doc.url;}
else{urlLink=outbrain_settings.domains.traffic+"?key="+doc.url_hash;isRedirectUrlOdbGen=false;}
paramLink+="&agent="+outbrain_settings.rater.recommendations.agentId+"_rec";paramLink+="&version="+outbrain_settings.versions.rater;if(refDID!=null&&!isRedirectUrlOdbGen){paramLink+="&rdid="+refDID;}}
var linkText=null;if(typeof(doc.content)=='string'){linkText=doc.content;}
var sourceName=null;if(typeof(doc.source_name)=='string'){sourceName=doc.source_name;}
var authorName=null;if(typeof(doc.author)=='string'){authorName=doc.author;}
var pubDate=null;if(typeof(doc.pubDate)=='string'){pubDate=doc.pubDate;}
var isSameSource=false;if(typeof(doc.same_source)=='string'){isSameSource=(doc.same_source=="true");}
var isAdId=false;if(typeof(doc.pc_id)!='undefined'){try{if(typeof(doc.adv_name)!='undefined'){if((doc.adv_name).length>0){isAdId=true;}}}
catch(ex){isAdId=false;}}
var bocr=false;if(typeof(doc.bocr)=='string'){bocr=(doc.bocr);}
if(outbrain_settings.rater.recommendations.defaultRecNumber<=docIdx){paramLink+="&hr=1";}
if(docIdx!=null&&(typeof(docIdx)=='number')){paramLink+="&idx="+docIdx;}
var recType=null;if(!isRedirectUrlOdbGen){if(typeof(doc.rec_type)=='string'){recType=doc.rec_type;paramLink+="&type="+recType;}else{paramLink+="&type="+outbrain_settings.rater.recommendations.type;}}
postLink=urlLink+paramLink;return[postLink,linkText,sourceName,authorName,pubDate,isSameSource,recType,isAdId,bocr];}
this.isAllSameSource=function(documents){var isSameSource=true;for(var t=0;t<documents.doc.length;t++)
if(typeof(documents.doc[t].same_source)=='string'){if(!(documents.doc[t].same_source=="true")){isSameSource=false;}}
documents.isAllSameSource=isSameSource;return isSameSource;}
this.setStatus=function(templateIndex,index,statusId,extraInt,extraStr){var itemData=this.getDataPerPost(templateIndex,index);itemData.rateMode=statusId;switch(statusId){case outbrain_settings.rater.statuses.RATER_PRE_RATE_MODE:break;case outbrain_settings.rater.statuses.RATER_RATE_MODE:outbrain_rater.rate(templateIndex,index,extraInt);break;case outbrain_settings.rater.statuses.RATER_POST_RATE_MODE:itemData.frezz=false;itemData.frezzSemaphore=0;this.updateAllData(index,statusId);break;}}
this.isThereTemplateWithRecommendations=function(){for(i=0;i<this.templates.length;i++){if(this.templates[i].supportRecommendations()){return true;}}
return false;}
this.recommendationsStatusPerItem=function(templateIndex,index,rateMode){var currentVoterWidget=this.getDataPerPost(templateIndex,index);var value=false;if(this.lastOdbRotationRequestedItem<index){value=false;}else if(outbrain_settings.rater.recommendations.always){value=true;}else if(this.templates[templateIndex].supportRecommendations()){if(outbrain_language_manager.isRecommendationsAvailable(outbrain_template_manager.templates[templateIndex].getLanguageId())){if((rateMode==outbrain_settings.rater.statuses.RATER_POST_RATE_MODE)&&(OB_voterWidgetObjArray[index].rankInfo.vote>=3)){value=true;}else if(currentVoterWidget.isPersonalized){value=!(currentVoterWidget.rankInfo.getPersonalRateIndex()==0);}else if(currentVoterWidget.rankInfo==null){value=false;}else if(typeof(OB_voterWidgetObjArray[index].hasRecommendations)=='boolean'&&OB_voterWidgetObjArray[index].hasRecommendations==true){value=true;}else if((currentVoterWidget.rankInfo.getComputedRank(true)>2.5||currentVoterWidget.rankInfo.getComputedRank(true)==0)&&(OB_voterWidgetObjArray[index].rankInfo.vote==0)){value=true;}else{value=false;}}else{value=false;}}else{value=false;}
return value;}
this.recommendationsHaveDataPerItem=function(index,jsonObj){var value=(typeof(jsonObj.response)!='undefined'&&typeof(jsonObj.response.documents)!='undefined'&&typeof(jsonObj.response.documents.total_count)!='undefined'&&jsonObj.response.documents.total_count>0);return value;}
this.showRecommendationsPerTemplateIsOk=function(templateIndex,index,itemData,rateMode){self_manager.templates[templateIndex].showRecommendations(index,itemData,rateMode);}
this.showRecommendationsPerTemplate=function(templateIndex,index,itemData,rateMode){if(this.recommendationsStatusPerItem(templateIndex,index,rateMode)&&this.recommendationsHaveDataPerItem(index,itemData.jsonObj)){this.showRecommendationsPerTemplateIsOk(templateIndex,index,itemData,rateMode);}}
this.showRecommendations=function(templateIndex,index,itemData,rateMode){var jsonObj=itemData.jsonObj;if(this.recommendationsStatusPerItem(templateIndex,index,rateMode)&&this.recommendationsHaveDataPerItem(index,jsonObj)){for(var templatesLoop=0;templatesLoop<this.templates.length;templatesLoop++){self_manager.showRecommendationsPerTemplateIsOk(templatesLoop,index,itemData,rateMode);}}}
this.updateRateInfoPerTemplate=function(templateIndex,index,itemData,rateMode){this.templates[templateIndex].updateRateInfo(index,itemData,rateMode);}
this.updateRateInfo=function(index,itemData,rateMode,rateInfo){for(var templatesLoop=0;templatesLoop<this.templates.length;templatesLoop++){self_manager.updateRateInfoPerTemplate(templatesLoop,index,itemData,rateMode);}}
this.changeViewPerTemplate=function(templateIndex,index,itemData,rateMode){this.templates[templateIndex].changeView(index,itemData,rateMode);}
this.changeView=function(index,itemData,rateMode){for(var templatesLoop=0;templatesLoop<this.templates.length;templatesLoop++){self_manager.changeViewPerTemplate(templatesLoop,index,itemData,rateMode);}}
this.updateAllDataPerTemplate=function(templateIndex,index,rateMode){if(typeof(rateMode)=='undefined'){rateMode=null;}
var itemData=this.getDataPerPost(templateIndex,index,rateMode);if(rateMode==null){rateMode=itemData.rateMode;}
this.updateRateInfoPerTemplate(templateIndex,index,itemData,rateMode);this.changeViewPerTemplate(templateIndex,index,itemData,rateMode);this.showRecommendationsPerTemplate(templateIndex,index,itemData,rateMode);}
this.updateAllData=function(index,rateMode){for(var templatesLoop=0;templatesLoop<this.templates.length;templatesLoop++){if(typeof(rateMode)=='undefined'){rateMode=null;}
var itemData=this.getDataPerPost(templatesLoop,index);if(rateMode==null){rateMode=itemData.rateMode;}
self_manager.resetTemplate(templatesLoop,index);self_manager.showRecommendationsPerTemplate(templatesLoop,index,itemData,rateMode);self_manager.changeViewPerTemplate(templatesLoop,index,itemData,rateMode);self_manager.updateRateInfoPerTemplate(templatesLoop,index,itemData,rateMode);}}
this.resetTemplate=function(templatesLoop,index){self_manager.templates[templatesLoop].resetTemplate(index);}
this.postDataLoaded=function(index){this.updateAllData(index,null);}
this.userRated=function(index){}
this.getMatrixInfosData=function()
{this.result=null;this.defaultMatrixInfosJson=outbrain_settings.defaultMatrixInfos;this.userMatrixInfos=(typeof(OB_user_matrix_infos)=='undefined')?this.defaultMatrixInfosJson:OB_user_matrix_infos;if(this.userMatrixInfos==null){this.userMatrixInfos=this.defaultMatrixInfoJson;}
if(this.userMatrixInfos!=null)
try{this.result=eval('('+this.userMatrixInfos+')');}
catch(error){return null;}
return this.result;}
this.checkIsRecOnly=function(itemsToCheck){if(self_manager.isRecOnly==true){for(var j=0;j<outbrain_settings.templateOptions.length;j++){if(itemsToCheck.indexOf(outbrain_settings.templateItemsJoin+outbrain_settings.templateOptions[j]+outbrain_settings.templateItemsJoin)>-1){if(outbrain_settings.templateOptions[j]=="stars"){return false;}}}}
return true;}
this.getTemplatesByUserString=function(){this.userMatrixInfos=self_manager.getMatrixInfosData();this.defaultArr=outbrain_settings.defaultTemplate;this.userTemplate=(typeof(OB_user_template)=='undefined')?this.defaultArr:OB_user_template;if(this.userTemplate==null){this.userTemplate=this.defaultArr;}
if(this.userTemplate.constructor!=Array){this.userTemplate=[this.userTemplate];}
for(var i=0;i<this.userTemplate.length;i++){var currentTemplateString=this.userTemplate[i];var currentTemplateAsArray=currentTemplateString.split(outbrain_settings.templateGlobalSplit);if(currentTemplateAsArray.length!=4&&currentTemplateAsArray.length!=5){continue;}
if((currentTemplateAsArray[0]!="top")&&(currentTemplateAsArray[0]!="bottom")){continue;}
if(typeof(self_manager.optionalTemplates[currentTemplateAsArray[1]])=='undefined'){continue;}
if(typeof(self_manager.optionalTemplates[currentTemplateAsArray[1]].constructor)=='undefined'){continue;}
if(typeof(self_manager.optionalTemplates[currentTemplateAsArray[1]].constructor)!='function'){continue;}
if(typeof(currentTemplateAsArray[2])!="string"){continue;}else if((currentTemplateAsArray[2]!="true")&&(currentTemplateAsArray[2]!="false")){continue;}else{currentTemplateAsArray[2]=(currentTemplateAsArray[2]=="true");}
if((currentTemplateAsArray[1]==outbrain_settings.defaultTemplateName)&&(currentTemplateAsArray[0]=="bottom")){if((typeof(OB_isOnHeader)=='boolean')&&(OB_isOnHeader)){currentTemplateAsArray[0]="top";}
if(typeof(OB_rater_position)=='string'){currentTemplateAsArray[0]=(OB_rater_position=="top")?"top":"boolean";}
if(typeof(OB_insertInElement)=='boolean'){currentTemplateAsArray[2]=OB_insertInElement;}
if((typeof(OB_showRec)=='boolean')&&(OB_showRec)){if(currentTemplateAsArray[3].indexOf("recommendations")==-1){if(currentTemplateAsArray[3].length>0){currentTemplateAsArray[3]+=" ";}
currentTemplateAsArray[3]+="recommendations";}}}
var templateItems=outbrain_settings.templateItemsJoin+currentTemplateAsArray[3].split(outbrain_settings.templateItemsSplit).join(outbrain_settings.templateItemsJoin)+outbrain_settings.templateItemsJoin;var someTemplateItem=false;for(var j=0;j<outbrain_settings.templateOptions.length;j++){if(templateItems.indexOf(outbrain_settings.templateItemsJoin+outbrain_settings.templateOptions[j]+outbrain_settings.templateItemsJoin)>-1){someTemplateItem=true;break;}}
this.isRecOnly=self_manager.checkIsRecOnly(templateItems);if(!someTemplateItem){continue;}
templateName='';if(currentTemplateAsArray[4]==null||currentTemplateAsArray[4]=='undefined'){templateName=currentTemplateAsArray[1];}
else{templateName=currentTemplateAsArray[4];}
var templateMatrixInfo=null;try{templateMatrixInfo=self_manager.userMatrixInfos.matrixInfos[templateName];}
catch(error){}
self_manager.templates[self_manager.templates.length]=new self_manager.optionalTemplates[currentTemplateAsArray[1]]((self_manager.templates.length),currentTemplateAsArray[0],currentTemplateAsArray[2],currentTemplateAsArray[3],templateMatrixInfo);self_manager.templates[self_manager.templates.length-1].startTemplate();}
this.ready=true;self_manager.templatesListInit=true;}
this.addTemplate=function(templatesArray){for(var i=0;i<templatesArray.length;i++){this.optionalTemplates[templatesArray[i][0]]=templatesArray[i][1];if(templatesArray[i][0]!=outbrain_settings.defaultTemplateName){self_manager.userTemplatesFileReturned=true;}}}
this.templatesLoaded=function(){this.getTemplatesByUserString();}
this.userScriptTag="userTemplateElement";this.removeTemplateScriptElement=function(){var element=outbrain_dom.$(this.userScriptTag);if(element){element.src="about:blank";var ele=this.removeElementFromManagerHelper(element);return true;}
return false;}
this.addTemplateScriptElement=function(){var s=document.createElement("script");s.type=outbrain_settings.globals.scriptType;s.id=this.userScriptTag;s.src=this.userTemplatesFileUrl;this.addElementToManagerHelper(s);new outbrain_timeout(function(){return(self_manager.userTemplatesFileReturned);},function(){self_manager.templatesLoaded();},null,function(){self_manager.templatesLoaded();},1000,20,true);}
this.loadTemplates=function(){this.addTemplate([[outbrain_settings.defaultTemplateName,outbrain_template_object]]);if(typeof(OB_userTemplateFile)=='string'){this.userTemplatesFileUrl=OB_userTemplateFile;this.addTemplateScriptElement();}else{self_manager.userTemplatesFileReturned=true;this.templatesLoaded();}}
this.initTemplateManager=function(){this.dom=new outbrain_dom_object();var helper="<div id='"+this.helperElementId+"' style='display:none;'></div>";document.write(helper);}
this.getHelperElement=function(){return this.dom.$(this.helperElementId);}
this.isSingleTemplateReady=function(index){return this.templates[index].isTemplateReady();}
this.isTemplatesReady=function(){for(var j=0;j<this.templates.length;j++){if(!self_manager.isSingleTemplateReady(j)){return false;}}
return true;}
this.onDomReady=function(){var returnedArray=[];for(var j=0;j<this.templates.length;j++){returnedArray[returnedArray.length]=self_manager.templates[j].domReady(itemsArray[j].rateMode,j);}
return returnedArray;}
this.insertDomPerPost=function(index,a){var returnValue=null;for(var j=0;j<this.templates.length;j++){var newDom=self_manager.templates[j].getDomPerPost(index);var newElement=document.createElement("div");newElement.innerHTML=newDom;returnValue=self_manager.templates[j].insertRaterElement(newElement,a);}
return returnValue;}
this.getElementsPerPost=function(index){var tempArr=new Array();for(var j=0;j<this.templates.length;j++){var elementToReg=self_manager.templates[j].getElementWithFullName(self_manager.templates[j].constants.containerId,index);tempArr[tempArr.length]=elementToReg;}
return tempArr;}
this.IsRecForAllTemplates=function(){if((typeof(OB_showRec)=='boolean')&&OB_showRec==false)
return false;for(var j=0;j<this.templates.length;j++){if(self_manager.templates[j].supportRecommendations()==true)
return true;}
return false;}
this.loadRankDataForPost=function(index){new outbrain_timeout(function(){return self_manager.isTemplatesReady();},function(){if(!self_manager.allTemplatesWasReadyBefore){outbrain_rater.initOnlyWithTemplates();self_manager.allTemplatesWasReadyBefore=true;}
outbrain_rater.loadRankData(index);},null,null,100,1000,true);}
this.addElementToManagerHelper=function(newElement){var helperDiv=this.getHelperElement();if(helperDiv){var ele=helperDiv.appendChild(newElement);return ele;}
return false;}
this.removeElementFromManagerHelper=function(Element){if(Element){return Element.parentNode.removeChild(Element);}
return false;}
this.doRate=function(templatesLoop,index,url){var currWidgetObj=this.getDataPerPost(templatesLoop,index);if(typeof(currWidgetObj.rankInfo.lastRateId)!='undefined'&&OB_voterWidgetObjArray[index].rankInfo.lastRateId!=null){var rateFrame=this.dom.$(currWidgetObj.rankInfo.lastRateId);if(rateFrame){rateFrame.parentNode.removeChild(rateFrame);}}
var helperDiv=this.getHelperElement();if(helperDiv){var tempIFrame=document.createElement('iframe');var randId='RSIFrame'+Math.random();tempIFrame.setAttribute('id',randId);tempIFrame.style.border='0px';tempIFrame.frameborder=0;tempIFrame.style.width='0px';tempIFrame.style.height='0px';tempIFrame.style.display='none';var IFrameObj=this.addElementToManagerHelper(tempIFrame);var IFrameDoc=IFrameObj.contentWindow.document;IFrameDoc.location.replace(url);OB_voterWidgetObjArray[index].rankInfo.lastRateId=randId;}}
this.initTemplateManager();}
var outbrain_whatIs=typeof(outbrain_whatIs)=="object"?outbrain_whatIs:new function(){this.openedBefore=false;var self=this;this.start=function(index){new outbrain_timeout(function(){return(typeof(outbrain_whatis_create)=='function');},function(){outbrain_whatis_create(index);},null,null,500,100,true);}
this.loadJs=function(index){if(!this.openedBefore){var newScriptElement=document.createElement("script");newScriptElement.src=outbrain_settings.whatIs.url;newScriptElement.setAttribute('id',outbrain_settings.whatIs.id);newScriptElement.setAttribute('type',outbrain_settings.globals.scriptType);var heads=document.getElementsByTagName("head");if(heads.length>0){heads[0].insertBefore(newScriptElement,heads[0].firstChild);}else{var managerHelper=outbrain_template_manager.getHelperElement();if(managerHelper){voter.parentNode.insertBefore(newScriptElement,voter);}else{setTimeout(function(){self.loadJs(index);},1000);}}
this.openedBefore=true;this.start(index);}else{outbrain_whatis_click(index);}}}
var outbrain_rater_object=function(){var self=this;this.isRunning=false;this.supportRecommendations=false;this.halt=false;this.pmd=null;this.startTime=new Date();this.odbSemafor=false;this.delay=(outbrain_browsers.mozilla)?1000:200;this.odbDynamicCallsArray=[];this.isLoadDynamicDataOn=false;this.pageLoaded=false;this.insertReady=false;this.isHomePage=false;this.permalinksUsed=[];this.userCustomizeContainerDivClass=null;this.userCustomizePermaLinkClass=null;this.userCustomizeFooterClass=null;this.userAppendContainerDivClass=null;this.elementToSearch="div";this.countInsertedItems=-1;this.lastOdbRotationRequestedItem=0;this.lastOdbRotationReturnedItem=0;this.isRecEnabled=true;this.odbCallsList=[];this.odbCallsListSemaforIsLock=false;this.scrollMaxTimeInterval=150;this.scrollHeightLast=0;this.scrollHeightFactor=70;this.isToolTipLoaded=false;this.getQSParam=function(param){var query=document.location.search.substring(1);var parms=query.split('&');var val=null;for(var i=0;i<parms.length;i++){var pos=parms[i].indexOf('=');if(pos>0){var key=parms[i].substring(0,pos);if(param==key){val=parms[i].substring(pos+1);break;}}}
return val;}
this.returnedOdbData=function(jsonObj,index,isRec){this.lastOdbRotationReturnedItem=index;this.odbCallsListSemaforIsLock=false;this.fireNextOdbRequestItem();OB_voterWidgetObjArray[index].jsonObj=jsonObj;this.widgetInit(index);}
this.returnedCancelOdbData=function(jsonObj,index,templateIndex){if(jsonObj!=null){if(typeof(jsonObj.ob_exclude_resp)!='undefined'){if(typeof(jsonObj.ob_exclude_resp.code)=='number'){if(jsonObj.ob_exclude_resp.code==0){this.setRecOdbScript(index,true);return;}
else if(typeof(jsonObj.ob_exclude_resp.message)=='string'){outbrain_template_manager.templates[templateIndex].noMoreWaitting(index,jsonObj.ob_exclude_resp.message);return;}}}}
if(typeof(index)=='number'){outbrain_template_manager.templates[templateIndex].noMoreWaitting(index,"");}}
this.widgetInit=function(index){var currentJsonObj=OB_voterWidgetObjArray[index].jsonObj;if(currentJsonObj==null){return;}
OB_voterWidgetObjArray[index].isPersonalized=currentJsonObj.response.score.preferred=='personal';OB_voterWidgetObjArray[index].rankInfo=new OB_voterWidgetObjArray[index].rankInfo_object(currentJsonObj.response.score.average.ratings.wsum_ratings,currentJsonObj.response.score.average.ratings.count_users,currentJsonObj.response.score.average.ratings.wcount_users,currentJsonObj.response.score.average.ratings.pos_ratings,currentJsonObj.response.score.average.ratings.neg_ratings,outbrain_settings.keys_and_users.userName);if(typeof(currentJsonObj.response.score.self_rating)!='undefined'){OB_voterWidgetObjArray[index].rankInfo.vote=currentJsonObj.response.score.self_rating;OB_voterWidgetObjArray[index].rankInfo.rank=OB_voterWidgetObjArray[index].rankInfo.rank-OB_voterWidgetObjArray[index].rankInfo.vote;OB_voterWidgetObjArray[index].rateMode=outbrain_settings.rater.statuses.RATER_POST_RATE_MODE;OB_voterWidgetObjArray[index].rated=true;OB_voterWidgetObjArray[index].frezz=false;OB_voterWidgetObjArray[index].frezzSemaphore=0;}
if(OB_voterWidgetObjArray[index].isPersonalized){OB_voterWidgetObjArray[index].rankInfo.personalRatedBy=currentJsonObj.response.score.personal.ratings.count_users;OB_voterWidgetObjArray[index].rankInfo.personalRank=currentJsonObj.response.score.personal.score;}
outbrain_template_manager.postDataLoaded(index);return true;}
this.lockRater=function(index){if(OB_voterWidgetObjArray[index].frezz&&OB_voterWidgetObjArray[index].frezzSemaphore==0){OB_voterWidgetObjArray[index].frezzSemaphore++;return false;}else if(OB_voterWidgetObjArray[index].frezz&&OB_voterWidgetObjArray[index].frezzSemaphore>0){return true;}}
this.disqusOnPage=false;this.isDisqusOn=function(language){if(this.disqusOnPage)return true;if(outbrain_language_manager.languages_list[language].OPTIONAL_ADDONS.disqus&&outbrain_settings.rater.isDisqus&&document.getElementById("disqus_thread")!=null){this.disqusOnPage=true;return true;}else{return false;}}
this.getDisqusLink=function(){var dsq_link=null;var dsq_tagList=(typeof(OB_dsqTagList)!='undefined')?OB_dsqTagList:['dsq-add-new-comment','dsq-content','disqus_thread'];for(var linkCounter=0;linkCounter<dsq_tagList.length;linkCounter++)
{dsq_link=document.getElementById(dsq_tagList[linkCounter]);if(dsq_link!=null)break;}
return((dsq_link!=null)?dsq_tagList[linkCounter]:"");}
this.cleanLink=function(urlLink){if(urlLink.indexOf('#')>0){urlLink=urlLink.substr(0,urlLink.lastIndexOf('#'));}
return(urlLink);}
this.cleanLink=function(urlLink){if(urlLink.indexOf('#')>0){urlLink=urlLink.substr(0,urlLink.lastIndexOf('#'));}
return(urlLink);}
this.changeOdbCallMode=function(){if(self.isRecEnabled==false)
outbrain_settings.odb.isSemafor=false;}
this.registerOdbRequest=function(index,tryOnload){if((typeof(OB_odb_static_mode)=='boolean')&&(OB_odb_static_mode==true))return;self.isRecEnabled=outbrain_template_manager.IsRecForAllTemplates();self.changeOdbCallMode();var arrElementsToRegister=outbrain_template_manager.getElementsPerPost(index);var isEager=(index<outbrain_settings.odb.eagerOdbCalls||index<1);var objdata=null;for(var t=0;t<arrElementsToRegister.length;t++){objdata=this.getOdbRequestObject(index,arrElementsToRegister[t],function(){self.setRecOdbScript(index);});if(isEager==true){this.addOdbRequestItem(objdata);}else{this.objLocationItemHolder.addLocationItem(objdata);}}
this.checkLocations(false);this.fireNextOdbRequestItem();}
this.getOdbRequestObject=function(index,element,func){var ObjData=new Object();ObjData.index=index;ObjData.element=element;ObjData.func=func;return ObjData;}
this.addOdbRequestItem=function(dataObj){this.odbCallsList[this.odbCallsList.length]=dataObj;}
this.fireNextOdbRequestItem=function(){if(!self.insertReady)return;if(outbrain_settings.odb.isSemafor==true&&this.odbCallsListSemaforIsLock==true)
return;for(var t=0;t<this.odbCallsList.length;t++){if(this.odbCallsList[t]!=null){this.odbCallsListSemaforIsLock=true;var tempOdbCallObj=this.odbCallsList[t];this.removeItemsByPostIndex(this.odbCallsList[t].index);try{tempOdbCallObj.func();}catch(ex){var error=ex;}
if(outbrain_settings.odb.isSemafor==true)
return;}}
this.cleanList();return;}
this.removeItemsByPostIndex=function(index){for(t=this.odbCallsList.length-1;t>=0;t-=1){if(this.odbCallsList[t]!=null){if(this.odbCallsList[t].index==index){this.odbCallsList[t]=null;}}}}
this.cleanList=function(){for(t=this.odbCallsList.length-1;t>=0;t-=1){if(this.odbCallsList[t]==null)
this.odbCallsList.splice(t,1);}}
this.checkLocationsWithDimmer=function(){clearTimeout(self.scrollLocationCheckTimer);this.scrollLocationCheckTimer=setTimeout(self.checkLocations,self.scrollMaxTimeInterval);}
this.checkLocations=function(usePositionDimmer){if(usePositionDimmer==true){var currFactorPosition=Math.round(self.objLocationCalc.getTopY()/self.scrollHeightFactor);if(currFactorPosition==self.scrollHeightLast){return;}else{self.scrollHeightLast=currFactorPosition;}}
var elementInScope=self.objLocationItemHolder.getElementsInScope();if(elementInScope.length>0){for(var t=0;t<elementInScope.length;t++){self.odbCallsList[self.odbCallsList.length]=elementInScope[t];}
self.fireNextOdbRequestItem();}}
this.createOdbScriptElement=function(id,src,defer,isSig,isRand){var s=null;var sig="";src+=(isSig)?"&sig="+outbrain_settings.rater.windowName:"";src+=(isRand)?"&rand="+Math.random():"";s=document.createElement("script");s.setAttribute('id',id);s.setAttribute('type',outbrain_settings.globals.scriptType);s.setAttribute('src',src);s.setAttribute('defer',defer);return s;}
this.setRecOdbScript=function(index,odbRefresher){outbrain_customSettings.postSettings();var requestUrl="";if(self.isRecEnabled){requestUrl=outbrain_settings.odb.odbGetDataUrlRec;}else{requestUrl=outbrain_settings.odb.odbGetDataUrlRegular;}
requestUrl=self.odbPathReplacer(requestUrl,index);if(odbRefresher){requestUrl=self.odbBcrReplacer(requestUrl);}
var scriptTag=self.createOdbScriptElement(outbrain_settings.rater.odb.getScoreRecId+'_'+index,requestUrl,true,true,true);this.setOdbScript(index,scriptTag)}
this.setRecCancellationOdbScript=function(index,templateIndex,bocr){var requestUrl="";requestUrl=outbrain_settings.blogUtils.cancelRecs;requestUrl=requestUrl.replace(/\$VOTER_INDEX/g,index);requestUrl=requestUrl.replace(/\$TEMPLATE_INDEX/g,templateIndex);requestUrl=requestUrl.replace(/\$BOCR/g,bocr);var scriptTag=self.createOdbScriptElement(outbrain_settings.rater.odb.getCancelRecId+'_'+index,requestUrl,true,true,false);this.setOdbScript(index,scriptTag)}
this.setOdbScript=function(index,scriptTag){var insertInElement;if(document.getElementsByTagName("head").length>-1){insertInElement=document.getElementsByTagName("head")[0];}else{insertInElement=outbrain_template_manager.getHelperElement();}
self.insertOdbRequestIntoDom(insertInElement,scriptTag);}
this.odbPathReplacer=function(path,index){var languageName=outbrain_language_manager.getName(outbrain_template_manager.templates[0].getLanguageId());var permaLink=OB_voterWidgetObjArray[index].permaLink;if(outbrain_settings.rater.cleanPermalink){permaLink=this.cleanPermalinkQueryString(permaLink);}
permaLink=encodeURIComponent(permaLink);path=path.replace(/\$VOTER_INDEX/g,index);path=path.replace(/\$PERMA_LINK/g,permaLink);if((typeof(outbrain_template_manager)!='undefined')&&(outbrain_template_manager.templates.length>0)&&(typeof(outbrain_language_manager.isLanguageReady)=='function')&&(outbrain_language_manager.isLanguageReady(outbrain_template_manager.templates[0].languageName))){if(outbrain_language_manager.getName(outbrain_template_manager.templates[0].getLanguageId())){path=path.replace(/\$LANGUAGE/g,languageName);}}else{path=path.replace(/\$LANGUAGE/g,"en")}
path+="&r="+Math.random();path+="&r="+Math.random();path+="&is_hp="+self.isHomePage;if(index==0&&typeof(outbrain_customSettings.getSearchReferrer)=='function'){var sref=outbrain_customSettings.getSearchReferrer();if(sref!=null&&typeof(sref)!='undefined'&&sref.length>0){path+="&ref_search="+outbrain_customSettings.getSearchReferrer();}}
return path;}
this.odbBcrReplacer=function(path){path+="&bcr=true";return path;}
this.cleanPermalinkQueryString=function(tempPL){var indxPL=tempPL.indexOf("?");if(indxPL>0){return(tempPL.substr(0,(indxPL)));}
return tempPL;}
this.insertOdbRequestIntoDom=function(oldN,newN){oldN.appendChild(newN);}
this.isDuplicatedContainer=function(permaLink)
{for(var i=0;i<self.permalinksUsed.length;i++){if(self.permalinksUsed[i]==permaLink){return true;}}
self.permalinksUsed.push(permaLink);return false;}
this.extractStopElement=function(containerDiv){var tags=containerDiv.getElementsByTagName("input");for(var i=0;i<tags.length;i++){if(tags[i].name.toLowerCase()=='postattribute'){if(tags[i].value.toLowerCase()=='hide')return true;}}
return false;}
this.extractePermalinkByFooter=function(containerDiv){var retPermalink=null;var divs=containerDiv.getElementsByTagName("div");if(self.pmd.postFooterDivClassname!=null){for(var i=0;i<divs.length&&retPermalink==null;i++){if(divs[i].parentNode!=containerDiv){continue;}
var linksArray=divs[i].getElementsByTagName("a");for(var j=0;j<self.pmd.postFooterDivClassname.length&&retPermalink==null;j++){var currFooterName=self.pmd.postFooterDivClassname[j];if(divs[i].className==currFooterName){for(var k=0;k<linksArray.length;k++){var a=linksArray[k];if((a.title=="permanent link")&&(a.href!=null)){if(a.href!=""){self.pmd.postFooterDivClassname=[self.pmd.postFooterDivClassname[j]];retPermalink=a.href;break;}}}}}}}
return retPermalink;}
this.extractePermalinkByClass=function(containerDiv){var retPermalink=null;var linksArray=containerDiv.getElementsByTagName("a");for(var i=0;i<linksArray.length&&retPermalink==null;i++){var a=linksArray[i];for(var j=0;j<self.pmd.permaLinkClassName.length;j++){if((a.href!=null)&&(a.href!="")){if(a.className==self.pmd.permaLinkClassName[j]){self.pmd.permaLinkClassName=[self.pmd.permaLinkClassName[j]];retPermalink=a.href;break;}}}}
return retPermalink;}
this.extractePermalinkByHTag=function(containerDiv){var retPermalink=null;var maxHtags=6;for(var i=0;i<=maxHtags&&retPermalink==null;i++){var h=containerDiv.getElementsByTagName("h"+i);for(var j=0;j<h.length&&retPermalink==null;j++){var linksArray=h[j].getElementsByTagName("a");for(var k=0;k<linksArray.length;k++){var a=linksArray[k];if((a.href!=null)&&(a.href!="")){retPermalink=a.href;break;}}}}
return retPermalink;}
this.extractePermalinkByFirstLink=function(containerDiv){var retPermalink=null;var linksArray=containerDiv.getElementsByTagName("a");for(var i=0;i<linksArray.length;i++){var a=linksArray[i];if((a.href!=null)&&(a.href!="")){retPermalink=a.href;break;}}
return retPermalink;}
this.extractePermalink=function(containerDiv){if(typeof(containerDiv)=='undefined'){return null;}
var returnValue=null;switch(outbrain_settings.platformType){case null:default:break;case outbrain_settings.PLATFORM_TYPE_BLOGGER_SIDEBAR:returnValue=this.extractePermalinkByFooter(containerDiv);if(returnValue==null){returnValue=this.extractePermalinkByClass(containerDiv);if(returnValue==null){returnValue=this.extractePermalinkByHTag(containerDiv);if(returnValue==null){returnValue=this.extractePermalinkByFirstLink(containerDiv);}}}
break;case outbrain_settings.PLATFORM_TYPE_TYPEPAD:returnValue=this.extractePermalinkByClass(containerDiv);break;case outbrain_settings.PLATFORM_TYPE_TUMBLR:returnValue=this.extractePermalinkByHTag(containerDiv);if(returnValue==null){returnValue=this.extractePermalinkByFirstLink(containerDiv);}
break;}
return returnValue;}
this.isAllLanguagesPerTemplatesInited=function(){for(var i=0;i<outbrain_template_manager.templates.length;i++){var currLang=outbrain_template_manager.templates[i].getLanguageId();if(!outbrain_language_manager.isLanguageReady(currLang)){return false;}}
return true;}
this.createPmd=function(){var postDivClassname=null;var permaLinkClassName=null;var postFooterDivClassname=null;var postDivClassnameArr=null;switch(outbrain_settings.platformType){case outbrain_settings.PLATFORM_TYPE_BLOGGER_SIDEBAR:postDivClassname=["post-body","post-body entry-content","postcontent","cover","entry"];permaLinkClassName=["timestamp-link","post-title entry-title"];postFooterDivClassname=["post-footer","footer","postfooter"];break;case outbrain_settings.PLATFORM_TYPE_TYPEPAD:postDivClassname=["entry-more","entry-body"];permaLinkClassName=["permalink"];break;case outbrain_settings.PLATFORM_TYPE_TUMBLR:postDivClassname=["regular"];break;case null:default:postDivClassname=[outbrain_settings.rater.globalElementClass];break;}
if(self.userAppendContainerDivClass!=null){postDivClassnameArr=self.userAppendContainerDivClass;if(typeof(postDivClassnameArr)=='array'){for(var i=0;i<postDivClassnameArr.length;i++){postDivClassname.push(postDivClassnameArr[i]);}}}
if(self.userCustomizeContainerDivClass!=null)
postDivClassname.unshift(self.userCustomizeContainerDivClass);if(self.userCustomizePermaLinkClass!=null)
permaLinkClassName=[self.userCustomizePermaLinkClass];if(self.userCustomizeFooterClass!=null)
postFooterDivClassname=[self.userCustomizeFooterClass];self.pmd=new OB_platformMetaData(postDivClassname,permaLinkClassName,postFooterDivClassname);}
this.loadMP=function(){var userMPFlag=typeof(OB_showMP)=='boolean'?OB_showMP:false;if(userMPFlag){switch(outbrain_settings.platformType){case outbrain_settings.PLATFORM_TYPE_BLOGGER_SIDEBAR:case outbrain_settings.PLATFORM_TYPE_TYPEPAD:case outbrain_settings.PLATFORM_TYPE_TUMBLR:var MPScript=document.createElement("script");MPScript.type=outbrain_settings.globals.scriptType;MPScript.id=outbrain_settings.MP.id;MPScript.src=outbrain_settings.MP.url;document.getElementById(outbrain_settings.rater.firstRaterPositionElementId).appendChild(MPScript);break;case null:default:break;}}}
this.checkNextBrother=function(elementList,elementListIndex,pmdList){try{var nodesFather=elementList[elementListIndex].parentNode.childNodes;var currentClass=elementList[elementListIndex].className;var currentContainerPosition=0;var currentBrotherPosition=0;var newContainerItem=null;for(var t=0;t<nodesFather.length;t++){if(nodesFather[t].className==currentClass){currentContainerPosition=t;break;}}
for(var p=0;p<pmdList.postDivClassname.length;p++){if(currentClass!=pmdList.postDivClassname[p]){for(var t=currentContainerPosition;t<nodesFather.length;t++){if(nodesFather[t].className==pmdList.postDivClassname[p]){newContainerItem=nodesFather[t];currentBrotherPosition=t;}}}}
if(newContainerItem==null)return 0;for(var elemCounter=0,t=elementListIndex;t<elementList.length;t++,elemCounter++){if(nodesFather[currentBrotherPosition]==elementList[t]){return(elemCounter);}}}
catch(e){return 0;}
return 0}
this.dynamicInsertion=function(){var elementToSearch=this.elementToSearch;if(this.halt){return;}
new outbrain_timeout(function(){var loadedLock=false;if(self.pageLoaded==true){loadedLock=true;}
if(!((outbrain_template_manager!=null)&&(outbrain_template_manager.templatesListInit)&&(self.isAllLanguagesPerTemplatesInited())&&(outbrain_customSettings.ready)))
return false;else
self.fullSettingReady=true;var as=document.getElementsByTagName(elementToSearch);var isTypepad=(outbrain_settings.platformType==outbrain_settings.PLATFORM_TYPE_TYPEPAD);var blockIndex=0;for(var j=0;j<self.pmd.postDivClassname.length;j++){for(blockIndex=0;blockIndex<as.length;blockIndex++){if(as[blockIndex].className==(self.pmd.postDivClassname[j])){if(isTypepad){blockIndex+=self.checkNextBrother(as,blockIndex,self.pmd,j);}
if(typeof(as[blockIndex].outbrainWidget)=='boolean'){continue;}
if(typeof(OB_parentsCount)=='number'){try{postMainDiv=as[blockIndex];for(var parentsLoop=0;parentsLoop<OB_parentsCount;parentsLoop++){postMainDiv=postMainDiv.parentNode;}}catch(e){continue;}}else{var postMainDiv=null;try{switch(outbrain_settings.platformType){case outbrain_settings.PLATFORM_TYPE_TYPEPAD:postMainDiv=as[blockIndex].parentNode.parentNode;break;case outbrain_settings.PLATFORM_TYPE_BLOGGER_SIDEBAR:postMainDiv=as[blockIndex].parentNode;break;case outbrain_settings.PLATFORM_TYPE_TUMBLR:postMainDiv=as[blockIndex];break;default:postMainDiv=as[blockIndex];break;}}catch(e){continue;}}
self.countInsertedItems++;if((OB_voterWidgetObjArray.length>=self.countInsertedItems)&&(typeof(OB_voterWidgetObjArray[self.countInsertedItems])!='undefined')&&(typeof(OB_voterWidgetObjArray[self.countInsertedItems].permaLink)=='string')){var newPosition=self.countInsertedItems;}else{var OutbrainPermaLink=self.extractePermalink(postMainDiv);if(OutbrainPermaLink==null){self.countInsertedItems--;continue;}
if(self.extractStopElement(postMainDiv)==true||self.isDuplicatedContainer(OutbrainPermaLink)){self.countInsertedItems--;continue;}
var newPosition=self.countInsertedItems;OB_voterWidgetObjArray[newPosition]=new voterWidgetObj();OB_voterWidgetObjArray[newPosition].permaLink=OutbrainPermaLink;}
var widgetBlock=as[blockIndex];var widgetHTML=outbrain_template_manager.insertDomPerPost(newPosition,widgetBlock);if(widgetHTML!=null){this.itemInserted=true;widgetBlock.outbrainWidget=true;if(typeof(reverseCallbackInsertByIdx)=='function'){reverseCallbackInsertByIdx(newPosition);}
self.pmd.postDivClassname=[self.pmd.postDivClassname[j]];j=0;if(newPosition>0){self.insertReady=true;self.isHomePage=true;}
self.registerOdbRequest(newPosition);}else{self.countInsertedItems--;}}}}
if(loadedLock&&this.itemInserted)
{return true;}else{return false;}},function(){self.insertReady=true;self.fireNextOdbRequestItem();},null,function(){outbrain_error_manager.addError(1001,"No rater inserted",outbrain_error_manager.FATAL);},100,1000,true,function(){return(self.pageLoaded&&self.fullSettingReady);});}
this.reDraw=function(){}
this.pageLoadedEvent=function(draw){self.pageLoaded=true;outbrain_customSettings.pageLoaded=true;if(draw){this.reDraw();}}
this.loadToolTip=function(){if(this.isToolTipLoaded==true)return;this.isToolTipLoaded=true;var toolElement=document.createElement("script");toolElement.setAttribute('id','ToolTip');toolElement.setAttribute('type','text/javascript');toolElement.setAttribute('src',outbrain_settings.domains.js+'/wz_tooltip.js');var heads=document.getElementsByTagName("head");if(heads.length>0){heads[0].insertBefore(toolElement,heads[0].firstChild);}}
this.waitForCustomSettings=function(){new outbrain_timeout(function(){return(outbrain_customSettings.ready);},function(){self.resetClassNames();self.createPmd();outbrain_template_manager.loadTemplates();self.loadMP();self.objLocationItemHolder.setLocationsSettingsOnce();self.dynamicInsertion();},null,null,100,1000,true)}
this.dateTriggers=function(){if(typeof(OBITm)!='undefined'){if(!isNaN(parseInt(OBITm))){OBITm=parseInt(OBITm);if((OBITm/1000000000000)<1.0)OBITm*=1000;if(((typeof(outbrain_settings.timestampDef.activeV400Timestamp))!='undefined')&&(OBITm>outbrain_settings.timestampDef.activeV400Timestamp)){OB_PC_enable=(typeof(OB_PC_enable)!='undefined')?OB_PC_enable:true;}
if(((typeof(outbrain_settings.timestampDef.activeV361Timestamp))!='undefined')&&(OBITm>outbrain_settings.timestampDef.activeV361Timestamp)){OB_self_posts=(typeof(OB_self_posts)!='undefined')?OB_self_posts:false;}
if(((typeof(outbrain_settings.timestampDef.activeV355Timestamp))!='undefined')&&(OBITm>outbrain_settings.timestampDef.activeV355Timestamp)){OB_defaultRecNumber=(typeof(OB_defaultRecNumber)!='undefined')?OB_defaultRecNumber:2;OB_RecNumberFetch=(typeof(OB_RecNumberFetch)!='undefined')?OB_RecNumberFetch:4;}
if(((typeof(outbrain_settings.timestampDef.activeV354Timestamp))!='undefined')&&(OBITm>outbrain_settings.timestampDef.activeV354Timestamp)){OB_showMP=(typeof(OB_showMP)!='undefined')?OB_showMP:false;}
if(((typeof(outbrain_settings.timestampDef.activeRecTimestamp))!='undefined')&&(OBITm>outbrain_settings.timestampDef.activeRecTimestamp)){outbrain_settings.timestampDef.installTimestmp=OBITm;OB_showRec=(typeof(OB_showRec)!='undefined')?OB_showRec:true;OB_showMP=(typeof(OB_showMP)!='undefined')?OB_showMP:true;outbrain_settings.rater.recommendations.selfPost=(typeof(OB_self_posts)!='undefined')?OB_self_posts:true;}}}}
this.firstRater=function(){self.dateTriggers();this.isRunning=true;var waitForLoad=(typeof(OB_waitForLoad)=='boolean')?OB_waitForLoad:false;if(!waitForLoad){this.reDraw();}
if(window.addEventListener){window.addEventListener("load",function(){self.pageLoadedEvent(waitForLoad);},false)}else if(window.attachEvent){window.attachEvent("onload",function(){self.pageLoadedEvent(waitForLoad);})}else if(document.getElementById){window.onload=function(){self.pageLoadedEvent(waitForLoad);}}
document.write("<span id='"+outbrain_settings.rater.firstRaterPositionElementId+"'></span>");this.waitForCustomSettings();}
this.insertGlobalSpan=function(index,toReturn){var globalSpan='';var elementName=this.elementToSearch;if(toReturn){globalSpan=document.createElement(elementName);globalSpan.className=outbrain_settings.rater.globalElementClass;return globalSpan;}else{document.write("<"+elementName+" class='"+outbrain_settings.rater.globalElementClass+"'></"+elementName+">");}}
this.insertRater=function(){if(!this.halt){if((!this.isRunning&&typeof(OB_platformType)=='number')||typeof(OB_platformType)!='number'){if(OB_voterWidgetObjArray.length==0){this.firstRater();}
if(typeof(OutbrainPermaLink)=='string'){var newPosition=OB_voterWidgetObjArray.length;OB_voterWidgetObjArray[newPosition]=new voterWidgetObj();OB_voterWidgetObjArray[newPosition].permaLink=OutbrainPermaLink;this.elementToSearch="span";this.insertGlobalSpan(newPosition,false);}}}}
this.rate=function(templateIndex,index,rateValue){var widgetObject=OB_voterWidgetObjArray[index];if(widgetObject.rankInfo==null){return false;}
if(this.lockRater(index)){return;}
var permaLink=widgetObject.permaLink;if(outbrain_settings.rater.cleanPermalink){permaLink=this.cleanPermalinkQueryString(permaLink);}
var rate="?s="+rateValue;permaLink="&u="+encodeURIComponent(permaLink);var version="&v="+outbrain_settings.versions.odb;var agent="";var partner="";var rdid="";var user="";if(outbrain_settings.keys_and_users.agentId!=null){agent="&a="+encodeURIComponent(outbrain_settings.keys_and_users.agentId);}
if(outbrain_settings.keys_and_users.partnerName!=null){partner="&p="+encodeURIComponent(outbrain_settings.keys_and_users.partnerName);}
if(typeof(OB_rfdid)=='string'){rdid=OB_rfdid;}else if(this.getQSParam("rfdid")!=null){rdid=this.getQSParam("rfdid");}
if(rdid!=""){rdid="&rfdid="+rdid;}
if(outbrain_settings.keys_and_users.userName!=null){user="&e="+outbrain_settings.keys_and_users.userName;}
var random="&r="+Math.random();var imgSrc=outbrain_settings.odb.odbRatesRecorder;imgSrc+=rate+permaLink+version+agent+partner+rdid+user+random;outbrain_template_manager.doRate(templateIndex,index,imgSrc);OB_voterWidgetObjArray[index].rankInfo.vote=rateValue;if(!OB_voterWidgetObjArray[index].rated){OB_voterWidgetObjArray[index].rankInfo.ratedBy++;OB_voterWidgetObjArray[index].rankInfo.wratedBy++;}
if(rateValue==4){OB_voterWidgetObjArray[index].rankInfo.posRate++;}
if(rateValue==2){OB_voterWidgetObjArray[index].rankInfo.negRate++;}
if(rateValue==-1){OB_voterWidgetObjArray[index].rankInfo.ratedBy--;OB_voterWidgetObjArray[index].rankInfo.wratedBy--;OB_voterWidgetObjArray[index].rated=false;}else{OB_voterWidgetObjArray[index].rated=true;}
outbrain_template_manager.userRated(index);}
this.initOnlyWithTemplates=function(){self.supportRecommendations=outbrain_template_manager.isThereTemplateWithRecommendations();}
this.resetClassNames=function(){self.userCustomizeContainerDivClass=(typeof(OB_containerClass)=='string')?OB_containerClass:null;self.userCustomizePermaLinkClass=(typeof(OB_permaLinkClass)=='string')?OB_permaLinkClass:null;self.userCustomizeFooterClass=(typeof(OB_footerClass)=='string')?OB_footerClass:null;self.userAppendContainerDivClass=(typeof(OB_containerAppend)=='string')?OB_containerAppend:null;}
this.init=function(){self.resetClassNames();self.halt=((typeof(OB_Halt)=='boolean')?OB_Halt:false);self.bindLocationEvent();self.bindResizeEvent();}
this.bindLocationEvent=function(){if(window.addEventListener){window.addEventListener("scroll",function(){self.checkLocationsWithDimmer();},false)}else if(window.attachEvent){window.attachEvent("onscroll",function(){self.checkLocationsWithDimmer();})}else if(document.getElementById){var oldOnScroll=window.onscroll;window.onload=function(){oldOnScroll();self.checkLocationsWithDimmer();}}}
this.bindResizeEvent=function(){if(window.addEventListener){window.addEventListener("resize",function(){self.resizeMethods();},false)}else if(window.attachEvent){window.attachEvent("onresize",function(){self.resizeMethods();})}else if(document.getElementById){var oldOnResize=window.onresize;window.onresize=function(){oldOnResize();self.resizeMethods();}}}
this.resizeMethods=function(){self.objLocationItemHolder.setLocationsSettings();}
this.locationItemHolder=function(){var self_locationHolder=this;this.objPositionCalc=new(outbrain_PositionCalc);this.actionList=new Array();this.counter=0;this.addLocationItem=function(dataObj){this.actionList[this.actionList.length]=dataObj;}
this.cleanList=function(){for(t=this.actionList.length-1;t>=0;t-=1){if(this.actionList[t]==null)
this.actionList.splice(t,1);}}
this.removeItemByPostIndex=function(index){for(t=this.actionList.length-1;t>=0;t-=1){if(this.actionList[t]!=null){if(this.actionList[t].index==index){this.actionList[t]=null;}}}}
this.getElementsInScope=function(){var tempList=new Array();this.objPositionCalc.reCalc();for(var t=0;t<this.actionList.length;t++){if(this.actionList[t]!=null){var result=this.objPositionCalc.checkIfElementInViewPort(this.actionList[t].element);if(result==outbrain_settings.odb.INSIDEFOLD||result==outbrain_settings.odb.NEARFOLD||result==outbrain_settings.odb.ERRED){tempList[tempList.length]=this.actionList[t];this.removeItemByPostIndex(this.actionList[t].index);}}}
this.cleanList();return tempList;}
this.setLocationsSettings=function(){var vph=this.objPositionCalc.getViewportHeight();this.objPositionCalc.topThreshold=Math.round(outbrain_settings.odb.topPaddingThreshold*vph);this.objPositionCalc.bottomThreshold=Math.round(outbrain_settings.odb.bottomPaddingThreshold*vph);}
this.setLocationsSettingsOnce=function(){this.objPositionCalc.setSerialMode=outbrain_settings.odb.isOdbCallsSerial;self_locationHolder.setLocationsSettings();}}
this.objLocationItemHolder=new(this.locationItemHolder);this.init();}
var OB_platformMetaData=typeof(OB_platformMetaData)=="function"?OB_platformMetaData:function(postDivClassname_,permaLinkClassName_,postFooterDivClassname_){this.postDivClassname=postDivClassname_;this.permaLinkClassName=permaLinkClassName_;this.postFooterDivClassname=postFooterDivClassname_;}
var voterWidgetObj=typeof(voterWidgetObj)=="object"?voterWidgetObj:function(){this.frezz=false;this.rateMode=outbrain_settings.rater.statuses.RATER_PRE_RATE_MODE;this.frezzSemaphore=0;this.rateScore=0;this.ratedBy=0;this.wratedBy=0.0;this.isPersonalized=false;this.userName="";this.jsonObj=null;this.mainDiv=null;this.currentRateValue=1
this.rankInfo=null;this.permaLink=null;this.rated=false;this.rateInfo="";this.rateStatus="";this.rateInfo="";this.rankInfo_object=function(ranke_,ratedBy_,wratedBy_,posRate_,negRate_,user_){this.user=user_;this.rank=Number(ranke_);this.ratedBy=Number(ratedBy_);this.wratedBy=Number(wratedBy_);this.posRate=Number(posRate_);this.negRate=Number(negRate_);this.vote=0;this.personalRank=0;this.personalRatedBy=0;this.getComputedRank=function(isAvrage){if(this.ratedBy==0){return 0;}
var res=0;res=(this.personalRank!=0&&(typeof(isAvrage)=='undefined'))?this.personalRank:(this.rank+Number(this.vote))/this.wratedBy;return outbrain_language_manager.changeX(null,res);}
this.getPersonalRateIndex=function(){var rank=this.getComputedRank();var rankAvg=this.getComputedRank(true);var personalIndex=(rank<2.5&&rank>0)?0:(rank>2.5&&rank<4?1:2);if((personalIndex==2)&&rankAvg>rank){personalIndex=1;}
return personalIndex;}}}
var outbrain_event_manager_object=(typeof(outbrain_template_object)=="function")?outbrain_template_object:new function(){this.event=function(){this.eventArr=new Array;this.addEvent=function(evt){if(evt!=null&&typeof(evt)=="function"){this[evt].push(evt);}}
this.removeEvent=function(eventType,evt){}
this.fireEvents=function(){for(var t;t<this.eventArr.length;t++){try{if(this.eventArr[t]!=null&&typeof(eventArr[t])=='function'){this.eventArr[t]();}}catch(ex){}}}}
this.updateData=new event();}
var outbrain_plugin_object=(typeof(outbrain_plugin_object)=="function")?outbrain_plugin_object:function(){var plSelf=this;this.ID="DEF_PLUG_ID";this.keyList=new Array();this.valueList=new Array();this.onStart=function(index){}
this.onRate=function(index){}
this.onPostRate=function(index){}
this.initPost=function(index){}
this.init=function(){}}
var plugin_disqus_object=function plugin_disqus_id(){var dsq_self=this;this.ID="DSQ_PL_ID";plugin_disqus_object.baseConstructor.call(this);this.settings=new function(){}
this.dsq_isDisqusHere=false;this.templateDOM='';this.iframeOpen=false;this.active=false;this.getDomPerPost=function(index){}
this.onStart=function(index){}
this.initPost=function(index){}
this.initDOM=function(templateIndex){}
this.replaceOnce=function(){}
this.init=function(){}}
plugin_disqus_object.prototype=outbrain_plugin_object;plugin_disqus_object.prototype.constructor=plugin_disqus_object;plugin_disqus_object.baseConstructor=outbrain_plugin_object;var outbrain_owner_template_object=(typeof(outbrain_owner_template_object)=="function")?outbrain_owner_template_object:function(templateIndex,position,inside,elements,matrixInfoJson){var self=this;}
outbrain_owner_template_object.prototype=outbrain_template_object;outbrain_owner_template_object.prototype.constructor=outbrain_owner_template_object;outbrain_owner_template_object.baseConstructor=outbrain_template_object;function OutbrainStart(){if(outbrain_browsers.opera){return;}
outbrain_rater.insertRater();if(typeof(reverseCallback)=='function'){reverseCallback();}}
if(!outbrain_browsers.opera){var outbrain_dom=((typeof(outbrain_dom)=='object')?outbrain_dom:(new outbrain_dom_object()));var outbrain_error_manager=((typeof(outbrain_error_manager)=='object')?outbrain_error_manager:(new outbrain_error_manager_object()));var outbrain_language_manager=((typeof(outbrain_language_manager)=='object')?outbrain_language_manager:(new outbrain_language_manager_object()));var outbrain_template_manager=((typeof(outbrain_template_manager)=='object')?outbrain_template_manager:(new outbrain_template_manager_object()));var OB_odb_life=((typeof(OB_odb_life)=='object')?OB_odb_life:null);if(OB_odb_life==null){OB_odb_life=new outbrain_odb_life_object(outbrain_settings.ping.maxTime,outbrain_settings.ping.url,outbrain_settings.ping.id);}
var outbrain_customSettings=((typeof(outbrain_customSettings)=='object')?outbrain_customSettings:new outbrain_customSettings_object());var outbrain_rater=((typeof(outbrain_rater)=='object')?outbrain_rater:(new outbrain_rater_object()));OutbrainStart();}