var g={stopDefault:function(a){if(window.event){window.event.returnValue=false}if(a&&a.preventDefault){a.preventDefault()}},addEvent:function(e,d,b,a){if(e.addEventListener){e.addEventListener(d,b,a);return true}else{if(e.attachEvent){var c=e.attachEvent("on"+d,b);return c}else{e["on"+d]=b}}}};positionAdsActive=0;$(document).ready(function(){$(".dynamic-tabswindow").css({visibility:"visible",position:"relative",top:"-16px",left:"0px"});if($("#popular-articles").length){popularSidebar()}if($("#popular-articles-double").length){popularSidebarDouble()}submitButton();buttons();carouselCreate();carouselNavigation();if($("#headline-articles").length>0){articleTracking.getBreadValues();articleTracking.setTabPosition()}if($("div#accordian").length>0){$("div#accordian> ul:gt(0)").hide()}if($("ul.tabme").length>0){$("ul.tabme").each(function(){$(this).tabs()})}$("table.zebra tbody").each(function(){$(this).find("tr:even").addClass("odd")});$("table.zebra tbody").each(function(){$(this).find("tr:odd").addClass("even")});$("table.zebra thead th:first-child").addClass("zebra-firstcol");$("table.zebra thead th:last-child").addClass("zebra-lastcol");$("table.zebra tbody th:first-child").addClass("zebra-firstcol");$("table.zebra tbody td:last-child").addClass("zebra-lastcol");$("table.zebra tbody td:first-child").addClass("zebra-firstcol");articleEmailForm.formVisibility();$(".article-display #headlines-wrapper").css({visibility:"visible",height:"auto"});TSinit();TSSetup();if($("#tvguide-carousel").length){tvGuideCarousel.setInitialPos()}$("tbody.twocol-split tr").each(function(){$(this).children("td:eq(1)").addClass("onecol-right");$(this).children("td:eq(2), td:eq(3)").addClass("twocol-left")});innerTabs.forceSwitch();$(".dynamic-tabs").tabs({show:function(a,b){if($("#popular-articles-double").length&&positionAdsActive==1){positionAds()}}});showHideTemp.createMinMax();weatherForm.populateGlobalValues();weatherForm.buildForm();$(".hover").hover(function(c){var b=$(this).attr("src");var a=b.replace(/(\.[^.]+)$/,".hover$1");$(this).attr("src",a)},function(c){var b=$(this).attr("src");var a=b.replace(/.hover(\.[^.]+)$/,"$1");$(this).attr("src",a)});captureLink();$('a[rel="external"]').append('<img src="http://files.stv.tv/img/misc/icon.new.window.png" class="popupicon" width="16" height="14" alt="Opens in new window" />').click(function(){window.open($(this).attr("href"));return false});searchHints.searchHint();searchHints.removeTipsOnSubmit();$("#commentstarrating").append('<ul id="commentstarrating-stars"></ul> <p id="yourrating">Your Rating: <span id="starrating-text">not set</span></p>');$("#commentstarrating-stars").ratings(5).bind("ratingchanged",function(a,b){$("#commentstarrating-text").text(b.rating)});mySTVSigninChoice()});function mySTVSigninChoice(){$(".fbopen > input:radio[@id=connectchoice]").eq(0).attr("checked","checked");$("#connectchoice input:radio[@id=connectchoice]").click(function(){if(this.id=="connectfb"){$(this).attr("checked","checked");$("#connectstv").attr("checked","");$("#connectfb-details").slideDown("slow").parent().addClass("shadebg");$("#connnectstv-details").slideUp("slow").parent().removeClass("fbopen");$("#connnectstv-details").slideUp("slow").parent().removeClass("shadebg")}else{if(this.id=="connectstv"){$(this).attr("checked","checked");$("#connectfb").attr("checked","");$("#connnectstv-details").slideDown("slow").parent().addClass("shadebg");$("#connectfb-details").slideUp("slow").parent().removeClass("fbopen");$("#connectfb-details").slideUp("slow").parent().removeClass("shadebg")}else{return false}}})}jQuery.fn.ratings=function(a,c){var b=this;return this.each(function(){if(!c){c=0}var l=this;var d=jQuery(this);var e=Array();l.rating=c;for(var k=0;k<a;k++){var h=document.createElement("li");var f=jQuery(h);h.rating=k+1;f.addClass("jquery-ratings-star");$(f).attr("id","star"+k);if(k<c){f.addClass("jquery-ratings-full")}d.append(f);e.push(f);f.click(function(){$("#ratingoptions option").removeAttr("selected");var q=$(this).attr("id");var o=q.indexOf("star");var n=q.substr(o+4);var p=parseInt(n);var m=$("#ratingoptions ."+p);$("#ratingoptions ."+p).attr("selected","selected");l.rating=this.rating;b.triggerHandler("ratingchanged",{rating:this.rating})});f.mouseenter(function(){for(var m=0;m<this.rating;m++){e[m].addClass("jquery-ratings-full")}for(var m=this.rating;m<a;m++){e[m].removeClass("jquery-ratings-full")}});d.mouseleave(function(){for(var m=0;m<l.rating;m++){e[m].addClass("jquery-ratings-full")}for(var m=l.rating;m<a;m++){e[m].removeClass("jquery-ratings-full")}})}})};var innerTabs={forceSwitch:function(){$("#vid-popular").tabs({select:function(b,c){var a=c.panel.id.substr(9);$("#all-popular div").addClass("ui-tabs-hide");$("#allpop-"+a).removeClass("ui-tabs-hide");$("#all-popular .nested-tabs li").removeClass("ui-state-active");$("#all-popular .nested-tabs li").removeClass("ui-tabs-selected");$("#all-popular .nested-tabs ."+a).addClass("ui-state-active ui-tabs-selected")},show:function(a,b){if(positionAdsActive==1){positionAds()}}});$("#all-popular").tabs({select:function(b,c){var a=c.panel.id.substr(7);$("#vid-popular div").addClass("ui-tabs-hide");$("#videopop-"+a).removeClass("ui-tabs-hide");$("#vid-popular .nested-tabs li").removeClass("ui-state-active");$("#vid-popular .nested-tabs li").removeClass("ui-tabs-selected");$("#vid-popular .nested-tabs ."+a).addClass("ui-state-active ui-tabs-selected")},show:function(a,b){if(positionAdsActive==1){positionAds()}}})}};function captureLink(){var b=window.location;function a(c){return c.split(" ").join("")}$("#inarticle-related").click(function(h){var c=$(h.target);if(c.is("a")){var d=$(h.target).attr("href");var f=a($(h.target).text());pageTracker._trackEvent("RelatedItems-InArticle",d,b.toString());AggpageTracker._trackEvent("RelatedItems-InArticle",d,b.toString())}});$("#nav-global").click(function(h){var c=$(h.target);if(c.is("a")){var d=$(h.target).attr("href");var f=a($(h.target).text());pageTracker._trackEvent("Home-Main-Navigation",f,b.toString());AggpageTracker._trackEvent("Home-Main-Navigation",f,b.toString())}});$("#nav-global-common").click(function(h){var c=$(h.target);if(c.is("a")){var d=$(h.target).attr("href");var f=a($(h.target).text());pageTracker._trackEvent("Home-Common-Navigation",f,b.toString());AggpageTracker._trackEvent("Home-Common-Navigation",f,b.toString())}});$("#global-logo").click(function(d){var c="Home";pageTracker._trackEvent("Logo",c,b.toString());AggpageTracker._trackEvent("Logo",c,b.toString())});$("#lineupswitch-wrapper").click(function(f){var c=$(f.target);if(c.is("a")){var d=$(f.target).attr("href")}if(c.is("img")){var d=$(f.target).parent().attr("href")}if(c.is("p")){var d=$(f.target).prev().prev().attr("href")}if(c.is("li")){var d=$(f.target).find("a").attr("href")}pageTracker._trackEvent("RelatedItems-rhs",d,b.toString());AggpageTracker._trackEvent("RelatedItems-rhs",d,b.toString())});$("#jobsearch-widget").click(function(d){var c=$(d.target);if(c.is("a")){if((c).attr("id")=="jobstitle"){var f=$(d.target).attr("id")}else{var f=$(d.target).parent().attr("id")}}if(c.is("#jobsearchbutton")){var f=$(d.target).attr("id")}if(c.is("img")){var f=$(d.target).parent().attr("id")}pageTracker._trackEvent("jobsWidgetLinks",f,b.toString());AggpageTracker._trackEvent("jobsWidgetLinks",f,b.toString())});$("#article-navigation").click(function(f){var d=$(f.target);if(d.is("a")){var c=$(f.target).parent().attr("id")}pageTracker._trackEvent("nextprev-Bottom",c,b.toString());AggpageTracker._trackEvent("nextprev-Bottom",c,b.toString())});$("#nextarticle").click(function(d){var c=$(d.target);if(c.is("a")){var f=$(d.target).parent().attr("id")}pageTracker._trackEvent("nextprev-Top",f,b.toString());AggpageTracker._trackEvent("nextprev-Top",f,b.toString())});$("#jobs-sidepanel").click(function(f){var c=$(f.target);if(c.is("a")){if((c).attr("id")=="jobstitle-side"){var d=$(f.target).attr("id")}else{var d=$(f.target).attr("href")}}if(c.is("img")){var d=$(f.target).parent().attr("href")}pageTracker._trackEvent("side-jobspanel",d,b.toString());AggpageTracker._trackEvent("side-jobspanel",d,b.toString())});$("#jobs-centralpanel").click(function(f){var c=$(f.target);if(c.is("a")){if((c).attr("id")=="jobstitle-central"){var d=$(f.target).attr("id")}else{var d=$(f.target).attr("href")}}if(c.is("img")){var d=$(f.target).parent().attr("href")}pageTracker._trackEvent("central-jobspanel",d,b.toString());AggpageTracker._trackEvent("central-jobspanel",d,b.toString())});$("#lineup-widgettabs").click(function(d){var c=$(d.target);if(c.is("a")||c.is("img")){var f=$("#lineup-widgettabs .nav-tabs").eq(0).find(".ui-state-active").find("a").eq(0).attr("href")}else{return false}pageTracker._trackEvent("Video-eds-pop-catchup",f,b.toString());AggpageTracker._trackEvent("Video-eds-pop-catchup",f,b.toString())});$("#popular-articles").click(function(d){var c=$(d.target);if(c.is("a")){var f=$("#popular-articles .nav-tabs").eq(0).find(".ui-state-active").find("a").eq(0).attr("href")}else{return false}pageTracker._trackEvent("Popular-now-48-7-all",f,b.toString());AggpageTracker._trackEvent("Popular-now-48-7-all",f,b.toString())});$("#popular-articles-double").click(function(k){var c=$(k.target);if(c.is("a")||c.is("img")){var h=$("#popular-articles-double .nav-tabs").eq(0).find(".ui-state-active").find("a").eq(0).attr("href");var f=$("#popular-articles-double .nested-tabs").eq(0).find(".ui-state-active").find("a").eq(0).attr("href");var d=h+"-"+f}else{return false}pageTracker._trackEvent("PopularDouble-now-48-7-all",d,b.toString());AggpageTracker._trackEvent("PopularDouble-now-48-7-all",d,b.toString())});$("#toppuff-carousel-wrapper, #puffs-skyscraper, #puff-carousel-wrapper, #widepuffs").click(function(d){var c=$(d.target);if(c.is("a")||c.is("img")||c.is("span")||c.is("strong")){var f=this.id}else{return false}pageTracker._trackEvent("puffs",f,b.toString());AggpageTracker._trackEvent("puffs",f,b.toString())});$("#articles-latest").click(function(d){var c=$(d.target);if(c.is("a")){var f=this.id}else{return false}pageTracker._trackEvent("latestArticles",f,b.toString());AggpageTracker._trackEvent("latestArticles",f,b.toString())})}var searchHints={searchHint:function(){$(".hint").each(function(){var b=this.value;var a=$(this).attr("id");var c=$("label[for='"+a+"']").eq(0).find(".searchhint").text();if(!b){$(this).addClass("hashint");$(this).attr("value",c)}if(b===c){$(this).addClass("hashint")}});$("form label span.searchhint").each(function(){var b=$(this).text();var a=$(this).parent().attr("for");var c=$("#"+a);$(c).click(function(){if($(this).hasClass("hashint")){this.value=""}$(this).removeClass("hashint")});$(c).blur(function(){var d=this.value;if(!d){$(this).attr("value",b);$(this).addClass("hashint")}})})},removeTipsOnSubmit:function(){$("#jobssearch-button").click(function(a){$(".hashint").each(function(){var d=$(this).attr("value");var b=$(this).attr("id");if(b=="jobskeywords"){var c=$("#jobskeywordslabel").find(".searchhint").eq(0).text()}if(d===c){$(this).attr("value","")}})})}};var showMore={itemsPerSet:5,jsondata:"",indexNumber:0,internalIndex:0,getFirstSet:"",loadFIle:function(){if($("#lineupswitch").length){if(relatedJson==undefined){return false}showMore.jsondata=relatedJson;showMore.getFirstSet=$("#lineupswitch li")}},buttonListener:function(){$("#backmore-buttons").find(".showmore-next a").click(function(a){a.preventDefault();if($(this).hasClass("disabled")){return false}else{showMore.nextSet()}});$("#backmore-buttons").find(".showmore-prev a").click(function(a){a.preventDefault();if($(this).hasClass("disabled")){return false}else{showMore.prevSet()}})},nextSet:function(){var d=showMore.jsondata;$("#lineupswitch li").hide();$(".showmore-prev a").removeClass("disabled");for(var c=showMore.indexNumber;c<d.items.length;c++){if(!d.items[c+1]){$(".showmore-next a").addClass("disabled");var a=d.items.length%5;if(a!=0){var e=showMore.itemsPerSet-a;showMore.indexNumber=d.items.length+e}}if((showMore.internalIndex%5)==4){var b="lastlineup"}else{var b=""}if((showMore.internalIndex%2)==0){if(d.items[c].thumbimg!=undefined){$('<li class="even '+b+'"><a href="'+d.items[c].href+'" class="lineup-thumb default-container"><img src="'+d.items[c].thumbimg+'" /></a><h3><a href="'+d.items[c].href+'">'+d.items[c].titletext+"</a></h3><p>"+d.items[c].paratext+"</p></li>").appendTo("#lineupswitch")}else{$('<li class="even '+b+'"><a href="'+d.items[c].href+'" class="lineup-thumb default-container"><span class="hide">'+d.items[c].titletext+'</span></a><h3><a href="'+d.items[c].href+'">'+d.items[c].titletext+"</a></h3><p>"+d.items[c].paratext+"</p></li>").appendTo("#lineupswitch")}showMore.internalIndex=showMore.internalIndex+1;showMore.unequalCount=false}else{if(d.items[c].thumbimg!=undefined){$('<li class="odd '+b+'"><a href="'+d.items[c].href+'" class="lineup-thumb default-container"><img src="'+d.items[c].thumbimg+'" /></a><h3><a href="'+d.items[c].href+'">'+d.items[c].titletext+"</a></h3><p>"+d.items[c].paratext+"</p></li>").appendTo("#lineupswitch")}else{$('<li class="odd '+b+'"><a href="'+d.items[c].href+'" class="lineup-thumb default-container"><span class="hide">'+d.items[c].titletext+'</span></a><h3><a href="'+d.items[c].href+'">'+d.items[c].titletext+"</a></h3><p>"+d.items[c].paratext+"</p></li>").appendTo("#lineupswitch")}showMore.internalIndex=showMore.internalIndex+1}if(c==showMore.indexNumber+(showMore.itemsPerSet-1)){showMore.indexNumber=showMore.indexNumber+showMore.itemsPerSet;showMore.internalIndex=0;$(".lineup-widget ul li h3 a").bigTarget();if(showMore.indexNumber===d.items.length){$(".showmore-next a").addClass("disabled")}return false}}},prevSet:function(){var d=showMore.jsondata;$("#lineupswitch li").hide();$(".showmore-next a").removeClass("disabled");var a=showMore.indexNumber-(showMore.itemsPerSet*2);for(var c=a;c<d.items.length;c++){if(showMore.indexNumber<=showMore.itemsPerSet){$(showMore.getFirstSet).show();showMore.indexNumber=0;$(".showmore-prev a").addClass("disabled")}else{if((showMore.internalIndex%5)==4){var b="lastlineup"}else{var b=""}if((showMore.internalIndex%2)==0){if(d.items[c].thumbimg==undefined){$('<li class="even '+b+'"><a href="'+d.items[c].href+'" class="lineup-thumb"><img src="'+d.items[c].thumbimg+'" /></a><h3><a href="'+d.items[c].href+'">'+d.items[c].titletext+"</a></h3><p>"+d.items[c].paratext+"</p></li>").appendTo("#lineupswitch")}else{$('<li class="even '+b+'"><a href="'+d.items[c].href+'" class="lineup-thumb default-container"><span class="hide">'+d.items[c].titletext+'</span></a><h3><a href="'+d.items[c].href+'">'+d.items[c].titletext+"</a></h3><p>"+d.items[c].paratext+"</p></li>").appendTo("#lineupswitch")}showMore.internalIndex=showMore.internalIndex+1}else{if(d.items[c].thumbimg==undefined){$('<li class="odd '+b+'"><a href="'+d.items[c].href+'" class="lineup-thumb"><img src="'+d.items[c].thumbimg+'" /></a><h3><a href="'+d.items[c].href+'">'+d.items[c].titletext+"</a></h3><p>"+d.items[c].paratext+"</p></li>").appendTo("#lineupswitch")}else{$('<li class="odd '+b+'"><a href="'+d.items[c].href+'" class="lineup-thumb default-container"><span class="hide">'+d.items[c].titletext+'</span></a><h3><a href="'+d.items[c].href+'">'+d.items[c].titletext+"</a></h3><p>"+d.items[c].paratext+"</p></li>").appendTo("#lineupswitch")}showMore.internalIndex=showMore.internalIndex+1}if(c==showMore.indexNumber-(showMore.itemsPerSet+1)){showMore.indexNumber=showMore.indexNumber-showMore.itemsPerSet;showMore.internalIndex=0;$(".lineup-widget ul li h3 a").bigTarget();return false}}}}};function popularSidebarDouble(){$("#popular-articles-double .dynamic-tabswindow .inner-window").css({visibility:"visible",position:"relative",top:"0px",left:"0px"});var b=$("#popular-articles-double h2").eq(0).outerHeight();var f=$("#popular-articles-double .nav-tabs").eq(0).outerHeight();var e=$("#popular-articles-double .nested-tabs").eq(0).outerHeight();var d=(b+f+e);var a=0;$("#popular-articles-double .inner-window").each(function(){var h=$(this).outerHeight();if(h>a){a=h}});var c=d+(a)}function popularSidebar(){$(".dynamic-tabswindow").css({visibility:"visible",position:"relative",top:"-16px",left:"0px"});var b=$("#popular-articles h2").eq(0).outerHeight();var e=$("#popular-articles .nav-tabs").eq(0).outerHeight();var d=(b+e)-6;var a=0;$("#popular-articles div").each(function(){var f=$(this).outerHeight();if(f>a){a=f}});var c=d+(a);$("#popular-articles").css({height:c})}var commenting={swearArray:"",insertErrorDivs:function(){if($("#commenting-errors").length<1){$("#comment-form, #comment-form-nonick").before('<div id="commenting-errors" class="formerrors"></div>')}if($("#offensivcommenting-errors").length<1){$("#offensive-form").before('<div id="offensivcommenting-errors" class="formerrors clearing"></div>')}},commentSubmit:function(){$("#comment-form").RSV({displayType:"display-html",errorTargetElementId:"commenting-errors",errorFieldClass:"errorfield",errorTextIntro:"<span>Whoops</span>Some of the details you entered need corrected:",rules:["required,commentsay,You have not entered any comment","length<2001,commentsay,Your comment must be no longer than 2000 characters"]})},commentSubmitNonick:function(){$("#comment-form-nonick").RSV({displayType:"display-html",errorTargetElementId:"commenting-errors",errorFieldClass:"errorfield",errorTextIntro:"<span>Whoops</span>Some of the details you entered need corrected:",rules:["required,nickname,You need a nickname to comment","required,commentsay,You have not entered any comment","length<2001,commentsay,Your comment must be no longer than 2000 characters"]})},offensiveCommentSubmit:function(){$("#offensive-form").RSV({displayType:"display-html",errorTargetElementId:"offensivcommenting-errors",errorFieldClass:"errorfield",errorTextIntro:"<span>Whoops</span>Some of the details you entered need corrected:",rules:["required,offensive-email,Enter your email address","valid_email,offensive-email,Enter a valid email address for the recipitent","required,offensive-why,You need to choose why this comment is inappropriate","required,offensive-text,You have not entered any comment","length<255,offensive-text,Your message must be no longer than 255 characters"]})},loadFIle:function(){if($("#comment-form, #comment-form-nonick").length){if(swearwords==undefined){return false}commenting.swearArray=swearwords}},commentForm:function(){$("#comment-form, #comment-form-nonick").submit(function(b){var c=false;var a=$("#commentsay").val();$(commenting.swearArray).each(function(d){var f=$.trim(commenting.swearArray[d]).toLowerCase();var e=new RegExp("\\b"+RegExp.escape(f)+"\\b","gi");if(f.length&&a.match(e)){c=true}});if(c==false){return true}else{b.preventDefault();commenting.errorDisplay(a);return false}})},errorDisplay:function(a){$(commenting.swearArray).each(function(b){var d=$.trim(this).toLowerCase();var c=new RegExp("\\b"+RegExp.escape(d)+"\\b","gi");if((a.match(c))&&($("#commenting-errors h2:first-child").length==0)){$("#commenting-errors").css({display:"block"}).append('<h2><span>Whoops</span>We need you to fix a few words in your post before we can show your comment</h2><ul id="email-errorlist"><li>The term "<span id="swearword">'+d+' </span>" is not allowed, please replace this with a more appropriate word</li></ul>');return false}if((a.match(c))&&($("#commenting-errors h2:first-child").length>0)){$("#commenting-errors").css({display:"block"}).html('<h2><span>Whoops</span>We need you to fix a few words in your post before we can show your comment</h2><ul id="email-errorlist"><li>The term "<span id="swearword">'+d+' </span>" is not allowed, please replace this with a more appropriate word</li></ul>');return false}})},addLastCommentClass:function(){$(".comment-text p:last").addClass("lastitem")}};var showHideTemp={createMinMax:function(){$("#max-header").html('<dl class="cent-far"><dt>Max </dt><dd class="currenttemp">(<a id="max-cent-switch" href="#">C<span class="hide">elcius</span></a>, </dd><dd><a id="max-far-switch" href="#">F<span class="hide">ahrenheit</span></a>)</dd></dl>');$("#min-header").html('<dl class="cent-far"><dt>Min </dt><dd class="currenttemp">(<a id="min-cent-switch" href="#">C<span class="hide">entigrade</span></a>, </dd><dd><a id="min-far-switch" href="#">F<span class="hide">ahrenheit</span></a>)</dd></dl>')},tempToggle:function(){$("#max-cent-switch").click(function(a){$(this).parent().next().removeClass("currenttemp");$(this).parent().addClass("currenttemp");$("#centfar td.maximum").each(function(){$(this).children(".cent").css({display:"block"});$(this).children(".far").css({display:"none"})});return false});$("#max-far-switch").click(function(a){$(this).parent().prev().removeClass("currenttemp");$(this).parent().addClass("currenttemp");$("#centfar td.maximum").each(function(){$(this).children(".far").css({display:"block"});$(this).children(".cent").css({display:"none"})});return false});$("#min-cent-switch").click(function(a){$(this).parent().next().removeClass("currenttemp");$(this).parent().addClass("currenttemp");$("#centfar td.minimum").each(function(){$(this).children(".cent").css({display:"block"});$(this).children(".far").css({display:"none"})});return false});$("#min-far-switch").click(function(a){$(this).parent().prev().removeClass("currenttemp");$(this).parent().addClass("currenttemp");$("#centfar td.minimum").each(function(){$(this).children(".far").css({display:"block"});$(this).children(".cent").css({display:"none"})});return false})}};var weatherForm={townNamesLinks:[],populateGlobalValues:function(){if($("#popular-topics-lists").length){weatherForm.townNamesLinks=$("#weather #popular-topics-lists .ul5:gt(0) li a")}else{weatherForm.townNamesLinks=$("#weather #weather-cities .ul5:gt(0) li a")}},buildForm:function(){$("#weather-cities").children().css({display:"none"});$("#weather-search-area").append('<div class="box" id="weather-search"><form action="" method="post" id="weather-form"><div class="row"><label id="forecast-label" for="forecast-search">Search location:</label><input type="text" id="forecast-search" autocomplete="off" /><div id="searchdrop"></div><input value="Go" name="forecast-go" id="forecast-go" type="image"  src="http://files.stv.tv/img/misc/button-go.gif" alt="Go"></div></form></div>')},keyHandling:function(){$("input#forecast-search").keyup(function(k){if($("#forecast-search").val().length===0){$("#searchdrop").html("")}if($("#forecast-search").val().length>1){var d=k.charCode?k.charCode:k.keyCode?k.keyCode:0;if(d!==40&&d!==38){var c=$(this).val();var a=[];for(var b=0;b<weatherForm.townNamesLinks.length;b++){var f=new RegExp("^"+c,"i");if(f.exec($(weatherForm.townNamesLinks[b]).text())){a.push($(weatherForm.townNamesLinks[b]).text())}}var h=$("<ul>");$(a).each(function(l,e){$(h).append("<li>"+e+"</li>")});if($(h).children().length>0){$("#searchdrop").html(h)}weatherForm.mouseHandling()}}})},weatherFormSubmit:function(){$("#weather-form").submit(function(a){var c="";a.preventDefault();var b=$("#forecast-search").val();$(weatherForm.townNamesLinks).each(function(){var d=$(this).text();if(d.toLowerCase()===b.toLowerCase()){c=this.href}});if(c){$("#searchdrop").html("").css({display:"none"});window.location=c}else{if($("#rsvErrors").length===0){$('<div id="rsvErrors" style="display:block"><ul id="email-errorlist"><li>We cannot find the location entered.</li></ul></div>').insertBefore("#weather-form");return false}}})},mouseHandling:function(){$("#searchdrop li").mouseover(function(){$("#searchdrop ul li").removeClass("focused");$(this).addClass("focused")});$("#searchdrop li").mouseout(function(){$(this).removeClass("focused")});$("#searchdrop").click(function(b){var d=b||window.event;var a=d.target||d.srcElement;var c=$(a).text();$("#searchdrop").html("");$(weatherForm.townNamesLinks).each(function(){if($(this).text()===c){$("#forecast-search").val(c);$("#searchdrop").html("");window.location=this.href}});return false})},shiftfocus:function(){$("#weather-search").keyup(function(h){var m=h.charCode?h.charCode:h.keyCode?h.keyCode:0;var b=$("#searchdrop ul li");var n=$("#searchdrop ul li.focused");var k=$(b).eq(0);var a=$(b).eq(b.length-1);var d=$("#forecast-search");if(m===40){if($(n).length==0){var l=$(b).eq(0);var f=$(l).text();$(l).addClass("focused");$(d).val(f)}else{if($(a).hasClass("focused")){$(a).removeClass("focused");$(k).addClass("focused");var f=$(k).text();$(d).val(f)}else{$(n).removeClass("focused").next().addClass("focused");var c=$(n).next();var f=$(c).text();$(d).val(f)}}}if(m===38){if($(n).length==0){var l=$(a);var f=$(l).text();$(l).addClass("focused");$(d).val(f)}else{if($(k).hasClass("focused")){$(k).removeClass("focused");$(a).addClass("focused");var f=$(a).text();$(d).val(f)}else{$(n).removeClass("focused").prev().addClass("focused");var c=$(n).prev();var f=$(c).text();$(d).val(f)}}}})},closeDropOnTab:function(){$("#forecast-go").focus(function(){$("#searchdrop").html("")})}};function submitButton(){$("form .formsubmit").each(function(){var a=this;var b=a.value;$(a).before('<div class="button-container fleft wbg"><a href="#">'+b+"</a></div>").remove()})}var articleEmailForm={formVisibility:function(){$("#emailbutton").attr("href","#TB_inline?height=400&width=375&inlineId=article-email-wrapper").click(function(a){$("#article-email").css({display:"block"})});$("#boookmarkbutton").attr("href","#TB_inline?height=250&width=200&inlineId=socialbookmarking").click(function(a){$("#socialbookmarking").css({display:"block"})});$("#shareicons ul").eq(0).append('<li class=""><a href="" onclick="window.print(); return false" id="printbutton"><span class="hide">Print</span></a></li>')},emailFormValidation:function(){if(!document.getElementById("article-email")){return false}$("#article-email").RSV({displayType:"display-html",errorTextIntro:"Please correct the following errors:",errorFieldClass:"errorfield",rules:["required,recipientemail,Enter an email address for the recipient","valid_email,recipientemail,Enter a valid email address for the recipient","required,youremail,Enter an email address for the sender","valid_email,youremail,Enter a valid email address for the sender","required,name,Enter your name","length<1001,message,The message must be no longer than 1000 characters"]})},submitEmailArticleForm:function(){if(!document.getElementById("article-email")){return false}$("#article-email div.js-button-container").click(function(a){a.preventDefault();$("#article-email").submit()})}};function accordiananimation(){$("div#accordian").addClass("accordian-active");$("div#accordian> h3").wrapInner("<a></a>");$("#accordian h3.firstlist a").addClass("open-state");$("div#accordian> h3").click(function(){var c=this.firstChild;if(c.className==="open-state"){$(c).removeClass("open-state")}else{$("div#accordian> h3 a").each(function(){$(this).removeClass("open-state")});$(c).addClass("open-state")}var b=$(this).next();var a=b.siblings("ul:visible");if(a.length){a.slideUp("normal",function(){b.slideToggle("normal");return false})}else{b.slideToggle("normal")}})}jQuery.fn.vjustify=function(){var a=0;this.each(function(){if(this.offsetHeight>a){a=this.offsetHeight}});this.each(function(){var b=a-10+"px";if($.browser.msie&&jQuery.browser.version<7){$(this).css("height",b)}else{$(this).css("min-height",b)}if(this.offsetHeight>a){var c=((a-10)/-(this.offsetHeight-a))+"px";if($.browser.msie){$(this).css("height",c)}else{$(this).css("min-height",c)}}})};(function(d){d.fn.jCarouselLite=function(e){e=d.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,pauseOnHover:true,speed:0,easing:null,vertical:false,circular:true,visible:2,start:0,scroll:2,beforeStart:null,afterEnd:null},e||{});return this.each(function(){var q=false,o=e.vertical?"top":"left",h=e.vertical?"height":"width";var f=d(this),s=d("ul",f),l=d("li",s),x=l.size(),w=e.visible;var z=false;if(e.circular){s.prepend(l.slice(x-w-1+1).clone()).append(l.slice(0,w).clone());e.start+=w}var u=d("li",s),r=u.size(),y=e.start;f.css("visibility","visible");u.css({overflow:"hidden","float":e.vertical?"none":"left"});s.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});f.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var n=e.vertical?a(u):c(u);var t=n*r;var p=n*w;s.css(h,t+"px").css(o,-(y*n));f.css(h,p+"px");u.mouseover(function(){z=true});u.mouseout(function(){z=false});if(e.btnPrev){d(e.btnPrev).click(function(){if(this.id==="headline-left"){return m(y-e.scroll,"headline-left")}else{return m(y-e.scroll)}})}d(e.btnPrev).mouseover(function(){z=true});d(e.btnPrev).mouseout(function(){z=false});if(e.btnNext){d(e.btnNext).click(function(){if(this.id==="headline-right"){return m(y+e.scroll,"headline-right")}else{return m(y+e.scroll)}})}d(e.btnNext).mouseover(function(){z=true});d(e.btnNext).mouseout(function(){z=false});if(e.btnGo){d.each(e.btnGo,function(v,A){d(A).click(function(){articleTracking.currentTab=this.className;return m(e.circular?e.visible+v:v,"jump")})})}if(e.mouseWheel&&f.mousewheel){f.mousewheel(function(v,A){return A>0?m(y-e.scroll):m(y+e.scroll)})}if(e.auto){setInterval(function(){if(e.pauseOnHover&&z){return}m(y+e.scroll,"auto")},e.auto+e.speed)}function k(){return u.slice(y).slice(0,w)}function m(A,v){if(d(v).attr("id")=="headline-right"){articleTracking.dirFlag=1}else{if(d(v).attr("id")=="headline-left"){articleTracking.dirFlag=0}}if(!q){if(e.beforeStart){e.beforeStart.call(this,k())}if(e.circular){if(A<=e.start-w-1){s.css(o,-((r-(w*2))*n)+"px");y=A==e.start-w-1?r-(w*2)-1:r-(w*2)-e.scroll}else{if(A>=r-w+1){s.css(o,-((w)*n)+"px");y=A==r-w+1?w+1:w+e.scroll}else{y=A}}}else{if(A<0||A>r-w){return}else{y=A}}q=true;s.animate(o=="left"?{left:-(y*n)}:{top:-(y*n)},e.speed,e.easing,function(){if(e.afterEnd){e.afterEnd.call(this,k())}if(v==="headline-left"||v==="headline-right"||v==="jump"||v==="auto"){articleTracking.moveHeadlline(v)}q=false});if(!e.circular){d(e.btnPrev+","+e.btnNext).removeClass("disabled");d((y-e.scroll<0&&e.btnPrev)||(y+e.scroll>r-w&&e.btnNext)||[]).addClass("disabled")}}return false}})};function b(e,f){return parseInt(d.css(e[0],f))||0}function c(e){return e[0].offsetWidth+b(e,"marginLeft")+b(e,"marginRight")}function a(e){return e[0].offsetHeight+b(e,"marginTop")+b(e,"marginBottom")}})(jQuery);function carouselNavigation(){$("#nip-carousel .carousel-window:first").jCarouselLite({btnNext:"#nip-carousel-right",btnPrev:"#nip-carousel-left",visible:3,scroll:3,circular:false});$("#picture-carousel .carousel-window:first").jCarouselLite({btnNext:"#picture-carousel-right",btnPrev:"#picture-carousel-left",visible:3,scroll:3,speed:1000,circular:false});$("#catchup-carousel .carousel-window:first").jCarouselLite({btnNext:"#catchup-carousel-right",btnPrev:"#catchup-carousel-left",visible:3,scroll:3,circular:false});$("#puff-carousel .carousel-window:first").jCarouselLite({btnNext:"#puff-carousel-right",btnPrev:"#puff-carousel-left",visible:4,scroll:4,speed:1000,circular:false});$("#toppuff-carousel .carousel-window:first").jCarouselLite({btnNext:"#toppuff-carousel-right",btnPrev:"#toppuff-carousel-left",visible:4,scroll:4,speed:1000,circular:false})}function headlineButtons(){if(($("#headlines-window").length>0)){$('<a href="#" id="headline-left">Previous headline summary</a><a href="#" id="headline-right">Next headline summary</a>').appendTo("#headlines-wrapper")}$('<a href="#" id="nip-left">News in pictures - Left</a><a href="#" id="nip-right">News in picutres - Right</a>').appendTo("#news-in-pictures")}function carouselCreate(){carouselButtons2(".carousel-3");carouselButtons2(".carousel-4");carouselIndicator2(".carousel-3");carouselIndicator2(".carousel-4")}function carouselButtons2(a){$(a).each(function(){var d=this;var h=this.id;var c=this.className;var f=c.replace("carousel-","");var b=new Array();b=f.split(" ");var e=parseInt(b[0]);if($("#"+h+" div ul > li").length>e){$('<div class="carousel-buttons clearing"><div id="'+h+'-butts" class="fleft"><a href="#" onClick="return false" id="'+h+'-left" class="carousel-navigation-left disabelleft">More from stv - Left</a><div id="'+h+'-indicator" class="indicator"></div><a href=#"" onClick="return false" id="'+h+'-right" class="carousel-navigation-right">More from stv - Right</a></div></div>').appendTo("#"+h)[0]}})}function carouselIndicator2(a){$(a).each(function(){var q=this;var c=this.id;var p=this.className;var n=p.replace("carousel-","");var d=new Array();d=n.split(" ");var m=parseInt(d[0]);var e=$("#"+c+" div ul > li").length;var e=parseInt(e);if(e>m){var f=e/m;var l=Math.round(f);$("div#"+c+"-indicator").append("<div class='carouseldot firstcarouseldot currentcarouseldot'></div>");for(var k=2;k<l;k++){$("div#"+c+"-indicator").append("<div class='carouseldot'></div>")}$("div#"+c+"-indicator").append("<div class='carouseldot lastcarouseldot'></div>");var r=$("#"+c+"-butts");var o=$(r).width();var h=$("#"+c).width()-o;var b=parseInt(h)/2;$(r).css({marginLeft:b,display:"inline"})}})}function slideIndicatorInfo(a){$(a).each(function(){var b=this.id;slideIndicator(b)})}function slideIndicator(a){if($("a#"+a+"-right")&&$("a#"+a+"-left")){var b=$("div #"+a+"-indicator div").length;var c=parseInt(b)-1;$("a#"+a+"-left").click(function(){var d=$("#"+a+"-indicator .currentcarouseldot")[0];if($(d).hasClass("firstcarouseldot")){return false}else{if($(d).hasClass("lastcarouseldot")){$("#"+a+"-indicator").next().removeClass("disabelright")}$(d).prev().addClass("currentcarouseldot");if($(d).prev().hasClass("firstcarouseldot")){$(this).addClass("disabelleft")}$(d).removeClass("currentcarouseldot")}});$("a#"+a+"-right").click(function(){var d=$("#"+a+"-indicator .currentcarouseldot")[0];if($(d).hasClass("lastcarouseldot")){return false}else{if($(d).hasClass("firstcarouseldot")){$("#"+a+"-indicator").prev().removeClass("disabelleft")}$(d).next().addClass("currentcarouseldot");if($(d).next().hasClass("lastcarouseldot")){$(this).addClass("disabelright")}$(d).removeClass("currentcarouseldot")}})}}var buildHeadlineTabs={category:[],uniqueCategories:[],groupSize:0,getBreadValues:function(){var a=$("#headline-articles > li");$(a).each(function(){var b=this.className;buildHeadlineTabs.category.push(b)})},getUnique:function(){b(buildHeadlineTabs.category);function b(c){temp=new Array();for(i=0;i<c.length;i++){if(!a(temp,c[i])){temp.length+=1;temp[temp.length-1]=c[i]}}return temp}function a(c,d){for(j=0;j<c.length;j++){if(c[j]==d){return true}}return false}buildHeadlineTabs.uniqueCategories=temp},createNavTabs:function(){var c=buildHeadlineTabs.category.length;var l=buildHeadlineTabs.uniqueCategories.length;var d=c/l;buildHeadlineTabs.groupSize=d;var b=1;var k=document.createElement("ul");k.setAttribute("id","headline-nav");k.className="clearing";for(var f=0;f<buildHeadlineTabs.uniqueCategories.length;f++){var m=document.createElement("li");m.setAttribute("id","head-"+buildHeadlineTabs.uniqueCategories[f]);m.className=b;m.innerHTML='<a href="#'+buildHeadlineTabs.uniqueCategories[f]+'"><span>'+buildHeadlineTabs.uniqueCategories[f]+"</span></a>";k.appendChild(m);b=b+buildHeadlineTabs.groupSize}$(k).appendTo("#headlines");var h=$(k).width();var e=950-h;var a=parseInt(e)/2;$(k).css({marginLeft:a+10,display:"inline"})},createCarouselButtons:function(){var a='<ul id="headline-nav" class="clearing">';$("ul#headline-articles li").each(function(f,h){a+='<li class="'+(f+1)+' js-button-container fleft gbut" id="head-'+buildHeadlineTabs.uniqueCategories[f]+'"><div class="emptybut"> </div><div class="button"><span><a href="#'+$(h).attr("class")+'">'+$(h).attr("class").replace(/-/g," ")+"</a></span></div></li>"});$("div#headlines").append(a);var d=$("ul#headline-nav");var c=$(d).width();var e=950-c;var b=parseInt(e)/2;$(d).css({marginLeft:b+10,display:"inline"})},carouselButtonHover:function(){$("#headline-nav .gbut").mouseover(function(){$(this).addClass("active-nav-hover")});$("#headline-nav .gbut").mouseout(function(){$(this).removeClass("active-nav-hover")})}};var articleTracking={currentlyDisplayed:1,category:[],uniqueCategories:[],currentTab:0,dirFlag:null,headlineButtons:function(){if(($("#headlines-window").length>0)){$('<a href="#" id="headline-left">Previous headline summary</a><a href="#" id="headline-right">Next headline summary</a>').appendTo("#headlines-wrapper")}},getBreadValues:function(){var b=$("#headline-articles > li");$(b).each(function(){var e=this.className;articleTracking.category.push(e)});var d=articleTracking.category[1];var c=d.indexOf("-");while(c!=-1){d=d.replace("-"," ");c=d.indexOf("-")}$("#current-section").text(d);var a=b.length-2;if($("#headlines-window").length>0){$('<p id="article-number">Article <span id="currentarticle">'+articleTracking.currentlyDisplayed+"</span> of "+a+"</p>").appendTo("#headlines")}},getUnique:function(){b(articleTracking.category);function b(c){temp=new Array();for(i=1;i<c.length;i++){if(!a(temp,c[i])){temp.length+=1;temp[temp.length-1]=c[i]}}return temp}function a(c,d){for(j=0;j<c.length;j++){if(c[j]==d){return true}}return false}articleTracking.uniqueCategories=temp},setTabPosition:function(){$("#headline-nav li:first-child").addClass("active-nav")},moveHeadlline:function(c){var f=articleTracking.category.length-2;var e=articleTracking.category[f];var k=articleTracking.category[0];var b=$("#currentarticle");var h=f-articleTracking.uniqueCategories.length;switch(c){case"auto":var b=$("#currentarticle");if(articleTracking.currentlyDisplayed===f){articleTracking.currentlyDisplayed=1;$(b).text(1)}else{articleTracking.currentlyDisplayed=articleTracking.currentlyDisplayed+1;$(b).text(articleTracking.currentlyDisplayed)}articleTracking.moveActiveButton();break;case"headline-right":if((articleTracking.category[articleTracking.currentlyDisplayed].indexOf(e)!==-1)&&(articleTracking.currentlyDisplayed===f)){$("#current-section a").text(articleTracking.category[1]);articleTracking.currentlyDisplayed=1;$(b).text(1)}else{$("#current-section a").text(articleTracking.category[articleTracking.currentlyDisplayed+1]);$(b).text(articleTracking.currentlyDisplayed+1);articleTracking.currentlyDisplayed=articleTracking.currentlyDisplayed+1}articleTracking.moveActiveButton();break;case"headline-left":if((articleTracking.category[articleTracking.currentlyDisplayed-1].indexOf(k)!==-1)&&(articleTracking.currentlyDisplayed===1)&&(articleTracking.currentlyDisplayed!==h)){$("#current-section a").text(articleTracking.category[f]);$(b).text(f);var a=$("#current-section a").text();articleTracking.currentlyDisplayed=f}else{$("#current-section a").text(articleTracking.category[articleTracking.currentlyDisplayed-1]);$(b).text(articleTracking.currentlyDisplayed-1);articleTracking.currentlyDisplayed=articleTracking.currentlyDisplayed-1}articleTracking.moveActiveButton();break;case"jump":var d=articleTracking.currentTab.match(/\d+\.?\d*/g);articleTracking.currentlyDisplayed=parseInt(d[0]);$("#currentarticle").text(d[0]);articleTracking.moveActiveButton();break;default:return false;break}},moveActiveButton:function(){var c=articleTracking.currentlyDisplayed;var d=articleTracking.category[c];var h=0;for(var b=0;b<buildHeadlineTabs.category.length;b++){if((buildHeadlineTabs.category[b]===d)&&(h===0)){var a=b;h=1}}h=0;var f=a+1;var e=articleTracking.category[f];articleTracking.tagActiveTab(e)},tagActiveTab:function(c){var b=$("#headline-nav .active-nav")[0];var d=c;var a=d.indexOf("-");while(a!=-1){d=d.replace("-"," ");a=d.indexOf("-")}$("#current-section").text(d);$(b).removeClass("active-nav");$("#head-"+c).addClass("active-nav")}};function buttons(){$(".button-container").addClass("js-button-container").removeClass("button-container").each(function(a){var b=this;if(b.firstChild.className!=="emptybut"){$(b).prepend("<div class='emptybut'></div>")}});$(".js-button-container > a").wrap("<div class='button'><span></span></div>")}var socialBookmarking={bookmark:function(){if(!document.getElementById("socialbookmarking")){return false}var d=$("#socialbookmarking a");for(var b=0;b<d.length;b++){var c=$("#article-headlines-content :header").text()||$("#gallery-title").text();var a=encodeURIComponent(c);d[b].onclick=function(){var f=this.href;var m=encodeURIComponent(location.href);switch(f){case"http://www.stumbleupon.com/":var l=f+"submit?url="+m+"&title="+a;break;case"http://www.facebook.com/sharer.php":var l=f+"?u="+m+"&="+a;break;case"http://www.google.com/bookmarks/":var l=f+"mark?op=edit&bkmk="+m+"&title="+a;break;case"http://technorati.com/":var l=f+"faves?add="+m+"&t="+a;break;case"http://twitter.com/":var k=$("#articleid").text();var e="http://stv.tv/a/"+k+"/";var l="http://twitter.com/home?status="+a+", "+e;break;case"http://www.furl.net/":var l=f+"storeIt.jsp?u="+m+"&t="+a;break;case"http://www.newsvine.com/_tools/seed":var l=f+"?u="+m+"&h="+a;break;default:var l=f+"?url="+m+"&title="+a;break}var h=this.href;window.open(l);g.stopDefault(h);return false}}}};function newWindowIcon(){$("a[@rel$='external']").append(" <img src='/assets/img/misc/icon-new-window.gif' alt='(link open in new browser window)'").click(function(){this.target="_blank"})}function operaCheck(){if(navigator.appVersion.indexOf("Win")==-1){if($.browser.opera){$("body").css({fontSize:"60%"})}}}function jsKitExtraStyles(){$(".js-kit-rating").css({width:"80px"});$("#now-playing .js-kit-rating div:first").css({width:"80px","float":"right"}).addClass("clearing")}function positionAds(){if($("#mpu").length){var e=$("#mpu").position();var b=e.top+10;$("#mpu-content").css({position:"absolute",top:b,right:"10px",display:"block"})}if($("#mpu2").length){var a=$("#mpu2").position();var d=a.top+10;$("#mpu-content2").css({position:"absolute",top:d,right:"10px",display:"block"})}if($("#skyscraper").length){var f=$("#skyscraper").position();var h=f.top;$("#innersky").css({position:"absolute",top:h,right:"10px",display:"block"})}if($("#google-adsense-mpusize").length){var c=$("#google-adsense-mpusize").position();var k=c.top;$("#adsense-content").css({position:"absolute",top:k,right:"34px",display:"block"})}}function TSinit(){var a=TextResizeDetector.addEventListener(onFontResize,null)}function onFontResize(b,a){positionAds()}function TSSetup(){TextResizeDetector.TARGET_ELEMENT_ID="font-size-detect";TextResizeDetector.USER_INIT_FUNC=TSinit}TextResizeDetector=function(){var c=null;var h=200;var b=null;var d=-1;var e=-1;var n=[];var k=function(){c=document.createElement("span");c.id="textResizeControl";c.innerHTML="&nbsp;";c.style.position="absolute";c.style.left="-9999px";var o=document.getElementById(TextResizeDetector.TARGET_ELEMENT_ID);if(o){o.insertBefore(c,o.firstChild)}e=d=TextResizeDetector.getSize()};function m(){window.clearInterval(b);b=null}function a(){if(!b){b=window.setInterval("TextResizeDetector.detect()",h)}}function l(){var p=TextResizeDetector.getSize();if(p!==d){for(var o=0;o<n.length;o++){aListnr=n[o];var q={iBase:e,iDelta:((d!=-1)?p-d+"px":"0px"),iSize:d=p};if(!aListnr.obj){aListnr.fn("textSizeChanged",[q])}else{aListnr.fn.apply(aListnr.obj,["textSizeChanged",[q]])}}}return d}var f=function(){if(!TextResizeDetector.onAvailableCount_i){TextResizeDetector.onAvailableCount_i=0}if(document.getElementById(TextResizeDetector.TARGET_ELEMENT_ID)){TextResizeDetector.init();if(TextResizeDetector.USER_INIT_FUNC){TextResizeDetector.USER_INIT_FUNC()}TextResizeDetector.onAvailableCount_i=null}else{if(TextResizeDetector.onAvailableCount_i<600){TextResizeDetector.onAvailableCount_i++;setTimeout(f,200)}}};setTimeout(f,500);return{init:function(){k();a()},addEventListener:function(p,q,o){n[n.length]={fn:p,obj:q};return e},detect:function(){return l()},getSize:function(){var o;return c.offsetHeight},stopDetector:function(){return m()},startDetector:function(){return a()}}}();TextResizeDetector.TARGET_ELEMENT_ID="doc";TextResizeDetector.USER_INIT_FUNC=null;var tvGuideCarousel={currentPosition:0,setInitialPos:function(){liveNow=$(".current-programme");var b=$(liveNow[0]).position();var c=b.left;var a=parseInt("-"+c);$("#tvguide-listings").css({left:a});tvGuideCarousel.currentPosition=a;$('<a href="" id="tvguide-prev" class="carousel-navigation-left">Previous</a><a href="" id="tvguide-next" class="carousel-navigation-right">Next</a>').appendTo("#tvguide-carousel")},guideCarousel:function(){$("a#tvguide-next").click(function(k){k.preventDefault();if($("a#tvguide-prev").is(".disabelleft")){$("a#tvguide-prev").removeClass("disabelleft")}var c=$(".current-programme")[0];if($(this).is(".disabelright")){return false}else{var h=$(c).outerWidth();var d=$(c).next().outerWidth();var b=tvGuideCarousel.currentPosition-h;$("#tvguide-listings").animate({left:b});$(c).next().addClass("current-programme");$(c).removeClass("current-programme");tvGuideCarousel.currentPosition=b;var a=0;$("#tvguide-listings li").each(function(){var e=$(this).outerWidth();a=e+a});var f=a-Math.abs(tvGuideCarousel.currentPosition);if(f<730){$(this).addClass("disabelright")}}return false});$("a#tvguide-prev").click(function(h){h.preventDefault();if($("a#tvguide-next").is(".disabelright")){$("a#tvguide-next").removeClass("disabelright")}var d=$(".current-programme")[0];if($(d).is("#firstguide")&&$(this).is(".disabelleft")){return false}else{var a=$(d).prev();var f=$(d).outerWidth();var b=$(d).prev().outerWidth();var c=tvGuideCarousel.currentPosition+b;$("#tvguide-listings").animate({left:c});$(d).prev().addClass("current-programme");$(d).removeClass("current-programme");tvGuideCarousel.currentPosition=c;if($(a).is("#firstguide")){$(this).addClass("disabelleft")}}return false})}};function popups(){$(".popup-voucher-small").click(function(b){b.preventDefault();var a=this.href;window.open(a,"mypop","height=550, width=660, status, resizable, scrollbars, toolbar");return false})}(function(b){b.fn.bigTarget=function(d){var e=b.extend({},b.fn.bigTarget.defaults,d);return this.each(function(){var h=b(this);var f=h.attr("href");var l=h.attr("title");var k=b.meta?b.extend({},e,h.data()):e;h.parents(k.clickZone).hover(function(){$h=b(this);$h.addClass(k.hoverClass);if(typeof k.title!="undefined"&&k.title===true&&l!=""){$h.attr("title",l)}},function(){$h.removeClass(k.hoverClass);if(typeof k.title!="undefined"&&k.title===true&&l!=""){$h.removeAttr("title")}}).click(function(){if(c()==""){if(h.is("[rel*=external]")){window.open(f);return false}else{window.location=f}}})})};function a(d){if(window.console&&window.console.log){window.console.log("bigTarget selection count: "+d.size())}}function c(){if(window.getSelection){return window.getSelection().toString()}else{if(document.getSelection){return document.getSelection()}else{if(document.selection){return document.selection.createRange().text}}}}b.fn.bigTarget.defaults={hoverClass:"hover",clickZone:"li:eq(0)",title:true}})(jQuery);$(window).load(function(){socialBookmarking.bookmark();accordiananimation();operaCheck();if($("#article-email").length){articleEmailForm.emailFormValidation();articleEmailForm.submitEmailArticleForm()}if($("#article-comments").length){commenting.insertErrorDivs();commenting.loadFIle();commenting.commentForm();commenting.offensiveCommentSubmit();commenting.commentSubmit();commenting.commentSubmitNonick();commenting.addLastCommentClass()}jsKitExtraStyles();positionAdsActive=1;positionAds();tvGuideCarousel.guideCarousel();slideIndicatorInfo(".carousel-3");slideIndicatorInfo(".carousel-4");operaCheck();popups();showHideTemp.tempToggle();weatherForm.keyHandling();weatherForm.weatherFormSubmit();weatherForm.shiftfocus();weatherForm.closeDropOnTab();showMore.loadFIle();showMore.buttonListener()});RegExp.escape=function(b){var a=new RegExp("[.*+?|()\\[\\]{}\\\\]","g");return b.replace(a,"\\$&")};