function blqAddLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}
else{window.onload=function(){if(oldonload){oldonload();}
func();}}}
var blqOnDomReady;(function(){var toRun=function(){},isReady=false,d=document,ua=navigator.userAgent.toLowerCase();blqOnDomReady=function(f){if(isReady){f();}else{var oldLoadFunc=toRun;toRun=function(){oldLoadFunc();f();};}};if(/*@cc_on !@*/false){(function(){try{d.documentElement.doScroll('left');}catch(e){setTimeout(arguments.callee,50);return;}
toRun();})();}else if(typeof d.readyState!='undefined'&&!(Number((/applewebkit\/(\d+(?:\.\d+)?)/.exec(ua)||[0,NaN])[1])<312)){var f=function(){/loaded|complete/.test(d.readyState)?toRun():setTimeout(f,10);};f();}else{var callback=function(){if(arguments.callee.fired){return;}
arguments.callee.fired=true;toRun();};d.addEventListener("DOMContentLoaded",callback,false);var oldOnload=window.onload;window.onload=function(){if(oldOnload){oldOnload();}
callback();};}
blqOnDomReady(function(){isReady=true;});})();var blq=new function(){var computedStyles,navClicked=false,browserCSS=false,browserImages=false,onloadComplete=false,browserJS=(document.getElementById&&document.getElementsByTagName)?true:false;this.panelSrc=false;this.init=function(){if(browserJS){if(typeof document.documentElement.className=="string"){document.documentElement.className+=" blq-js";}else{document.documentElement.className="blq-js";}}}
this.exploreReady=function(){var exploreButton=el('blq-nav-btn').getElementsByTagName('a')[0];computedStyles=(document.defaultView&&document.defaultView.getComputedStyle(exploreButton,null))||exploreButton.currentStyle;if(computedStyles.color=="rgb(255, 255, 255)"||computedStyles.color=="#ffffff"||computedStyles.color=="#fff"||computedStyles.color==""){browserCSS=true;}
if(browserJS&&browserCSS){exploreButton.href="#blq-nav";exploreButton.onclick=function(e){navClicked=true;stopBubble(e);return false;};}}
this.domReady=function(){if(el('blq-nav')){var exploreButton=el('blq-nav-btn').getElementsByTagName('a')[0];if(computedStyles.color=="rgb(255, 255, 255)"){browserCSS=true;}}
if(browserJS&&browserCSS&&exploreButton){if(navClicked){animateNav('show');}
exploreButton.href="#blq-nav";exploreButton.onclick=function(e){blq.toggleNav(e);return false;};if(typeof document.body.onclick=="function"){var oldOnClick=document.body.onclick;document.body.onclick=function(){animateNav('hide');oldOnClick();};}else{document.body.onclick=function(){animateNav('hide');};}
el('blq-nav').onclick=function(e){stopBubble(e);};}
blq.addGoTrack('blq-acc',{go:'{id}/{dir}'});blq.addGoTrack('blq-mast',{go:'{id}/{dir}'});blq.addGoTrack('blq-nav',{go:'{id}/{dir}'});blq.addGoTrack('blq-disclaim',{go:'{id}/{dir}'});blq.addGoTrack('blq-sitelinks',{go:'{id}/{count}/{dir}'});blq.addGoTrack('blq-bbclinks',{go:'{id}/{dir}'});}
this.onLoad=function(){if(imagesOn()){var navPanelBG=new Image(645,199);navPanelBG.src=blq.panelSrc;el('blq-acc').style.backgroundColor="transparent";}else{var navLinks=el('blq-nav-links');navLinks.style.backgroundColor="#efefef";navLinks.style.border="1px solid #ccc";}}
this.toggleNav=function(e){if(document.getElementById('blq-nav-links').style.display=="block"){animateNav('hide');}else{animateNav('show');}
stopBubble(e);}
this.addGoTrack=function(el,opts){var el=document.getElementById(el)||el,opts=opts||{},links=el.nodeName=='A'?[el]:el.length?el:el.getElementsByTagName('a'),extOnly=opts.external||false,filePath=opts.path||window.location.toString().split('bbc.co.uk/')[1],elId=el.id?el.id.replace(/-/g,'/'):'_auto',goCode=opts.go||'{path}/int/{id}/{dir}';for(var i=0;i<links.length;i++){var externalURL=false,oldHref=false;if((typeof links[i]!="object")||(!links[i].href)||links[i].className.indexOf('blq-nogo')!=-1||links[i].href.indexOf('/go/')!=-1||links[i].href.charAt(0)=='#'
||links[i].href.charAt(window.location.toString().split('#')[0].length)=='#'||links[i].href.indexOf('mailto:')==0||links[i].href.indexOf('javascript:')==0||links[i].href.indexOf('itpc:')==0||links[i].href.indexOf('zune:')==0||links[i].href.indexOf('zcast:')==0){continue;}
if(links[i].href.indexOf('bbc.co.uk')!=-1&&links[i].href.indexOf('#')!=-1){if(links[i].href.indexOf(filePath+'#')!=-1){continue;}}
var currentServer=window.location.href.split("//")[1].split("/")[0],reCurrentServer=currentServer.replace(/\./g,'\\.'),path=links[i].href.split('?')[0],re=new RegExp("^[A-Za-z]+:\\/\\/(?:[^.]+\\.)*(?:bbc\\.co\\.uk|doubleclick\\.net|"+reCurrentServer+")");if(!re.test(path)){var page=location.pathname,externalURL=true,goCopy=page+(page.charAt(page.length-1)=='/'?'':'/')+'ext/_auto';}else if(extOnly){continue;}else{var splitPath=path.split('/'),goCopy=goCode,goDir=splitPath.length<5?splitPath[splitPath.length-1]||splitPath[splitPath.length-2]:splitPath[splitPath.length-2]||splitPath[splitPath.length-1];goCopy=goCopy.replace('{dir}',goDir);goCopy=goCopy.replace('{count}',i+1);goCopy=goCopy.replace('{path}',filePath);goCopy=goCopy.replace('{id}',elId);goCopy=goCopy.replace('#','_');goCopy='/'+goCopy;}
var clickCopy=links[i].onclick,hrefCopy,baseCopy=false;if(path.indexOf('www.bbc.co.uk')!=-1){hrefCopy='http://www.bbc.co.uk/go'+goCopy+'/-/'+links[i].href.substring(links[i].href.indexOf("bbc.co.uk/")+10,links[i].href.length);}else if(externalURL||links[i].href.indexOf(currentServer)==-1){hrefCopy='/go'+goCopy+'/-/'+links[i].href;}else{hrefCopy='/go'+goCopy+'/-/'+links[i].href.substring(links[i].href.indexOf("bbc.co.uk/")+10,links[i].href.length);}
links[i].onclick=(function(){var thisClick=clickCopy,thisHref=hrefCopy;return function(){this.href=thisHref;if(typeof thisClick=='function'){thisClick()};}})();}}
this.tagEnglishLinks=function(label,tooltipTargets){if(browserJS&&browserCSS&&imagesOn()){this.addTooltips(el('blq-acc').getElementsByTagName('a'),label,"hreflang","en-GB");this.addTooltips(el('blq-foot').getElementsByTagName('a'),label,"hreflang","en-GB");if(tooltipTargets!="false"){tooltipTargets=tooltipTargets.split(',');for(var i=tooltipTargets.length-1;i>=0;i--){if(el(tooltipTargets[i])){this.addTooltips(el(tooltipTargets[i]).getElementsByTagName('a'),label,"hreflang","en-GB");}}}
}}
this.addTooltips=function(collection,label,attribute,value){for(var i=collection.length-1;i>=0;i--){if(collection[i].getAttribute(attribute)==value){if(collection[i].className){collection[i].className+=' blq-tooltipped';}else{collection[i].className='blq-tooltipped';}
var tooltip=document.createElement('span');var tooltipClassString="blq-tooltip";if(getPosition(collection[i])[1]<40){tooltipClassString+=" blq-tipunder";}
if(getPosition(collection[i])[0]-getPosition(el('blq-main'))[0]>600){tooltipClassString+=" blq-tipright";}
tooltip.setAttribute('class',tooltipClassString);tooltip.setAttribute('className',tooltipClassString);tooltip.innerHTML='<span class="blq-tooltip-l">'+label+'</span><span class="blq-tooltip-r">&nbsp;</span>';collection[i].appendChild(tooltip);}}}
this.suggest=function(data){if(this.suggestion._pendingRequest){clearTimeout(this.suggestion._pendingRequest._timeout);this.suggestion._pendingRequest=null;}
this.suggestion.setData(data[1]||[]);this.suggestion.find();}
this.addAutoSuggest=function(){var searchBox=document.getElementById('blq-search'),self=this;if(!searchBox){return false;}
searchBox.setAttribute('autocomplete','off');searchBox.onfocus=function(){if(document.getElementById('blq-autosuggest')){return false;}
gloader.load(["glow","1","glow.dom","glow.net","glow.widgets.AutoSuggest"],{async:true,onLoad:function(glow){glow.ready(function(){var $=glow.dom.get;var scope=$("#blq-mast input").filter(function(i){return $(this).attr('name')=="scope";});scope=(scope.length)?scope.attr('value'):'all';self.suggestion=new glow.widgets.AutoSuggest('#blq-search',[],{formatItem:function(item){var name=item.title;if(name.length>28){name=item.title.substring(0,25)+'...';name+='<span class="blq-hide">'+item.title.substring(25,item.title.length)+'</span>';}
return name;},isMatch:function(){return this.data.length?true:false;},index:'title',maxListLength:3,activeOnShow:false,useCache:true,onInputChange:function(event){event.preventDefault();if(this.noData){return false;}
glow.dom.get('#suggid').remove();if(this._pendingRequest){this._pendingRequest.abort();}
var self=this;var qs=glow.data.encodeUrl({'q':event.value,'scope':scope,'format':'blq-1','callback':'blq.suggest'});this._pendingRequest=glow.net.loadScript('http://search.bbc.co.uk/suggest?'+qs,{useCache:true,charset:'utf-8',onError:function(){self.inputElement.attr('autocomplete','on');self.noData=true;},timeout:5});},onDataError:function(event){this.inputElement.attr('autocomplete','on');},onItemSelect:function(event){this.setValue(event.selectedItem.title);var form=glow.dom.get('#blq-mast form');form[0].submit();},onItemActive:function(e){var input=glow.dom.get('#suggid');if(!input.length){input=glow.dom.create('<input type="hidden" name="suggid" id="suggid" />');glow.dom.get('#blq-mast form').get('fieldset').prepend(input);}
input.val(e.activeItem.id);this.inputElement.val(e.activeItem.title);}});self.suggestion.overlay.container.attr('id','blq-autosuggest');self.suggestion.overlay.opts.hideWindowedFlash=false;self.suggestion.overlay.container.get(".autosuggest-light").removeClass("autosuggest-light");});}});searchBox.onfocus=function(){};};}
function imagesOn(){if(document.images&&el('blq-blocks').offsetWidth=="107"){return true;}else{return false;}}
function letShowTooltip(n,i){return function(){el('blq-tooltip-'+n+i).style.display='block';};}
function letHideTooltip(n,i){return function(){el('blq-tooltip-'+n+i).style.display='none';};}
function getPosition(theElement){var positionY=0;var positionX=0;while(theElement!=null){positionX+=theElement.offsetLeft;positionY+=theElement.offsetTop;theElement=theElement.offsetParent;}
return[positionX,positionY];}
function animateNav(action){var agent=navigator.userAgent.toLowerCase();if(el('blq-nav-links').style.opacity!=undefined&&agent.indexOf("chrome")==-1){var currentOpacity=el('blq-nav-links').style.opacity||0;if(action=='show'){el('blq-nav-links').style.display="block";if(el('blq-home').focus){el('blq-home').focus();}
if(currentOpacity<1){el('blq-nav-links').style.opacity=(parseFloat(currentOpacity)+0.15);setTimeout(function(){animateNav('show');},30);}else{el('blq-nav-links').style.opacity=1;}}else{if(currentOpacity>0){el('blq-nav-links').style.opacity=(parseFloat(currentOpacity)-0.15);setTimeout(function(){animateNav('hide');},30);}else{el('blq-nav-links').style.opacity=0;el('blq-nav-links').style.display="none";}}}else{if(action=='show'){el('blq-nav-links').style.display="block";}else{el('blq-nav-links').style.display="none";}}}
function stopBubble(e){if(!e)var e=window.event;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();}
function el(id){return document.getElementById(id);}}
blq.init();blqOnDomReady(function(){blq.domReady();});blqAddLoadEvent(blq.onLoad);