namespace("UPC.widgets");UPC.widgets.Search=Class.create({initialize:function(input){this.element=$(input);this.defaultText=this.element.value;Event.observe(this.element,"focus",this.focus.bindAsEventListener(this));var form=this.element.up();Event.observe(form,"submit",this.submit.bindAsEventListener(this))},focus:function(){this.element.addClassName("active");this.element.value=""},blur:function(){this.element.removeClassName("active");this.element.value=this.defaultText},submit:function(ev){if(this.element.value==""||this.element.value==this.defaultText){Event.stop(ev)}}});namespace("UPC.apps.epg.ShowController");UPC.apps.epg.ToolBoxController=function(){var targetElement;var channelsPopup;var programmesPopup;var toolboxSettings;var config={filterClassName:"filtered",noSelection:"WONoSelectionString",favouritesChannelValue:"favourite",selectorTemplate:new Template("li:not([class~=#{filter}]):not([class~=channel_info])"),selectProgrammeId:"programme-type",selectChannelId:"channels-type",updateContainerId:"wordPopupUpdateContainer",cookieName:"UPC.apps.epg.toolboxSettings",cookieExpiresDays:0,cookieDefaultValues:$A(["WONoSelectionString","WONoSelectionString"])};var menus=$A([config.selectProgrammeId,config.selectChannelId]);function initialize(element){targetElement=element;_loadToolboxSettings();var menuAOptIndex=_getIndexOfValue(config.selectProgrammeId,toolboxSettings[menus.indexOf(config.selectProgrammeId)]);programmesPopup=new UPC.widgets.WordPopup(config.selectProgrammeId,config.updateContainerId,{selectedIndex:menuAOptIndex},applyProgrammeFilter);var menuBOptIndex=_getIndexOfValue(config.selectChannelId,toolboxSettings[menus.indexOf(config.selectChannelId)]);channelsPopup=new UPC.widgets.WordPopup(config.selectChannelId,config.updateContainerId,{selectedIndex:menuBOptIndex},applyChannelFilter);targetElement.observe("epg:contentUpdated",_applyFilters);return this}function _getIndexOfValue(selectId,optionVal){var opt=$(selectId).select('option[value="'+optionVal+'"]')[0];return(opt)?opt.index:0}function _loadToolboxSettings(){toolboxSettings=UPC.util.Cookie.readJ(config.cookieName);if(null==toolboxSettings){toolboxSettings=config.cookieDefaultValues;UPC.util.Cookie.writeJ(config.cookieName,toolboxSettings,config.cookieExpiresDays)}}function _updateToolboxSettings(pos,value){toolboxSettings[pos]=value;UPC.util.Cookie.writeJ(config.cookieName,toolboxSettings,config.cookieExpiresDays)}function applyChannelFilter(filter){switch(filter.value){case config.favouritesChannelValue:if(!UPC.apps.epg.FavouritesController.isActive()){UPC.apps.epg.FavouritesController.toggle(filter)}break;case config.noSelection:if(UPC.apps.epg.FavouritesController.isActive()){UPC.apps.epg.FavouritesController.toggle(filter)}break;default:break}_updateToolboxSettings(menus.indexOf(config.selectChannelId),filter.value);_applyFilters()}function _applyFilters(){applyChannelGroupFilter(channelsPopup.selectEl.value);applyProgrammeFilter(programmesPopup.selectEl)}function applyChannelGroupFilter(group_id){var logTime=new Date().getTime();UPC.apps.epg.visibleChannelsCount=0;if(group_id!==config.noSelection){var channels=targetElement.getElementsByTagName("ol");var c;for(var i=0;i<channels.length;i++){c=channels[i];if(c.className.indexOf(group_id)>-1){c.style.display="block";UPC.apps.epg.visibleChannelsCount++}else{c.style.display="none"}}}else{UPC.apps.epg.visibleChannelsCount=targetElement.getElementsByTagName("ol").length}}function getElementsByPrgGenre(searchClass,node){var classElements=new Array();if(node==null){node=document}var els=node.getElementsByTagName("li");var elsLen=els.length;var pattern=new RegExp("(^|\\s)"+searchClass+"(\\s|$)");for(i=0,j=0;i<elsLen;i++){if(pattern.test(els[i].className)){classElements[j]=els[i];j++}}return classElements}function applyProgrammeFilter(filter){_resetFilter();if(filter.value!==config.noSelection){var channelFound=false;var channels=targetElement.getElementsByTagName("ol");var noneStyle="none";var c=null;var p=null;for(var i=0;i<channels.length;i++){c=channels[i];if(c.style.display!="none"){p=getElementsByPrgGenre(filter.value,c);if(p.length==0){c.style.display=noneStyle;UPC.apps.epg.visibleChannelsCount--}else{channelFound=true;var es=c.getElementsByTagName("li");for(var e=1;e<es.length;e++){var aP=es[e];if(aP.className.indexOf(filter.value)===-1){aP.className=aP.className+" "+config.filterClassName}}}}}if(!channelFound){applyChannelGroupFilter(channelsPopup.selectEl.value);UPC.util.Error.raise(UPC.util.Localization.getString("error.filter.no_results.msg"),UPC.util.Localization.getString("error.filter.no_results.title"));programmesPopup.setSelectedIndex(0)}else{}}_updateToolboxSettings(menus.indexOf(config.selectProgrammeId),filter.value);UPC.apps.epg.GridController.needsDisplay()}function _resetFilter(){if(channelsPopup.selectEl.value!=config.noSelection){var channels=document.getElementsByClassName(channelsPopup.selectEl.value)}else{var channels=document.getElementsByTagName("ol")}UPC.apps.epg.visibleChannelsCount=channels.length;var c;for(var i=0;i<channels.length;i++){channels[i].style.display="block"}var filteredEvents=getElementsByPrgGenre(config.filterClassName,null);var e;var pattern=new RegExp("(^|\\s+)"+config.filterClassName+"(\\s+|$)");for(var i=0;i<filteredEvents.length;i++){e=filteredEvents[i];e.className=e.className.replace(pattern,"")}}function getChannelsPopUp(){return channelsPopup}return{init:initialize,channelsPopup:getChannelsPopUp}}();namespace("UPC.apps.epg");UPC.apps.epg.TimeController=function(){Prototype.Browser.IE6=Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==6;Prototype.Browser.IE7=Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==7;Prototype.Browser.IE8=Prototype.Browser.IE&&!Prototype.Browser.IE6&&!Prototype.Browser.IE7;Prototype.Browser.IE8Compatibility=Prototype.Browser.IE&&(navigator.userAgent.indexOf("Trident")>-1);var day_localizer_keys=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];var month_localizer_keys=["january","february","march","april","may","june","july","august","september","october","november","december"];var currentTimeSlot=null;var timeControl=null;var ctiElement=null;var mainElement=null;var currentEvents=[];var ctiStarted=false;var _ctiOffset=null;var timelineInset=(Prototype.Browser.IE7||Prototype.Browser.IE6)?{left:25,top:1}:{left:25,top:0};var ctiCurrentStyle=null;var config={hours:3,primetimeStartHour:20,timeRibbonId:"timeline",timeControllerId:"timeController",hoursElementId:"hours",ctiElementId:"current-time-indicator",selectedClassName:"selected",selectedHoursSelector:"#timeController ul#hours li.selected",selectedDaySelector:"#timeController > li.selectedDay",hourUnitsSelector:"#timeController ul#hours li",dayLinksSelector:"#timeController a.date",dateTimeDisplayId:"currentTimeDisplayPlaceholder",timeSlotTemplate:new Template("#{day_abbr} #{date} #{month_abbr}"),hourMarkerSelector:".timeline",currentEventClassName:"current-event",isTodayClassName:"today",ctiInterval:60,ctiFirstMarketInset:30};function initialize(element){mainElement=$(element);if(mainElement==null){return false}timeControl=$(config.timeControllerId);if(timeControl==null){throw"UPC.apps.epg.TimeController: Time Controller element could not be found. Was expecting to find ul#timeController"}currentTimeSlot=new Date();currentTimeSlot.setDate(currentTimeSlot.getDate());currentTimeSlot.setMinutes(0);currentTimeSlot.setSeconds(0);currentTimeSlot.setMilliseconds(0);$$(config.hourUnitsSelector).each(function(element){element.observe("click",_handleTimeClick)});$$(config.dayLinksSelector).each(function(element){element.observe("click",_handleDateClick)});ctiElement=$(config.ctiElementId);mainElement.observe("epg:contentUpdated",updateDisplay);return this}function _selectPrimetime(){currentTimeSlot.setHours(config.primetimeStartHour);_selectCurrentHours()}function _selectNow(){currentTimeSlot=new Date();currentTimeSlot.setMinutes(0);currentTimeSlot.setSeconds(0);currentTimeSlot.setMilliseconds(0);_selectCurrentHours()}function _selectCurrentHours(){$$(config.selectedHoursSelector).invoke("toggleClassName","selected");var startHour=currentTimeSlot.getHours();var defaultHours=$$(config.hourUnitsSelector);var defaultHoursA=$A(defaultHours).slice(startHour,startHour+config.hours);defaultHoursA.invoke("toggleClassName","selected")}function _handleDateClick(event){var element=Event.element(event);var selectedDay=$$(config.selectedDaySelector).first();selectedDay.removeClassName("selectedDay");element.up().addClassName("selectedDay");element.up().insert($(config.hoursElementId));if(element.up().hasClassName(config.isTodayClassName)){_selectNow()}event.stop();_updateGridDate(element)}function _handleTimeClick(event){var element=Event.element(event);var times=$$(config.hourUnitsSelector);var timesA=$A(times);var hour=timesA.indexOf(element);if(currentTimeSlot.getHours()!=hour){hour=Math.min(25-config.hours,hour);var currentSelectedTimes=$$(config.selectedHoursSelector);currentSelectedTimes.invoke("toggleClassName","selected");var selectedTimes=timesA.slice(hour,hour+config.hours);selectedTimes.invoke("toggleClassName","selected");_updateGridTime(hour)}event.stop()}function getCurrentTimeSlot(){return currentTimeSlot}function _updateGridDate(element){var newDate=element.readAttribute("href").substring(1);newDate=newDate.split("-");currentTimeSlot.setDate(newDate[2].substring(0,newDate[2].length-1));currentTimeSlot.setYear(newDate[0]);var month=(newDate[1]-1);currentTimeSlot.setMonth(month);UPC.apps.epg.DataController.load(currentTimeSlot)}function _updateDate(){var endHour=currentTimeSlot.getHours()+3;endHour=(endHour>24)?endHour-24:endHour;endHour=(endHour<10)?"0"+endHour:endHour;var l=UPC.util.Localization;var locale=UPC.util.Configuration.getConfigValue("TimeController.locale");var timeSlotStringValues={day_abbr:l.getString("days.full."+day_localizer_keys[currentTimeSlot.getDay()]),date:currentTimeSlot.getDate(),month_abbr:l.getString("months.full."+month_localizer_keys[currentTimeSlot.getMonth()]),hour_start:currentTimeSlot.getHours(),hour_end:endHour};if(l.isLoaded(locale)){var time=config.timeSlotTemplate.evaluate(timeSlotStringValues);$(config.dateTimeDisplayId).innerHTML=time}else{setTimeout(_updateDate,0.25)}}function _updateGridTime(hour){currentTimeSlot.setHours(hour);UPC.apps.epg.DataController.load(currentTimeSlot)}function updateDisplay(){updateHourMarkers();setTimeout(UPC.apps.epg.TimeController.updateTimeIndicator,1);_updateDate()}function updateHourMarkers(){var ribbon=$(config.timeRibbonId);if(ribbon==null){return}var hourValue=currentTimeSlot.getHours();ribbon.select(".timeline-position").each(function(hr,idx){hr.innerHTML=(hourValue<10?"0"+hourValue:hourValue)+":00";hourValue++;if(hourValue==24){hourValue=0}}.bind(this))}function ctiCalculatedOffset(){if(_ctiOffset==null){var ctiWidth=ctiElement.getWidth()/2;var timeline=$("timeline");var timelineOrigin=timeline.cumulativeOffset();var leftOffset=timelineOrigin.left-ctiWidth;var topOffset=timelineOrigin.top+timeline.getHeight();_ctiOffset={top:topOffset,left:leftOffset}}return _ctiOffset}function updateTimeIndicator(newHeight){var ctiPos=0;var now=new Date();var ts=new Date();var currentClassName=config.currentEventClassName;ts.setTime(currentTimeSlot.getTime()+(3*3600000));if(now<currentTimeSlot||now>ts){ctiElement.hide();return}else{ctiElement.show()}var ctiTimeElapsed=((now-currentTimeSlot)/60000);var ctiMinutesResolution=5;var ctiShift=Math.floor(ctiTimeElapsed/ctiMinutesResolution*19);var ctiOffset=ctiCalculatedOffset();ctiCurrentStyle={left:ctiOffset.left+ctiShift+timelineInset.left,top:ctiOffset.top+timelineInset.top};var ctiStyle={left:ctiCurrentStyle.left+"px",top:ctiCurrentStyle.top+"px"};ctiElement.setStyle(ctiStyle);if(currentEvents.length>0){$A(currentEvents).invoke("removeClassName",currentClassName);currentEvents=[]}var hours=(now.getHours()<10)?"0"+now.getHours():now.getHours();var mins=(now.getMinutes()<10)?"0"+now.getMinutes():now.getMinutes();var timestamp=(hours+"."+mins)/1;var channels=mainElement.select("ol");var classAttrName=(Prototype.Browser.IE&&!Prototype.Browser.IE8&&!(Prototype.Browser.IE8&&Prototype.Browser.IE8Compatibility))?"className":"class";var channels=mainElement.getElementsByTagName("ol");var channelEvents;for(var i=0;i<channels.length;i++){channelEvents=channels[i].getElementsByTagName("li");var currentEvent=null;for(var x=1;x<channelEvents.length;x++){var event=channelEvents[x];var time=event.getElementsByTagName("span")[1];currentEventFound=false;if(time){time=time.innerHTML.split("-").inject([],function(array,el){array.push(el.replace(":",".")/1);return array});if((time&&time[0]<=timestamp&&(time[1]>timestamp||time[1]<time[0]))||(time[0]==time[1])){var currentClasses;var currentClasses=event.getAttribute(classAttrName);event.setAttribute(classAttrName,currentClasses+" "+currentClassName);currentEventFound=true;break}}if(currentEventFound){break}}}if(!ctiStarted){new PeriodicalExecuter(updateTimeIndicator.bind(this),config.ctiInterval);ctiStarted=true}}function resetHorizontalPositionAndHeight(height){var ctiOffset=ctiCalculatedOffset();_ctiOffset=null;var newCtiOffset=ctiCalculatedOffset();var leftMovePixels=ctiOffset.left-newCtiOffset.left;var ctiStyle={};if(height!=null){ctiStyle.height=height+"px"}if(ctiCurrentStyle!=null){ctiCurrentStyle.left=Math.round(ctiCurrentStyle.left-leftMovePixels);ctiStyle.left=ctiCurrentStyle.left+"px"}ctiElement.setStyle(ctiStyle)}return{init:initialize,getCurrentTimeSlot:getCurrentTimeSlot,updateTimeIndicator:updateTimeIndicator,resetPosition:resetHorizontalPositionAndHeight}}();namespace("UPC.apps.epg");UPC.apps.epg.GridController=function(){var gridElement=null;var locale=null;var filter=null;var data=null;var tooltip=null;var config=null;var favourites=null;var channelSelectContent=null;var viewHeight=null;var viewPortHeight=null;function initialize(element){gridElement=$(element);if(gridElement==null){throw"UPC.apps.epg.GridController: main element missing."}config=UPC.util.Configuration;locale=UPC.util.Localization.init(config.getConfigValue("GridController.locale"),{localeBasePath:new Template("/javascript/pc/src/apps/epg/locales/#{locale}.js")});UPC.apps.epg.FavouritesController.init(gridElement);UPC.apps.epg.ToolBoxController.init(gridElement);UPC.apps.epg.TimeController.init(gridElement);tooltip=UPC.widget.Tooltip.init(config);var scId=config.getConfigValue("GridController.slotContainerId");Event.observe(scId,"mouseover",_showTooltip);Event.observe(scId,"click",_handleClick);Event.observe(scId,"mousewheel",tooltip.hide);viewHeight=$("header").getHeight()+$("tvguide-breadcrumb").getHeight()+$("tvguide-toolbox").getHeight()+$("footer").getHeight();Event.observe(window,"resize",_resizeGrid);data=UPC.apps.epg.DataController.init($(config.getConfigValue("GridController.slotContainerId")));data.load();return this}function _showTooltip(e){var element=Event.element(e)||null;if(element==null||element.href==null){return}element=element.parentElement||element.parentNode;element=$(element);var ignoreClassNames=["channel_info","channel-logo","filtered","channel_meta","nodata"];var classNames=element.className.split(" ");var className=null;for(var i=0;i<classNames.length;i++){className=classNames[i];for(var ii=0;ii<ignoreClassNames.length;ii++){if(ignoreClassNames[ii]===className){return}}}var elPos=element.cumulativeOffset();var elWid=element.getWidth();var blockMiddle=elPos.left+(elWid/2);var top=elPos.top-element.cumulativeScrollOffset().top;tooltip.show(null,element.innerHTML,{top:top,left:blockMiddle},element);e.stop()}function _handleClick(e){var element=Event.element(e);if(element!=null&&element.className==="favicon"){var li=element.up("ol");if(UPC.apps.epg.FavouritesController.update(li)){li.addClassName("favourite")}else{li.removeClassName("favourite")}e.stop();return}}function _resizeGrid(){var newViewPortHeight=document.viewport.getDimensions().height-viewHeight;if(viewPortHeight!=newViewPortHeight){viewPortHeight=newViewPortHeight}_resizeChannels()}function _resizeChannels(){var shim=60;var channelHeight=44;var maxGridHeight=((UPC.apps.epg.visibleChannelsCount*channelHeight))||channelHeight;var gridHeight=Math.min(maxGridHeight,viewPortHeight-shim);gridHeight=Math.max(gridHeight,channelHeight);document.getElementById("slot-container").style.height=gridHeight+"px";UPC.apps.epg.TimeController.resetPosition(gridHeight);return gridHeight}function needsDisplay(){_resizeChannels();UPC.apps.epg.DataController.toggleLoader(false)}return{init:initialize,needsDisplay:needsDisplay,resizeGrid:_resizeGrid}}();UPC.apps.epg.ListController=function(){var listElement=null;function initialize(element){listElement=$(element);if(listElement==null){throw"UPC.apps.epg.ListController: main element could not be found."}UPC.apps.epg.FavouritesController.init(listElement);UPC.apps.epg.FavouritesController.displayFavourites();listElement.observe("click",_handleClick)}function _handleClick(e){var element=e.findElement("a")||null;if(element!=null){if(element.match("a.favicon")){var smiley=element.up();if(UPC.apps.epg.FavouritesController.update(smiley)){smiley.addClassName("favourite")}else{smiley.removeClassName("favourite")}e.stop();return}}}return{init:initialize}}();UPC.apps.epg.DataController=function(){var cache={keys:$A([]),data:$A([])};var loading=$A([]);var gridElement=null;var config=UPC.util.Configuration;var busy=false;function initialize(element){gridElement=$(element);if(gridElement==null){throw"UPC.apps.epg.DataController: Grid element could not be found."}gridElement.observe("epg:contentUpdated",preloadData);return this}function loadData(datetime){toggleLoader(true);if(typeof(datetime)=="undefined"){datetime=UPC.apps.epg.TimeController.getCurrentTimeSlot()}var url=config.getConfigValue("DataController.dataUrlTpl").evaluate({datetime:datetime.toJSON().gsub(/"/,"")});if(getDataFromCache(datetime)!=null){displayData()}else{new Ajax.Request(url,{method:"get",onSuccess:cacheData.bind(this,datetime),onFailure:raiseException})}}function cacheData(datetime,transport){var data={};var tc=UPC.apps.epg.TimeController;data.timeslot=datetime.getTime();data.content=transport.responseText;if(cache.length>=config.getConfigValue("DataController.maxCacheSize")){cache.shift()}cache.keys.push(data.timeslot);cache.data[data.timeslot]=data;if(datetime.getTime()==tc.getCurrentTimeSlot().getTime()){displayData(datetime)}if(cache.keys.length==1){UPC.apps.epg.GridController.resizeGrid()}}function preloadData(e){var datetime=e.memo.datetime;for(var idx=1;idx<=config.getConfigValue("DataController.preloadCount");idx++){var ts=new Date(datetime.getFullYear(),datetime.getMonth(),datetime.getDate(),datetime.getHours(),0,0);ts.setHours(ts.getHours()+(3*idx));var ajaxOptions={method:"get",onSuccess:cacheData.bind(this,ts),onFailure:function(){}};if(getDataFromCache(ts)==null&&!loading.include(ts.getTime())){loading.push(ts.getTime());var url=config.getConfigValue("DataController.dataUrlTpl").evaluate({datetime:ts.toJSON().gsub(/"/,"")});new Ajax.Request(url,ajaxOptions)}}}function displayData(datetime){if(typeof(datetime)=="undefined"){datetime=UPC.apps.epg.TimeController.getCurrentTimeSlot()}var data=getDataFromCache(datetime);gridElement.update(data.content);UPC.apps.epg.FavouritesController.displayFavourites();gridElement.fire("epg:contentUpdated",{datetime:datetime})}function loadEvent(element,ev){if(!element.hasClassName("nodata")&&!element.hasClassName("filtered")){var id=element.id.substring(3,element.id.length);var url=UPC.util.Configuration.getConfigValue("DataController.eventInfoUrl")+id+"/";new UPC.widget.modalWindow.Balloon(url,{useAJAX:true,destroyOnClose:true,width:300,height:"auto",id:"event-details",className:"event-details"},ev)}}function getDataFromCache(datetime){if(cache.keys.include(datetime.getTime())){return cache.data[datetime.getTime()]}return null}function raiseException(msg){toggleLoading(false);UPC.util.Error.raise(UPC.util.Localization.getString("error.data.not_loaded.msg"),UPC.util.Localization.getString("error.data.not_loaded.title"));return false}function toggleLoader(show){if(cache.keys.length>0&&show!=busy){var loaderElementId=UPC.util.Configuration.getConfigValue("DataController.busyElementId");if(loaderElementId!=null){if(show){busy=true;document.body.style.cursor="wait";$(loaderElementId).addClassName(UPC.util.Configuration.getConfigValue("DataController.busyClassName"))}else{window.setTimeout(function(){busy=false;document.body.style.cursor="default";$(loaderElementId).removeClassName(UPC.util.Configuration.getConfigValue("DataController.busyClassName"))},0)}}}}return{init:initialize,load:loadData,display:displayData,loadEvent:loadEvent,toggleLoader:toggleLoader}}();UPC.apps.epg.FavouritesController=function(){var cookieExpires=new Date();cookieExpires.setYear(cookieExpires.getFullYear()+1);var cookieParams={name:"UPC.apps.epg.userFavourites",expires:cookieExpires,path:"/",domain:""};var favourites=$A([]);var showFavourites=false;function initialize(element){loadFavourites();return this}function saveFavourites(){var cookie=cookieParams.name+"="+escape(favourites.toJSON())+";expires="+cookieParams.expires.toGMTString()+";"+(cookieParams.path!=""?"path="+cookieParams.path+";":"")+(cookieParams.domain!=""?"domain="+cookieParams.domain+";":"");document.cookie=cookie}function loadFavourites(){var search=cookieParams.name+"=";var offset=-1;var end=-1;if(document.cookie.length>0){if((offset=document.cookie.indexOf(search))!=-1){offset+=search.length;end=document.cookie.indexOf(";",offset)!=-1?document.cookie.indexOf(";",offset):document.cookie.length;var value=unescape(document.cookie.substring(offset,end));favourites=value.evalJSON()}}}function _displayFavourites(){var elToFavourite;for(var i=0;i<favourites.length;i++){elToFavourite=document.getElementById(favourites[i]);if(elToFavourite!=null){elToFavourite.className=elToFavourite.className+" favourite"}}}function update(element){var id=element.id;if(favourites.member(id)){result=removeFavorite(id)}else{result=addFavorite(id)}saveFavourites();return result}function addFavorite(id){favourites.push(id);favourites.sortBy(function(fav){return fav});return true}function removeFavorite(id){favourites=favourites.findAll(function(fav){return fav!=id});return false}function getFavourites(){return favourites}function toggleFavourites(e){var mainElement=$("upc-tvguide");if(!showFavourites&&favourites.length==0){UPC.util.Error.raise(UPC.util.Localization.getString("error.favourites.no_results.msg"),UPC.util.Localization.getString("error.favourites.no_results.title"));UPC.apps.epg.ToolBoxController.channelsPopup().setSelectedIndex(0);return}if(!showFavourites){mainElement.select(".timeslot ol").each(function(list){if(!favourites.member(list.id)){list.hide()}});showFavourites=true;mainElement.fire("epg:showFavourites")}}function isFavourite(id){return(showFavourites&&(favourites.member(id)))}function isActive(){return showFavourites}function hasFavourites(){return favourites.length>0}return{init:initialize,update:update,get:getFavourites,toggle:toggleFavourites,isFavourite:isFavourite,isActive:isActive,hasFavourites:hasFavourites,displayFavourites:_displayFavourites}}();Event.observe(document,"dom:loaded",function(){var locale="";var scriptTag=$$("script").find(function(tag){var src=tag.src;var match=tag.src.match(/core(.*)\.js(\?.*)?$/gi);if(src&&match!=null){return tag}});if(scriptTag!=null&&scriptTag.src!=""){var path=scriptTag.src.replace(/core(.*)\.js(\?.*)?$/,"");var locales=scriptTag.src.match(/\?.*locale=([a-z]{2}_[A-Z]{2})/);locale=locales[1]||"nl_NL"}if(config=UPC.util.Configuration){var GlobalConfig={GridController:{locale:locale,slotContainerId:"slot-container"},ListController:{locale:locale},DataController:{maxCacheSize:6,preloadCount:0,dataUrlTpl:new Template("/TV/wa/grid/?startDateTime=#{datetime}"),eventInfoUrl:"/TV/Guide/Event/",busyElementId:"currentTimeDisplay",busyClassName:"busy"},TimeController:{timelineSelector:".timeline",ctiId:"",currentTimeSlotId:"",ctiInterval:60,locale:locale},Tooltip:{ttElement:"tooltip",showDelay:800,hideDelay:5000,width:300,autoDismissDelay:12500,offset:[0,0]}};config.init(GlobalConfig)}new UPC.widgets.Search("query");var grid=$("grid");if($("grid")!=null){UPC.apps.epg.GridController.init($("upc-tvguide"))}else{if($("channel-description")!=null){UPC.apps.epg.ListController.init($("upc-tvguide"))}}});