if(window.adgroupid==undefined){window.adgroupid=Math.round(Math.random()*1000)
}var adtech={debug:true&&(window.console!=undefined),timestamp:new Date().getTime(),adtechHostName:"adtech.staticwhich.co.uk",liveNetworkID:"987.1",testNetworkID:"72.49",liveAdTagData:{LB:"2241372|0|277",TA:"2241371|0|750",MA:"2241373|0|751",L2:"2366222|0|1358",BL:"2374384|0|1358",BA:"2387541|0|2973",BR:"2374385|0|1945",ML:"2374386|0|1356",MR:"2374382|0|1357",TL:"2374387|0|2892",TR:"2374383|0|1946"},testAdTagData:{LB:"2180432|0|277",TA:"2180431|0|750",MA:"2180433|0|751"},liveAdTagPrefix:"WLP",testAdTagPrefix:"LP",networkID:this.liveNetworkID,adTagData:this.liveAdTagData,adTagPrefix:this.liveAdTagPrefix,contentID:$("meta[name='content_id']").attr("content"),keywords:$("meta[name='categories']").attr("content"),hostname:"www.which.co.uk",inlineTagPrefix:"#adtech",setAdTagPrefix:function(a){this.adTagPrefix=a
},setAdTagData:function(a){this.adTagData=a
},setHostname:function(a){if(a!=undefined){this.hostname=a
}},getHostname:function(){return this.hostname
},log:function(b){if(adtech.debug){try{window.console.log(b)
}catch(a){}}},setModeLive:function(){this.networkID=this.liveNetworkID;
this.adTagData=this.liveAdTagData;
this.adTagPrefix=this.liveAdTagPrefix
},setModeTest:function(){this.networkID=this.testNetworkID;
this.adTagData=this.testAdTagData;
this.adTagPrefix=this.testAdTagPrefix
},protocol:"http:",adTag:function(c,g,h){var a=(g==undefined)?true:g;
var d=((h===undefined)||(h==""))?this.contentID:h;
var b=(!a)?Math.round(Math.random()*1000):window.adgroupid;
var e=this.adTagPrefix+d+c;
var f=adtech.protocol+"//"+adtech.adtechHostName+"/addyn|3.0|"+this.networkID+"|"+this.adTagData[c]+"|ADTECH"+(a?";alias="+e:"")+(this.keywords?(";key="+this.keywords.replace(/\s+/g,"").split(",").join("+")):"")+";cookie=info;loc=100;target=_blank;grp="+b+";misc="+this.timestamp;
return f
},invokeURL:function(a){if((a!=undefined)&&(a!="")){var b=new Image();
b.src=a
}},defaultCallback:function(){},reloadCallback:function(a){setTimeout("window.location.reload()",350)
},postAdTagWrite:function(){},adDocWrite:function(a){__ADTECH_CODE__+=a
},fetchScript:function(a,b){$.ajax({type:"GET",url:a,async:true,success:b,beforeSend:function(c){inFIF=undefined;
__ADTECH_CODE__="";
document.write=adtech.adDocWrite
},dataType:"script"})
},maxTry:8,adTagWriteCallback:function(a){},mutex:0,adTagWrite:function(b,a,c){document.write=adtech.realDocWrite;
if($(adtech.inlineTagPrefix+"-"+b).size()==0){document.write("<div id='adtech-"+b+"'></div>")
}setTimeout(function(){adtech.adTagWriteExec(b,a,c,0)
},500)
},adTagWriteExec:function(b,a,e,d){if(adtech.mutex>0){adtech.log("adTagWrite clash ["+b+"] - waiting "+adtech.mutex);
if(d<adtech.maxTry){setTimeout(function(){adtech.adTagWriteExec(b,a,e,d+1)
},500)
}return
}adtech.mutex++;
var c="";
if(typeof(a)=="boolean"){c=adtech.adTag(b,a,"")
}else{c=adtech.adTag(b,true,a)
}adtech.log("Fetching tag ["+b+"] url ="+c);
document.write=adtech.adDocWrite;
if(e===undefined){e=adtech.adTagWriteCallback
}this.testCookieBinding(function(){adtech.fetchScript(c,function(){adtech.log("Completing tag ["+b+"] ad= /"+__ADTECH_CODE__+"/");
document.write=adtech.realDocWrite;
$(adtech.inlineTagPrefix+"-"+b).empty().append(__ADTECH_CODE__);
__ADTECH_CODE__="";
e();
adtech.mutex--
})
});
$.ajaxSetup({async:true});
document.write=adtech.realDocWrite
},beacon:function(a){this.invokeURL("https://secserv.adtech.de/pcsale/3.0/987/0/0/0/BeaconId=4511;rettype=img;subnid=1;SalesValue=1;custom1="+a+" width='1' height'1'")
},cookieBind:function(e,a,c,d){var b=this.getCookieUrl(e,a,c);
$.ajax({type:"GET",url:b,async:true,dataType:"script",complete:d})
},getCookieUrl:function(d,a,c){var b="";
if((c==null)||(c=="remove")){b=";expiresDays=-1"
}else{if(a=="session"){b=";expiressession=1"
}else{b=";expiresDays="+a
}}return"http://"+adtech.adtechHostName+"/bind?ckey1="+d+";cvalue1="+c+b+";adct=text/javascript"
},bindOfferCodeCookie:function(a,b){this.cookieBind("user_offer",90,a,b)
},bindMemberCookie:function(a,b){this.cookieBind("member",90,a,b)
},unbindMemberCookie:function(a){this.cookieBind("member",0,"remove",a)
},setAdtechOfferCodeCookie:function(c,b){var a=new Date();
if(c>0){a.setTime(a.getTime()+(c*24*60*60*1000))
}document.cookie="adtech_code="+b+"; expires="+a.toGMTString()+"; path=/"
},setAdtechLoginCookie:function(c,b){var a=new Date();
if(c>0){a.setTime(a.getTime()+(c*24*60*60*1000))
}document.cookie="adtech_auth="+b+"; expires="+a.toGMTString()+"; path=/"
},isOfferCodeBindRequired:function(){if(which.readCookie("adtech_code")==null){return true
}if(which.readCookie("adtech_code")!=which.readCookie("offer_code")){return true
}return false
},isBindRequired:function(){if((which.readCookie("sso_auth")!="0")&&(which.readCookie("adtech_auth")=="0")){return true
}return false
},isUnbindRequired:function(){if(which.readCookie("adtech_auth")==null){return true
}if((which.readCookie("sso_auth")=="0")&&(which.readCookie("adtech_auth")!="0")){return true
}return false
},testCookieBinding:function(c){message="sso_auth: "+which.readCookie("sso_auth")+", adtech_auth: "+which.readCookie("adtech_auth")+", offer_code: "+which.readCookie("offer_code")+", adtech_code: "+which.readCookie("adtech_code")+", unbind? "+this.isUnbindRequired()+", bind? "+this.isBindRequired()+", bindoffer? "+this.isOfferCodeBindRequired();
if(this.isUnbindRequired()){adtech.unbindMemberCookie(function(){adtech.setAdtechLoginCookie(90,"0");
if(adtech.isOfferCodeBindRequired()){var d=which.readCookie("offer_code");
adtech.bindOfferCodeCookie(d,function(){adtech.setAdtechOfferCodeCookie(90,d);
if(typeof c=="function"){c.call(this,null)
}})
}else{if(typeof c=="function"){c.call(this,null)
}}})
}else{if(this.isBindRequired()){adtech.bindMemberCookie("wol",function(){adtech.setAdtechLoginCookie(90,"1");
if(adtech.isOfferCodeBindRequired()){var d=which.readCookie("offer_code");
adtech.bindOfferCodeCookie(d,function(){adtech.setAdtechOfferCodeCookie(90,d);
if(typeof c=="function"){c.call(this,null)
}})
}else{if(typeof c=="function"){c.call(this,null)
}}})
}else{if(this.isOfferCodeBindRequired()){var b=which.readCookie("offer_code");
adtech.bindOfferCodeCookie(b,function(){adtech.setAdtechOfferCodeCookie(90,b);
if(typeof c=="function"){c.call(this,null)
}})
}else{if(typeof c=="function"){c.call(this,null)
}}}}var a=window.console;
if(a&&a.log){a.log(message)
}},init:function(){inFIF=false;
__ADTECH_CODE__="";
this.setModeLive();
var a=$("meta[name='adtagprefix']").attr("value");
if((a!=undefined)&&(a!="")){this.setAdTagPrefix(a)
}}};
adtech.realDocWrite=document.write;
adtech.init();
var host="www.which.co.uk";
try{host=adtech.setHostname(document.location.host)
}catch(Err){}$(document).ready(function(){$(".promo-ba").hide();
$("div[class^='promo'|class^=js-promo] a.thickbox").each(function(){var a=this.href;
var b=a.indexOf("#");
if(b!=-1){var c=a.substr(b+1);
a="#TB_inline?keepThis=true&amp;height=558&amp;width=736&amp;modal=true&amp;inlineId="+c
}$(this).attr("href",a)
})
});
