geoLookupNeeded="false";adsNeedGeo="";pixelTaggingNeeded="false";tsCookies3rd="%COOKIES%";
/*! END BASE HEADER */
var tsSitePlacementProperties = [];
String.prototype.tsTrim = function () { return this.replace(/^\s+|\s+$/g, ''); };
Date.prototype.mGetDay = function () {
return (this.getDay() + 6) %7;
};
/* --- Create the TS object only once (shared between placements)  */
if(window.G === undefined){window.G = window;}
var TS = {};
TS.getCookieValue = function (cookieName) {
var exp = new RegExp (escape(cookieName) + "=([^;]+)");
if (exp.test (document.cookie + ";")) {
exp.exec (document.cookie + ";");
return unescape(RegExp.$1);
}
else {return false;}
};
TS.getUrl = function () {
var s="";
s+="tsUUI="+this.getRand();/* Random number */
s += "&tsLho=" + this.ho;               /* Random hostname */
s += "&tsQu=" + this.qu;                /* Query string */
s += "&tsRef=" + this.ref;              /* Referrer */
s += "&tsLP="+this.lp;                  /* Pathname */
s += this.bp;                                                   /* screen width and height and color- and pixel-depth */
return s;
};
TS.writeStatImg = function (url) {
if(window.statImgCSSIsSet === undefined) {
document.write('<style type="text/css">.tsStatImg{width:0px;height:0px;margin:0;padding:0;border-style:none;border-width:0;display:none;}</style>');
window.statImgCSSIsSet = true;
}
url += "&" + this.getUrl();
document.write('<img src="'+url+'" border="0" width="0" height="0" class="tsStatImg" alt="" />');
};
TS.renderFillerAd = function (currentSlot, fillerAds, placementId)
{
var randomFiller = this.getRandomNr(fillerAds.length);
var chosenFiller = fillerAds[randomFiller];
TS.log(chosenFiller);
TS.log("midContent - Rendering filler supplier = " + chosenFiller.fillerSupplier);
document.write(tsApplyRandom(chosenFiller.content));
var theUrl = "http://script.tailsweep.com/siteplacementfillersupplierhit/" +
"542444" + "?" +
"tsId=" + "542444" +
"&placementId=" + placementId +
"&slot=" + currentSlot +
"&supplierId=" + chosenFiller.fillerSupplier +
"&partnerPlacementId=" + chosenFiller.sitePlacement +
"&sitePlacementFillerSupplierId=" + chosenFiller.id;
this.writeStatImg(theUrl);
};
/* Validates if we should display the ad in regard to active periods */
TS.isAdContentActive = function(activePeriods)
{
if(activePeriods.length === 0)
{
return true;
}
else
{
var theDate = new Date();
var weekDay = theDate.mGetDay();
var hour = theDate.getHours();
for(var i = 0; i < activePeriods.length; i++)
{
var activePeriod = activePeriods[i];
if(activePeriod.startWeekDay <= weekDay && activePeriod.endWeekDay >= weekDay && activePeriod.startHour <= hour && activePeriod.endHour >= hour)
{
return true;
}
}
}
return false;
};
TS.shuffleArray = function(array) {
var tmp, current, top = array.length;
if(top)
{
while(--top) {
current = Math.floor(Math.random() * (top + 1));
tmp = array[current];
array[current] = array[top];
array[top] = tmp;
}
}
return array;
};
TS.loadScript = function(url)
{
var line = '<scr'+'ipt src=\"' + url + '\" type=\"text/javascript\"></scr'+'ipt>';
document.write(line);
};
TS.loadCss = function(url)
{
var line = '<li'+'nk rel="stylesheet" type="text/css" href=\"' + url + '\" type=\"text/javascript\"></li'+'nk>';
document.write(line);
};
TS.writeSessionCookie = function (cookieName, cookieValue)
{
if (this.testSessionCookie()) {
document.cookie = escape(cookieName) + "=" + escape(cookieValue) + "; path=/";
return true;
}
else {return false;}
};
TS.testSessionCookie = function ()
{
document.cookie ="testSessionCookie=Enabled";
if (this.getCookieValue ("testSessionCookie")=="Enabled")
{ return true;}
else
{  return false;}
};
TS.writePersistentCookie = function (CookieName, CookieValue, periodType, offset)
{
var expireDate = new Date ();
offset = offset / 1;
var myPeriodType = periodType;
switch (myPeriodType.toLowerCase()) {
case "years":
var year = expireDate.getYear();
/* Note some browsers give only the years since 1900, and some since 0. */
if (year < 1000){ year = year + 1900;}
expireDate.setYear(year + offset);
break;
case "months":
expireDate.setMonth(expireDate.getMonth() + offset);
break;
case "days":
expireDate.setDate(expireDate.getDate() + offset);
break;
case "hours":
expireDate.setHours(expireDate.getHours() + offset);
break;
case "minutes":
expireDate.setMinutes(expireDate.getMinutes() + offset);
break;
default:
/*alert ("Invalid periodType parameter for writePersistentCookie()"); */
break;
}
document.cookie = escape(CookieName ) + "=" + escape(CookieValue) + "; expires=" + expireDate.toGMTString() + "; path=/";
};
TS.testPersistentCookie = function ()
{
this.writePersistentCookie ("testPersistentCookie", "Enabled", "minutes", 1);
if (this.getCookieValue ("testPersistentCookie")=="Enabled")
{  return true;}
else
{  return false;}
};
TS.incrementCookie = function (id,frequence,frequenceDays)
{
if(frequence != '' && frequence > 0)
{
var cval = this.getCookieValue("ts_ad_"+id);
if(!cval)
{
cval = 0;
}
if(cval < frequence)
{
cval++;
this.writePersistentCookie ("ts_ad_"+id, cval, "days", frequenceDays);
return true;
}
return false;
}
return true;
};
TS.incrementSessionCookie = function (id, sessionFrequence)
{
if(sessionFrequence != '' && sessionFrequence > 0)
{
var cval = this.getCookieValue("ts_ad_session"+id);
if(!cval)
{
cval = 0;
}
if(cval < sessionFrequence)
{
cval++;
this.writeSessionCookie("ts_ad_session"+id, cval);
return true;
}
return false;
}
return true;
};
TS.isInCountry = function (adCountryCode)
{
var placeholder = "";
placeholder = "%COUNTRY"+placeholder+"_CODE%"; /* If we failed to replace it server-side */
var isin = (adCountryCode === "0" || adCountryCode === 0 || adCountryCode === "" || adCountryCode == this.countryCode || this.countryCode == placeholder);
return isin;
};
TS.isInRegion = function (adRegionCode)
{
var placeholder = "";
placeholder = "%REGION"+placeholder+"_CODE%"; /* If we failed to replace it server-side */
var isin = (adRegionCode === "0" || adRegionCode === 0 || adRegionCode === "" || adRegionCode == this.regionCode || this.regionCode == placeholder);
return isin;
};
TS.deleteFromAds = function (ads, ad)
{
for(i=0;i<ads.length;i++)
{
if(ads[i].siteAdId === ad.siteAdId)
{
ads.splice(i,1);
}
}
};
TS.showAdHeader = function ()
{
document.write('<div><a class="tailsweep-link" href="http://www.tailsweep.com/"><img border="0" src="http://files.tailsweep.com/resources/ts_adheader_250_en.png" width="250" height="9" alt="" style="padding:0;margin: 0 auto;border-style:none;border-width:0;"/></a></div>');
};
TS.contains = function(a, obj)
{
for(var i = 0; i < a.length; i++)
{
if(a[i] === obj)
{
return true;
}
}
return false;
};
TS.isMobileDevice = function()
{
var userAgent = navigator.userAgent||navigator.vendor||window.opera;
TS.log("User-agent: " + userAgent);
if(/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(userAgent.substr(0,4)))
{
return true;
}
return false;
};
TS.getQParamFromStr = function (str, paramName)
{
var regex = new RegExp("[\\?&]"+paramName+"=([^&#]*)");
var qParam = regex.exec(str);
if(qParam === null){
return "";
}
return qParam[1];
};
TS.getQParam = function (paramName)
{
return this.getQParamFromStr(window.location.href,paramName);
};
TS.PosPopUp = function (id,x,y,offset)
{
var el = document.getElementById(id);
el.style.left=x+offset;
el.style.top=y-document.body.scrollTop+offset;
};
TS.getRand = function ()
{
var uu=Math.round(Math.random()*2147483647);
return uu;
};
TS.getRandomNr = function (max)
{
var ranNum= Math.floor(Math.random()*(max));
return ranNum;
};
TS.getBrowserProperties = function ()
{
return '&tsSW='+self.screen.width+'&tsSH='+self.screen.height+'&tsSC='+self.screen.colorDepth+'&tsPD='+self.screen.pixelDepth;
};
TS.encode = function (s,u)
{
if (typeof(encodeURIComponent) == 'function') {
if (u) {return encodeURI(s);}
else {return encodeURIComponent(s);}
}
else {
return escape(s);
}
};
TS.isDebug = function ()
{
if(window.location.href.indexOf('tsDebug=1') !== -1){
return true;
}
else{
return false;
}
};
TS.isLogDebug = function ()
{
if(window.location.href.indexOf('tsDebug=2') !== -1){
return true;
}
else{
return false;
}
};
TS.log = function(msg)
{
if (TS.isLogDebug() && window.console && window.console.firebug)
{
console.log(msg);
}
};
TS.renderDebugAd = function (height, width, text)
{
var randPopUpId = this.getRandomNr(1000);
document.write('<div id="tsDebugPop_'+randPopUpId+'" style="display:none;border:#666 1px solid;width:200px;height:110px;text-align:left;background:#eee;position:fixed;z-index:99;left:40%;top:40%;padding:0px 5px 10px 5px;"><p style="cursor:pointer;text-align:right;margin:0px;" onclick="this.parentNode.style.display=\'none\';">X</p>Height<br/><input onkeyup="document.getElementById(\'tsDebugAd_'+randPopUpId+'\').style.height=this.value+\'px\';"><br />Width:<br/><input onkeyup="document.getElementById(\'tsDebugAd_'+randPopUpId+'\').style.width=this.value+\'px\';"></div>');
document.write('<button id="tsDebugAd_'+randPopUpId+'" onclick="TS.PosPopUp(\'tsDebugPop_'+randPopUpId+'\',this.offsetLeft,this.offsetTop,20);document.getElementById(\'tsDebugPop_'+randPopUpId+'\').style.display=\'block\';" style="border:#000 0px solid;background-image:none;background-color:#ff17fc;text-align:center;font-size:12px;color:#fff; height:'+height+'px;width:'+width+'px;">' + text + '</button>');
};
/* TS Variables ----------------------------------------------------------------------------------------------------- */
TS.bd=document;
TS.dl=TS.bd.location;
TS.ho = (TS.dl.hostname && TS.dl.hostname != "")  ? TS.encode(TS.dl.hostname) : "";
TS.lp = (TS.dl.pathname && TS.dl.pathname != "") ? TS.dl.pathname : "";
TS.qu = (TS.dl.search && TS.dl.search != "") ? TS.encode(TS.dl.search) : "";
TS.ref = (TS.bd.referrer && TS.bd.referrer != "") ? TS.encode(TS.bd.referrer) :"";
TS.session = TS.getCookieValue("ts_session") ? TS.getCookieValue("ts_session") : "";
TS.uid = TS.getCookieValue("ts_uid") ? TS.getCookieValue("ts_uid") : "";
TS.uv = TS.getCookieValue("ts_uv") ? TS.getCookieValue("ts_uv") : "";
TS.bp = TS.getBrowserProperties() || "";
var tsUrl = (tsUrl === undefined) ? "" : tsUrl;
TS.tsUrl = (tsUrl != "") ? escape(tsUrl) : "";
TS.countryCode=TS.getQParam('tsCountryCode') ||"%COUNTRY_CODE%";
TS.regionCode=TS.getQParam('tsRegionCode') ||"%REGION_CODE%";
var headerShown = "false";
var adsRenderedInSlot = 0;  /* Reset  the number of ads rendered in this current slot  (This var used to be named "success" ) */
if(G.tsAdsRendered_midContent_slot === undefined){G.tsAdsRendered_midContent_slot =[];}
if(G.tsAdsRendered_midContent === undefined){G.tsAdsRendered_midContent=0;}
function tsApplyRandom(content)
{
var rand = TS.getRand();
content = content.replace(/\[timestamp\]/g, rand);
return content;
}
function tsPlacementHit()
{
var url = "http://script.tailsweep.com/siteplacementhit/542444" + "?sitePlacements=2,"+G.ts_currentSlot_midContent +"&tsSession="+TS.session+"&tsUid="+TS.uid+"&tsUV="+TS.uv+"&tsUrl="+TS.tsUrl;
TS.writeStatImg(url);
}
/*
END Site Ads -------------------------------------------------------
*/
if(G.midContentIdx === undefined){G.midContentIdx = 1;};
G.ts_currentSlot_midContent = (G.ts_currentSlot_midContent === undefined) ? 1 : G.ts_currentSlot_midContent+1;
var currentSlot = G.ts_currentSlot_midContent;
G.tsAdsRendered_midContent_slot[currentSlot-1]=0;
G.ts_midContent_maxAds = 1;
if( currentSlot == midContentIdx )
{
G.ts_slotsEntered = currentSlot+1-midContentIdx;      TS.log("midContent - maxAds =  "+G.ts_midContent_maxAds + ", slotsEntered = "+G.ts_slotsEntered);
if(TS.isDebug() || false)
{
document.write('<style type="text/css">.tailsweep-div{text-align:center;font-family: arial,verdana,sans-serif;font-size: 12px;color: #000;margin: 0 auto; padding: 0; display: block;} .smallBr{font-size: 1px;line-height: 0;} .tailsweep-host,.tailsweep-host:link{color:green;font-size:10} .tailsweep-buylink{font-size:12px} .tailsweep-link{color:#00c;font-size:12px;font-weight:bold} .tailsweep-title{color:#00c;font-size:12px;font-weight:bold}</style>');
if (typeof(tsAdStyle)=="undefined") {var tsAdStyle="";}
document.write('<div class="tailsweep-div" id="tailsweep-div-midContent" style="'+tsAdStyle+'">');
if(TS.isDebug())
{
TS.renderDebugAd(250, 375, 'Tailsweep Debug<br />midContent');
}
else
{
}
document.write('</div>');
}
tsPlacementHit();
}

