function pageLoaded(){TNCMS_PAGE_LOADED=!0}"number"!=typeof TNCMS_DotConnect_Tile&&(TNCMS_DotConnect_Tile=1),"undefined"==typeof TNCMS_Used_Ad&&(TNCMS_Used_Ad={}),Object.create||(Object.create=function(e){var i=function(){};return i.prototype=e,new i}),"boolean"!=typeof TNCMS_PAGE_LOADED&&(TNCMS_PAGE_LOADED=!1,window.addEventListener?window.addEventListener("load",pageLoaded,!1):window.attachEvent?window.attachEvent("onload",pageLoaded):(priorOnLoad=window.onload,window.onload="function"!=typeof window.onload?pageLoaded:function(){priorOnLoad&&priorOnLoad(),pageLoaded()})),window.TNCMS||(window.TNCMS={}),window.TNCMS.AdManager||(window.TNCMS.AdManager=function(){function init(e){if(e=e||{},e.debug&&(iDebug=e.debug,iDebug>0&&("undefined"==typeof console?alert("Please turn on the debugging console!"):(info("Debug level set to: "+iDebug),bCanLog=!0))),e.domain&&(e.domain=normDomain(e.domain)),domainConfig(e)&&(e.slot||(sDefaultDomain?warn("Changing the default domain from "+sDefaultDomain+" to "+e.domain+"."):info("Setting the default domain to "+e.domain+"."),sDefaultDomain=e.domain,sDefaultSecureDomain=e.secureDomain),window.TNCMS.Tracking||bTracker?window.TNCMS.Tracking&&!bTracker&&(bTracker=!0):(info("Start loading tracking script"),bTracker="loading",loadScript(e,"/shared-content/art/tncms/tracking.js",function(){bTracker=!0,info("Finished loading tracker script"),renderAll()}))),e.virtualregion)for(regionType in kVirtualRegionCallback)e.virtualregion&&e.virtualregion[regionType]&&(kVirtualRegionCallback[regionType]=e.virtualregion[regionType]);if(e.callback)for(adType in kAdCallback)"dotconnect"!=adType&&"html"!=adType&&"video"!=adType&&e.callback&&e.callback[adType]&&(kAdCallback[adType]=e.callback[adType])}function setImpressions(e,i){e=normDomain(e),kImpressions[e]=i}function setTraffic(e,i){e=normDomain(e),kTraffic[e]=i}function setSettings(e,i){e=normDomain(e),kSettings[e]=i,kSettings[e].trafficSmoothing&&info("Traffic smoothing active on "+e)}function info(e){1&iDebug&&bCanLog&&console.info(e)}function warn(e){2&iDebug&&bCanLog&&console.warn(e)}function error(e){4&iDebug&&bCanLog&&console.error(e)}function loadScript(e,i,t){function o(){"loaded"==n.readyState&&t()}if(e=e||{},!e.domain||!e.secureDomain)throw new Error("Failed to load script ("+i+"): valid domain data not detected");domain="https:"==location.protocol?e.secureDomain:e.domain;var n=document.createElement("script");return n.src=location.protocol+"//"+domain+i,n.type="text/javascript",document.getElementsByTagName("head")[0].appendChild(n),"function"==typeof t&&("undefined"!=typeof n.addEventListener?n.addEventListener("load",t,!1):n.attachEvent("onreadystatechange",o)),n}function normDomain(e){return e&&e.length>0?e.replace(/^www\./i,""):""}function positionIsAutoPlay(e){return 1==getPositionSetting(e,"video_autoplay",0)}function getPositionSetting(e,i,t){if(!kSettings)return warn("Settings not loaded"),t;var o=normDomain(sDefaultDomain),n=e.region,a=e.slot,d=e.section;return kSettings[o]?kSettings[o][n]?kSettings[o][n][a]?kSettings[o][n][a][d]?kSettings[o][n][a][d][i]&&kSettings[o][n][a][d][i]!=t?kSettings[o][n][a][d][i]:t:(warn("No slot settings for: "+n+" at slot: "+a+" with section: "+d),t):(warn("No slot settings for: "+n+" at slot: "+a),t):(warn("No position settings for: "+n),t):(warn("No settings found for: "+o),t)}function domainConfig(e){if(!e.domain||!e.secureDomain)return!1;var i=normDomain(e.domain);return kDomain[i]?!0:kImpressions[i]&&kTraffic[i]&&kSettings[i]?(info("Using existing configs for "+i),kPositionList[i]=kPositionList[i]||[],kDomain[i]=!0,!0):(kImpressions[i]?info("Using existing impression data for "+i):(info("Start loading impression data for "+i),loadScript(e,"/content/tncms/ads/impressions.js",function(){info("Finished loading impression data for "+i),kTraffic[i]&&kSettings[i]&&(kDomain[i]=!0,renderDomain(i))})),kTraffic[i]?info("Using existing traffic data for "+i):(info("Start loading traffic data for "+i),loadScript(e,"/content/tncms/ads/traffic.js",function(){info("Finished loading traffic data for "+i),kImpressions[i]&&kSettings[i]&&(kDomain[i]=!0,renderDomain(i))})),kSettings[i]?info("Using existing settings for "+i):(info("Start loading settings for "+i),loadScript(e,"/content/tncms/ads/settings.js",function(){info("Finished loading settings for "+i),kImpressions[i]&&kTraffic[i]&&(kDomain[i]=!0,renderDomain(i))})),kPositionList[i]=[],kDomain[i]="loading",!0)}function render(e){if(e=e||{},init(e),e.domain=e.domain||sDefaultDomain,e.secureDomain=e.secureDomain||sDefaultSecureDomain,!e.region||!e.slot)return warn("No valid position"),warn(e),!1;if(aRegionType=e.region.match(/^\_(.*)$/),e.regionType=aRegionType&&aRegionType[1]?aRegionType[1]:"inline",!document.getElementById("blox-ad-position-"+e.region+e.slot)&&"inline"==e.regionType){if(TNCMS_PAGE_LOADED)return warn("The div for position ("+e.region+e.slot+") does not exist!"),!1;document.write('\n
\n')}return renderPosition(e)}function renderDomain(e){if(e=normDomain(e),bTracker!==!0)return info("Rendering deferred for "+e+": Tracker script has not been loaded"),!1;if(kDomain[e]!==!0)return info("Rendering deferred for "+e+": Config scripts have not been loaded"),!1;if(0==kPositionList[e].length)return info("No positions for "+e+" currently need rendering"),!1;for(;oConfig=kPositionList[e].shift();)renderPosition(oConfig)}function refresh(e){if(e=e||{},e.all){for(sDomain in kRenderedPositionList)refresh({domain:sDomain});return!0}if(e.domain&&(e.domain=normDomain(e.domain)),e.region&&e.slot){if(sDomain=e.domain||sDefaultDomain,kRenderedPositionList[sDomain]&&kRenderedPositionList[sDomain][e.region]&&kRenderedPositionList[sDomain][e.region][e.slot]){if(!kSettings[e.domain][e.region]||!kSettings[e.domain][e.region].refreshable)return info("Ads for "+sDomain+" in "+e.region+" are not refreshable."),!1;info("Refreshing ads for "+sDomain+" in "+e.region+e.slot),renderPosition(kRenderedPositionList[sDomain][e.region][e.slot])}return!0}if(e.region){if(sDomain=e.domain||sDefaultDomain,!kSettings[sDomain][e.region]||!kSettings[sDomain][e.region].refreshable)return info("Ads for "+sDomain+" in "+e.region+" are not refreshable."),!1;for(sSlot in kRenderedPositionList[sDomain][e.region])e.slot=sSlot,refresh({domain:sDomain,region:e.region,slot:sSlot});return!0}if(sDomain=e.domain||sDefaultDomain,!kRenderedPositionList[sDomain])return info("No ads to refresh for "+sDomain),!1;for(sRegion in kRenderedPositionList[sDomain])refresh({domain:sDomain,region:sRegion});return!0}function renderAll(){if(bTracker!==!0)return info("Rendering deferred: Tracker script has not been loaded"),!1;for(sDomain in kPositionList)renderDomain(sDomain);for(;oAd=aRenderAdList.shift();)renderAd(oAd)}function renderPosition(e){if(e=e||{},e.domain&&(e.domain=normDomain(e.domain)),kDomain[e.domain]!==!0||bTracker!==!0)return kPositionList[e.domain]=kPositionList[e.domain]||[],kPositionList[e.domain].push(e),!0;if(sPositionCookie=readCookie("tncms_position_"+e.region+"_"+e.slot),sPositionCookie&&(aData=sPositionCookie.split("&"),iFrequency=parseInt(aData[0],10),nMinutes=(new Date(unescape(aData[1]))-new Date)/6e4,nMinutes>0)){iMinutes=parseInt(nMinutes,10),sMessage="The position "+e.region+e.slot+" has met its frequency cap, which is set to "+iFrequency+" minutes. This position will be available again in ",sMessage+=0==iMinutes?"under a minute.":1==iMinutes?"around a minute.":"around "+iMinutes+" minutes.",warn(sMessage),sMessage="";try{document.getElementById("blox-ad-position-"+e.region+e.slot).innerHTML=sMessage}catch(i){}return!1}if(e.position=e.region+e.slot,e.cdn=kSettings[e.domain].cdn||null,e.section=e.section?e.section:sDefaultSection,kAdList[e.domain]=kAdList[e.domain]||{},kAdList[e.domain][e.region]=kAdList[e.domain][e.region]||{},kAdList[e.domain][e.region][e.slot]=kAdList[e.domain][e.region][e.slot]||!1,!e.adList&&!kAdList[e.domain][e.region][e.slot]&&!e.finalRender)return info("Attempting to load ads for "+e.domain+" in "+e.region+e.slot),loadScript(e,"/content/tncms/ads/"+escape(e.region)+"/"+e.slot+".js",function(){return info("Finished loading ads for "+e.domain+" in "+e.region+e.slot),e.finalRender=!0,renderPosition(e)}),!1;kRenderedPositionList[e.domain]&&kRenderedPositionList[e.domain][e.region]&&kRenderedPositionList[e.domain][e.region][e.slot]||(kRenderedPositionList[e.domain]=kRenderedPositionList[e.domain]||{},kRenderedPositionList[e.domain][e.region]=kRenderedPositionList[e.domain][e.region]||{},kRenderedPositionList[e.domain][e.region][e.slot]=e);for(iAd in TNCMS_Used_Ad)if(TNCMS_Used_Ad[iAd]==e.position){info("Removing ad #"+iAd+" from used ad list."),delete TNCMS_Used_Ad[iAd];break}try{return info("Generating ad for "+e.domain+" in "+e.position),oAd=getAd(e),kVirtualRegionCallback[oAd.regionType]?kVirtualRegionCallback[oAd.regionType](oAd):renderAd(oAd)}catch(t){"Warning"==t.name?warn(t.message):error(t.message),oPositionDiv=document.getElementById("blox-ad-position-"+e.position),oPositionDiv&&(oPositionDiv.innerHTML="")}return!1}function renderAd(e){if(!e.type)throw new Error("No ad type was found.");if(!kAdCallback[e.type])throw new Error('No callback for type "'+e.type+" was found.");if(kDomain[e.domain]!==!0||bTracker!==!0)return aRenderAdList.push(e),!0;if(1&iDebug&&bCanLog){var i={};for(x in e)i[x]=e[x];info(i)}kAdCallback[e.type](e),TNCMS.Tracking.addEvent({domain:TNCMS.AdManager.isSecure?e.secureDomain:e.domain,app:"bannerad",metric:"impressions",id:e.section+"/"+e.position+"/"+e.uuid}),"dotconnect"!=e.type&&(TNCMS_Used_Ad[e.adid]=e.position);var t=normDomain(e.domain);if(kSettings[t][e.region][e.slot]&&kSettings[e.domain][e.region][e.slot][e.section]&&kSettings[e.domain][e.region][e.slot][e.section].frequency&&(iFrequency=parseInt(kSettings[t][e.region][e.slot][e.section].frequency,10),iFrequency>0&&!readCookie("tncms_position_"+e.region+"_"+e.slot))){var o=new Date;o.setTime(o.getTime()+6e4*iFrequency),info("Creating frequency cookie for "+e.region+e.slot+". It will expire in "+iFrequency+" minutes."),document.cookie="tncms_position_"+e.region+"_"+e.slot+"="+iFrequency+"&"+escape(o.toUTCString())+"; expires="+o.toUTCString()+"; path=/"}if(e.frequency_limit)if(sCookieName="tncms_ad_"+e.adid,sCookieValue=readCookie(sCookieName),sCookieValue)aData=sCookieValue.split("&"),nAdCount=parseInt(aData[0],10)+1,info("Incrementing frequency limit cookie for "+e.adid),document.cookie=sCookieName+"="+nAdCount+"&"+aData[1]+"; expires="+unescape(aData[1])+"; path=/";else if(e.frequency_number&&e.frequency_type){var o=new Date;switch(e.frequency_type){case"minutes":o.setTime(o.getTime()+6e4*e.frequency_number);break;case"hours":o.setTime(o.getTime()+36e5*e.frequency_number);break;case"days":o.setTime(o.getTime()+864e5*e.frequency_number)}var n="; expires="+o.toUTCString();info("Creating frequency limit cookie for "+e.adid),document.cookie=sCookieName+"=1&"+escape(o.toUTCString())+n+"; path=/"}return!0}function renderStandaloneVideo(e){if(!e)return void warn("Could not render video. Missing required objects.");if(!e.asseturl.match(/\.mp4$/i))return void warn("Could not render video. Unsupported format.");if(e.positionDiv.childNodes&&e.positionDiv.childNodes.length>0){if(document.getElementById("tncms-admanager-video-player-"+e.adid))return void info("Ad already rendered.");for(var i in e.positionDiv.children)info("Removing existing child elements to render new ad."),1===e.positionDiv.children[i].nodeType&&e.positionDiv.removeChild(e.positionDiv.children[i])}if(info("Rendering standalone video"),oAd.clickuri){var t=TNCMS.Tracking.getRedirectURL({domain:TNCMS.AdManager.isSecure?e.secureDomain:e.domain,app:"bannerad",metric:"clicks",id:e.section+"/"+e.position+"/"+e.uuid,url:e.clickuri.match(/^[htpsmailo]+:/i)?e.clickuri:"http://"+e.clickuri}),o=document.createElement("div");o.setAttribute("class","tncms-admanager-video-click-cnt");var n=document.createElement("a");n.setAttribute("class","tncms-admanager-video-click-url"),n.setAttribute("href",t),n.setAttribute("target",e.target||"_blank"),n.setAttribute("onclick","tncmsAdmanagerVideoCtrl('"+e.adid+"', 'pause')"),n.innerHTML="Visit this sponsor for details"}var a=document.createElement("style");a.appendChild(document.createTextNode(".tncms-admanager-video-cnt { width: 100%; height: 100%; text-align: center;}\n.tncms-admanager-video-inner-cnt { display:inline-block; position:relative;}\n.tncms-admanager-video-click-cnt { position: absolute; right: 10px; top: 10px; z-index: 1; padding: 5px 5px; font-size: 20px; font-family: Helvetica; color: #FFF; background-color: rgba(50, 50, 50, 0.3);}\nvideo { width: 100%; height: 100%;}\n.tncms-admanager-video-click-cnt a { color: #DDD;}\n"));var d=document.createElement("script");d.setAttribute("type","text/javascript"),d.innerHTML=" var tncmsAdmanagerVideoCtrl = function (sAdID, sAction) { var oPlayer = document.getElementById('tncms-admanager-video-player-' + sAdID); if ( oPlayer ) { switch(sAction) { case 'pause': oPlayer.pause(); break; case 'play': oPlayer.play(); break; } }} ";var r=document.createElement("div");r.setAttribute("class","tncms-admanager-video-cnt"),r.setAttribute("id","tncms-admanager-video-"+e.adid);var s=document.createElement("div");s.setAttribute("class","tncms-admanager-video-inner-cnt");var l=document.createElement("video");l.setAttribute("controls",""),l.setAttribute("loop",""),l.setAttribute("class","tncms-admanager-video"),l.setAttribute("id","tncms-admanager-video-player-"+e.adid),l.setAttribute("width",e.width),l.setAttribute("height",e.height),positionIsAutoPlay(e)?(l.setAttribute("autoplay",""),l.setAttribute("muted","")):(l.setAttribute("preload","metadata"),l.setAttribute("onloadstart","this.volume=0.5"));var c=document.createElement("source");c.setAttribute("src",e.asseturl),c.setAttribute("type","video/mp4"),l.appendChild(c),l.appendChild(document.createTextNode("Video not supported by browser.")),n&&o&&(o.appendChild(n),s.appendChild(o)),s.appendChild(l),r.appendChild(s),e.positionDiv.appendChild(a),e.positionDiv.appendChild(d),e.positionDiv.appendChild(r)}function setAds(e,i,t,o){var n=normDomain(e);kAdList[n]=kAdList[n]||{},kAdList[n][i]=kAdList[n][i]||{},kAdList[n][i][t]=o}function getAd(oPosition){var sNormDomain=normDomain(oPosition.domain);if(oPosition.adList)info("Caching passed ads for "+oPosition.domain+" in "+oPosition.region+oPosition.slot),setAds(oPosition.domain,oPosition.region,oPosition.slot,oPosition.adList),oAdList=oPosition.adList;else{if(!kAdList[sNormDomain][oPosition.region][oPosition.slot])throw{name:"Warning",message:"No ads found in cache for "+sNormDomain+" in "+oPosition.region+oPosition.slot};info("Using cached ads for "+sNormDomain+" in "+oPosition.region+oPosition.slot),oAdList=kAdList[sNormDomain][oPosition.region][oPosition.slot]}for(iAd in oAdList)if("_popunder"!=oPosition.region||"expandable"!=oAdList[iAd].type&&"pagecurl"!=oAdList[iAd].type)if(TNCMS_Used_Ad[iAd])info("Removing ad #"+oAdList[iAd].adid+" because it is already being displayed."),delete oAdList[iAd];else if(oAdList[iAd].uri||"image"!=oAdList[iAd].type&&"video"!=oAdList[iAd].type)if("html"!=oAdList[iAd].type||"https:"!=location.protocol||oAdList[iAd].secure)if(kAdCallback[oAdList[iAd].type])if("dotconnect"==oAdList[iAd].type&&TNCMS_DotConnect_Tile>16)info("Removing ad #"+oAdList[iAd].adid+" because it is a DotConnect ad and there are already 16 DoctConnect ads on this page."),delete oAdList[iAd];else{if(oAdList[iAd].keywords&&0!==Object.keys(oAdList[iAd].keywords).length){bKeep=0;for(var sKey in oAdList[iAd].keywords){var oRegex=new RegExp(" "+oAdList[iAd].keywords[sKey].toLowerCase()+" ","");if(sMetaKeywords.match(oRegex)){bKeep=1;break}}if(!bKeep){info("Removing ad #"+oAdList[iAd].adid+" because it does not match any keywords on this page."),delete oAdList[iAd];continue}}var oToday=new Date,oStartDate=new Date,oEndDate=new Date,aDateParts=oAdList[iAd].startdate.split("-");if(oStartDate.setFullYear(aDateParts[0],aDateParts[1]-1,aDateParts[2]),aDateParts=oAdList[iAd].enddate.split("-"),oEndDate.setFullYear(aDateParts[0],aDateParts[1]-1,aDateParts[2]),oStartDate>oToday)info("Removing ad #"+oAdList[iAd].adid+" because it has not yet started."),delete oAdList[iAd];else if(oToday>oEndDate)info("Removing ad #"+oAdList[iAd].adid+" because it has already ended."),delete oAdList[iAd];else if(oPosition.width&&oAdList[iAd].width&&oAdList[iAd].width>oPosition.width)info("Removing ad #"+oAdList[iAd].adid+" because it is too wide for this region."),delete oAdList[iAd];else if(kImpressions[sNormDomain].daily[iAd]&&oAdList[iAd].dailyLimit&&oAdList[iAd].dailyLimit<=kImpressions[oPosition.domain].daily[iAd])info("Removing ad #"+oAdList[iAd].adid+" because it has already met its daily impression limit."),delete oAdList[iAd];else if(kImpressions[sNormDomain].total[iAd]&&oAdList[iAd].totalLimit&&oAdList[iAd].totalLimit<=kImpressions[oPosition.domain].total[iAd])info("Removing ad #"+oAdList[iAd].adid+" because it has already met its total impression limit."),delete oAdList[iAd];else{if(oAdList[iAd].daypart_enabled&&""!=oAdList[iAd].daypart_enabled){if(!oAdList[iAd].daypart_schedule){info("Removing ad #"+oAdList[iAd].adid+" because day parting is enabled but there is not schedule."),delete oAdList[iAd];continue}var adSchedule=eval("("+oAdList[iAd].daypart_schedule+")");if(!adSchedule[oDayPart.day]){info("Removing ad #"+oAdList[iAd].adid+" because day parting is enabled and this day is not in the schedule."),delete oAdList[iAd];continue}if(!(adSchedule[oDayPart.day].allday||adSchedule[oDayPart.day][oDayPart.startBound]&&adSchedule[oDayPart.day][oDayPart.endBound])){info("Removing ad #"+oAdList[iAd].adid+" because day parting is enabled and it is not in the the start or end bound."),delete oAdList[iAd];continue}}if(oAdList[iAd].frequency_limit&&(sValue=readCookie("tncms_ad_"+iAd),sValue&&(aData=sValue.split("&"),nAdCount=parseInt(aData[0],10),nAdCount>=oAdList[iAd].frequency_limit)))info("Removing ad #"+oAdList[iAd].adid+" because it has met its frequency limit."),delete oAdList[iAd];else if(oAdList[iAd].lat&&oAdList[iAd]["long"]&&oAdList[iAd].proximity&&kLocation){var sinDeltaLat=Math.sin((kLocation.lat*Math.PI/180-oAdList[iAd].lat)/2),sinDeltaLong=Math.sin((kLocation["long"]*Math.PI/180-oAdList[iAd]["long"])/2),a=Math.pow(sinDeltaLat,2)+Math.pow(sinDeltaLong,2)*Math.cos(oAdList[iAd].lat)*Math.cos(kLocation.lat*Math.PI/180);if(7974*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))>oAdList[iAd].proximity){info("Removing ad #"+oAdList[iAd].adid+" because the reader was not detected within the configured porximity."),delete oAdList[iAd];continue}}}}else info("Removing ad #"+oAdList[iAd].adid+" because it is of type ("+oAdList[iAd].type+") and there is no callback registerd for that."),delete oAdList[iAd];else info("Removing ad #"+oAdList[iAd].adid+" because is not a secure HTML ad."),delete oAdList[iAd];else info("Removing "+oAdList[iAd].type+" ad #"+oAdList[iAd].adid+" because it is missing the mandatory asset uri."),delete oAdList[iAd];else info("Removing ad #"+oAdList[iAd].adid+" because "+oAdList[iAd].type+" ads are not allowed in a popunder."),delete oAdList[iAd];if(0==oAdList.length)throw{name:"Warning",message:"All ads have been eliminated from the ad list for this position ("+oPosition.region+oPosition.slot+")."};if(oSectionAds=getAdsBySection(oPosition.section,oAdList),sCurrentSection=oSectionAds.section,aAd=oSectionAds.ads,"ros"==sCurrentSection&&kSettings[sNormDomain].sectionExclusions)for(var i=0;i-1)throw{name:"Warning",message:"ROS ads are excluded from this section ("+oPosition.section+") so no ads will be displayed for this position ("+oPosition.region+oPosition.slot+")."};if(!aAd||0==aAd.length)throw{name:"Warning",message:"There are no ads available in this section ("+oPosition.section+") for this position ("+oPosition.region+oPosition.slot+")."};for(var nIterator=0,nLockedTotalPerc=0,nLimitedPerc=0,nUnlockedTotalPerc=0,nUnlockedAds=0,nNoAd=0,i=0;i100-nLockedTotalPerc)for(nMultiplier=(100-nLockedTotalPerc)/100,i=0;i=nLimitedPerc+nUnlockedTotalPerc)if(0==nUnlockedTotalPerc)for(nNoAd=100-nLockedTotalPerc-nLimitedPerc,i=0;irandomWeight){info("Ad #"+aAd[i].adid+"(type: "+aAd[i].type+") chosen from "+oPosition.domain+" to display in "+oPosition.region+oPosition.slot),oAd=Object.create(aAd[i]);for(sFieldName in oPosition)"finalRender"==sFieldName||oAd[sFieldName]||(oAd[sFieldName]=oPosition[sFieldName]);if(oAd.originalSection=oPosition.section,oAd.section=sCurrentSection,oAd.position=oPosition.region+oPosition.slot,oAd.cdn&&(oAd.asseturl="https://"+oAd.cdn+oAd.uri),oAd.window=window,1&iDebug&&"function"!=typeof kVirtualRegionCallback[oAd.regionType]?(debugHeaderDiv=document.getElementById("blox-ad-position-debug-header-"+oAd.position),debugHeaderDiv?oAd.positionDiv=document.getElementById("blox-ad-position-"+oAd.position):(debugDiv=document.getElementById("blox-ad-position-"+oAd.position),debugDiv.setAttribute("id","blox-ad-position-debug-"+oAd.position),debugHeaderDiv=document.createElement("div"),debugHeaderDiv.style.border="1px solid black",debugHeaderDiv.style.width="100%",debugHeaderDiv.setAttribute("id","blox-ad-position-debug-header-"+oAd.position),debugDiv.appendChild(debugHeaderDiv),oAd.positionDiv=document.createElement("div"),oAd.positionDiv.setAttribute("id","blox-ad-position-"+oAd.position),debugDiv.appendChild(oAd.positionDiv)),debugHeaderDiv.innerHTML=" Ad Position: "+oAd.section+" : "+oAd.region+" : "+oAd.slot+" Ad ID: "+oAd.adid+" ("+oAd.type+":API 2)"):oAd.positionDiv=document.getElementById("blox-ad-position-"+oAd.position),oAd.clickuri?(clickuri=oAd.clickuri.match(/^[htpsmailo]+:/i)?oAd.clickuri:"http://"+oAd.clickuri,oAd.clickuri=TNCMS.Tracking.getRedirectURL({domain:TNCMS.AdManager.isSecure?oAd.secureDomain:oAd.domain,app:"bannerad",metric:"clicks",id:oAd.section+"/"+oAd.position+"/"+oAd.uuid,url:clickuri})):"html"==oAd.type&&oAd.html&&(trackerURL=location.protocol+TNCMS.Tracking.getRedirectURL({domain:TNCMS.AdManager.isSecure?oAd.secureDomain:oAd.domain,app:"bannerad",metric:"clicks",id:oAd.section+"/"+oAd.position+"/"+oAd.uuid,url:"TNCMS_AD_TRACKER"}),trackerURL=trackerURL.replace(/TNCMS_AD_TRACKER/,""),html=eval(oAd.html),oAd.html=html.replace(/__TRACKER_URL__/g,trackerURL)),"video"==oAd.type&&(oAd.rolltype="pre",oAd.autoplay=0,oAd.embed=0,oAd.volume=50,kSettings[normDomain(oAd.domain)][oAd.region][oAd.slot]&&kSettings[normDomain(oAd.domain)][oAd.region][oAd.slot][oAd.section])){var kSectionSettings=kSettings[normDomain(oAd.domain)][oAd.region][oAd.slot][oAd.section];oAd.rolltype=kSectionSettings.video_rolltype||oAd.rolltype,oAd.autoplay=kSectionSettings.video_autoplay?parseInt(kSectionSettings.video_autoplay,10):oAd.autoplay,oAd.embed=kSectionSettings.video_embed?parseInt(kSectionSettings.video_embed,10):oAd.embed,oAd.volume=kSectionSettings.video_volume?parseInt(kSectionSettings.video_volume,10):oAd.volume}return oAd}throw{name:"Warning",message:"No ad was selected from the list"}}function getAdWeightData(e,i,t){t=normDomain(t);for(adSection in e.weights)if(adSection==i){if(!kSettings[t].trafficSmoothing||"asap"==e.ad_balancing)return info("On "+t+" using default weights (ASAP) for ad#"+e.adid),e.weights[adSection];if(!kTraffic[t].estimate||!kTraffic[t].ratio)return warn("No traffic data found for "+t+": using default weights for ad#"+e.adid),e.weights[adSection];var o=new Date;return iHour=o.getHours(),nTrafficEstimate=kTraffic[t].estimate[iHour]||0,nTrafficRatio=kTraffic[t].ratio[iHour]||0,e.dailyLimit&&kImpressions[t].daily[e.adid]&&nTrafficRatio&&nTrafficEstimate?(nWantedImpressions=(e.dailyLimit-kImpressions[t].daily[e.adid])*nTrafficRatio,nWantedImpressions>=nTrafficEstimate?(info("Wanted impressions for "+e.adid+" is greater than the current traffic estimate: using default weights for ad#"+e.adid),e.weights[adSection]):(nWeight=nWantedImpressions/nTrafficEstimate,info("Overriding default weight: using traffic curve for ad#"+e.adid),{section:i,percent:100*nWeight,locked:2})):(info("Using default weight in favor of traffic curve for ad#"+e.adid),e.weights[adSection])}return warn("No weight data found for ad#"+e.adid+" found: using 0"),0}function getAdsBySection(e,i){oValidAds=[];for(nAdId in i)for(var t=i[nAdId].sections,o=0;o0||"ros"==e?(info("Returning ads for section: "+e),{section:e,ads:oValidAds}):(sMatch=e.match(/(\/[\w\-]+)$/g),sMatch?getAdsBySection(e.replace(sMatch,""),i):getAdsBySection("ros",i))}function readCookie(e){for(var i=e+"=",t=document.cookie.split(";"),o=0;o1&&-1==t[1].indexOf(".")&&(o=t[1]);var a="";if(e.fold&&("above"==e.fold?a="atf":"below"==e.fold?a="btf":"span"==e.fold&&(a="stf")),!window.googletag&&(window.googletag={},null===document.getElementById("dotconnect-gpt-load"))){var d=document.createElement("script");d.id="dotconnect-gpt-load",d.async=!0,d.type="text/javascript";var r="https:"==document.location.protocol;d.src=(r?"https:":"http:")+"//www.googletagservices.com/tag/js/gpt.js";var s=document.getElementsByTagName("head")[0];s.appendChild(d,s)}var l=window.googletag||{};if(l.cmd=l.cmd||[],kGoogleSlots[e.adid])l.pubads().refresh([kGoogleSlots[e.adid]]);else{for(;e.positionDiv&&e.positionDiv.firstChild;)e.positionDiv.removeChild(e.positionDiv.firstChild);l.cmd.push(function(){kGoogleSlots[e.adid]=l.defineSlot("/132916964/"+n,[parseInt(e.width),parseInt(e.height)],e.positionDiv.id).addService(l.pubads()).setTargeting("pos",a),l.pubads().setTargeting("sec",o),l.enableServices(),l.display(e.positionDiv.id)}),e.positionDiv.className="tncms-iq-ad",TNCMS_DotConnect_Tile++}},expandable:function(e){var i=e.title?e.title:"*",t=''+i+'";e.clickuri&&(t=''+t+""),e.positionDiv.innerHTML=t},html5:function(e){if(e.positionDiv.hasChildNodes())for(info("Position "+e.position+" has child nodes. Removing child nodes for refresh.");e.positionDiv.firstChild;)e.positionDiv.removeChild(e.positionDiv.firstChild);var i=document.createElement("iframe");i.setAttribute("id","html5-ad-frame-"+e.adid),i.setAttribute("width",e.width),i.setAttribute("height",e.height),i.setAttribute("marginwidth",0),i.setAttribute("marginheight",0),i.setAttribute("hspace",0),i.setAttribute("vspace",0),i.setAttribute("frameborder",0),i.setAttribute("scrolling","no"),i.setAttribute("sandbox","allow-forms allow-popups allow-same-origin allow-scripts");var t="https://"+e.cdn+"/content/tncms/ads/__html5/"+e.uuid+"/"+e.html5_id+"/"+e.htmlfile;e.clickuri&&(t+="?clickTag="+encodeURIComponent(e.clickuri)),i.src=t,e.positionDiv.appendChild(i)},html:function(e){if(null!=e.height&&""!=e.height){if(e.positionDiv.hasChildNodes())for(info("Position "+e.position+" has child nodes. Removing child nodes for refresh.");e.positionDiv.firstChild;)e.positionDiv.removeChild(e.positionDiv.firstChild);var i=document.createElement("iframe");i.setAttribute("id","html-ad-frame-"+e.adid),i.setAttribute("width",e.width),i.setAttribute("height",e.height),i.setAttribute("marginwidth",0),i.setAttribute("marginheight",0),i.setAttribute("hspace",0),i.setAttribute("vspace",0),i.setAttribute("frameborder",0),i.setAttribute("scrolling","no");var t='"+e.html,t=t.replace(/[-[\]\/{}()*+?.\\^$|'"]/g,"\\$&"),i.src="javascript:'"+t+"'",e.positionDiv.appendChild(i)}else{e.positionDiv.innerHTML=e.html,aChildNode=e.positionDiv.childNodes;for(var o=0;aChildNode[o];o++)if(aChildNode[o].nodeName&&"script"===aChildNode[o].nodeName.toLowerCase()&&(!aChildNode[o].type||"text/javascript"===aChildNode[o].type.toLowerCase())){if(oNode=aChildNode[o].parentNode?aChildNode[o].parentNode.removeChild(aChildNode[o]):aChildNode[o],oNode.src)info("Ad #"+e.adid+": Loading script: "+oNode.src+" on "+e.position),jsLoader.loadScript(oNode.src,"blox-ad-position-"+e.position);else{info("Ad #"+e.adid+": Running inline script: on "+e.position),sData=oNode.text||oNode.textContent||oNode.innerHTML||"";var n=document.getElementsByTagName("head")[0]||document.documentElement,a=document.createElement("script");a.type="text/javascript",a.appendChild(document.createTextNode(sData)),oldDocumentWrite=document.write,document.write=function(i){e.positionDiv.innerHTML+=i},n.insertBefore(a,n.firstChild),n.removeChild(a),document.write=oldDocumentWrite}oNode.parentNode&&oNode.parentNode.removeChild(oNode)}}},image:function(e){alt=e.title?e.title:"*",sHeight=e.height?' height="'+e.height+'"':"",sWidth=e.width?' width="'+e.width+'"':"",sOnClick="",e.clickuri&&(sOnClick=" onclick=\"window.open('"+e.clickuri+"','_blank');\" style=\"cursor: pointer;\""),e.positionDiv.innerHTML=''+alt+'"},pagecurl:function(){},text:function(e){e.positionDiv.innerHTML=''+e.title+"
"+e.text},video:function(e){renderStandaloneVideo(e)}},kVirtualRegionCallback={popunder:function(e){if("expandable"==e.type||"pagecurl"==e.type)throw new Error("Ad type "+e.type+"is not allowed in a popunder.");iWidth=e.width?parseInt(e.width,10)+30:300,iHeight=e.height?parseInt(e.height,10)+100:300, iLeft=(screen.width-iWidth)/2,iTop=(screen.height-iHeight)/2,e.window=window.open("","tncms_adman_popunder","top="+iTop+", left="+iLeft+",width="+iWidth+",height="+iHeight+",scrollbars=0,resizable=0,toolbar=0,location=0,menubar=0,status=0,directories=0"),e.positionDiv=e.window.document.body,e.positionDiv.setAttribute("id","blox-ad-position-"+e.position),e.positionDiv.innerHTML="",e.window.blur(),window.focus(),e.window.document.title=e.title,e.window.resizeTo(iWidth,iHeight),e.window.moveTo(iLeft,iTop),renderAd(e)},popup:function(e){function i(){document.getElementsByTagName("body")[0].removeChild(document.getElementById("blox-ad-position-_popup1")),document.getElementsByTagName("body")[0].removeChild(document.getElementById("BlackOutDiv"))}var t=document.createElement("div");if(t.setAttribute("id","BlackOutDiv"),t.style.position="fixed",t.style.top=0,t.style.left=0,t.style.width="100%",t.style.height="100%",t.style.zIndex=99999,t.style.backgroundColor="black",t.style.opacity=.9,t.style.filter="alpha(opacity=90)","number"==typeof window.innerWidth)iWinWidth=window.innerWidth,iWinHeight=window.innerHeight;else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))iWinWidth=document.documentElement.clientWidth,iWinHeight=document.documentElement.clientHeight;else{if(!document.body||!document.body.clientWidth&&!document.body.clientHeight)throw new Error("No valid hight or width for the current window could be found");iWinWidth=document.body.clientWidth,iWinHeight=document.body.clientHeight}iWidth=e.width||400,iHeight=e.height||400,iAdLeft=parseInt((iWinWidth-iWidth)/2),iAdLeft=iAdLeft>0?iAdLeft:0,iAdTop=parseInt((iWinHeight-iHeight)/2),iAdTop=iAdTop>0?iAdTop:0;var o=document.createElement("div");o.style.position="absolute",o.style.top=iAdTop+"px",o.style.left=iAdLeft+"px",o.style.zIndex=parseInt(t.style.zIndex)+1,o.setAttribute("id","blox-ad-position-_popup1"),"undefined"!=typeof t.addEventListener?t.addEventListener("click",i,!1):("BackCompat"==document.compatMode&&(t.style.width="110%",t.style.height="110%",t.style.position="absolute"),t.attachEvent("onclick",i)),document.getElementsByTagName("body")[0].appendChild(t),document.getElementsByTagName("body")[0].appendChild(o),e.positionDiv=document.getElementById("blox-ad-position-_popup1"),renderAd(e)}};if(iDebug>0&&("undefined"==typeof console?alert("Please turn on the debugging console!"):(info("Debug level set to: "+iDebug),bCanLog=!0)),window.XMLHttpRequest?oReq=new XMLHttpRequest:window.ActiveXObject&&(oReq=new ActiveXObject("MSXML2.XMLHTTP.3.0")),oReq){oReq.onreadystatechange=function(){if(4==oReq.readyState&&200==oReq.status){var oResponse=eval("("+oReq.responseText+")");""!==oResponse.lat&&""!==oResponse["long"]&&(kLocation={lat:oResponse.lat,"long":oResponse["long"]})}};try{oReq.open("GET","/_services/v1/client_ip_info/"),oReq.send()}catch(e){}}aTime=location.search.match(/(\?|\&)adman_debug_time=(\d\d)\/(\d\d)\/(\d\d\d\d)_(\d\d)-(\d\d)/),oCurrent=aTime?new Date(aTime[4],aTime[2]-1,aTime[3],aTime[5],aTime[6]):new Date,sBound=4*oCurrent.getHours()+Math.floor(oCurrent.getMinutes()/15);var oDayPart={day:oCurrent.getDay(),startBound:sBound,endBound:sBound+1};delete aTime,delete oCurrent,delete sBound,aTag=document.getElementsByTagName("meta"),oKeyword={},aKeyword=[];for(var i=0;i0;){t=D.pop();var a=t.id,d=n(a);if(d){var r=d.parentNode;d.id=a+"__tmp",r.insertBefore(t,d),r.removeChild(d)}}e()}}function t(e){var t,o,n=e.domId;t=m(k.join("")),k=[],o=l(t),v[n]?Array.prototype.unshift.apply(v[n],o):v[n]=o,i(e)}function o(e){return b[e]||(b[e]=document.getElementById(e))}function n(e){return T.originalGetElementById.call?T.originalGetElementById.call(document,e):T.originalGetElementById(e)}function a(e){function i(e,t){var o,n,a,d=t.children;if(d&&d.length)for(o=0,n=d.length;n>o;o++){if(a=d[o],a.id&&a.id===e)return a;if(a.children&&a.children.length){var r=i(e,a);if(r)return r}}}function t(e){var i,t,o;for(i=0,t=D.length;t>i;i++)if(o=D[i],o.id===e)return o}var o,a,d,r,s=n(e);return s?s:D.length&&(r=t(e))?r:k.length?(o=k.join(""),a=document.createDocumentFragment(),d=document.createElement("div"),d.innerHTML=o,a.appendChild(d),r=i(e,d),r&&D.push(r),r):void 0}function d(e){return 0===e.toLowerCase().indexOf("d&&r.push(e.slice(d,t.index)),t.length>1&&t.indexn;n+=1)""!==o[n]&&r.push(o[n]);return r}function m(e){return e.replace(/