iplayer.pollnode.add("nws-content",function(a){iplayer.rollover.add(a)});iplayer.pollnode.add("spo-content",function(a){iplayer.rollover.add(a)});iplayer.widgets={};iplayer.widgets.lastNightOnTv=function(){var f,k,d,j,b,h,c={showSchedule:"channel-schedule-visible",tabActive:"channel-name-active",linkActive:"active",filterActive:"active"},g="lnt-homepage-widget";function i(){var o=d.get(" li.channel");o.get(" > .channel-name").each(function(){$(this).removeClass(c.tabActive)});o.get(" > .channel-schedule").each(function(){$(this).removeClass(c.showSchedule)});o.get(" > .channel-link").each(function(){$(this).removeClass(c.linkActive)})}function l(o){h=(o==="today")?"today":"yesterday"}function e(p){var o="";switch(p){case"today":o="today";break;case"yesterday":o="yesterday";break}if(o.length>0){return h==o}return false}function n(){return h}function m(){var o=dom.create('<div id="lnt-day-switch" class="filter-buttons ignore"><span class="left"></span><div class="controls"><a href="#" id="filter-yesterday" class="'+c.filterActive+' button">'+iplayer.localisation.yesterday+'</a><span class="divider"></span><a href="#" id="filter-today" class="button">'+iplayer.localisation.today+'</a></div><span class="right"></span></div>').insertAfter("#lnt-homepage-widget .widget-title"),q=o.get("#filter-yesterday"),p=o.get("#filter-today");function r(u){var s=glow.anim.css(d.get("."+c.showSchedule),0.3,{opacity:{from:1,to:0}}),t=events.addListener(s,"complete",function(){var v=j.get(".channel-schedule");d.get(".channel-schedule").each(function(y){var w=$(v.item(y)),z=$(this),x=z.clone();z.html(w.html());w.html(x.html())});a(b);glow.anim.css(d.get("."+c.showSchedule),0.3,{opacity:{from:0,to:1}}).start();events.removeListener(t)});s.start()}events.addListener(q,"click",function(s){s.preventDefault();if(!e("yesterday")){$(this).addClass(c.filterActive);p.removeClass(c.filterActive);l("yesterday");r.call(this,s)}});events.addListener(p,"click",function(s){s.preventDefault();if(!e("today")){$(this).addClass(c.filterActive);q.removeClass(c.filterActive);l("today");r.call(this,s)}})}function a(r){var p=r.next().get("> li.dataHolder");function t(){if(typeof(r[0][(n())])!=="object"){r[0][(n())]={}}return r[0][(n())]}function q(){return !!t().loading}function s(u){t().loading=u}if(p.length>0&&!q()){var o=this;s(true);p.html('<img src="'+iplayer.config.root+'img/results/xhr-loader.gif" />');net.get(p.attr("title"),{useCache:true,onLoad:function(u){s(null);r.next().html(u.text())}})}}return{showSchedule:function(q,o){var p=$(q);b=p;if(!p.hasClass(c.tabActive)){i();p.addClass(c.tabActive);p.next().addClass(c.showSchedule);p.next().next().addClass(c.linkActive);a(p)}else{if(o!=="key"){window.location.href=p.attr("href")}}},init:function(p){var o=this,q=true;f=p;d=$("#"+f);j=$("#lnt-content-today");k=parseInt(d.css("height"));m();b=d.get("."+c.tabActive);l("yesterday");d.get("> li.channel > .channel-name").each(function(){if(q&&glow.env.ie<7){$(this).next().css("height",k+"px")}q=false;var r=function(t,s){o.showSchedule(this,s);t.preventDefault();return false};events.addListener(this,"click",r);events.addListener(this,"keyup",function(s){r.call(this,s,"key")})})}}}();iplayer.pollnode.add("lnt-content",function(){iplayer.widgets.lastNightOnTv.init("lnt-content")});iplayer.widgets.mostPopular=function(){var e={show:0.3,hide:0.3},d,g="active",a,b;function f(i){i=(i.toLowerCase()==="tv")?"tv":"radio";var h=d[i],j=events.addListener(b,"complete",function(k){a.html(h.html());glow.anim.css(a,e.show,{opacity:{from:0,to:1}}).start();events.removeListener(j)});b.start()}function c(){var l=dom.create('<div id="service-filter" class="filter-buttons ignore"><span class="left"></span><div class="controls"><a href="#" id="filter-tv" class="'+g+' button">'+iplayer.localisation.tv+'</a><span class="divider"></span><a href="#" id="filter-radio" class="button">'+iplayer.localisation.radio+'</a></div><span class="right"></span></div>').insertAfter("#mp-homepage-widget .widget-title"),h=l.get("#filter-tv"),k=l.get("#filter-radio"),m=function(){try{a.get("li").slice(0,1).get("a")[0].focus()}catch(n){}},j=function(){var n=$(this);if(!n.hasClass(g)){f("tv");k.removeClass(g);n.addClass(g)}m();return false},i=function(){var n=$(this);if(!n.hasClass(g)){f("radio");h.removeClass(g);n.addClass(g)}m();return false};events.addListener(h,"click",j);events.addListener(h,"keyup",function(n){if(n.key==="SPACE"||n.key==="ENTER"){j.call(this)}});events.addListener(k,"click",i);events.addListener(k,"keyup",function(n){if(n.key==="SPACE"||n.key==="ENTER"){i.call(this)}})}return{init:function(){a=dom.get("#mp-content-tv");if(!a.length){return}b=glow.anim.css(a,e.hide,{opacity:{from:1,to:0}});c();var h=$("#mp-content-radio");d={tv:a.clone(),radio:h.clone()};h.remove();glow.ready(function(){d.radio.get("> li > a > img").each(function(){if(this.updated||!this.id){return}var i=iplayer.convertIdToURL(this.id);if(!i){return}this.src=i;this.id="";this.updated=true})})}}}();iplayer.pollnode.add("mp-homepage-widget",function(){iplayer.widgets.mostPopular.init()});iplayer.widgets.liveRadio=function(){var b="live-radio",d,e=true;function c(f){var g=f,h;while(g&&g.className.indexOf(b)===-1){g=g.parentNode}$(g).get("> li").each(function(){if(f===this||$(f).isWithin(this)){h=this}});return h}function a(h,j){var f=j==="show",i=(f?"on":"off"),g=(f?"info on":"info");h=$(h);h.attr("class",i);h.get(" .info").attr("class",g)}return function(){var h=$("#listen-live-radio ul")[0],f=$(h).get("> li")[0],i=f;if(e){a(f,"show");e=false}if(h){function g(k){if(k.source!==h){var j=c(k.source);if(i!==j){a(i,"hide")}if(j){a(j,"show");i=j}}}events.addListener(h,"mouseover",function(j){g(j)});events.addListener(h,"keyup",function(j){g(j)})}}}();iplayer.pollnode.add("listen-live-radio",function(){iplayer.widgets.liveRadio()});iplayer.widgets.lastPlayed=function(){var f=iplayer.cookie,c=iplayer.config.cookie,j=c.name,d=c.key.lastPlayed,e=f.get(j,d);function h(){var l=$("#lp-timeline").item(0);if(l){if(!l.className){return}var k=new SWFObject("http://www.bbc.co.uk/emp/recentlyplayed.swf","bbc_rp_embed",178,35,"8","#000000");k.addParam("wmode","default");k.addParam("quality","high");k.addParam("allowScriptAccess","always");k.addVariable("version_pid",l.className);k.write(l.id);l.className=""}}function a(){var k=$("#last-played-homepage .widget-title");k.text(iplayer.localisation.lastPlayed);k.css("display","block")}function g(){net.get(iplayer.config.root+"widget/lastplayed/template/cleared/locale/"+iplayer.locale,{useCache:true,onLoad:function(k){$("#last-played-homepage .widget-content").html(k.text());$("#last-played").css("display","block")}})}function i(){var k=e.split(",");net.get(iplayer.config.root+"widget/lastplayed/episodes/"+k.splice(0,iplayer.config.lastPlayed.maxDisplayed).join(",")+"/locale/"+iplayer.locale,{useCache:true,onLoad:function(l){$("#last-played-homepage .widget-content").html(l.text());h();b()}})}function b(){var k=dom.create('<div id="clear-last-played" class="filter-buttons"><span class="left"></span><div class="controls"><a href="" id="lp-clear" class="button">'+iplayer.localisation.clear+'</a></div><span class="right"></span></div>').insertAfter("#last-played-homepage .widget-title");events.addListener(k.get("#lp-clear"),"click",function(l){l.preventDefault();f.set(j,d,"cleared");g();window.setTimeout(function(){k.html("")},200)})}return{init:function(){if(e!=""){a();if(e=="cleared"){g()}else{i()}}else{this.show()}},show:function(){$("#last-played-homepage .widget-title").css("display","block");$("#last-played").css("display","block")}}}();iplayer.pollnode.add("last-played-homepage",function(){iplayer.widgets.lastPlayed[(iplayer.config.lastPlayedEnabled)?"init":"show"]()});iplayer.widgets.highlights=function(){var d="active",c,b;function a(){var i=dom.create('<div id="highlights-service-filter" class="filter-buttons ignore"><span class="left"></span><div class="controls"><a href="#" id="highlights-filter-tv" class="'+d+' button">'+iplayer.localisation.tv+'</a><span class="divider"></span><a href="#" id="highlights-filter-radio" class="button">'+iplayer.localisation.radio+'</a></div><span class="right"></span></div>').prependTo("#top-picks"),e=i.get("#highlights-filter-tv"),h=i.get("#highlights-filter-radio"),g=function(){var j=$(this);if(!j.hasClass(d)){h.removeClass(d);j.addClass(d);c.css("display","block");b.css("display","none")}return false},f=function(){var j=$(this);if(!j.hasClass(d)){e.removeClass(d);j.addClass(d);c.css("display","none");b.css("display","block")}return false};events.addListener(e,"click",g);events.addListener(e,"keyup",function(j){if(j.key==="SPACE"||j.key==="ENTER"){g.call(this)}});events.addListener(h,"click",f);events.addListener(h,"keyup",function(j){if(j.key==="SPACE"||j.key==="ENTER"){f.call(this)}})}return{init:function(){c=$("#highlights-content-tv");if(!c.length){return}a();b=$("#highlights-content-radio");b.css("display","none")}}}();iplayer.pollnode.add("top-picks",function(){iplayer.widgets.highlights.init()});(function(){var a="yesterday",g="bbc_one",c="tv",d="tv";function e(){return(a=="today")?0:1}function f(){return(c=="tv")?0:1}function b(){return(d=="tv")?0:1}iplayer.sage.actiontrack.setActionList("homepage",[[/^(<img>)?<a href="[^"]+"><li id="([a-z-]+)"( class="selected")?><ul id="blq-local-nav"><div id="bip-header">/,function(h){var i=h[2];switch(i){case"bip-logo":i="iPlayer logo";tab=1;break;case"home":tab=2;break;case"tvchannels":i="tv channels";tab=3;break;case"radio":i="radio stations";tab=4;break;case"categories":tab=5;break;case"atoz":i="a to z";tab=6;break}return["Tab click - "+i,15,null,null,null,null,null,null,null,null,tab,null,"iPlayerHome"]}],[/^<img><a href=".+?(\/iplayer\/[^"]+)"><p class="banner">/,function(h){return["Banner",null,null,null,null,null,3,null,null,null,null,h[1],null]}],[/^<a id="highlights-filter-(tv|radio)"[^>]+><div class="controls">/,function(h){d=h[1];return["Highlights - "+d,1,null,b(),null,null,null,null,null,3,null,null,null]}],[/^<a id="control-prev" class="control".+?<div id="highlights-tv"/,function(){return["TV Highlights - Left",1,1,0,null,null,null,null,null,3,null,null,null]}],[/^<a id="control-next" class="control".+?<div id="highlights-tv"/,function(){return["TV Highlights - Right",1,2,0,null,null,null,null,null,3,null,null,null]}],[/^(<p>|<span class="ep-title">)?<div class="details pid_(.{8})[^"]*"><li class=".*?pos_(\d+)[^"]*">.+?<div id="highlights-tv"/,function(h){return["TV Highlights - Content",1,null,0,h[2],h[3]*1,3,null,null,3,null,null,null]}],[/^(<span class="se-title">)?<a.+?href=".+?\/episode\/(.{8})\/[^"]+">.+?<li class=".*?pos_(\d+)[^"]*">.+?<div id="highlights-tv"/,function(h){return["TV Highlights - Content",1,null,0,h[2],h[3]*1,0,null,null,3,null,null,null]}],[/^<a id="control-prev" class="control".+?<div id="highlights-radio"/,function(){return["Radio Highlights - Left",1,1,1,null,null,null,null,null,3,null,null,null]}],[/^<a id="control-next" class="control".+?<div id="highlights-radio"/,function(){return["Radio Highlights - Right",1,2,1,null,null,null,null,null,3,null,null,null]}],[/^(<p>|<span class="ep-title">)?<div class="details pid_(.{8})[^"]*"><li class=".*?pos_(\d+)[^"]*">.+?<div id="highlights-radio"/,function(h){return["Radio Highlights - Content",1,null,1,h[2],h[3]*1,3,null,null,3,null,null,null]}],[/^(<span class="se-title">)?<a.+?href=".+?\/episode\/(.{8})\/[^"]+">.+?<li class=".*?pos_(\d+)[^"]*">.+?<div id="highlights-radio"/,function(h){return["Radio Highlights - Content",1,null,1,h[2],h[3]*1,0,null,null,3,null,null,null]}],[/^<a id="filter-(today|yesterday)".+?<div class="controls">/,function(h){a=h[1];return["TV - "+a,4,null,0,null,null,null,e(),null,3,null,null,null]}],[/^<a class="channel-name[^"]*" href=".+?\/tv\/([^"]+)"><li class="channel">/,function(h){g=h[1];return["TV - "+g,4,null,0,null,null,null,e(),g,3,null,null,null]}],[/^(<span class=".+">)?<a href=".+?\/episode\/(.{8})\/[^"]+">.+?<li class="result[^"]*">.+?<li class="channel">/,function(h){return["TV - "+a+" : "+g,4,null,0,h[2],null,null,e(),g,3,null,null,null]}],[/^<a class="[^"]+" href=".+?\/tv\/([^"]+)"><li class="channel">/,function(h){return["TV - More",4,4,0,null,null,null,null,h[1],3,null,null,null]}],[/^<a id="lr_[^"]+"( class="end")? href=".+?\/radio\/#?([^"]+)"><li class="[^"]+"><ul class="live-radio">/,function(h){return["Radio - "+h[2],5,null,1,null,null,null,null,h[2],3,null,null,null]}],[/^(<p>|<span class="ep-title">)?<div class="details pid_(.{8})[^"]*">.+?<div id="nws-content"/,function(h){return["News - Content",7,null,null,h[2],null,3,null,null,3,null,null,null]}],[/^(<span class="se-title">)?<a class="[^"]+" href=".+?\/episode\/(.{8})\/[^"]+">.+?<div id="nws-content"/,function(h){return["News - Content",7,null,null,h[2],null,0,null,null,3,null,null,null]}],[/^<a href="[^"]+"><div id="nws-more-link">/,function(){return["News - More",7,4,null,null,null,null,null,null,3,null,null,null]}],[/^(<p>|<span class="ep-title">)?<div class="details pid_(.{8})[^"]*">.+?<div id="spo-content"/,function(h){return["Sport - Content",6,null,null,h[2],null,3,null,null,3,null,null,null]}],[/^(<span class="se-title">)?<a class="[^"]+" href=".+?\/episode\/(.{8})\/[^"]+">.+?<div id="spo-content"/,function(h){return["Sport - Content",6,null,null,h[2],null,0,null,null,3,null,null,null]}],[/^<a href="[^"]+"><div id="spo-more-link">/,function(){return["Sport - More",6,4,null,null,null,null,null,null,3,null,null,null]}],[/^<a id="filter-(tv|radio)"[^>]+><div class="controls">/,function(h){c=h[1];return["Most Popular - "+c,8,null,f(),null,null,null,null,null,3,null,null,null]}],[/^(<(span|img)[^>]*>)?<a href="[^"]+\/episode\/([^\/]+)\/[^"]+">.*?<li class="[^"]*pos_(\d+)[^"]*"><ol id="mp-content-tv"/,function(h){return["Most Popular - "+c,8,null,f(),h[3],h[4]*1,(h[2]==="img"?3:0),null,null,3,null,null,null]}],[/^<a id="lp-clear" class="button" href="[^"]+"><div class="controls">/,function(){return["Last Played - Clear",9,3,null,null,null,null,null,null,3,null,null,null]}],[/^<img><a class="image" href=".+?\/episode\/(.{8})\/[^"]+">.+?<div id="last-played-homepage"/,function(h){return["Last Played - Content",9,null,null,h[1],0,3,null,null,3,null,null,null]}],[/^<span class="(series|episode)"><a href=".+?\/episode\/(.{8})\/[^"]+">.+?<li class=".*?pos_(\d+)[^"]*">.+?<div id="last-played-homepage"/,function(h){return["Last Played - Content",9,null,null,h[2],h[3]*1,0,null,null,3,null,null,null]}]])})();