$(document).ready(function(){});
ItvJs.Neighbour={COOKIE_NAME:"ITV-NBR",COOKIE_EXPIRY_DAYS:1024,COOKIE_PATH:"/",COOKIE_DOMAIN:"",COOKIE_SECURE:false,COOKIE_REGION_LABEL:"-REGION",COOKIE_CITY_LABEL:"-LOCATION-ID",COOKIE_MENU_LABEL:"-MENU",REGION_CHANGE_CONFIRM_TEXT:"Would you like to set <region> as your default region?",REGIONS:{anglia:{strFormattedName:"Anglia",strPrimaryBrand:"Anglia Tonight",strSecondaryBrand:"ITV Anglia",strURL:"http://www.itv.com/anglia/",strMenuText:"My Anglia"},border:{strFormattedName:"Border",strPrimaryBrand:"Lookaround",strSecondaryBrand:"ITV Border",strURL:"http://www.itv.com/border/",strMenuText:"My Border"},centraleast:{strFormattedName:"Central",strPrimaryBrand:"Central Tonight",strSecondaryBrand:"ITV Central",strURL:"http://www.itv.com/central-east/",strMenuText:"My Central"},centralwest:{strFormattedName:"Central",strPrimaryBrand:"Central Tonight",strSecondaryBrand:"ITV Central",strURL:"http://www.itv.com/central-west/",strMenuText:"My Central"},granada:{strFormattedName:"Granada",strPrimaryBrand:"Granada Reports",strSecondaryBrand:"ITV Granada",strURL:"http://www.itv.com/granada/",strMenuText:"My Granada"},london:{strFormattedName:"London",strPrimaryBrand:"London Tonight",strSecondaryBrand:"ITV London",strURL:"http://www.itv.com/london/",strMenuText:"My London"},meridianeast:{strFormattedName:"Meridian",strPrimaryBrand:"Meridian Tonight",strSecondaryBrand:"ITV Meridian",strURL:"http://www.itv.com/meridian-east/",strMenuText:"My Meridian"},meridianwest:{strFormattedName:"Meridian",strPrimaryBrand:"Meridian Tonight",strSecondaryBrand:"ITV Meridian",strURL:"http://www.itv.com/meridian-west/",strMenuText:"My Meridian"},tynetees:{strFormattedName:"Tyne Tees",strPrimaryBrand:"North East Tonight",strSecondaryBrand:"ITV Tyne Tees",strURL:"http://www.itv.com/tynetees/",strMenuText:"My Tyne Tees"},wales:{strFormattedName:"Wales",strPrimaryBrand:"Wales Tonight",strSecondaryBrand:"ITV Wales",strURL:"http://www.itv.com/wales/",strMenuText:"My Wales"},westcountryeast:{strFormattedName:"West",strPrimaryBrand:"The West Country Tonight",strSecondaryBrand:"ITV West",strURL:"http://www.itv.com/westcountry-east/",strMenuText:"My West"},westcountrywest:{strFormattedName:"Westcountry",strPrimaryBrand:"The West Country Tonight",strSecondaryBrand:"ITV Westcountry",strURL:"http://www.itv.com/westcountry-west/",strMenuText:"My Westcountry"},yorkshire:{strFormattedName:"Yorkshire",strPrimaryBrand:"Calendar",strSecondaryBrand:"ITV Yorkshire",strURL:"http://www.itv.com/yorkshire/",strMenuText:"My Yorkshire"}},GetUserRegion:function(){return this.readNeighbourCookie(this.COOKIE_REGION_LABEL)
},SetUserRegion:function(strRegion,blnRedirect){if(typeof strRegion!="string"||!this.validateRegion(strRegion)){throw"Invalid region"
}if(this.GetUserRegion()!=strRegion){if(confirm(this.REGION_CHANGE_CONFIRM_TEXT.replace(/<region>/,this.REGIONS[strRegion].strFormattedName))){this.writeNeighbourCookie(this.COOKIE_REGION_LABEL,strRegion);
this.writeNeighbourCookie(this.COOKIE_MENU_LABEL,this.REGIONS[strRegion].strMenuText.replace(/~/,"%7E")+"~"+this.REGIONS[strRegion].strURL.replace(/~/,"%7E"));
NeighbourNavModification();
this.deleteNeighbourCookie(this.COOKIE_CITY_LABEL)
}}if(blnRedirect){this.redirectToRegion(strRegion)
}},ClearUserRegion:function(){this.deleteNeighbourCookie(this.COOKIE_REGION_LABEL);
this.deleteNeighbourCookie(this.COOKIE_MENU_LABEL);
this.deleteNeighbourCookie(this.COOKIE_CITY_LABEL);
NeighbourNavModification()
},GetUserCity:function(){return this.readNeighbourCookie(this.COOKIE_CITY_LABEL)
},SetUserCity:function(intCity){if(typeof intCity!="number"){throw"Invalid city"
}if(this.GetUserCity()!=intCity){this.writeNeighbourCookie(this.COOKIE_CITY_LABEL,intCity)
}},UpdateRegionPicker:function(){var strRegion=this.GetUserRegion(),chkRegion=$(".nbr-regionPicker #chkRegionPicker"),chkLabel=$(".nbr-regionPicker label");
chkRegion.attr("checked",false);
if(strRegion==chkRegion.attr("value")){chkRegion.attr("checked",true)
}return},FindRegionInUrl:function(){var strRegion,strPath=window.location.pathname;
strPath=strPath.replace(/-/,"");
for(strRegion in this.REGIONS){if(strPath.indexOf("/"+strRegion+"/")>=0){return strRegion
}}return},MakeAdCall:function(iWidth,iHeight){var sAmz="",sAdSize=iWidth+"x"+iHeight;
switch(sAdSize){case"150x113":sAmz="SPONSORBUTTON";
break;case"163x64":sAmz="FOOTBALLSPONSORBUTTON";
break;case"1x1":sAmz="OUTOFPAGE";
break;case"150x80":sAmz="SPONSORBUTTON";
break;default:sAmz=sAdSize;
break}if(Bloom.Adverts.AdvertServer.Current.AdHash[sAdSize]===undefined){Bloom.Adverts.AdvertServer.Current.AdHash[sAdSize]=1
}else{Bloom.Adverts.AdvertServer.Current.AdHash[sAdSize]++
}document.write('<script type="text/javascript" src="'+Bloom.Adverts.AdvertServer.Current.Server+"/jserver/acc_random="+Math.round(Math.random()*10000000000)+"/SITE="+Bloom.Adverts.AdvertServer.Current.Site+"/AREA="+Bloom.Adverts.AdvertServer.Current.Area+"/POSITION="+Bloom.Adverts.AdvertServer.Current.AdHash[sAdSize]+"/AAMSZ="+sAmz+"/RS="+Bloom.Adverts.AdvertServer.Current.RSI.replace(/_/g,"")+"/SEG="+Bloom.Adverts.AdvertServer.Current.Area+"/pageid="+Math.round(Math.random()*10000000000)+'"><\/script>')
},validateRegion:function(strRegion){return(typeof this.REGIONS[strRegion]!="undefined")?true:false
},redirectToRegion:function(strRegion){window.location=this.REGIONS[strRegion].strURL
},readNeighbourCookie:function(strKey){if(typeof strKey!="string"){throw"Invalid key"
}return $.cookie(this.COOKIE_NAME+strKey)
},writeNeighbourCookie:function(strKey,strValue){if(typeof strKey!="string"){throw"Invalid key"
}if(typeof strValue!="string"&&typeof strValue!="number"){throw"Invalid value"
}$.cookie(this.COOKIE_NAME+strKey,strValue,{expires:this.COOKIE_EXPIRY_DAYS,path:this.COOKIE_PATH,domain:this.COOKIE_DOMAIN,secure:this.COOKIE_SECURE})
},deleteNeighbourCookie:function(strKey){if(typeof strKey!="string"){throw"Invalid key"
}$.cookie(this.COOKIE_NAME+strKey,null,{expires:this.COOKIE_EXPIRY_DAYS,path:this.COOKIE_PATH,domain:this.COOKIE_DOMAIN,secure:this.COOKIE_SECURE})
}};function sendData(val,val2){if(typeof ItvJs.Neighbour!="undefined"){ItvJs.Neighbour.SetUserRegion(val,true)
}};
(function($){function runTicker(settings){if(settings.firstRun==1){currentLength=settings.currentLength;
currentItem=settings.currentItem;
settings.firstRun=0}if(currentItem==settings.newsItemCounter+1){currentItem=0
}if(currentLength==0){if(settings.newsLinks[currentItem].length>0){$(settings.newsList).empty().append('<li><a href="'+settings.newsLinks[currentItem]+'"></a></li>')
}else{$(settings.newsList).empty().append("<li></li>")
}}if(currentLength%2==0){placeHolder=settings.placeHolder1
}else{placeHolder=settings.placeHolder2
}if(currentLength<=settings.newsItems[currentItem].length+1){var tickerText=settings.newsItems[currentItem].substring(0,currentLength);
if(settings.newsLinks[currentItem].length>0){$(settings.newsList+" li a").text(tickerText+placeHolder)
}else{$(settings.newsList+" li").text(tickerText+placeHolder)
}currentLength++;setTimeout(function(){runTicker(settings);
settings=null},settings.tickerRate)
}else{if(settings.newsLinks[currentItem].length>0){$(settings.newsList+" li a").text(settings.newsItems[currentItem])
}else{$(settings.newsList+" li").text(settings.newsItems[currentItem])
}currentLength=0;currentItem++;
setTimeout(function(){runTicker(settings);
settings=null},settings.loopDelay)
}}$.fn.extend({newsTicker:function(settings){settings=jQuery.extend({newsList:"#news",tickerRate:80,startDelay:100,loopDelay:3000,placeHolder1:" |",placeHolder2:"_"},settings);
var newsItems=new Array();
var newsLinks=new Array();
var newsItemCounter=0;
$(settings.newsList+" li").hide();
$(settings.newsList+" li").each(function(){if($(this).children("a").length){newsItems[newsItemCounter]=$(this).children("a").text();
newsLinks[newsItemCounter]=$(this).children("a").attr("href")
}else{newsItems[newsItemCounter]=$(this).text();
newsLinks[newsItemCounter]=""
}newsItemCounter++});
settings=jQuery.extend(settings,{newsItems:newsItems,newsLinks:newsLinks,newsItemCounter:newsItemCounter-1,currentItem:0,currentLength:0,firstRun:1});
setTimeout(function(){runTicker(settings);
settings=null},settings.startDelay)
}})})(jQuery);$(function(){if($("#nbr-ticker").length>0){$().newsTicker({newsList:"#nbr-ticker",placeHolder1:"_",placeHolder2:"_"})
}});if(!Scrolling){var Scrolling={}
}Scrolling.Scroller=function(o,w,h,t){var self=this;
var _vwidth=w;var _vheight=h;
var _twidth=o.offsetWidth;
var _theight=o.offsetHeight;
var _hasTween=t?true:false;
var _timer,_x,_y;this.onScrollStart=function(){};
this.onScrollStop=function(){};
this.onScroll=function(){};
this.scrollSpeed=30;this.itvScrollerContainerClassName="itv-scroller-container";
var list=o.getElementsByTagName("div");
for(var i=0;i<list.length;
i++){if(list[i].className.indexOf(this.itvScrollerContainerClassName)>-1){o=list[i]
}}function setPosition(x,y){if(x<_vwidth-_twidth){x=_vwidth-_twidth
}if(x>0){x=0}if(y<_vheight-_theight){y=_vheight-_theight
}if(y>0){y=0}_x=x;_y=y;
o.style.left=_x+"px";
o.style.top=_y+"px"}this.scrollBy=function(x,y){setPosition(_x-x,_y-y);
this.onScroll()};this.scrollTo=function(x,y){setPosition(-x,-y);
this.onScroll()};this.startScroll=function(x,y){this.stopScroll();
this.onScrollStart();
_timer=window.setInterval(function(){self.scrollBy(x,y)
},this.scrollSpeed)};
this.stopScroll=function(){if(_timer){window.clearInterval(_timer)
}this.onScrollStop()};
this.reset=function(){_twidth=o.offsetWidth;
_theight=o.offsetHeight;
_x=0;_y=0;o.style.left="0px";
o.style.top="0px";if(_hasTween){t.apply(this)
}};this.swapContent=function(c,w,h){o=c;
var list=o.getElementsByTagName("div");
for(var i=0;i<list.length;
i++){if(list[i].className.indexOf(this.itvScrollerContainerClassName)>-1){o=list[i]
}}if(w){_vwidth=w}if(h){_vheight=h
}this.reset()};this.getDimensions=function(){return{vwidth:_vwidth,vheight:_vheight,twidth:_twidth,theight:_theight,x:-_x,y:-_y}
};this.getContent=function(){return o
};this.reset()};if(!Scrolling){var Scrolling={}
}Scrolling.Scrollbar=function(o,s,t){var self=this;
var _components={};var _dimensions={};
var _temporary={};var _hasTween=t?true:false;
var _timer,_ratio;this.onMouseDown=function(){};
this.onMouseUp=function(){};
this.onScroll=function(){};
this.scrollAmount=5;this.scrollSpeed=30;
this.disabled=false;this.scrollbarUp="itv-scrollbar-up";
this.scrollbarDown="itv-scrollbar-down";
this.scrollbarTrack="itv-scrollbar-track";
this.scrollbarHandle="itv-scrollbar-handle";
function initialize(){var c=_components;
var d=_dimensions;var g=s.getDimensions();
c.up=findComponent(self.scrollbarUp,o);
c.down=findComponent(self.scrollbarDown,o);
c.track=findComponent(self.scrollbarTrack,o);
c.handle=findComponent(self.scrollbarHandle,c.track);
d.trackTop=findOffsetTop(c.track);
d.trackHeight=c.track.offsetHeight;
d.handleHeight=c.handle.offsetHeight;
d.y=0;if(_hasTween){t.apply(self)
}addEvent(s.getContent(),"mousewheel",scrollbarWheel);
addEvent(s.getContent(),"DOMMouseScroll",scrollbarWheel);
addEvent(o,"mousedown",scrollbarClickPrimer);
self.reset()}function findOffsetTop(o){var t=0;
if(o.offsetParent){while(o.offsetParent){t+=o.offsetTop;
o=o.offsetParent}}return t
}function addEvent(o,t,f){if(o.attachEvent){o.attachEvent("on"+t,f)
}else{o.addEventListener(t,f,false)
}}function removeEvent(o,t,f){if(o.detachEvent){o.detachEvent("on"+t,f)
}else{o.removeEventListener(t,f,false)
}}function findComponent(c,o){var kids=o.childNodes;
for(var i=0;i<kids.length;
i++){if(kids[i].className&&kids[i].className.indexOf(c)>=0){return kids[i]
}}}function scroll(y){if(y<0){y=0
}if(y>_dimensions.trackHeight-_dimensions.handleHeight){y=_dimensions.trackHeight-_dimensions.handleHeight
}_components.handle.style.top=y+"px";
_dimensions.y=y;s.scrollTo(0,Math.round(_dimensions.y*_ratio));
self.onScroll()}function scrollbarClickPrimer(e){if(self.disabled){return false
}e=e?e:event;if(!e.target){e.target=e.srcElement
}_dimensions.trackTop=findOffsetTop(_components.track);
scrollbarClick(e.target.className,e)
}function scrollbarClick(c,e){var d=_dimensions;
var t=_temporary;var cy=e.clientY+document.body.scrollTop;
if(c.indexOf(self.scrollbarUp)>=0){startScroll(-self.scrollAmount)
}if(c.indexOf(self.scrollbarDown)>=0){startScroll(self.scrollAmount)
}if(c.indexOf(self.scrollbarTrack)>=0){if(_hasTween){self.tweenTo((cy-d.trackTop-d.handleHeight/2)*_ratio)
}}if(c.indexOf(self.scrollbarHandle)>=0){t.grabPoint=cy-findOffsetTop(_components.handle);
addEvent(document,"mousemove",scrollbarDrag,false)
}t.target=e.target;t.select=document.onselectstart;
document.onselectstart=function(){return false
};self.onMouseDown(e.target,c,e);
addEvent(document,"mouseup",stopScroll)
}function scrollbarDrag(e){e=e?e:event;
var d=_dimensions;var t=parseInt(_components.handle.style.top);
var v=e.clientY+document.body.scrollTop-d.trackTop;
if(v>=d.trackHeight-d.handleHeight+_temporary.grabPoint){v=d.trackHeight-d.handleHeight
}else{if(v<=_temporary.grabPoint){v=0
}else{v=v-_temporary.grabPoint
}}scroll(v)}function scrollbarWheel(e){if(self.disabled){return false
}e=e?e:event;var dir=0;
if(typeof e.wheelDelta=="undefined"){if(e.detail>0){dir=1
}if(e.detail<0){dir=-1
}}else{if(e.wheelDelta>=120){dir=-1
}if(e.wheelDelta<=-120){dir=1
}}self.scrollBy(dir*20);
if(e.stopPropagation){e.stopPropagation()
}if(e.preventDefault){e.preventDefault()
}e.cancelBubble=true;
e.cancel=true;e.returnValue=false;
return false}function startScroll(y){console.log("attempting to scroll");
_temporary.disty=y;_timer=window.setInterval(function(){self.scrollBy(_temporary.disty)
},self.scrollSpeed)}function stopScroll(e){e=e?e:event;
removeEvent(document,"mousemove",scrollbarDrag);
removeEvent(document,"mouseup",stopScroll);
document.onselectstart=_temporary.select;
if(_timer){window.clearInterval(_timer)
}self.onMouseUp(_temporary.target,_temporary.target.className,e)
}this.reset=function(){var d=_dimensions;
var c=_components;var g=s.getDimensions();
_ratio=(g.theight-g.vheight)/(d.trackHeight-d.handleHeight);
c.handle.ondragstart=function(){return false
};c.handle.onmousedown=function(){return false
};c.handle.style.top="0px";
d.y=0;s.reset();scroll(0);
if(g.theight<g.vheight){this.disable()
}else{this.enable()}};
this.scrollTo=function(y){scroll(y/_ratio)
};this.scrollBy=function(y){scroll((s.getDimensions().y+y)/_ratio)
};this.swapContent=function(n){var d=s.getDimensions;
s.swapContent(n,d.vwidth,d.vheight);
initialize()};this.disable=function(){this.disabled=true;
o.className+="itv-scrollbar-disabled"
};this.enable=function(){this.disabled=false;
o.className=o.className.replace(/itv-scrollbar\-disabled/,"")
};this.getContent=function(){return s.getContent()
};this.getComponents=function(){return _components
};this.getDimensions=function(){var d=s.getDimensions();
d.trackHeight=_dimensions.trackHeight;
d.handleHeight=_dimensions.handleHeight;
d.handleY=_dimensions.y;
return d};initialize()
};
if(!Scrolling){var Scrolling={}
}Scrolling.ScrollTween=function(){var self=this;
var _steps=[0,25,50,70,85,95,97,99,100];
var _values=[];var _idle=true;
var o,_inc,_timer;function tweenTo(y){if(!_idle){return false
}var d=o.getDimensions();
if(y<0){y=0}if(y>d.theight-d.vheight){y=d.theight-d.vheight
}var dist=y-d.y;_inc=0;
_timer=null;_values=[];
_idle=false;for(var i=0;
i<_steps.length;i++){_values[i]=Math.round(d.y+dist*(_steps[i]/100))
}_timer=window.setInterval(function(){o.scrollTo(_values[_inc]);
if(_inc==_steps.length-1){window.clearInterval(_timer);
_idle=true}else{_inc++
}},o.stepSpeed)}function tweenBy(y){o.tweenTo(o.getDimensions().y+y)
}function setSteps(s){_steps=s
}this.apply=function(p){o=p;
o.tweenTo=tweenTo;o.tweenBy=tweenBy;
o.setSteps=setSteps;o.stepSpeed=30
}};var scroller=null;var scrollbar=null;
$(function(){if(document.getElementById("nbr-scroll1")){document.getElementById("nbr-scroll1").style.overflow="hidden";
scroll_1=new Scrolling.Scroller(document.getElementById("nbr-scroll1"),278,268);
scrollbar_1=new Scrolling.Scrollbar(document.getElementById("nbr-featureContentSecondary-scrollbar"),scroll_1)
}});$(function(){if(document.getElementById("nbr-scroll2")){document.getElementById("nbr-scroll2").style.overflow="hidden";
document.getElementById("nbr-featureContentSecondary-scrollbar2").style.width="23px";
scroll_2=new Scrolling.Scroller(document.getElementById("nbr-scroll2"),514,500);
scrollbar_2=new Scrolling.Scrollbar(document.getElementById("nbr-featureContentSecondary-scrollbar2"),scroll_2)
}});