var _global_flash={};var JSON_Programme={};function ListenerProxy(a,c,b){this.type=a;this.callback=c;if(b==undefined){this.id="listenerProxy_"+a+"_"+guid()}else{this.id=b}}ListenerProxy.prototype.dispatchProxy=function(a){this.callback(a,this)};CustomEvent.prototype.type="";CustomEvent.prototype.id="";CustomEvent.prototype.value="";VideoEvent={};VideoEvent.PLAYHEAD_UPDATE="playheadUpdate";function swfReady(a){}function CustomEvent(){}function delegate(d,e){if(!e||!d){return}var c=[];for(var b=2;b<arguments.length;b++){c.push(arguments[b])}var a=function(){var f=[];for(var g=0;g<arguments.length;g++){f.push(arguments[g])}return e.apply(d,f.concat(c))};return a}function buildOpenChannel(a){if(swfobject.hasFlashPlayerVersion("9")){if(a.programme_id){a.cookie_val=getCookieTime(a.programme_id)}openChannelOne=new JavascriptAPI("openchannelcore",a,delegate(this,onCoreReady),null)}else{$("#openchannelcore").html('<div style="line-height:14px;margin:45px auto 0 auto; font-family:Verdana, Geneva, sans-serif; color:#000; background-color:#FFF; border:1px solid #000; width:85%; padding:10px;"><p style="font-size:10px;margin:0; padding:0;">We have detected that you are not seeing the video. Please <a style="color:#000;" href="http://www.multichanneltv.com/client_checks" target="_blank">click here</a> to to do a system check.</p><p style="margin:0; padding:0;">&nbsp;</p><p style="font-size:10px;margin:0; padding:0;">You might not currently have the correct version of Flash Player installed on your system.</p><p style="margin:0; padding:0;">&nbsp;</p><p style="font-size:10px;margin:0; padding:0;"><b>This site requires the use of Flash Player 9 or above.</strong></p><p style="margin:0; padding:0;">&nbsp;</p><p style="font-size:10px;margin:0; padding:0;">Flash Player is a widely used free product from Adobe, which will enhance your experience accross millions of websites. In order to view this programme you must install Flash Player.</p><p style="margin:0; padding:0;">&nbsp;</p><p style="font-size:10px;margin:0; padding:0;">To install Flash Player, click the image below and we will take you to the official download.</p><p style="margin:0; padding:0;">&nbsp;</p><p style="margin:0; padding:0;"><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p></div>')}}function JavascriptAPI(d,b,f,a){if(JavascriptAPI.instances==null){JavascriptAPI.instances=[]}JavascriptAPI.instances.push(this);this.cookie_name=b.programme_id?"mctv_"+b.programme_id:false;this.listenerProxies=[];this.id=this.guid();this._corePath="http://openchannel.multichanneltv.com/core/v3/OpenChannel.swf";this.JSON={};this.onReady=f;this.tracer=d+"_tracer";this.chapters={};this.current_intelligent_video=false;this.current_chapter=null;this.intelligent_videos={};if(!window._openchannelModules){window._openchannelModules={}}b.id=this.id;var e={menu:"false",scale:"noScale",allowFullscreen:"true",allowScriptAccess:"always",bgcolor:"#000000",wmode:"transparent",align:"TL",salign:"TL"};var c={id:d,name:d};window._openchannelModules["_openchannelModule_"+this.id]=this;swfobject.embedSWF(this._corePath,d,b.width,(b.show_controls==1?b.height+48:b.height),"9.0.0","expressInstall.swf",b,e,{},delegate(this,this.onEmbed))}JavascriptAPI.prototype.guid=function(){return String((this.S4()+this.S4()+"_"+this.S4()+"_"+this.S4()+"_"+this.S4()+"_"+this.S4()+this.S4()+this.S4())).toUpperCase()};JavascriptAPI.prototype.S4=function(){return(((1+Math.random())*65536)|0).toString(16).substring(1)};JavascriptAPI.prototype.onEmbed=function(a){this.swfmodule=a.ref};JavascriptAPI.prototype.callCoreMethod=function(){var b=arguments[0],c=[];for(var a=1;a<arguments.length;a++){c.push(arguments[a])}if(c.length>0){if(this.swfmodule[b]!=undefined){return this.swfmodule[b].apply(this.swfmodule,c)}else{return this.swfmodule.callCoreMethod.apply(this.swfmodule,arguments)}}else{if(this.swfmodule[b]!=undefined){return this.swfmodule[b]()}else{return this.swfmodule.callCoreMethod.apply(this.swfmodule,arguments)}}};JavascriptAPI.prototype.setJSON=function(a){this.JSON=a;this.setChapters();this.setIntelligentVideos()};JavascriptAPI.prototype.setChapters=function(){for(i in this.JSON.chapters){this.chapters[i]=this.JSON.chapters[i]}};JavascriptAPI.prototype.setIntelligentVideos=function(){for(i in this.JSON.intelligent_video){this.intelligent_videos[i]=this.JSON.intelligent_video[i]}};JavascriptAPI.prototype.init=function(){setTimeout(delegate(this,this.oninit),100)};JavascriptAPI.prototype.oninit=function(){if(this.onReady){this.onReady(this.id)}};JavascriptAPI.prototype.setCookie=function(c){if(c.playheadTime==null){return}if(!this.cookie_name){return}var b=new Date();b.setTime(b.getTime()+(21*24*60*60*1000));var a="; expires="+b.toGMTString();document.cookie=this.cookie_name+"="+Math.floor(c.playheadTime)+a+"; path=/"};JavascriptAPI.prototype.onChapterChange=function(b){if(b.playheadTime==null){return}for(var a in this.chapters){a=parseInt(a);if(Math.floor(b.playheadTime)>=Math.floor(this.chapters[a].start_point)){if(this.chapters[a+1]){if(Math.floor(b.playheadTime)<Math.floor(this.chapters[a+1].start_point)){if(this.current_chapter!=a){this.current_chapter=a;this.callCoreMethod("doTracking","chapter_loaded",this.chapters[a].chapter_title);cChange(this.chapters[a])}break}}else{if(this.current_chapter!=a){this.current_chapter=a;cChange(this.chapters[a]);this.callCoreMethod("doTracking","chapter_loaded",this.chapters[a].chapter_title)}}}}};JavascriptAPI.prototype.addEventListener=function(d,c,f){for(var b=0;b<this.listenerProxies.length;b++){if(this.listenerProxies[b].callback==c&&this.listenerProxies[b].type==d){return null}}var a=this.swfmodule.addJSEventListener(d,f);var e=new ListenerProxy(d,c,a);this.listenerProxies.push(e);window[a]=c};JavascriptAPI.prototype.onIntelligentVideoChange=function(a){if(a==null){return}if(this.current_intelligent_video){if(Math.floor(a.playheadTime)>=Math.floor(this.intelligent_videos[this.current_intelligent_video].end_point)||Math.floor(a.playheadTime)<Math.floor(this.intelligent_videos[this.current_intelligent_video].start_point)){this.callCoreMethod("unloadIntelligentVideo");this.current_intelligent_video=false}}for(i in this.intelligent_videos){if(Math.floor(a.playheadTime)>=Math.floor(this.intelligent_videos[i].start_point)&&Math.floor(a.playheadTime)<Math.floor(this.intelligent_videos[i].end_point)){if(this.current_intelligent_video===i){continue}this.callCoreMethod("loadIntelligentVideo",this.intelligent_videos[i].swf,this.intelligent_videos[i].action);this.current_intelligent_video=i}}};function JSRestartVideo(){jsAPI.callCoreMethod("restartVideo")}function getCookieTime(f){var d="mctv_"+f+"=";var a=document.cookie.split(";");for(var b=0;b<a.length;b++){var g=a[b];while(g.charAt(0)==" "){g=g.substring(1,g.length)}if(g.indexOf(d)==0){var e=g.substring(d.length,g.length);return e}}return 0}function onCoreReady(b){openChannelOne.addEventListener(VideoEvent.PLAYHEAD_UPDATE,delegate(openChannelOne,openChannelOne.onChapterChange));openChannelOne.addEventListener(VideoEvent.PLAYHEAD_UPDATE,delegate(openChannelOne,openChannelOne.onIntelligentVideoChange));openChannelOne.addEventListener(VideoEvent.PLAYHEAD_UPDATE,delegate(openChannelOne,openChannelOne.setCookie));try{customCoreInit()}catch(a){}}function customTracker(a){openChannelOne.callCoreMethod("doTracking","custom_tracking",a)};