var hasClass=function(b,a){return((" "+b.className+" ").indexOf(" "+a+" ")>-1)};var removeClass=function(b,a){var c=new RegExp("(\\s|^)"+a+"(\\s|$)");b.className=b.className.replace(c,"")};setTimeout(function(){var a=document.getElementById("channels");var c=a.getElementsByTagName("div"),e;var d=false;for(e in c){var b=c[e];if(hasClass(b,"listings")){d=d||hasClass(b,"loading");removeClass(b,"loading")}}if(d){_gaq.push(["_trackEvent","Listings","Error","Timed out loading"])}},5000);window.RT=window.RT||{};var asiPqTag=false;var cb=new Date().getTime();try{document.write("<script type='text/javascript' language='JavaScript' src='http://pq-direct.revsci.net/pql?placementIdList=s0IuO0,44he4c&cb="+cb+"'></script>")}catch(err){}var gptadslots=[];var googletag=googletag||{};googletag.cmd=googletag.cmd||[];RT.ads=(function(){function b(g){return g.toLowerCase().replace(/ /g,"")}function f(k,i,g){var j=document.createElement("script");j.async=true;j.type="text/javascript";var n="https:"==document.location.protocol;j.src=(n?"https:":"http:")+"//www.googletagservices.com/tag/js/gpt.js";var l=document.getElementsByTagName("script")[0];l.parentNode.insertBefore(j,l);googletag.cmd.push(function(){googletag.pubads().enableSingleRequest();googletag.pubads().enableAsyncRendering();googletag.pubads().collapseEmptyDivs();googletag.enableServices();for(target in i){var o=i[target];if(o!=""){googletag.pubads().setTargeting(target,[o])}}for(target in k){var p=k[target];if(p!=""){googletag.pubads().setTargeting(target,[p])}}googletag.pubads().setTargeting("enableInskin",(jQuery(window).width()>=1280).toString())});var m=d(i);var h=jQuery(".rt-dfp-ad");h.each(function(){var q=this.getAttribute("data-adkey");var p=this.getAttribute("data-pos");var o=this.id;if(p!="oop"){googletag.cmd.push(function(){var r=a(g[q]);googletag.defineSlot(m,c(g[q]),o).defineSizeMapping(r).addService(googletag.pubads()).setTargeting("pos",[p])})}else{googletag.cmd.push(function(){googletag.defineOutOfPageSlot(m,o).addService(googletag.pubads()).setTargeting("pos",[""])})}});h.each(function(){var o=this.id;googletag.cmd.push(function(){googletag.display(o)})})}function a(g){var j=googletag.sizeMapping();for(var h=0;h<g.length;h++){j.addSize(g[h][0],g[h][1])}return j.build()}function c(g){var h=[];for(var j=0;j<g.length;j++){h=h.concat(g[j][1])}return h}function d(g){return"/4817/P4681.radiotimes.com/"+b(g.channel)+"/"+b(g.cat)}function e(j,k,i,h){var n=d(i),m=j.attr("data-adkey"),l=j.attr("data-pos"),g=j.attr("id");googletag.cmd.push(function(){var o=a(h[m]);googletag.defineSlot(n,c(h[m]),g).defineSizeMapping(o).addService(googletag.pubads()).setTargeting("pos",[l]);googletag.display(g)})}return{init:function(i,h,g){this.keywords=i;this.adTargets=h;this.adSizes=g;f(i,h,g)},newAdvert:function(g){e(g,this.keywords,this.adTargets,this.adSizes)}}})();var TypeHelpers=new function(){var a=this;a.hasSmoothing=function(){if(typeof(screen.fontSmoothingEnabled)!="undefined"){return screen.fontSmoothingEnabled}else{try{var c=document.createElement("canvas");c.width="35";c.height="35";c.style.display="none";document.body.appendChild(c);var d=c.getContext("2d");d.textBaseline="top";d.font="32px Arial";d.fillStyle="black";d.strokeStyle="black";d.fillText("O",0,0);for(var h=8;h<=32;h++){for(var f=1;f<=32;f++){var g=d.getImageData(f,h,1,1).data;var b=g[3];if(b!=255&&b!=0){return true}}}return false}catch(e){return null}}};a.insertClasses=function(){var c=a.hasSmoothing();var b=document.getElementsByTagName("html")[0];if(c==true){b.className+=" hasFontSmoothing-true"}else{if(c==false){b.className+=" hasFontSmoothing-false"}else{b.className+=" hasFontSmoothing-unknown"}}}};TypeHelpers.insertClasses();MooTools.More={version:"1.4.0.1",build:"a4244edf2aa97ac8a196fc96082dd35af1abab87"};String.implement({parseQueryString:function(a,b){if(a==null){a=true}if(b==null){b=true}var d=this.split(/[&;]/),c={};if(!d.length){return c}d.each(function(h){var e=h.indexOf("=")+1,i=e?h.substr(e):"",f=e?h.substr(0,e-1).match(/([^\]\[]+|(\B)(?=\]))/g):[h],g=c;if(!f){return}if(b){i=decodeURIComponent(i)}f.each(function(l,k){if(a){l=decodeURIComponent(l)}var j=g[l];if(k<f.length-1){g=g[l]=j||{}}else{if(typeOf(j)=="array"){j.push(i)}else{g[l]=j!=null?[j,i]:i}}})});return c},cleanQueryString:function(a){return this.split("&").filter(function(d){var b=d.indexOf("="),c=b<0?"":d.substr(0,b),e=d.substr(b+1);return a?a.call(null,c,e):(e||e===0)}).join("&")}});(function(){var a=function(){return this.get("value")};var b=this.URI=new Class({Implements:Options,options:{},regex:/^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,parts:["scheme","user","password","host","port","directory","file","query","fragment"],schemes:{http:80,https:443,ftp:21,rtsp:554,mms:1755,file:0},initialize:function(e,d){this.setOptions(d);var c=this.options.base||b.base;if(!e){e=c}if(e&&e.parsed){this.parsed=Object.clone(e.parsed)}else{this.set("value",e.href||e.toString(),c?new b(c):false)}},parse:function(e,c){var d=e.match(this.regex);if(!d){return false}d.shift();return this.merge(d.associate(this.parts),c)},merge:function(d,c){if((!d||!d.scheme)&&(!c||!c.scheme)){return false}if(c){this.parts.every(function(e){if(d[e]){return false}d[e]=c[e]||"";return true})}d.port=d.port||this.schemes[d.scheme.toLowerCase()];d.directory=d.directory?this.parseDirectory(d.directory,c?c.directory:""):"/";return d},parseDirectory:function(d,c){d=(d.substr(0,1)=="/"?"":(c||"/"))+d;if(!d.test(b.regs.directoryDot)){return d}var e=[];d.replace(b.regs.endSlash,"").split("/").each(function(f){if(f==".."&&e.length>0){e.pop()}else{if(f!="."){e.push(f)}}});return e.join("/")+"/"},combine:function(c){return c.value||c.scheme+"://"+(c.user?c.user+(c.password?":"+c.password:"")+"@":"")+(c.host||"")+(c.port&&c.port!=this.schemes[c.scheme]?":"+c.port:"")+(c.directory||"/")+(c.file||"")+(c.query?"?"+c.query:"")+(c.fragment?"#"+c.fragment:"")},set:function(d,f,c){if(d=="value"){var e=f.match(b.regs.scheme);if(e){e=e[1]}if(e&&this.schemes[e.toLowerCase()]==null){this.parsed={scheme:e,value:f}}else{this.parsed=this.parse(f,(c||this).parsed)||(e?{scheme:e,value:f}:{value:f})}}else{if(d=="data"){this.setData(f)}else{this.parsed[d]=f}}return this},get:function(d,c){switch(d){case"value":return this.combine(this.parsed,c?c.parsed:false);case"data":return this.getData()}return this.parsed[d]||""},go:function(){document.location.href=this.toString()},toURI:function(){return this},getData:function(c,e){var f=this.get(e||"query");if(!(f||f===0)){return c?null:{}}var d=f.parseQueryString();return c?d[c]:d},setData:function(f,d,e){if(typeof f=="string"){var c=this.getData();c[arguments[0]]=arguments[1];f=c}else{if(d){f=Object.merge(this.getData(),f)}}return this.set(e||"query",Object.toQueryString(f))},clearData:function(c){return this.set(c||"query","")},toString:a,valueOf:a});b.regs={endSlash:/\/$/,scheme:/^(\w+):/,directoryDot:/\.\/|\.$/};b.base=new b(Array.from(document.getElements("base[href]",true)).getLast(),{base:document.location});String.implement({toURI:function(c){return new b(this,c)}})})();(function(){if(this.Hash){return}var a=this.Hash=new Type("Hash",function(c){if(typeOf(c)=="hash"){c=Object.clone(c.getClean())}for(var b in c){this[b]=c[b]}return this});this.$H=function(b){return new a(b)};a.implement({forEach:function(c,b){Object.forEach(this,c,b)},getClean:function(){var b={};for(var c in this){if(this.hasOwnProperty(c)){b[c]=this[c]}}return b},getLength:function(){var c=0;for(var b in this){if(this.hasOwnProperty(b)){c++}}return c}});a.alias("each","forEach");a.implement({has:Object.prototype.hasOwnProperty,keyOf:function(b){return Object.keyOf(this,b)},hasValue:function(b){return Object.contains(this,b)},extend:function(b){a.each(b||{},function(d,c){a.set(this,c,d)},this);return this},combine:function(b){a.each(b||{},function(d,c){a.include(this,c,d)},this);return this},erase:function(b){if(this.hasOwnProperty(b)){delete this[b]}return this},get:function(b){return(this.hasOwnProperty(b))?this[b]:null},set:function(b,c){if(!this[b]||this.hasOwnProperty(b)){this[b]=c}return this},empty:function(){a.each(this,function(c,b){delete this[b]},this);return this},include:function(b,c){if(this[b]==undefined){this[b]=c}return this},map:function(c,b){return new a(Object.map(this,c,b))},filter:function(c,b){return new a(Object.filter(this,c,b))},every:function(c,b){return Object.every(this,c,b)},some:function(c,b){return Object.some(this,c,b)},getKeys:function(){return Object.keys(this)},getValues:function(){return Object.values(this)},toQueryString:function(b){return Object.toQueryString(this,b)}});a.alias({indexOf:"keyOf",contains:"hasValue"})})();(function(){var a=function(c){return c!=null};var b=Object.prototype.hasOwnProperty;Object.extend({getFromPath:function(f,e){if(typeof e=="string"){e=e.split(".")}for(var c=0,d=e.length;c<d;c++){if(b.call(f,e[c])){f=f[e[c]]}else{return null}}return f},cleanValues:function(e,d){d=d||a;for(var c in e){if(!d(e[c])){delete e[c]}}return e},erase:function(d,c){if(b.call(d,c)){delete d[c]}return d},run:function(e){var c=Array.slice(arguments,1);for(var d in e){if(e[d].apply){e[d].apply(e,c)}}return e}})})();(function(){var a=null,e={},c={};var b=function(f){if(instanceOf(f,d.Set)){return f}else{return e[f]}};var d=this.Locale={define:function(g,i,f,j){var h;if(instanceOf(g,d.Set)){h=g.name;if(h){e[h]=g}}else{h=g;if(!e[h]){e[h]=new d.Set(h)}g=e[h]}if(i){g.define(i,f,j)}if(!a){a=g}return g},use:function(f){f=b(f);if(f){a=f;this.fireEvent("change",f)}return this},getCurrent:function(){return a},get:function(g,f){return(a)?a.get(g,f):""},inherit:function(g,f,h){g=b(g);if(g){g.inherit(f,h)}return this},list:function(){return Object.keys(e)}};Object.append(d,new Events);d.Set=new Class({sets:{},inherits:{locales:[],sets:{}},initialize:function(f){this.name=f||""},define:function(h,g,i){var f=this.sets[h];if(!f){f={}}if(g){if(typeOf(g)=="object"){f=Object.merge(f,g)}else{f[g]=i}}this.sets[h]=f;return this},get:function(k,g,f){var r=Object.getFromPath(this.sets,k);if(r!=null){var q=typeOf(r);if(q=="function"){r=r.apply(null,Array.from(g))}else{if(q=="object"){r=Object.clone(r)}}return r}var j=k.indexOf("."),p=j<0?k:k.substr(0,j),o=(this.inherits.sets[p]||[]).combine(this.inherits.locales).include("en-US");if(!f){f=[]}for(var h=0,m=o.length;h<m;h++){if(f.contains(o[h])){continue}f.include(o[h]);var n=e[o[h]];if(!n){continue}r=n.get(k,g,f);if(r!=null){return r}}return""},inherit:function(g,h){g=Array.from(g);if(h&&!this.inherits.sets[h]){this.inherits.sets[h]=[]}var f=g.length;while(f--){(h?this.inherits.sets[h]:this.inherits.locales).unshift(g[f])}return this}})})();Class.Mutators.Binds=function(a){if(!this.prototype.initialize){this.implement("initialize",function(){})}return Array.from(a).concat(this.prototype.Binds||[])};Class.Mutators.initialize=function(a){return function(){Array.from(this.Binds).each(function(b){var c=this[b];if(c){this[b]=c.bind(this)}},this);return a.apply(this,arguments)}};Locale.define("en-US","Date",{months:["January","February","March","April","May","June","July","August","September","October","November","December"],months_abbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],days_abbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dateOrder:["month","date","year"],shortDate:"%m/%d/%Y",shortTime:"%I:%M%p",AM:"AM",PM:"PM",firstDayOfWeek:0,ordinal:function(a){return(a>3&&a<21)?"th":["th","st","nd","rd","th"][Math.min(a%10,4)]},lessThanMinuteAgo:"less than a minute ago",minuteAgo:"about a minute ago",minutesAgo:"{delta} minutes ago",hourAgo:"about an hour ago",hoursAgo:"about {delta} hours ago",dayAgo:"1 day ago",daysAgo:"{delta} days ago",weekAgo:"1 week ago",weeksAgo:"{delta} weeks ago",monthAgo:"1 month ago",monthsAgo:"{delta} months ago",yearAgo:"1 year ago",yearsAgo:"{delta} years ago",lessThanMinuteUntil:"less than a minute from now",minuteUntil:"about a minute from now",minutesUntil:"{delta} minutes from now",hourUntil:"about an hour from now",hoursUntil:"about {delta} hours from now",dayUntil:"1 day from now",daysUntil:"{delta} days from now",weekUntil:"1 week from now",weeksUntil:"{delta} weeks from now",monthUntil:"1 month from now",monthsUntil:"{delta} months from now",yearUntil:"1 year from now",yearsUntil:"{delta} years from now"});(function(){var c=this.Date;var d=c.Methods={ms:"Milliseconds",year:"FullYear",min:"Minutes",mo:"Month",sec:"Seconds",hr:"Hours"};["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds","Time","TimezoneOffset","Week","Timezone","GMTOffset","DayOfYear","LastMonth","LastDayOfMonth","UTCDate","UTCDay","UTCFullYear","AMPM","Ordinal","UTCHours","UTCMilliseconds","UTCMinutes","UTCMonth","UTCSeconds","UTCMilliseconds"].each(function(s){c.Methods[s.toLowerCase()]=s});var i=function(t,s,u){if(s==1){return t}return t<Math.pow(10,s-1)?(u||"0")+i(t,s-1,u):t};c.implement({set:function(t,u){t=t.toLowerCase();var s=d[t]&&"set"+d[t];if(s&&this[s]){this[s](u)}return this}.overloadSetter(),get:function(t){t=t.toLowerCase();var s=d[t]&&"get"+d[t];if(s&&this[s]){return this[s]()}return null}.overloadGetter(),clone:function(){return new c(this.get("time"))},increment:function(t,u){t=t||"day";u=u!=null?u:1;switch(t){case"year":return this.increment("month",u*12);case"month":var s=this.get("date");this.set("date",1).set("mo",this.get("mo")+u);return this.set("date",s.min(this.get("lastdayofmonth")));case"week":return this.increment("day",u*7);case"day":return this.set("date",this.get("date")+u)}if(!c.units[t]){throw new Error(t+" is not a supported interval")}return this.set("time",this.get("time")+u*c.units[t]())},decrement:function(s,t){return this.increment(s,-1*(t!=null?t:1))},isLeapYear:function(){return c.isLeapYear(this.get("year"))},clearTime:function(){return this.set({hr:0,min:0,sec:0,ms:0})},diff:function(s,t){if(typeOf(s)=="string"){s=c.parse(s)}return((s-this)/c.units[t||"day"](3,3)).round()},getLastDayOfMonth:function(){return c.daysInMonth(this.get("mo"),this.get("year"))},getDayOfYear:function(){return(c.UTC(this.get("year"),this.get("mo"),this.get("date")+1)-c.UTC(this.get("year"),0,1))/c.units.day()},setDay:function(t,u){if(u==null){u=c.getMsg("firstDayOfWeek");if(u===""){u=1}}t=(7+c.parseDay(t,true)-u)%7;var s=(7+this.get("day")-u)%7;return this.increment("day",t-s)},getWeek:function(v){if(v==null){v=c.getMsg("firstDayOfWeek");if(v===""){v=1}}var s=this,t=(7+s.get("day")-v)%7,u=0,w;if(v==1){var x=s.get("month"),y=s.get("date")-t;if(x==11&&y>28){return 1}if(x==0&&y<-2){s=new c(s).decrement("day",t);t=0}w=new c(s.get("year"),0,1).get("day")||7;if(w>4){u=-7}}else{w=new c(s.get("year"),0,1).get("day")}u+=s.get("dayofyear");u+=6-t;u+=(7+w-v)%7;return(u/7)},getOrdinal:function(s){return c.getMsg("ordinal",s||this.get("date"))},getTimezone:function(){return this.toString().replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")},getGMTOffset:function(){var s=this.get("timezoneOffset");return((s>0)?"-":"+")+i((s.abs()/60).floor(),2)+i(s%60,2)},setAMPM:function(s){s=s.toUpperCase();var t=this.get("hr");if(t>11&&s=="AM"){return this.decrement("hour",12)}else{if(t<12&&s=="PM"){return this.increment("hour",12)}}return this},getAMPM:function(){return(this.get("hr")<12)?"AM":"PM"},parse:function(s){this.set("time",c.parse(s));return this},isValid:function(s){if(!s){s=this}return typeOf(s)=="date"&&!isNaN(s.valueOf())},format:function(t){if(!this.isValid()){return"invalid date"}if(!t){t="%x %X"}if(typeof t=="string"){t=e[t.toLowerCase()]||t}if(typeof t=="function"){return t(this)}var s=this;return t.replace(/%([a-z%])/gi,function(u,v){switch(v){case"a":return c.getMsg("days_abbr")[s.get("day")];case"A":return c.getMsg("days")[s.get("day")];case"b":return c.getMsg("months_abbr")[s.get("month")];case"B":return c.getMsg("months")[s.get("month")];case"c":return s.format("%a %b %d %H:%M:%S %Y");case"d":return i(s.get("date"),2);case"e":return i(s.get("date"),2," ");case"H":return i(s.get("hr"),2);case"I":return i((s.get("hr")%12)||12,2);case"j":return i(s.get("dayofyear"),3);case"k":return i(s.get("hr"),2," ");case"l":return i((s.get("hr")%12)||12,2," ");case"L":return i(s.get("ms"),3);case"m":return i((s.get("mo")+1),2);case"M":return i(s.get("min"),2);case"o":return s.get("ordinal");case"p":return c.getMsg(s.get("ampm"));case"s":return Math.round(s/1000);case"S":return i(s.get("seconds"),2);case"T":return s.format("%H:%M:%S");case"U":return i(s.get("week"),2);case"w":return s.get("day");case"x":return s.format(c.getMsg("shortDate"));case"X":return s.format(c.getMsg("shortTime"));case"y":return s.get("year").toString().substr(2);case"Y":return s.get("year");case"z":return s.get("GMTOffset");case"Z":return s.get("Timezone")}return v})},toISOString:function(){return this.format("iso8601")}}).alias({toJSON:"toISOString",compare:"diff",strftime:"format"});var o=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var e={db:"%Y-%m-%d %H:%M:%S",compact:"%Y%m%dT%H%M%S","short":"%d %b %H:%M","long":"%B %d, %Y %H:%M",rfc822:function(s){return o[s.get("day")]+s.format(", %d ")+p[s.get("month")]+s.format(" %Y %H:%M:%S %Z")},rfc2822:function(s){return o[s.get("day")]+s.format(", %d ")+p[s.get("month")]+s.format(" %Y %H:%M:%S %z")},iso8601:function(s){return(s.getUTCFullYear()+"-"+i(s.getUTCMonth()+1,2)+"-"+i(s.getUTCDate(),2)+"T"+i(s.getUTCHours(),2)+":"+i(s.getUTCMinutes(),2)+":"+i(s.getUTCSeconds(),2)+"."+i(s.getUTCMilliseconds(),3)+"Z")}};var j=[],h=c.parse;var k=function(w,x,t){var u=-1,v=c.getMsg(w+"s");switch(typeOf(x)){case"object":u=v[x.get(w)];break;case"number":u=v[x];if(!u){throw new Error("Invalid "+w+" index: "+x)}break;case"string":var s=v.filter(function(y){return this.test(y)},new RegExp("^"+x,"i"));if(!s.length){throw new Error("Invalid "+w+" string")}if(s.length>1){throw new Error("Ambiguous "+w)}u=s[0]}return(t)?v.indexOf(u):u};var q=1900,r=70;c.extend({getMsg:function(t,s){return Locale.get("Date."+t,s)},units:{ms:Function.from(1),second:Function.from(1000),minute:Function.from(60000),hour:Function.from(3600000),day:Function.from(86400000),week:Function.from(608400000),month:function(t,u){var s=new c;return c.daysInMonth(t!=null?t:s.get("mo"),u!=null?u:s.get("year"))*86400000},year:function(s){s=s||new c().get("year");return c.isLeapYear(s)?31622400000:31536000000}},daysInMonth:function(s,t){return[31,c.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][s]},isLeapYear:function(s){return((s%4===0)&&(s%100!==0))||(s%400===0)},parse:function(s){var v=typeOf(s);if(v=="number"){return new c(s)}if(v!="string"){return s}s=s.clean();if(!s.length){return null}var u;j.some(function(w){var t=w.re.exec(s);return(t)?(u=w.handler(t)):false});if(!(u&&u.isValid())){u=new c(h(s));if(!(u&&u.isValid())){u=new c(s.toInt())}}return u},parseDay:function(s,t){return k("day",s,t)},parseMonth:function(s,t){return k("month",s,t)},parseUTC:function(u){var s=new c(u);var t=c.UTC(s.get("year"),s.get("mo"),s.get("date"),s.get("hr"),s.get("min"),s.get("sec"),s.get("ms"));return new c(t)},orderIndex:function(s){return c.getMsg("dateOrder").indexOf(s)+1},defineFormat:function(t,s){e[t]=s;return this},clearParsers:function(){j.length=0;return this},defineParser:function(s){j.push((s.re&&s.handler)?s:a(s));return this},defineParsers:function(){Array.flatten(arguments).each(c.defineParser);return this},define2DigitYearStart:function(s){r=s%100;q=s-r;return this}}).extend({defineFormats:c.defineFormat.overloadSetter()});var m=function(s){return new RegExp("(?:"+c.getMsg(s).map(function(t){return t.substr(0,3)}).join("|")+")[a-z]*")};var n=function(s){switch(s){case"T":return"%H:%M:%S";case"x":return((c.orderIndex("month")==1)?"%m[-./]%d":"%d[-./]%m")+"([-./]%y)?";case"X":return"%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%z?"}return null};var g={d:/[0-2]?[0-9]|3[01]/,H:/[01]?[0-9]|2[0-3]/,I:/0?[1-9]|1[0-2]/,M:/[0-5]?\d/,s:/\d+/,o:/[a-z]*/,p:/[ap]\.?m\.?/,y:/\d{2}|\d{4}/,Y:/\d{4}/,z:/Z|[+-]\d{2}(?::?\d{2})?/};g.m=g.I;g.S=g.M;var b;var l=function(s){b=s;g.a=g.A=m("days");g.b=g.B=m("months");j.each(function(u,t){if(u.format){j[t]=a(u.format)}})};var a=function(s){if(!b){return{format:s}}var t=[];var u=(s.source||s).replace(/%([a-z])/gi,function(v,w){return n(w)||v}).replace(/\((?!\?)/g,"(?:").replace(/ (?!\?|\*)/g,",? ").replace(/%([a-z%])/gi,function(v,w){var x=g[w];if(!x){return w}t.push(w);return"("+x.source+")"}).replace(/\[a-z\]/gi,"[a-z\\u00c0-\\uffff;&]");return{format:s,re:new RegExp("^"+u+"$","i"),handler:function(v){v=v.slice(1).associate(t);var w=new c().clearTime(),y=v.y||v.Y;if(y!=null){f.call(w,"y",y)}if("d" in v){f.call(w,"d",1)}if("m" in v||v.b||v.B){f.call(w,"m",1)}for(var x in v){f.call(w,x,v[x])}return w}}};var f=function(s,u){if(!u){return this}switch(s){case"a":case"A":return this.set("day",c.parseDay(u,true));case"b":case"B":return this.set("mo",c.parseMonth(u,true));case"d":return this.set("date",u);case"H":case"I":return this.set("hr",u);case"m":return this.set("mo",u-1);case"M":return this.set("min",u);case"p":return this.set("ampm",u.replace(/\./g,""));case"S":return this.set("sec",u);case"s":return this.set("ms",("0."+u)*1000);case"w":return this.set("day",u);case"Y":return this.set("year",u);case"y":u=+u;if(u<100){u+=q+(u<r?100:0)}return this.set("year",u);case"z":if(u=="Z"){u="+00"}var t=u.match(/([+-])(\d{2}):?(\d{2})?/);t=(t[1]+"1")*(t[2]*60+(+t[3]||0))+this.getTimezoneOffset();return this.set("time",this-t*60000)}return this};c.defineParsers("%Y([-./]%m([-./]%d((T| )%X)?)?)?","%Y%m%d(T%H(%M%S?)?)?","%x( %X)?","%d%o( %b( %Y)?)?( %X)?","%b( %d%o)?( %Y)?( %X)?","%Y %b( %d%o( %X)?)?","%o %b %d %X %z %Y","%T","%H:%M( ?%p)?");Locale.addEvent("change",function(s){if(Locale.get("Date")){l(s)}}).fireEvent("change",Locale.getCurrent())})();(function(){var b={a:/[àáâãäåaa]/g,A:/[ÀÁÂÃÄÅAA]/g,c:/[ccç]/g,C:/[CCÇ]/g,d:/[dd]/g,D:/[DÐ]/g,e:/[èéêëee]/g,E:/[ÈÉÊËEE]/g,g:/[g]/g,G:/[G]/g,i:/[ìíîï]/g,I:/[ÌÍÎÏ]/g,l:/[lll]/g,L:/[LLL]/g,n:/[ñnn]/g,N:/[ÑNN]/g,o:/[òóôõöøo]/g,O:/[ÒÓÔÕÖØ]/g,r:/[rr]/g,R:/[RR]/g,s:/[ššs]/g,S:/[ŠSS]/g,t:/[tt]/g,T:/[TT]/g,ue:/[ü]/g,UE:/[Ü]/g,u:/[ùúûuµ]/g,U:/[ÙÚÛU]/g,y:/[ÿý]/g,Y:/[ŸÝ]/g,z:/[žzz]/g,Z:/[ŽZZ]/g,th:/[þ]/g,TH:/[Þ]/g,dh:/[ð]/g,DH:/[Ð]/g,ss:/[ß]/g,oe:/[œ]/g,OE:/[Œ]/g,ae:/[æ]/g,AE:/[Æ]/g},c={" ":/[\xa0\u2002\u2003\u2009]/g,"*":/[\xb7]/g,"'":/[\u2018\u2019]/g,'"':/[\u201c\u201d]/g,"...":/[\u2026]/g,"-":/[\u2013]/g,"&raquo;":/[\uFFFD]/g};var d=function(h,f){var g=h,e;for(e in f){g=g.replace(f[e],e)}return g};var a=function(h,e){h=h||"";var g=e?"<"+h+"(?!\\w)[^>]*>([\\s\\S]*?)</"+h+"(?!\\w)>":"</?"+h+"([^>]+)?>",f=new RegExp(g,"gi");return f};String.implement({standardize:function(){return d(this,b)},repeat:function(e){return new Array(e+1).join(this)},pad:function(f,h,e){if(this.length>=f){return this}var g=(h==null?" ":""+h).repeat(f-this.length).substr(0,f-this.length);if(!e||e=="right"){return this+g}if(e=="left"){return g+this}return g.substr(0,(g.length/2).floor())+this+g.substr(0,(g.length/2).ceil())},getTags:function(f,e){return this.match(a(f,e))||[]},stripTags:function(f,e){return this.replace(a(f,e),"")},tidy:function(){return d(this,c)},truncate:function(g,i,e){var h=this;if(i==null&&arguments.length==1){i="…"}if(h.length>g){h=h.substring(0,g);if(e){var f=h.lastIndexOf(e);if(f!=-1){h=h.substr(0,f)}}if(i){h+=i}}return h}})})();Element.implement({tidy:function(){this.set("value",this.get("value").tidy())},getTextInRange:function(b,a){return this.get("value").substring(b,a)},getSelectedText:function(){if(this.setSelectionRange){return this.getTextInRange(this.getSelectionStart(),this.getSelectionEnd())}return document.selection.createRange().text},getSelectedRange:function(){if(this.selectionStart!=null){return{start:this.selectionStart,end:this.selectionEnd}}var c={start:0,end:0};var d=this.getDocument().selection.createRange();if(!d||d.parentElement()!=this){return c}var a=d.duplicate();if(this.type=="text"){c.start=0-a.moveStart("character",-100000);c.end=c.start+d.text.length}else{var e=this.get("value");var b=e.length;a.moveToElementText(this);a.setEndPoint("StartToEnd",d);if(a.text.length){b-=e.match(/[\n\r]*$/)[0].length}c.end=b-a.text.length;a.setEndPoint("StartToStart",d);c.start=b-a.text.length}return c},getSelectionStart:function(){return this.getSelectedRange().start},getSelectionEnd:function(){return this.getSelectedRange().end},setCaretPosition:function(a){if(a=="end"){a=this.get("value").length}this.selectRange(a,a);return this},getCaretPosition:function(){return this.getSelectedRange().start},selectRange:function(d,b){if(this.setSelectionRange){this.focus();this.setSelectionRange(d,b)}else{var e=this.get("value");var a=e.substr(d,b-d).replace(/\r/g,"").length;d=e.substr(0,d).replace(/\r/g,"").length;var c=this.createTextRange();c.collapse(true);c.moveEnd("character",d+a);c.moveStart("character",d);c.select()}return this},insertAtCursor:function(d,b){var a=this.getSelectedRange();var c=this.get("value");this.set("value",c.substring(0,a.start)+d+c.substring(a.end,c.length));if(b!==false){this.selectRange(a.start,a.start+d.length)}else{this.setCaretPosition(a.start+d.length)}return this},insertAroundCursor:function(b,d){b=Object.append({before:"",defaultMiddle:"",after:""},b);var g=this.getSelectedText()||b.defaultMiddle;var c=this.getSelectedRange();var f=this.get("value");if(c.start==c.end){this.set("value",f.substring(0,c.start)+b.before+g+b.after+f.substring(c.end,f.length));this.selectRange(c.start+b.before.length,c.end+b.before.length+g.length)}else{var a=f.substring(c.start,c.end);this.set("value",f.substring(0,c.start)+b.before+a+b.after+f.substring(c.end,f.length));var e=c.start+b.before.length;if(d!==false){this.selectRange(e,e+a.length)}else{this.setCaretPosition(e+f.length)}}return this}});Locale.define("en-US","FormValidator",{required:"This field is required.",length:"Please enter {length} characters (you entered {elLength} characters)",minLength:"Please enter at least {minLength} characters (you entered {length} characters).",maxLength:"Please enter no more than {maxLength} characters (you entered {length} characters).",integer:"Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.",numeric:'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").',digits:"Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).",alpha:"Please use only letters (a-z) within this field. No spaces or other characters are allowed.",alphanum:"Please use only letters (a-z) or numbers (0-9) in this field. No spaces or other characters are allowed.",dateSuchAs:"Please enter a valid date such as {date}",dateInFormatMDY:'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")',email:'Please enter a valid email address. For example "fred@domain.com".',url:"Please enter a valid URL such as http://www.example.com.",currencyDollar:"Please enter a valid $ amount. For example $100.00 .",oneRequired:"Please enter something for at least one of these inputs.",errorPrefix:"Error: ",warningPrefix:"Warning: ",noSpace:"There can be no spaces in this input.",reqChkByNode:"No items are selected.",requiredChk:"This field is required.",reqChkByName:"Please select a {label}.",match:"This field needs to match the {matchName} field",startDate:"the start date",endDate:"the end date",currendDate:"the current date",afterDate:"The date should be the same or after {label}.",beforeDate:"The date should be the same or before {label}.",startMonth:"Please select a start month",sameMonth:"These two dates must be in the same month - you must change one or the other.",creditcard:"The credit card number entered is invalid. Please check the number and try again. {length} digits entered."});Element.implement({isDisplayed:function(){return this.getStyle("display")!="none"},isVisible:function(){var b=this.offsetWidth,a=this.offsetHeight;return(b==0&&a==0)?false:(b>0&&a>0)?true:this.style.display!="none"},toggle:function(){return this[this.isDisplayed()?"hide":"show"]()},hide:function(){var a;try{a=this.getStyle("display")}catch(b){}if(a=="none"){return this}return this.store("element:_originalDisplay",a||"").setStyle("display","none")},show:function(a){if(!a&&this.isDisplayed()){return this}a=a||this.retrieve("element:_originalDisplay")||"block";return this.setStyle("display",(a=="none")?"block":a)},swapClass:function(b,a){return this.removeClass(b).addClass(a)}});Document.implement({clearSelection:function(){if(window.getSelection){var b=window.getSelection();if(b&&b.removeAllRanges){b.removeAllRanges()}}else{if(document.selection&&document.selection.empty){try{document.selection.empty()}catch(a){}}}}});if(!window.Form){window.Form={}}var InputValidator=this.InputValidator=new Class({Implements:[Options],options:{errorMsg:"Validation failed.",test:Function.from(true)},initialize:function(a,b){this.setOptions(b);this.className=a},test:function(a,b){a=document.id(a);return(a)?this.options.test(a,b||this.getProps(a)):false},getError:function(b,c){b=document.id(b);var a=this.options.errorMsg;if(typeOf(a)=="function"){a=a(b,c||this.getProps(b))}return a},getProps:function(a){a=document.id(a);return(a)?a.get("validatorProps"):{}}});Element.Properties.validators={get:function(){return(this.get("data-validators")||this.className).clean().split(" ")}};Element.Properties.validatorProps={set:function(a){return this.eliminate("$moo:validatorProps").store("$moo:validatorProps",a)},get:function(b){if(b){this.set(b)}if(this.retrieve("$moo:validatorProps")){return this.retrieve("$moo:validatorProps")}if(this.getProperty("data-validator-properties")||this.getProperty("validatorProps")){try{this.store("$moo:validatorProps",JSON.decode(this.getProperty("validatorProps")||this.getProperty("data-validator-properties")))}catch(a){return{}}}else{var c=this.get("validators").filter(function(d){return d.test(":")});if(!c.length){this.store("$moo:validatorProps",{})}else{b={};c.each(function(d){var g=d.split(":");if(g[1]){try{b[g[0]]=JSON.decode(g[1])}catch(f){}}});this.store("$moo:validatorProps",b)}}return this.retrieve("$moo:validatorProps")}};Form.Validator=new Class({Implements:[Options,Events],Binds:["onSubmit"],options:{fieldSelectors:"input, select, textarea",ignoreHidden:true,ignoreDisabled:true,useTitles:false,evaluateOnSubmit:true,evaluateFieldsOnBlur:true,evaluateFieldsOnChange:true,serial:true,stopOnFailure:true,warningPrefix:function(){return Form.Validator.getMsg("warningPrefix")||"Warning: "},errorPrefix:function(){return Form.Validator.getMsg("errorPrefix")||"Error: "}},initialize:function(a,b){this.setOptions(b);this.element=document.id(a);this.element.store("validator",this);this.warningPrefix=Function.from(this.options.warningPrefix)();this.errorPrefix=Function.from(this.options.errorPrefix)();if(this.options.evaluateOnSubmit){this.element.addEvent("submit",this.onSubmit)}if(this.options.evaluateFieldsOnBlur||this.options.evaluateFieldsOnChange){this.watchFields(this.getFields())}},toElement:function(){return this.element},getFields:function(){return(this.fields=this.element.getElements(this.options.fieldSelectors))},watchFields:function(a){a.each(function(b){if(this.options.evaluateFieldsOnBlur){b.addEvent("blur",this.validationMonitor.pass([b,false],this))}if(this.options.evaluateFieldsOnChange){b.addEvent("change",this.validationMonitor.pass([b,true],this))}},this)},validationMonitor:function(){clearTimeout(this.timer);this.timer=this.validateField.delay(50,this,arguments)},onSubmit:function(a){if(this.validate(a)){this.reset()}},reset:function(){this.getFields().each(this.resetField,this);return this},validate:function(a){var b=this.getFields().map(function(c){return this.validateField(c,true)},this).every(function(c){return c});this.fireEvent("formValidate",[b,this.element,a]);if(this.options.stopOnFailure&&!b&&a){a.preventDefault()}return b},validateField:function(b,c){if(this.paused){return true}b=document.id(b);var d=!b.hasClass("validation-failed");var a,h;if(this.options.serial&&!c){a=this.element.getElement(".validation-failed");h=this.element.getElement(".warning")}if(b&&(!a||c||b.hasClass("validation-failed")||(a&&!this.options.serial))){var e=b.get("validators");var f=e.some(function(k){return this.getValidator(k)},this);var g=[];e.each(function(k){if(k&&!this.test(k,b)){g.include(k)}},this);d=g.length===0;if(f&&!this.hasValidator(b,"warnOnly")){if(d){b.addClass("validation-passed").removeClass("validation-failed");this.fireEvent("elementPass",[b])}else{b.addClass("validation-failed").removeClass("validation-passed");this.fireEvent("elementFail",[b,g])}}if(!h){var i=e.some(function(k){if(k.test("^warn")){return this.getValidator(k.replace(/^warn-/,""))}else{return null}},this);b.removeClass("warning");var j=e.map(function(k){if(k.test("^warn")){return this.test(k.replace(/^warn-/,""),b,true)}else{return null}},this)}}return d},test:function(a,b,e){b=document.id(b);if((this.options.ignoreHidden&&!b.isVisible())||(this.options.ignoreDisabled&&b.get("disabled"))){return true}var d=this.getValidator(a);if(e!=null){e=false}if(this.hasValidator(b,"warnOnly")){e=true}var c=this.hasValidator(b,"ignoreValidation")||(d?d.test(b):true);if(d&&b.isVisible()){this.fireEvent("elementValidate",[c,b,a,e])}if(e){return true}return c},hasValidator:function(a,b){return a.get("validators").contains(b)},resetField:function(a){a=document.id(a);if(a){a.get("validators").each(function(b){if(b.test("^warn-")){b=b.replace(/^warn-/,"")}a.removeClass("validation-failed");a.removeClass("warning");a.removeClass("validation-passed")},this)}return this},stop:function(){this.paused=true;return this},start:function(){this.paused=false;return this},ignoreField:function(a,b){a=document.id(a);if(a){this.enforceField(a);if(b){a.addClass("warnOnly")}else{a.addClass("ignoreValidation")}}return this},enforceField:function(a){a=document.id(a);if(a){a.removeClass("warnOnly").removeClass("ignoreValidation")}return this}});Form.Validator.getMsg=function(a){return Locale.get("FormValidator."+a)};Form.Validator.adders={validators:{},add:function(a,b){this.validators[a]=new InputValidator(a,b);if(!this.initialize){this.implement({validators:this.validators})}},addAllThese:function(a){Array.from(a).each(function(b){this.add(b[0],b[1])},this)},getValidator:function(a){return this.validators[a.split(":")[0]]}};Object.append(Form.Validator,Form.Validator.adders);Form.Validator.implement(Form.Validator.adders);Form.Validator.add("IsEmpty",{errorMsg:false,test:function(a){if(a.type=="select-one"||a.type=="select"){return !(a.selectedIndex>=0&&a.options[a.selectedIndex].value!="")}else{return((a.get("value")==null)||(a.get("value").length==0))}}});Form.Validator.addAllThese([["required",{errorMsg:function(){return Form.Validator.getMsg("required")},test:function(a){return !Form.Validator.getValidator("IsEmpty").test(a)}}],["length",{errorMsg:function(a,b){if(typeOf(b.length)!="null"){return Form.Validator.getMsg("length").substitute({length:b.length,elLength:a.get("value").length})}else{return""}},test:function(a,b){if(typeOf(b.length)!="null"){return(a.get("value").length==b.length||a.get("value").length==0)}else{return true}}}],["minLength",{errorMsg:function(a,b){if(typeOf(b.minLength)!="null"){return Form.Validator.getMsg("minLength").substitute({minLength:b.minLength,length:a.get("value").length})}else{return""}},test:function(a,b){if(typeOf(b.minLength)!="null"){return(a.get("value").length>=(b.minLength||0))}else{return true}}}],["maxLength",{errorMsg:function(a,b){if(typeOf(b.maxLength)!="null"){return Form.Validator.getMsg("maxLength").substitute({maxLength:b.maxLength,length:a.get("value").length})}else{return""}},test:function(a,b){return a.get("value").length<=(b.maxLength||10000)}}],["validate-integer",{errorMsg:Form.Validator.getMsg.pass("integer"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^(-?[1-9]\d*|0)$/).test(a.get("value"))}}],["validate-numeric",{errorMsg:Form.Validator.getMsg.pass("numeric"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/).test(a.get("value"))}}],["validate-digits",{errorMsg:Form.Validator.getMsg.pass("digits"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^[\d() .:\-\+#]+$/.test(a.get("value")))}}],["validate-alpha",{errorMsg:Form.Validator.getMsg.pass("alpha"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^[a-zA-Z]+$/).test(a.get("value"))}}],["validate-alphanum",{errorMsg:Form.Validator.getMsg.pass("alphanum"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||!(/\W/).test(a.get("value"))}}],["validate-date",{errorMsg:function(a,c){if(Date.parse){var b=c.dateFormat||"%x";return Form.Validator.getMsg("dateSuchAs").substitute({date:new Date().format(b)})}else{return Form.Validator.getMsg("dateInFormatMDY")}},test:function(d,g){if(Form.Validator.getValidator("IsEmpty").test(d)){return true}var b=Locale.getCurrent().sets.Date,c=new RegExp([b.days,b.days_abbr,b.months,b.months_abbr].flatten().join("|"),"i"),h=d.get("value"),i=h.match(/[a-z]+/gi);if(i&&!i.every(c.exec,c)){return false}var a=Date.parse(h),e=g.dateFormat||"%x",f=a.format(e);if(f!="invalid date"){d.set("value",f)}return a.isValid()}}],["validate-email",{errorMsg:Form.Validator.getMsg.pass("email"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]\.?){0,63}[a-z0-9!#$%&'*+\/=?^_`{|}~-]@(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])$/i).test(a.get("value"))}}],["validate-url",{errorMsg:Form.Validator.getMsg.pass("url"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^(https?|ftp|rmtp|mms):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i).test(a.get("value"))}}],["validate-currency-dollar",{errorMsg:Form.Validator.getMsg.pass("currencyDollar"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/).test(a.get("value"))}}],["validate-one-required",{errorMsg:Form.Validator.getMsg.pass("oneRequired"),test:function(a,c){var b=document.id(c["validate-one-required"])||a.getParent(c["validate-one-required"]);return b.getElements("input").some(function(d){if(["checkbox","radio"].contains(d.get("type"))){return d.get("checked")}return d.get("value")})}}]]);Element.Properties.validator={set:function(a){this.get("validator").setOptions(a)},get:function(){var a=this.retrieve("validator");if(!a){a=new Form.Validator(this);this.store("validator",a)}return a}};Element.implement({validate:function(a){if(a){this.set("validator",a)}return this.get("validator").validate()}});Form.Validator.Inline=new Class({Extends:Form.Validator,options:{showError:function(a){if(a.reveal){a.reveal()}else{a.setStyle("display","block")}},hideError:function(a){if(a.dissolve){a.dissolve()}else{a.setStyle("display","none")}},scrollToErrorsOnSubmit:true,scrollToErrorsOnBlur:false,scrollToErrorsOnChange:false,scrollFxOptions:{transition:"quad:out",offset:{y:-20}}},initialize:function(a,b){this.parent(a,b);this.addEvent("onElementValidate",function(f,e,d,h){var g=this.getValidator(d);if(!f&&g.getError(e)){if(h){e.addClass("warning")}var c=this.makeAdvice(d,e,g.getError(e),h);this.insertAdvice(c,e);this.showAdvice(d,e)}else{this.hideAdvice(d,e)}})},makeAdvice:function(b,f,d,g){var e=(g)?this.warningPrefix:this.errorPrefix;e+=(this.options.useTitles)?f.title||d:d;var c=(g)?"warning-advice":"validation-advice";var a=this.getAdvice(b,f);if(a){a=a.set("html",e)}else{a=new Element("div",{html:e,styles:{display:"none"},id:"advice-"+b.split(":")[0]+"-"+this.getFieldId(f)}).addClass(c)}f.store("$moo:advice-"+b,a);return a},getFieldId:function(a){return a.id?a.id:a.id="input_"+a.name},showAdvice:function(b,c){var a=this.getAdvice(b,c);if(a&&!c.retrieve("$moo:"+this.getPropName(b))&&(a.getStyle("display")=="none"||a.getStyle("visiblity")=="hidden"||a.getStyle("opacity")==0)){c.store("$moo:"+this.getPropName(b),true);this.options.showError(a);this.fireEvent("showAdvice",[c,a,b])}},hideAdvice:function(b,c){var a=this.getAdvice(b,c);if(a&&c.retrieve("$moo:"+this.getPropName(b))){c.store("$moo:"+this.getPropName(b),false);this.options.hideError(a);this.fireEvent("hideAdvice",[c,a,b])}},getPropName:function(a){return"advice"+a},resetField:function(a){a=document.id(a);if(!a){return this}this.parent(a);a.get("validators").each(function(b){this.hideAdvice(b,a)},this);return this},getAllAdviceMessages:function(b,c){var a=[];if(b.hasClass("ignoreValidation")&&!c){return a}var d=b.get("validators").some(function(e){var g=e.test("^warn-")||b.hasClass("warnOnly");if(g){e=e.replace(/^warn-/,"")}var f=this.getValidator(e);if(!f){return}a.push({message:f.getError(b),warnOnly:g,passed:f.test(),validator:f})},this);return a},getAdvice:function(a,b){return b.retrieve("$moo:advice-"+a)},insertAdvice:function(a,b){var c=b.get("validatorProps");if(!c.msgPos||!document.id(c.msgPos)){if(b.type&&b.type.toLowerCase()=="radio"){b.getParent().adopt(a)}else{a.inject(document.id(b),"after")}}else{document.id(c.msgPos).grab(a)}},validateField:function(b,c,g){var f=this.parent(b,c);if(((this.options.scrollToErrorsOnSubmit&&g==null)||g)&&!f){var a=document.id(this).getElement(".validation-failed");var e=document.id(this).getParent();while(e!=document.body&&e.getScrollSize().y==e.getSize().y){e=e.getParent()}var d=e.retrieve("$moo:fvScroller");if(!d&&window.Fx&&Fx.Scroll){d=new Fx.Scroll(e,this.options.scrollFxOptions);e.store("$moo:fvScroller",d)}if(a){if(d){d.toElement(a)}else{e.scrollTo(e.getScroll().x,a.getPosition(e).y-20)}}}return f},watchFields:function(a){a.each(function(b){if(this.options.evaluateFieldsOnBlur){b.addEvent("blur",this.validationMonitor.pass([b,false,this.options.scrollToErrorsOnBlur],this))}if(this.options.evaluateFieldsOnChange){b.addEvent("change",this.validationMonitor.pass([b,true,this.options.scrollToErrorsOnChange],this))}},this)}});Form.Validator.addAllThese([["validate-enforce-oncheck",{test:function(a,c){var b=a.getParent("form").retrieve("validator");if(!b){return true}(c.toEnforce||document.id(c.enforceChildrenOf).getElements("input, select, textarea")).map(function(d){if(a.checked){b.enforceField(d)}else{b.ignoreField(d);b.resetField(d)}});return true}}],["validate-ignore-oncheck",{test:function(a,c){var b=a.getParent("form").retrieve("validator");if(!b){return true}(c.toIgnore||document.id(c.ignoreChildrenOf).getElements("input, select, textarea")).each(function(d){if(a.checked){b.ignoreField(d);b.resetField(d)}else{b.enforceField(d)}});return true}}],["validate-nospace",{errorMsg:function(){return Form.Validator.getMsg("noSpace")},test:function(a,b){return !a.get("value").test(/\s/)}}],["validate-toggle-oncheck",{test:function(b,d){var c=b.getParent("form").retrieve("validator");if(!c){return true}var a=d.toToggle||document.id(d.toToggleChildrenOf).getElements("input, select, textarea");if(!b.checked){a.each(function(e){c.ignoreField(e);c.resetField(e)})}else{a.each(function(e){c.enforceField(e)})}return true}}],["validate-reqchk-bynode",{errorMsg:function(){return Form.Validator.getMsg("reqChkByNode")},test:function(a,b){return(document.id(b.nodeId).getElements(b.selector||"input[type=checkbox], input[type=radio]")).some(function(c){return c.checked})}}],["validate-required-check",{errorMsg:function(a,b){return b.useTitle?a.get("title"):Form.Validator.getMsg("requiredChk")},test:function(a,b){return !!a.checked}}],["validate-reqchk-byname",{errorMsg:function(a,b){return Form.Validator.getMsg("reqChkByName").substitute({label:b.label||a.get("type")})},test:function(a,e){var c=e.groupName||a.get("name");var d=$$(document.getElementsByName(c)).some(function(g,f){return g.checked});var b=a.getParent("form").retrieve("validator");if(d&&b){b.resetField(a)}return d}}],["validate-match",{errorMsg:function(a,b){return Form.Validator.getMsg("match").substitute({matchName:b.matchName||document.id(b.matchInput).get("name")})},test:function(a,d){var b=a.get("value");var c=document.id(d.matchInput)&&document.id(d.matchInput).get("value");return b&&c?b==c:true}}],["validate-after-date",{errorMsg:function(a,b){return Form.Validator.getMsg("afterDate").substitute({label:b.afterLabel||(b.afterElement?Form.Validator.getMsg("startDate"):Form.Validator.getMsg("currentDate"))})},test:function(a,c){var d=document.id(c.afterElement)?Date.parse(document.id(c.afterElement).get("value")):new Date();var b=Date.parse(a.get("value"));return b&&d?b>=d:true}}],["validate-before-date",{errorMsg:function(a,b){return Form.Validator.getMsg("beforeDate").substitute({label:b.beforeLabel||(b.beforeElement?Form.Validator.getMsg("endDate"):Form.Validator.getMsg("currentDate"))})},test:function(a,c){var d=Date.parse(a.get("value"));var b=document.id(c.beforeElement)?Date.parse(document.id(c.beforeElement).get("value")):new Date();return b&&d?b>=d:true}}],["validate-custom-required",{errorMsg:function(){return Form.Validator.getMsg("required")},test:function(a,b){return a.get("value")!=b.emptyValue}}],["validate-same-month",{errorMsg:function(a,c){var d=document.id(c.sameMonthAs)&&document.id(c.sameMonthAs).get("value");var b=a.get("value");if(b!=""){return Form.Validator.getMsg(d?"sameMonth":"startMonth")}},test:function(c,d){var a=Date.parse(c.get("value"));var b=Date.parse(document.id(d.sameMonthAs)&&document.id(d.sameMonthAs).get("value"));return a&&b?a.format("%B")==b.format("%B"):true}}],["validate-cc-num",{errorMsg:function(b){var a=b.get("value").replace(/[^0-9]/g,"");return Form.Validator.getMsg("creditcard").substitute({length:a.length})},test:function(d){if(Form.Validator.getValidator("IsEmpty").test(d)){return true}var a=d.get("value");a=a.replace(/[^0-9]/g,"");var g=false;if(a.test(/^4[0-9]{12}([0-9]{3})?$/)){g="Visa"}else{if(a.test(/^5[1-5]([0-9]{14})$/)){g="Master Card"}else{if(a.test(/^3[47][0-9]{13}$/)){g="American Express"}else{if(a.test(/^6011[0-9]{12}$/)){g="Discover"}}}}if(g){var f=0;var c=0;for(var e=a.length-1;e>=0;--e){c=a.charAt(e).toInt();if(c==0){continue}if((a.length-e)%2==0){c+=c}if(c>9){c=c.toString().charAt(0).toInt()+c.toString().charAt(1).toInt()}f+=c}if((f%10)==0){return true}}var b="";while(a!=""){b+=" "+a.substr(0,4);a=a.substr(4)}d.getParent("form").retrieve("validator").ignoreField(d);d.set("value",b.clean());d.getParent("form").retrieve("validator").enforceField(d);return false}}]]);Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(a,b){this.elements=this.subject=$$(a);this.parent(b)},compute:function(b,j,a){var g={};for(var c in b){var d=b[c],f=j[c],e=g[c]={};for(var h in d){e[h]=this.parent(d[h],f[h],a)}}return g},set:function(c){for(var a in c){if(!this.elements[a]){continue}var b=c[a];for(var d in b){this.render(this.elements[a],d,b[d],this.options.unit)}}return this},start:function(f){if(!this.check(f)){return this}var a={},j={};for(var b in f){if(!this.elements[b]){continue}var d=f[b],c=a[b]={},e=j[b]={};for(var g in d){var h=this.prepare(this.elements[b],g,d[g]);c[g]=h.from;e[g]=h.to}}return this.parent(a,j)}});(function(){var b=function(f,e){var d=[];Object.each(e,function(g){Object.each(g,function(h){f.each(function(i){d.push(i+"-"+h+(i=="border"?"-width":""))})})});return d};var a=function(d,e){var f=0;Object.each(e,function(h,g){if(g.test(d)){f=f+h.toInt()}});return f};var c=function(d){return !!(!d||d.offsetHeight||d.offsetWidth)};Element.implement({measure:function(d){if(c(this)){return d.call(this)}var e=this.getParent(),h=[];while(!c(e)&&e!=document.body){h.push(e.expose());e=e.getParent()}var f=this.expose(),g=d.call(this);f();h.each(function(i){i()});return g},expose:function(){if(this.getStyle("display")!="none"){return function(){}}var d=this.style.cssText;this.setStyles({display:"block",position:"absolute",visibility:"hidden"});return function(){this.style.cssText=d}.bind(this)},getDimensions:function(h){h=Object.merge({computeSize:false},h);var d={x:0,y:0};var g=function(e,j){return(j.computeSize)?e.getComputedSize(j):e.getSize()};var i=this.getParent("body");if(i&&this.getStyle("display")=="none"){d=this.measure(function(){return g(this,h)})}else{if(i){try{d=g(this,h)}catch(f){}}}return Object.append(d,(d.x||d.x===0)?{width:d.x,height:d.y}:{x:d.width,y:d.height})},getComputedSize:function(e){e=Object.merge({styles:["padding","border"],planes:{height:["top","bottom"],width:["left","right"]},mode:"both"},e);var g={},f={width:0,height:0},d;if(e.mode=="vertical"){delete f.width;delete e.planes.width}else{if(e.mode=="horizontal"){delete f.height;delete e.planes.height}}b(e.styles,e.planes).each(function(h){g[h]=this.getStyle(h).toInt()},this);Object.each(e.planes,function(i,j){var h=j.capitalize(),k=this.getStyle(j);if(k=="auto"&&!d){d=this.getDimensions()}k=g[j]=(k=="auto")?d[j]:k.toInt();f["total"+h]=k;i.each(function(l){var m=a(l,g);f["computed"+l.capitalize()]=m;f["total"+h]+=m})},this);return Object.append(f,g)}})})();(function(b){var a=Element.Position={options:{relativeTo:document.body,position:{x:"center",y:"center"},offset:{x:0,y:0}},getOptions:function(c,d){d=Object.merge({},a.options,d);a.setPositionOption(d);a.setEdgeOption(d);a.setOffsetOption(c,d);a.setDimensionsOption(c,d);return d},setPositionOption:function(c){c.position=a.getCoordinateFromValue(c.position)},setEdgeOption:function(d){var c=a.getCoordinateFromValue(d.edge);d.edge=c?c:(d.position.x=="center"&&d.position.y=="center")?{x:"center",y:"center"}:{x:"left",y:"top"}},setOffsetOption:function(c,e){var f={x:0,y:0},d=c.measure(function(){return document.id(this.getOffsetParent())}),g=d.getScroll();if(!d||d==c.getDocument().body){return}f=d.measure(function(){var h=this.getPosition();if(this.getStyle("position")=="fixed"){var i=window.getScroll();h.x+=i.x;h.y+=i.y}return h});e.offset={parentPositioned:d!=document.id(e.relativeTo),x:e.offset.x-f.x+g.x,y:e.offset.y-f.y+g.y}},setDimensionsOption:function(c,d){d.dimensions=c.getDimensions({computeSize:true,styles:["padding","border","margin"]})},getPosition:function(c,e){var f={};e=a.getOptions(c,e);var g=document.id(e.relativeTo)||document.body;a.setPositionCoordinates(e,f,g);if(e.edge){a.toEdge(f,e)}var d=e.offset;f.left=((f.x>=0||d.parentPositioned||e.allowNegative)?f.x:0).toInt();f.top=((f.y>=0||d.parentPositioned||e.allowNegative)?f.y:0).toInt();a.toMinMax(f,e);if(e.relFixedPosition||g.getStyle("position")=="fixed"){a.toRelFixedPosition(g,f)}if(e.ignoreScroll){a.toIgnoreScroll(g,f)}if(e.ignoreMargins){a.toIgnoreMargins(f,e)}f.left=Math.ceil(f.left);f.top=Math.ceil(f.top);delete f.x;delete f.y;return f},setPositionCoordinates:function(g,h,i){var f=g.offset.y,e=g.offset.x,c=(i==document.body)?window.getScroll():i.getPosition(),j=c.y,d=c.x,k=window.getSize();switch(g.position.x){case"left":h.x=d+e;break;case"right":h.x=d+e+i.offsetWidth;break;default:h.x=d+((i==document.body?k.x:i.offsetWidth)/2)+e;break}switch(g.position.y){case"top":h.y=j+f;break;case"bottom":h.y=j+f+i.offsetHeight;break;default:h.y=j+((i==document.body?k.y:i.offsetHeight)/2)+f;break}},toMinMax:function(d,c){var f={left:"x",top:"y"},e;["minimum","maximum"].each(function(g){["left","top"].each(function(h){e=c[g]?c[g][f[h]]:null;if(e!=null&&((g=="minimum")?d[h]<e:d[h]>e)){d[h]=e}})})},toRelFixedPosition:function(d,c){var e=window.getScroll();c.top+=e.y;c.left+=e.x},toIgnoreScroll:function(d,c){var e=d.getScroll();c.top-=e.y;c.left-=e.x},toIgnoreMargins:function(d,c){d.left+=c.edge.x=="right"?c.dimensions["margin-right"]:(c.edge.x!="center"?-c.dimensions["margin-left"]:-c.dimensions["margin-left"]+((c.dimensions["margin-right"]+c.dimensions["margin-left"])/2));d.top+=c.edge.y=="bottom"?c.dimensions["margin-bottom"]:(c.edge.y!="center"?-c.dimensions["margin-top"]:-c.dimensions["margin-top"]+((c.dimensions["margin-bottom"]+c.dimensions["margin-top"])/2))},toEdge:function(g,f){var e={},c=f.dimensions,d=f.edge;switch(d.x){case"left":e.x=0;break;case"right":e.x=-c.x-c.computedRight-c.computedLeft;break;default:e.x=-(Math.round(c.totalWidth/2));break}switch(d.y){case"top":e.y=0;break;case"bottom":e.y=-c.y-c.computedTop-c.computedBottom;break;default:e.y=-(Math.round(c.totalHeight/2));break}g.x+=e.x;g.y+=e.y},getCoordinateFromValue:function(c){if(typeOf(c)!="string"){return c}c=c.toLowerCase();return{x:c.test("left")?"left":(c.test("right")?"right":"center"),y:c.test(/upper|top/)?"top":(c.test("bottom")?"bottom":"center")}}};Element.implement({position:function(c){if(c&&(c.x!=null||c.y!=null)){return(b?b.apply(this,arguments):this)}var d=this.setStyle("position","absolute").calculatePosition(c);return(c&&c.returnPos)?d:this.setStyles(d)},calculatePosition:function(c){return a.getPosition(this,c)}})})(Element.prototype.position);Fx.Move=new Class({Extends:Fx.Morph,options:{relativeTo:document.body,position:"center",edge:false,offset:{x:0,y:0}},start:function(a){var b=this.element,c=b.getStyles("top","left");if(c.top=="auto"||c.left=="auto"){b.setPosition(b.getPosition(b.getOffsetParent()))}return this.parent(b.position(Object.merge({},this.options,a,{returnPos:true})))}});Element.Properties.move={set:function(a){this.get("move").cancel().setOptions(a);return this},get:function(){var a=this.retrieve("move");if(!a){a=new Fx.Move(this,{link:"cancel"});this.store("move",a)}return a}};Element.implement({move:function(a){this.get("move").start(a);return this}});(function(){var a=function(c){var b=c.options.hideInputs;if(window.OverText){var d=[null];OverText.each(function(e){d.include("."+e.options.labelClass)});if(d){b+=d.join(", ")}}return(b)?c.element.getElements(b):null};Fx.Reveal=new Class({Extends:Fx.Morph,options:{link:"cancel",styles:["padding","border","margin"],transitionOpacity:!Browser.ie6,mode:"vertical",display:function(){return this.element.get("tag")!="tr"?"block":"table-row"},opacity:1,hideInputs:Browser.ie?"select, input, textarea, object, embed":null},dissolve:function(){if(!this.hiding&&!this.showing){if(this.element.getStyle("display")!="none"){this.hiding=true;this.showing=false;this.hidden=true;this.cssText=this.element.style.cssText;var c=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});if(this.options.transitionOpacity){c.opacity=this.options.opacity}var d={};Object.each(c,function(f,e){d[e]=[f,0]});this.element.setStyles({display:Function.from(this.options.display).call(this),overflow:"hidden"});var b=a(this);if(b){b.setStyle("visibility","hidden")}this.$chain.unshift(function(){if(this.hidden){this.hiding=false;this.element.style.cssText=this.cssText;this.element.setStyle("display","none");if(b){b.setStyle("visibility","visible")}}this.fireEvent("hide",this.element);this.callChain()}.bind(this));this.start(d)}else{this.callChain.delay(10,this);this.fireEvent("complete",this.element);this.fireEvent("hide",this.element)}}else{if(this.options.link=="chain"){this.chain(this.dissolve.bind(this))}else{if(this.options.link=="cancel"&&!this.hiding){this.cancel();this.dissolve()}}}return this},reveal:function(){if(!this.showing&&!this.hiding){if(this.element.getStyle("display")=="none"){this.hiding=false;this.showing=true;this.hidden=false;this.cssText=this.element.style.cssText;var c;this.element.measure(function(){c=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode})}.bind(this));if(this.options.heightOverride!=null){c.height=this.options.heightOverride.toInt()}if(this.options.widthOverride!=null){c.width=this.options.widthOverride.toInt()}if(this.options.transitionOpacity){this.element.setStyle("opacity",0);c.opacity=this.options.opacity}var d={height:0,display:Function.from(this.options.display).call(this)};Object.each(c,function(f,e){d[e]=0});d.overflow="hidden";this.element.setStyles(d);var b=a(this);if(b){b.setStyle("visibility","hidden")}this.$chain.unshift(function(){this.element.style.cssText=this.cssText;this.element.setStyle("display",Function.from(this.options.display).call(this));if(!this.hidden){this.showing=false}if(b){b.setStyle("visibility","visible")}this.callChain();this.fireEvent("show",this.element)}.bind(this));this.start(c)}else{this.callChain();this.fireEvent("complete",this.element);this.fireEvent("show",this.element)}}else{if(this.options.link=="chain"){this.chain(this.reveal.bind(this))}else{if(this.options.link=="cancel"&&!this.showing){this.cancel();this.reveal()}}}return this},toggle:function(){if(this.element.getStyle("display")=="none"){this.reveal()}else{this.dissolve()}return this},cancel:function(){this.parent.apply(this,arguments);if(this.cssText!=null){this.element.style.cssText=this.cssText}this.hiding=false;this.showing=false;return this}});Element.Properties.reveal={set:function(b){this.get("reveal").cancel().setOptions(b);return this},get:function(){var b=this.retrieve("reveal");if(!b){b=new Fx.Reveal(this);this.store("reveal",b)}return b}};Element.Properties.dissolve=Element.Properties.reveal;Element.implement({reveal:function(b){this.get("reveal").setOptions(b).reveal();return this},dissolve:function(b){this.get("reveal").setOptions(b).dissolve();return this},nix:function(b){var c=Array.link(arguments,{destroy:Type.isBoolean,options:Type.isObject});this.get("reveal").setOptions(b).dissolve().chain(function(){this[c.destroy?"destroy":"dispose"]()}.bind(this));return this},wink:function(){var b=Array.link(arguments,{duration:Type.isNumber,options:Type.isObject});var c=this.get("reveal").setOptions(b.options);c.reveal().chain(function(){(function(){c.dissolve()}).delay(b.duration||2000)})}})})();(function(){Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(c,d){this.element=this.subject=document.id(c);this.parent(d);if(typeOf(this.element)!="element"){this.element=document.id(this.element.getDocument().body)}if(this.options.wheelStops){var e=this.element,b=this.cancel.pass(false,this);this.addEvent("start",function(){e.addEvent("mousewheel",b)},true);this.addEvent("complete",function(){e.removeEvent("mousewheel",b)},true)}},set:function(){var b=Array.flatten(arguments);if(Browser.firefox){b=[Math.round(b[0]),Math.round(b[1])]}this.element.scrollTo(b[0],b[1]);return this},compute:function(c,d,b){return[0,1].map(function(e){return Fx.compute(c[e],d[e],b)})},start:function(c,d){if(!this.check(c,d)){return this}var b=this.element.getScroll();return this.parent([b.x,b.y],[c,d])},calculateScroll:function(h,i){var b=this.element,e=b.getScrollSize(),d=b.getScroll(),f=b.getSize(),c=this.options.offset,g={x:h,y:i};for(var j in g){if(!g[j]&&g[j]!==0){g[j]=d[j]}if(typeOf(g[j])!="number"){g[j]=e[j]-f[j]}g[j]+=c[j]}return[g.x,g.y]},toTop:function(){return this.start.apply(this,this.calculateScroll(false,0))},toLeft:function(){return this.start.apply(this,this.calculateScroll(0,false))},toRight:function(){return this.start.apply(this,this.calculateScroll("right",false))},toBottom:function(){return this.start.apply(this,this.calculateScroll(false,"bottom"))},toElement:function(c,b){b=b?Array.from(b):["x","y"];var e=a(this.element)?{x:0,y:0}:this.element.getScroll();var d=Object.map(document.id(c).getPosition(this.element),function(g,f){return b.contains(f)?g+e[f]:false});return this.start.apply(this,this.calculateScroll(d.x,d.y))},toElementEdge:function(e,b,f){b=b?Array.from(b):["x","y"];e=document.id(e);var j={},g=e.getPosition(this.element),i=e.getSize(),h=this.element.getScroll(),c=this.element.getSize(),d={x:g.x+i.x,y:g.y+i.y};["x","y"].each(function(k){if(b.contains(k)){if(d[k]>h[k]+c[k]){j[k]=d[k]-c[k]}if(g[k]<h[k]){j[k]=g[k]}}if(j[k]==null){j[k]=h[k]}if(f&&f[k]){j[k]=j[k]+f[k]}},this);if(j.x!=h.x||j.y!=h.y){this.start(j.x,j.y)}return this},toElementCenter:function(d,b,e){b=b?Array.from(b):["x","y"];d=document.id(d);var i={},f=d.getPosition(this.element),h=d.getSize(),g=this.element.getScroll(),c=this.element.getSize();["x","y"].each(function(j){if(b.contains(j)){i[j]=f[j]-(c[j]-h[j])/2}if(i[j]==null){i[j]=g[j]}if(e&&e[j]){i[j]=i[j]+e[j]}},this);if(i.x!=g.x||i.y!=g.y){this.start(i.x,i.y)}return this}});function a(b){return(/^(?:body|html)$/i).test(b.tagName)}})();Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical",wrapper:false,hideOverflow:true,resetHeight:false},initialize:function(a,b){a=this.element=this.subject=document.id(a);this.parent(b);b=this.options;var d=a.retrieve("wrapper"),c=a.getStyles("margin","position","overflow");if(b.hideOverflow){c=Object.append(c,{overflow:"hidden"})}if(b.wrapper){d=document.id(b.wrapper).setStyles(c)}if(!d){d=new Element("div",{styles:c}).wraps(a)}a.store("wrapper",d).setStyle("margin",0);if(a.getStyle("overflow")=="visible"){a.setStyle("overflow","hidden")}this.now=[];this.open=true;this.wrapper=d;this.addEvent("complete",function(){this.open=(d["offset"+this.layout.capitalize()]!=0);if(this.open&&this.options.resetHeight){d.setStyle("height","")}},true)},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth},set:function(a){this.element.setStyle(this.margin,a[0]);this.wrapper.setStyle(this.layout,a[1]);return this},compute:function(b,c,a){return[0,1].map(function(d){return Fx.compute(b[d],c[d],a)})},start:function(c,f){if(!this.check(c,f)){return this}this[f||this.options.mode]();var e=this.element.getStyle(this.margin).toInt(),d=this.wrapper.getStyle(this.layout).toInt(),a=[[e,d],[0,this.offset]],b=[[e,d],[-this.offset,0]],g;switch(c){case"in":g=a;break;case"out":g=b;break;case"toggle":g=(d==0)?a:b}return this.parent(g[0],g[1])},slideIn:function(a){return this.start("in",a)},slideOut:function(a){return this.start("out",a)},hide:function(a){this[a||this.options.mode]();this.open=false;return this.set([-this.offset,0])},show:function(a){this[a||this.options.mode]();this.open=true;return this.set([0,this.offset])},toggle:function(a){return this.start("toggle",a)}});Element.Properties.slide={set:function(a){this.get("slide").cancel().setOptions(a);return this},get:function(){var a=this.retrieve("slide");if(!a){a=new Fx.Slide(this,{link:"cancel"});this.store("slide",a)}return a}};Element.implement({slide:function(b,c){b=b||"toggle";var d=this.get("slide"),e;switch(b){case"hide":d.hide(c);break;case"show":d.show(c);break;case"toggle":var a=this.retrieve("slide:flag",d.open);d[a?"slideOut":"slideIn"](c);this.store("slide:flag",!a);e=true;break;default:d.start(b,c)}if(!e){this.eliminate("slide:flag")}return this}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:"left",y:"top"}},initialize:function(){var b=Array.link(arguments,{options:Type.isObject,element:function(c){return c!=null}});this.element=document.id(b.element);this.document=this.element.getDocument();this.setOptions(b.options||{});var a=typeOf(this.options.handle);this.handles=((a=="array"||a=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element;this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.ie)?"selectstart":"mousedown";if(Browser.ie&&!Drag.ondragstartFixed){document.ondragstart=Function.from(false);Drag.ondragstartFixed=true}this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:Function.from(false)};this.attach()},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);return this},start:function(b){var g=this.options;if(b.rightClick){return}if(g.preventDefault){b.preventDefault()}if(g.stopPropagation){b.stopPropagation()}this.mouse.start=b.page;this.fireEvent("beforeStart",this.element);var e=g.limit;this.limit={x:[],y:[]};var j,a;for(j in g.modifiers){if(!g.modifiers[j]){continue}var h=this.element.getStyle(g.modifiers[j]);if(h&&!h.match(/px$/)){if(!a){a=this.element.getCoordinates(this.element.getOffsetParent())}h=a[g.modifiers[j]]}if(g.style){this.value.now[j]=(h||0).toInt()}else{this.value.now[j]=this.element[g.modifiers[j]]}if(g.invert){this.value.now[j]*=-1}this.mouse.pos[j]=b.page[j]-this.value.now[j];if(e&&e[j]){var d=2;while(d--){var f=e[j][d];if(f||f===0){this.limit[j][d]=(typeof f=="function")?f():f}}}}if(typeOf(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid}}var c={mousemove:this.bound.check,mouseup:this.bound.cancel};c[this.selection]=this.bound.eventStop;this.document.addEvents(c)},check:function(b){if(this.options.preventDefault){b.preventDefault()}var a=Math.round(Math.sqrt(Math.pow(b.page.x-this.mouse.start.x,2)+Math.pow(b.page.y-this.mouse.start.y,2)));if(a>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent("start",[this.element,b]).fireEvent("snap",this.element)}},drag:function(a){var b=this.options;if(b.preventDefault){a.preventDefault()}this.mouse.now=a.page;for(var c in b.modifiers){if(!b.modifiers[c]){continue}this.value.now[c]=this.mouse.now[c]-this.mouse.pos[c];if(b.invert){this.value.now[c]*=-1}if(b.limit&&this.limit[c]){if((this.limit[c][1]||this.limit[c][1]===0)&&(this.value.now[c]>this.limit[c][1])){this.value.now[c]=this.limit[c][1]}else{if((this.limit[c][0]||this.limit[c][0]===0)&&(this.value.now[c]<this.limit[c][0])){this.value.now[c]=this.limit[c][0]}}}if(b.grid[c]){this.value.now[c]-=((this.value.now[c]-(this.limit[c][0]||0))%b.grid[c])}if(b.style){this.element.setStyle(b.modifiers[c],this.value.now[c]+b.unit)}else{this.element[b.modifiers[c]]=this.value.now[c]}}this.fireEvent("drag",[this.element,a])},cancel:function(a){this.document.removeEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});if(a){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element)}},stop:function(a){var b={mousemove:this.bound.drag,mouseup:this.bound.stop};b[this.selection]=this.bound.eventStop;this.document.removeEvents(b);if(a){this.fireEvent("complete",[this.element,a])}}});Element.implement({makeResizable:function(b){var a=new Drag(this,Object.merge({modifiers:{x:"width",y:"height"}},b));this.store("resizer",a);return a.addEvent("drag",function(){this.fireEvent("resize",a)}.bind(this))}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false,precalculate:false,includeMargins:true,checkDroppables:true},initialize:function(a,b){this.parent(a,b);a=this.element;this.droppables=$$(this.options.droppables);this.container=document.id(this.options.container);if(this.container&&typeOf(this.container)!="element"){this.container=document.id(this.container.getDocument().body)}if(this.options.style){if(this.options.modifiers.x=="left"&&this.options.modifiers.y=="top"){var c=a.getOffsetParent(),d=a.getStyles("left","top");if(c&&(d.left=="auto"||d.top=="auto")){a.setPosition(a.getPosition(c))}}if(a.getStyle("position")=="static"){a.setStyle("position","absolute")}}this.addEvent("start",this.checkDroppables,true);this.overed=null},start:function(a){if(this.container){this.options.limit=this.calculateLimit()}if(this.options.precalculate){this.positions=this.droppables.map(function(b){return b.getCoordinates()})}this.parent(a)},calculateLimit:function(){var g=this.element,b=this.container,l=document.id(g.getOffsetParent())||document.body,d=b.getCoordinates(l),i={},h={},e={},c={},m={};["top","right","bottom","left"].each(function(q){i[q]=g.getStyle("margin-"+q).toInt();h[q]=g.getStyle("border-"+q).toInt();e[q]=b.getStyle("margin-"+q).toInt();c[q]=b.getStyle("border-"+q).toInt();m[q]=l.getStyle("padding-"+q).toInt()},this);var p=g.offsetWidth+i.left+i.right,j=g.offsetHeight+i.top+i.bottom,k=0,o=0,n=d.right-c.right-p,a=d.bottom-c.bottom-j;if(this.options.includeMargins){k+=i.left;o+=i.top}else{n+=i.right;a+=i.bottom}if(g.getStyle("position")=="relative"){var f=g.getCoordinates(l);f.left-=g.getStyle("left").toInt();f.top-=g.getStyle("top").toInt();k-=f.left;o-=f.top;if(b.getStyle("position")!="relative"){k+=c.left;o+=c.top}n+=i.left-f.left;a+=i.top-f.top;if(b!=l){k+=e.left+m.left;o+=((Browser.ie6||Browser.ie7)?0:e.top)+m.top}}else{k-=i.left;o-=i.top;if(b!=l){k+=d.left+c.left;o+=d.top+c.top}}return{x:[k,n],y:[o,a]}},getDroppableCoordinates:function(a){var b=a.getCoordinates();if(a.getStyle("position")=="fixed"){var c=window.getScroll();b.left+=c.x;b.right+=c.x;b.top+=c.y;b.bottom+=c.y}return b},checkDroppables:function(){var a=this.droppables.filter(function(b,c){b=this.positions?this.positions[c]:this.getDroppableCoordinates(b);var d=this.mouse.now;return(d.x>b.left&&d.x<b.right&&d.y<b.bottom&&d.y>b.top)},this).getLast();if(this.overed!=a){if(this.overed){this.fireEvent("leave",[this.element,this.overed])}if(a){this.fireEvent("enter",[this.element,a])}this.overed=a}},drag:function(a){this.parent(a);if(this.options.checkDroppables&&this.droppables.length){this.checkDroppables()}},stop:function(a){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed,a]);this.overed=null;return this.parent(a)}});Element.implement({makeDraggable:function(b){var a=new Drag.Move(this,b);this.store("dragger",a);return a}});var Sortables=new Class({Implements:[Events,Options],options:{opacity:1,clone:false,revert:false,handle:false,dragOptions:{}},initialize:function(a,b){this.setOptions(b);this.elements=[];this.lists=[];this.idle=true;this.addLists($$(document.id(a)||a));if(!this.options.clone){this.options.revert=false}if(this.options.revert){this.effect=new Fx.Morph(null,Object.merge({duration:250,link:"cancel"},this.options.revert))}},attach:function(){this.addLists(this.lists);return this},detach:function(){this.lists=this.removeLists(this.lists);return this},addItems:function(){Array.flatten(arguments).each(function(a){this.elements.push(a);var b=a.retrieve("sortables:start",function(c){this.start.call(this,c,a)}.bind(this));(this.options.handle?a.getElement(this.options.handle)||a:a).addEvent("mousedown",b)},this);return this},addLists:function(){Array.flatten(arguments).each(function(a){this.lists.include(a);this.addItems(a.getChildren())},this);return this},removeItems:function(){return $$(Array.flatten(arguments).map(function(a){this.elements.erase(a);var b=a.retrieve("sortables:start");(this.options.handle?a.getElement(this.options.handle)||a:a).removeEvent("mousedown",b);return a},this))},removeLists:function(){return $$(Array.flatten(arguments).map(function(a){this.lists.erase(a);this.removeItems(a.getChildren());return a},this))},getClone:function(c,b){if(!this.options.clone){return new Element(b.tagName).inject(document.body)}if(typeOf(this.options.clone)=="function"){return this.options.clone.call(this,c,b,this.list)}var a=b.clone(true).setStyles({margin:0,position:"absolute",visibility:"hidden",width:b.getStyle("width")}).addEvent("mousedown",function(d){b.fireEvent("mousedown",d)});if(a.get("html").test("radio")){a.getElements("input[type=radio]").each(function(e,d){e.set("name","clone_"+d);if(e.get("checked")){b.getElements("input[type=radio]")[d].set("checked",true)}})}return a.inject(this.list).setPosition(b.getPosition(b.getOffsetParent()))},getDroppables:function(){var a=this.list.getChildren().erase(this.clone).erase(this.element);if(!this.options.constrain){a.append(this.lists).erase(this.list)}return a},insert:function(a,b){var c="inside";if(this.lists.contains(b)){this.list=b;this.drag.droppables=this.getDroppables()}else{c=this.element.getAllPrevious().contains(b)?"before":"after"}this.element.inject(b,c);this.fireEvent("sort",[this.element,this.clone])},start:function(b,a){if(!this.idle||b.rightClick||["button","input","a","textarea"].contains(b.target.get("tag"))){return}this.idle=false;this.element=a;this.opacity=a.getStyle("opacity");this.list=a.getParent();this.clone=this.getClone(b,a);this.drag=new Drag.Move(this.clone,Object.merge({droppables:this.getDroppables()},this.options.dragOptions)).addEvents({onSnap:function(){b.stop();this.clone.setStyle("visibility","visible");this.element.setStyle("opacity",this.options.opacity||0);this.fireEvent("start",[this.element,this.clone])}.bind(this),onEnter:this.insert.bind(this),onCancel:this.end.bind(this),onComplete:this.end.bind(this)});this.clone.inject(this.element,"before");this.drag.start(b)},end:function(){this.drag.detach();this.element.setStyle("opacity",this.opacity);if(this.effect){var c=this.element.getStyles("width","height"),a=this.clone,d=a.computePosition(this.element.getPosition(this.clone.getOffsetParent()));var b=function(){this.removeEvent("cancel",b);a.destroy()};this.effect.element=a;this.effect.start({top:d.top,left:d.left,width:c.width,height:c.height,opacity:0.25}).addEvent("cancel",b).chain(b)}else{this.clone.destroy()}this.reset()},reset:function(){this.idle=true;this.fireEvent("complete",this.element)},serialize:function(){var b=Array.link(arguments,{modifier:Type.isFunction,index:function(d){return d!=null}});var c=this.lists.map(function(d){return d.getChildren().map(b.modifier||function(e){return e.get("id")},this)},this);var a=b.index;if(this.lists.length==1){a=0}return(a||a===0)&&a>=0&&a<this.lists.length?c[a]:c}});Request.JSONP=new Class({Implements:[Chain,Events,Options],options:{onRequest:function(a){if(this.options.log&&window.console&&console.log){console.log("JSONP retrieving script with url:"+a)}},onError:function(a){if(this.options.log&&window.console&&console.warn){console.warn("JSONP "+a+" will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs")}},url:"",callbackKey:"callback",injectScript:document.head,data:"",link:"ignore",timeout:0,log:false},initialize:function(a){this.setOptions(a)},send:function(c){if(!Request.prototype.check.call(this,c)){return this}this.running=true;var f=typeOf(c);if(f=="string"||f=="element"){c={data:c}}c=Object.merge(this.options,c||{});var a=c.data;switch(typeOf(a)){case"element":a=document.id(a).toQueryString();break;case"object":case"hash":a=Object.toQueryString(a)}var b=this.index=Request.JSONP.counter++;var e=c.url+(c.url.test("\\?")?"&":"?")+(c.callbackKey)+"=Request.JSONP.request_map.request_"+b+(a?"&"+a:"");if(e.length>2083){this.fireEvent("error",e)}Request.JSONP.request_map["request_"+b]=function(){this.success(arguments,b)}.bind(this);var d=this.getScript(e).inject(c.injectScript);this.fireEvent("request",[e,d]);if(c.timeout){this.timeout.delay(c.timeout,this)}return this},getScript:function(a){if(!this.script){this.script=new Element("script",{type:"text/javascript",async:true,src:a})}return this.script},success:function(a,b){if(!this.running){return}this.clear().fireEvent("complete",a).fireEvent("success",a).callChain()},cancel:function(){if(this.running){this.clear().fireEvent("cancel")}return this},isRunning:function(){return !!this.running},clear:function(){this.running=false;if(this.script){this.script.destroy();this.script=null}return this},timeout:function(){if(this.running){this.running=false;this.fireEvent("timeout",[this.script.get("src"),this.script]).fireEvent("failure").cancel()}return this}});Request.JSONP.counter=0;Request.JSONP.request_map={};Request.implement({options:{initialDelay:5000,delay:5000,limit:60000},startTimer:function(a){var b=function(){if(!this.running){this.send({data:a})}};this.lastDelay=this.options.initialDelay;this.timer=b.delay(this.lastDelay,this);this.completeCheck=function(c){clearTimeout(this.timer);this.lastDelay=(c)?this.options.delay:(this.lastDelay+this.options.delay).min(this.options.limit);this.timer=b.delay(this.lastDelay,this)};return this.addEvent("complete",this.completeCheck)},stopTimer:function(){clearTimeout(this.timer);return this.removeEvent("complete",this.completeCheck)}});Hash.Cookie=new Class({Extends:Cookie,options:{autoSave:true},initialize:function(a,b){this.parent(a,b);this.load()},save:function(){var a=JSON.encode(this.hash);if(!a||a.length>4096){return false}if(a=="{}"){this.dispose()}else{this.write(a)}return true},load:function(){this.hash=new Hash(JSON.decode(this.read(),true));return this}});Hash.each(Hash.prototype,function(a,b){if(typeof a=="function"){Hash.Cookie.implement(b,function(){var c=a.apply(this.hash,arguments);if(this.options.autoSave){this.save()}return c})}});var Scroller=new Class({Implements:[Events,Options],options:{area:20,velocity:1,onChange:function(a,b){this.element.scrollTo(a,b)},fps:50},initialize:function(a,b){this.setOptions(b);this.element=document.id(a);this.docBody=document.id(this.element.getDocument().body);this.listener=(typeOf(this.element)!="element")?this.docBody:this.element;this.timer=null;this.bound={attach:this.attach.bind(this),detach:this.detach.bind(this),getCoords:this.getCoords.bind(this)}},start:function(){this.listener.addEvents({mouseover:this.bound.attach,mouseleave:this.bound.detach});return this},stop:function(){this.listener.removeEvents({mouseover:this.bound.attach,mouseleave:this.bound.detach});this.detach();this.timer=clearInterval(this.timer);return this},attach:function(){this.listener.addEvent("mousemove",this.bound.getCoords)},detach:function(){this.listener.removeEvent("mousemove",this.bound.getCoords);this.timer=clearInterval(this.timer)},getCoords:function(a){this.page=(this.listener.get("tag")=="body")?a.client:a.page;if(!this.timer){this.timer=this.scroll.periodical(Math.round(1000/this.options.fps),this)}},scroll:function(){var f=this.element.getSize(),d=this.element.getScroll(),c=this.element!=this.docBody?this.element.getOffsets():{x:0,y:0},e=this.element.getScrollSize(),b={x:0,y:0},g=this.options.area.top||this.options.area,a=this.options.area.bottom||this.options.area;for(var h in this.page){if(this.page[h]<(g+c[h])&&d[h]!=0){b[h]=(this.page[h]-g-c[h])*this.options.velocity}else{if(this.page[h]+a>(f[h]+c[h])&&d[h]+f[h]!=e[h]){b[h]=(this.page[h]-f[h]+a-c[h])*this.options.velocity}}b[h]=b[h].round()}if(b.y||b.x){this.fireEvent("change",[d.x+b.x,d.y+b.y])}}});Element.implement({removeClassAll:function(){this.erase("class");return this},removeClasses:function(a){this.className=this.className.replace(new RegExp("\\b("+a.replace(/\s+/g,"|")+")\\b","g")," ").clean();return this}});Element.implement(function(){function a(f,d,c){var e=this;if(typeOf(d)=="function"){c=d;d=undefined}new Fx.Morph(this,{duration:(d==undefined)?500:d,onComplete:function(){if(c!=undefined){c.call(this)}}}).start({opacity:(f=="out")?[1,0]:[0,1]}).chain(function(){if(f=="out"&&this.element.retrieve("hiding")){this.element.setStyle("display","none")}if(f=="out"){this.element.store("hiding",false)}})}function b(c){return c.getStyle("display")!="none"}return{fadeIn:function(d,c){if(b(this)&&!this.retrieve("hiding")){return this}this.store("hiding",false);this.setStyles({visibility:"visible",display:(this.retrieve("displayState")!=null)?this.retrieve("displayState"):"block",opacity:0});a.apply(this,["in"].combine(arguments));return this},fadeOut:function(d,c){if(!b(this)){return this}this.store("displayState",this.getStyle("display"));this.store("hiding",true);a.apply(this,["out"].combine(arguments));return this}}}());Function.implement({bindEvent:function(b,a){var c=this;a=Array.from(a);return function(d){return c.apply(this,[d,b].combine(a))}}});String.implement({toBoolean:function(){return"true"==this},toElement:function(){var a=document.createElement("div");a.innerHTML=this;return new Elements(a.childNodes)},limitText:function(a,b){var c=this.split(" ").slice(0,a).join(" ");if(b!==undefined){c+=b}return c},cleanHtml:function(){var a=document.createElement("DIV");a.innerHTML=this;return a.textContent||a.innerText}});Class.Singleton=new Class({initialize:function(a,b){var c=new Class(a);return new c(b)}});(function(){var a={};$publish=function(c,b){a[c]&&a[c].each(function(d){d.apply(d,b)})};$subscribe=function(c,b){if(!a[c]){a[c]=[]}a[c].push(b);return[c,b]};$unsubscribe=function(b){var c=b[0];a[c]&&a[c].each(function(e,d){if(e==b[1]){a[c].erase(e)}})}})();window.innerShiv=(function(){var a;var b=document;var e;var d="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" ");function c(f,g,h){return(/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i).test(h)?f:g+"></"+h+">"}return function(f,l){if(!a){a=b.createElement("div");a.innerHTML="<nav></nav>";e=a.childNodes.length!==1;if(e){var n=b.createDocumentFragment();var g=d.length;while(g--){n.createElement(d[g])}n.appendChild(a)}}f=f.replace(/^\s\s*/,"").replace(/\s\s*$/,"").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/(<([\w:]+)[^>]*?)\/>/g,c);var o;if(o=f.match(/^<(tbody|tr|td|col|colgroup|thead|tfoot)/i)){a.innerHTML="<table>"+f+"</table>"}else{a.innerHTML=f}var m;if(o){m=a.getElementsByTagName(o[1])[0].parentNode}else{m=a}if(l===false){return m.childNodes}var k=b.createDocumentFragment();var h=m.childNodes.length;while(h--){k.appendChild(m.firstChild)}return k}}());this.Handlebars={};(function(b){b.VERSION="1.0.rc.1";b.helpers={};b.partials={};b.registerHelper=function(f,d,e){if(e){d.not=e}this.helpers[f]=d};b.registerPartial=function(d,e){this.partials[d]=e};b.registerHelper("helperMissing",function(d){if(arguments.length===2){return undefined}else{throw new Error("Could not find property '"+d+"'")}});var c=Object.prototype.toString,a="[object Function]";b.registerHelper("blockHelperMissing",function(d,g){var f=g.inverse||function(){},e=g.fn;var h="";var i=c.call(d);if(i===a){d=d.call(this)}if(d===true){return e(this)}else{if(d===false||d==null){return f(this)}else{if(i==="[object Array]"){if(d.length>0){return b.helpers.each(d,g)}else{return f(this)}}else{return e(d)}}}});b.K=function(){};b.createFrame=Object.create||function(e){b.K.prototype=e;var d=new b.K();b.K.prototype=null;return d};b.registerHelper("each",function(d,l){var f=l.fn,h=l.inverse;var m="",e;if(l.data){e=b.createFrame(l.data)}if(d&&d.length>0){for(var g=0,k=d.length;g<k;g++){if(e){e.index=g}m=m+f(d[g],{data:e})}}else{m=h(this)}return m});b.registerHelper("if",function(d,e){var f=c.call(d);if(f===a){d=d.call(this)}if(!d||b.Utils.isEmpty(d)){return e.inverse(this)}else{return e.fn(this)}});b.registerHelper("unless",function(d,g){var e=g.fn,f=g.inverse;g.fn=f;g.inverse=e;return b.helpers["if"].call(this,d,g)});b.registerHelper("with",function(d,e){return e.fn(d)});b.registerHelper("log",function(d){b.log(d)})}(this.Handlebars));Handlebars.Exception=function(a){var c=Error.prototype.constructor.apply(this,arguments);for(var b in c){if(c.hasOwnProperty(b)){this[b]=c[b]}}this.message=c.message};Handlebars.Exception.prototype=new Error();Handlebars.SafeString=function(a){this.string=a};Handlebars.SafeString.prototype.toString=function(){return this.string.toString()};(function(){var b={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};var a=/[&<>"'`]/g;var d=/[&<>"'`]/;var c=function(e){return b[e]||"&amp;"};Handlebars.Utils={escapeExpression:function(e){if(e instanceof Handlebars.SafeString){return e.toString()}else{if(e==null||e===false){return""}}if(!d.test(e)){return e}return e.replace(a,c)},isEmpty:function(e){if(typeof e==="undefined"){return true}else{if(e===null){return true}else{if(e===false){return true}else{if(Object.prototype.toString.call(e)==="[object Array]"&&e.length===0){return true}else{return false}}}}}}})();Handlebars.VM={template:function(b){var a={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(e,d,c){var f=this.programs[e];if(c){return Handlebars.VM.program(d,c)}else{if(f){return f}else{f=this.programs[e]=Handlebars.VM.program(d);return f}}},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(c,d){d=d||{};return b.call(a,Handlebars,c,d.helpers,d.partials,d.data)}},programWithDepth:function(d,c,a){var b=Array.prototype.slice.call(arguments,2);return function(e,f){f=f||{};return d.apply(this,[e,f.data||c].concat(b))}},program:function(b,a){return function(c,d){d=d||{};return b(c,d.data||a)}},noop:function(){return""},invokePartial:function(f,d,a,c,g,b){var e={helpers:c,partials:g,data:b};if(f===undefined){throw new Handlebars.Exception("The partial "+d+" could not be found")}else{if(f instanceof Function){return f(a,e)}else{if(!Handlebars.compile){throw new Handlebars.Exception("The partial "+d+" could not be compiled when running in runtime-only mode")}else{g[d]=Handlebars.compile(f,{data:b!==undefined});return g[d](a,e)}}}}};Handlebars.template=Handlebars.VM.template;
/*
 * typeahead.js 0.9.3
 * https://github.com/twitter/typeahead
 * Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT
 */
(function(a){var l="0.9.3";var k={isMsie:function(){var m=/(msie) ([\w.]+)/i.exec(navigator.userAgent);return m?parseInt(m[2],10):false},isBlankString:function(m){return !m||/^\s*$/.test(m)},escapeRegExChars:function(m){return m.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(m){return typeof m==="string"},isNumber:function(m){return typeof m==="number"},isArray:a.isArray,isFunction:a.isFunction,isObject:a.isPlainObject,isUndefined:function(m){return typeof m==="undefined"},bind:a.proxy,bindAll:function(n){var o;for(var m in n){a.isFunction(o=n[m])&&(n[m]=a.proxy(o,n))}},indexOf:function(m,o){for(var n=0;n<m.length;n++){if(m[n]===o){return n}}return -1},each:a.each,map:a.map,filter:a.grep,every:function(m,o){var n=true;if(!m){return n}a.each(m,function(p,q){if(!(n=o.call(null,q,p,m))){return false}});return !!n},some:function(m,o){var n=false;if(!m){return n}a.each(m,function(p,q){if(n=o.call(null,q,p,m)){return false}});return !!n},mixin:a.extend,getUniqueId:function(){var m=0;return function(){return m++}}(),defer:function(m){setTimeout(m,0)},debounce:function(m,q,n){var p,o;return function(){var t=this,r=arguments,u,s;u=function(){p=null;if(!n){o=m.apply(t,r)}};s=n&&!p;clearTimeout(p);p=setTimeout(u,q);if(s){o=m.apply(t,r)}return o}},throttle:function(o,t){var n,m,s,r,q,p;q=0;p=function(){q=new Date();s=null;r=o.apply(n,m)};return function(){var u=new Date(),v=t-(u-q);n=this;m=arguments;if(v<=0){clearTimeout(s);s=null;q=u;r=o.apply(n,m)}else{if(!s){s=setTimeout(p,v)}}return r}},tokenizeQuery:function(m){return a.trim(m).toLowerCase().split(/[\s]+/)},tokenizeText:function(m){return a.trim(m).toLowerCase().split(/[\s\-_]+/)},getProtocol:function(){return location.protocol},noop:function(){}};var e=function(){var m=/\s+/;return{on:function(p,n){var o;if(!n){return this}this._callbacks=this._callbacks||{};p=p.split(m);while(o=p.shift()){this._callbacks[o]=this._callbacks[o]||[];this._callbacks[o].push(n)}return this},trigger:function(q,o){var p,n;if(!this._callbacks){return this}q=q.split(m);while(p=q.shift()){if(n=this._callbacks[p]){for(var r=0;r<n.length;r+=1){n[r].call(this,{type:p,data:o})}}}return this}}}();var d=function(){var n="typeahead:";function m(p){if(!p||!p.el){a.error("EventBus initialized without el")}this.$el=a(p.el)}k.mixin(m.prototype,{trigger:function(p){var o=[].slice.call(arguments,1);this.$el.trigger(n+p,o)}});return m}();var g=function(){var p,q;try{p=window.localStorage;p.setItem("~~~","!");p.removeItem("~~~")}catch(o){p=null}function s(t){this.prefix=["__",t,"__"].join("");this.ttlKey="__ttl__";this.keyMatcher=new RegExp("^"+this.prefix)}if(p&&window.JSON){q={_prefix:function(t){return this.prefix+t},_ttlKey:function(t){return this._prefix(t)+this.ttlKey},get:function(t){if(this.isExpired(t)){this.remove(t)}return m(p.getItem(this._prefix(t)))},set:function(t,v,u){if(k.isNumber(u)){p.setItem(this._ttlKey(t),n(r()+u))}else{p.removeItem(this._ttlKey(t))}return p.setItem(this._prefix(t),n(v))},remove:function(t){p.removeItem(this._ttlKey(t));p.removeItem(this._prefix(t));return this},clear:function(){var t,u,v=[],w=p.length;for(t=0;t<w;t++){if((u=p.key(t)).match(this.keyMatcher)){v.push(u.replace(this.keyMatcher,""))}}for(t=v.length;t--;){this.remove(v[t])}return this},isExpired:function(t){var u=m(p.getItem(this._ttlKey(t)));return k.isNumber(u)&&r()>u?true:false}}}else{q={get:k.noop,set:k.noop,remove:k.noop,clear:k.noop,isExpired:k.noop}}k.mixin(s.prototype,q);return s;function r(){return new Date().getTime()}function n(t){return JSON.stringify(k.isUndefined(t)?null:t)}function m(t){return JSON.parse(t)}}();var h=function(){function m(n){k.bindAll(this);n=n||{};this.sizeLimit=n.sizeLimit||10;this.cache={};this.cachedKeysByAge=[]}k.mixin(m.prototype,{get:function(n){return this.cache[n]},set:function(p,o){var n;if(this.cachedKeysByAge.length===this.sizeLimit){n=this.cachedKeysByAge.shift();delete this.cache[n]}this.cache[p]=o;this.cachedKeysByAge.push(p)}});return m}();var i=function(){var r=0,q={},p,s;function t(u){k.bindAll(this);u=k.isString(u)?{url:u}:u;s=s||new h();p=k.isNumber(u.maxParallelRequests)?u.maxParallelRequests:p||6;this.url=u.url;this.wildcard=u.wildcard||"%QUERY";this.filter=u.filter;this.replace=u.replace;this.ajaxSettings={type:"get",cache:u.cache,timeout:u.timeout,dataType:u.dataType||"json",beforeSend:u.beforeSend};this._get=(/^throttle$/i.test(u.rateLimitFn)?k.throttle:k.debounce)(this._get,u.rateLimitWait||300)}k.mixin(t.prototype,{_get:function(x,u){var w=this;if(m()){this._sendRequest(x).done(v)}else{this.onDeckRequestArgs=[].slice.call(arguments,0)}function v(z){var y=w.filter?w.filter(z):z;u&&u(y);s.set(x,z)}},_sendRequest:function(x){var w=this,v=q[x];if(!v){o();v=q[x]=a.ajax(x,this.ajaxSettings).always(u)}return v;function u(){n();q[x]=null;if(w.onDeckRequestArgs){w._get.apply(w,w.onDeckRequestArgs);w.onDeckRequestArgs=null}}},get:function(w,u){var y=this,v=encodeURIComponent(w||""),z,x;u=u||k.noop;z=this.replace?this.replace(this.url,v):this.url.replace(this.wildcard,v);if(x=s.get(z)){k.defer(function(){u(y.filter?y.filter(x):x)})}else{this._get(z,u)}return !!x}});return t;function o(){r++}function n(){r--}function m(){return r<p}}();var b=function(){var o={thumbprint:"thumbprint",protocol:"protocol",itemHash:"itemHash",adjacencyList:"adjacencyList"};function n(p){k.bindAll(this);if(k.isString(p.template)&&!p.engine){a.error("no template engine specified")}if(!p.local&&!p.prefetch&&!p.remote){a.error("one of local, prefetch, or remote is required")}this.name=p.name||k.getUniqueId();this.limit=p.limit||5;this.minLength=p.minLength||1;this.header=p.header;this.footer=p.footer;this.valueKey=p.valueKey||"value";this.template=m(p.template,p.engine,this.valueKey);this.local=p.local;this.prefetch=p.prefetch;this.remote=p.remote;this.itemHash={};this.adjacencyList={};this.storage=p.name?new g(p.name):null}k.mixin(n.prototype,{_processLocalData:function(p){this._mergeProcessedData(this._processData(p))},_loadPrefetchData:function(r){var x=this,y=l+(r.thumbprint||""),w,v,u,t,q,p;if(this.storage){w=this.storage.get(o.thumbprint);v=this.storage.get(o.protocol);u=this.storage.get(o.itemHash);t=this.storage.get(o.adjacencyList)}q=w!==y||v!==k.getProtocol();r=k.isString(r)?{url:r}:r;r.ttl=k.isNumber(r.ttl)?r.ttl:24*60*60*1000;if(u&&t&&!q){this._mergeProcessedData({itemHash:u,adjacencyList:t});p=a.Deferred().resolve()}else{p=a.getJSON(r.url).done(s)}return p;function s(A){var B=r.filter?r.filter(A):A,D=x._processData(B),C=D.itemHash,z=D.adjacencyList;if(x.storage){x.storage.set(o.itemHash,C,r.ttl);x.storage.set(o.adjacencyList,z,r.ttl);x.storage.set(o.thumbprint,y,r.ttl);x.storage.set(o.protocol,k.getProtocol(),r.ttl)}x._mergeProcessedData(D)}},_transformDatum:function(p){var s=k.isString(p)?p:p[this.valueKey],r=p.tokens||k.tokenizeText(s),q={value:s,tokens:r};if(k.isString(p)){q.datum={};q.datum[this.valueKey]=p}else{q.datum=p}q.tokens=k.filter(q.tokens,function(t){return !k.isBlankString(t)});q.tokens=k.map(q.tokens,function(t){return t.toLowerCase()});return q},_processData:function(q){var s=this,r={},p={};k.each(q,function(u,t){var w=s._transformDatum(t),v=k.getUniqueId(w.value);r[v]=w;k.each(w.tokens,function(z,A){var y=A.charAt(0),x=p[y]||(p[y]=[v]);!~k.indexOf(x,v)&&x.push(v)})});return{itemHash:r,adjacencyList:p}},_mergeProcessedData:function(p){var q=this;k.mixin(this.itemHash,p.itemHash);k.each(p.adjacencyList,function(s,r){var t=q.adjacencyList[s];q.adjacencyList[s]=t?t.concat(r):r})},_getLocalSuggestions:function(t){var u=this,p=[],q=[],r,s=[];k.each(t,function(w,x){var v=x.charAt(0);!~k.indexOf(p,v)&&p.push(v)});k.each(p,function(w,v){var x=u.adjacencyList[v];if(!x){return false}q.push(x);if(!r||x.length<r.length){r=x}});if(q.length<p.length){return[]}k.each(r,function(v,w){var z=u.itemHash[w],x,y;x=k.every(q,function(A){return ~k.indexOf(A,w)});y=x&&k.every(t,function(A){return k.some(z.tokens,function(B){return B.indexOf(A)===0})});y&&s.push(z)});return s},initialize:function(){var p;this.local&&this._processLocalData(this.local);this.transport=this.remote?new i(this.remote):null;p=this.prefetch?this._loadPrefetchData(this.prefetch):a.Deferred().resolve();this.local=this.prefetch=this.remote=null;this.initialize=function(){return p};return p},getSuggestions:function(s,q){var v=this,u,t,p=false;if(s.length<this.minLength){return}u=k.tokenizeQuery(s);t=this._getLocalSuggestions(u).slice(0,this.limit);if(t.length<this.limit&&this.transport){p=this.transport.get(s,r)}!p&&q&&q(t);function r(w){t=t.slice(0);k.each(w,function(y,x){var A=v._transformDatum(x),z;z=k.some(t,function(B){return A.value===B.value});!z&&t.push(A);return t.length<v.limit});q&&q(t)}}});return n;function m(s,q,t){var r,p;if(k.isFunction(s)){r=s}else{if(k.isString(s)){p=q.compile(s);r=k.bind(p.render,p)}else{r=function(u){return"<p>"+u[t]+"</p>"}}}return r}}();var f=function(){function o(p){var q=this;k.bindAll(this);this.specialKeyCodeMap={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"};this.$hint=a(p.hint);this.$input=a(p.input).on("blur.tt",this._handleBlur).on("focus.tt",this._handleFocus).on("keydown.tt",this._handleSpecialKeyEvent);if(!k.isMsie()){this.$input.on("input.tt",this._compareQueryToInputValue)}else{this.$input.on("keydown.tt keypress.tt cut.tt paste.tt",function(r){if(q.specialKeyCodeMap[r.which||r.keyCode]){return}k.defer(q._compareQueryToInputValue)})}this.query=this.$input.val();this.$overflowHelper=m(this.$input)}k.mixin(o.prototype,e,{_handleFocus:function(){this.trigger("focused")},_handleBlur:function(){this.trigger("blured")},_handleSpecialKeyEvent:function(p){var q=this.specialKeyCodeMap[p.which||p.keyCode];q&&this.trigger(q+"Keyed",p)},_compareQueryToInputValue:function(){var p=this.getInputValue(),q=n(this.query,p),r=q?this.query.length!==p.length:false;if(r){this.trigger("whitespaceChanged",{value:this.query})}else{if(!q){this.trigger("queryChanged",{value:this.query=p})}}},destroy:function(){this.$hint.off(".tt");this.$input.off(".tt");this.$hint=this.$input=this.$overflowHelper=null},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getQuery:function(){return this.query},setQuery:function(p){this.query=p},getInputValue:function(){return this.$input.val()},setInputValue:function(q,p){this.$input.val(q);!p&&this._compareQueryToInputValue()},getHintValue:function(){return this.$hint.val()},setHintValue:function(p){this.$hint.val(p)},getLanguageDirection:function(){return(this.$input.css("direction")||"ltr").toLowerCase()},isOverflow:function(){this.$overflowHelper.text(this.getInputValue());return this.$overflowHelper.width()>this.$input.width()},isCursorAtEnd:function(){var r=this.$input.val().length,q=this.$input[0].selectionStart,p;if(k.isNumber(q)){return q===r}else{if(document.selection){p=document.selection.createRange();p.moveStart("character",-r);return r===p.text.length}}return true}});return o;function m(p){return a("<span></span>").css({position:"absolute",left:"-9999px",visibility:"hidden",whiteSpace:"nowrap",fontFamily:p.css("font-family"),fontSize:p.css("font-size"),fontStyle:p.css("font-style"),fontVariant:p.css("font-variant"),fontWeight:p.css("font-weight"),wordSpacing:p.css("word-spacing"),letterSpacing:p.css("letter-spacing"),textIndent:p.css("text-indent"),textRendering:p.css("text-rendering"),textTransform:p.css("text-transform")}).insertAfter(p)}function n(p,q){p=(p||"").replace(/^\s*/g,"").replace(/\s{2,}/g," ");q=(q||"").replace(/^\s*/g,"").replace(/\s{2,}/g," ");return p===q}}();var c=function(){var p={suggestionsList:'<span class="tt-suggestions"></span>'},m={suggestionsList:{display:"block"},suggestion:{whiteSpace:"nowrap",cursor:"pointer"},suggestionChild:{whiteSpace:"normal"}};function n(q){k.bindAll(this);this.isOpen=false;this.isEmpty=true;this.isMouseOverDropdown=false;this.$menu=a(q.menu).on("mouseenter.tt",this._handleMouseenter).on("mouseleave.tt",this._handleMouseleave).on("click.tt",".tt-suggestion",this._handleSelection).on("mouseover.tt",".tt-suggestion",this._handleMouseover)}k.mixin(n.prototype,e,{_handleMouseenter:function(){this.isMouseOverDropdown=true},_handleMouseleave:function(){this.isMouseOverDropdown=false},_handleMouseover:function(q){var r=a(q.currentTarget);this._getSuggestions().removeClass("tt-is-under-cursor");r.addClass("tt-is-under-cursor")},_handleSelection:function(q){var r=a(q.currentTarget);this.trigger("suggestionSelected",o(r))},_show:function(){this.$menu.css("display","block")},_hide:function(){this.$menu.hide()},_moveCursor:function(t){var r,q,u,s;if(!this.isVisible()){return}r=this._getSuggestions();q=r.filter(".tt-is-under-cursor");q.removeClass("tt-is-under-cursor");u=r.index(q)+t;u=(u+1)%(r.length+1)-1;if(u===-1){this.trigger("cursorRemoved");return}else{if(u<-1){u=r.length-1}}s=r.eq(u).addClass("tt-is-under-cursor");this._ensureVisibility(s);this.trigger("cursorMoved",o(s))},_getSuggestions:function(){return this.$menu.find(".tt-suggestions > .tt-suggestion")},_ensureVisibility:function(q){var t=this.$menu.height()+parseInt(this.$menu.css("paddingTop"),10)+parseInt(this.$menu.css("paddingBottom"),10),u=this.$menu.scrollTop(),s=q.position().top,r=s+q.outerHeight(true);if(s<0){this.$menu.scrollTop(u+s)}else{if(t<r){this.$menu.scrollTop(u+(r-t))}}},destroy:function(){this.$menu.off(".tt");this.$menu=null},isVisible:function(){return this.isOpen&&!this.isEmpty},closeUnlessMouseIsOverDropdown:function(){if(!this.isMouseOverDropdown){this.close()}},close:function(){if(this.isOpen){this.isOpen=false;this.isMouseOverDropdown=false;this._hide();this.$menu.find(".tt-suggestions > .tt-suggestion").removeClass("tt-is-under-cursor");this.trigger("closed")}},open:function(){if(!this.isOpen){this.isOpen=true;!this.isEmpty&&this._show();this.trigger("opened")}},setLanguageDirection:function(q){var r={left:"0",right:"auto"},s={left:"auto",right:" 0"};q==="ltr"?this.$menu.css(r):this.$menu.css(s)},moveCursorUp:function(){this._moveCursor(-1)},moveCursorDown:function(){this._moveCursor(+1)},getSuggestionUnderCursor:function(){var q=this._getSuggestions().filter(".tt-is-under-cursor").first();return q.length>0?o(q):null},getFirstSuggestion:function(){var q=this._getSuggestions().first();return q.length>0?o(q):null},renderSuggestions:function(u,y){var v="tt-dataset-"+u.name,z='<div class="tt-suggestion">%body</div>',t,s,q=this.$menu.find("."+v),w,x,r;if(q.length===0){s=a(p.suggestionsList).css(m.suggestionsList);q=a("<div></div>").addClass(v).append(u.header).append(s).append(u.footer).appendTo(this.$menu)}if(y.length>0){this.isEmpty=false;this.isOpen&&this._show();w=document.createElement("div");x=document.createDocumentFragment();k.each(y,function(A,B){B.dataset=u.name;t=u.template(B.datum);w.innerHTML=z.replace("%body",t);r=a(w.firstChild).css(m.suggestion).data("suggestion",B);r.children().each(function(){a(this).css(m.suggestionChild)});x.appendChild(r[0])});q.show().find(".tt-suggestions").html(x)}else{this.clearSuggestions(u.name)}this.trigger("suggestionsRendered")},clearSuggestions:function(s){var q=s?this.$menu.find(".tt-dataset-"+s):this.$menu.find('[class^="tt-dataset-"]'),r=q.find(".tt-suggestions");q.hide();r.empty();if(this._getSuggestions().length===0){this.isEmpty=true;this._hide()}}});return n;function o(q){return q.data("suggestion")}}();var j=function(){var p={wrapper:'<span class="twitter-typeahead"></span>',hint:'<input class="tt-hint" type="text" autocomplete="off" spellcheck="off" disabled>',dropdown:'<span class="tt-dropdown-menu"></span>'},n={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none"},query:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},dropdown:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"}};if(k.isMsie()){k.mixin(n.query,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"})}if(k.isMsie()&&k.isMsie()<=7){k.mixin(n.wrapper,{display:"inline",zoom:"1"});k.mixin(n.query,{marginTop:"-1px"})}function q(u){var t,s,r;k.bindAll(this);this.$node=m(u.input);this.datasets=u.datasets;this.dir=null;this.eventBus=u.eventBus;t=this.$node.find(".tt-dropdown-menu");s=this.$node.find(".tt-query");r=this.$node.find(".tt-hint");this.dropdownView=new c({menu:t}).on("suggestionSelected",this._handleSelection).on("cursorMoved",this._clearHint).on("cursorMoved",this._setInputValueToSuggestionUnderCursor).on("cursorRemoved",this._setInputValueToQuery).on("cursorRemoved",this._updateHint).on("suggestionsRendered",this._updateHint).on("opened",this._updateHint).on("closed",this._clearHint).on("opened closed",this._propagateEvent);this.inputView=new f({input:s,hint:r}).on("focused",this._openDropdown).on("blured",this._closeDropdown).on("blured",this._setInputValueToQuery).on("enterKeyed tabKeyed",this._handleSelection).on("queryChanged",this._clearHint).on("queryChanged",this._clearSuggestions).on("queryChanged",this._getSuggestions).on("whitespaceChanged",this._updateHint).on("queryChanged whitespaceChanged",this._openDropdown).on("queryChanged whitespaceChanged",this._setLanguageDirection).on("escKeyed",this._closeDropdown).on("escKeyed",this._setInputValueToQuery).on("tabKeyed upKeyed downKeyed",this._managePreventDefault).on("upKeyed downKeyed",this._moveDropdownCursor).on("upKeyed downKeyed",this._openDropdown).on("tabKeyed leftKeyed rightKeyed",this._autocomplete)}k.mixin(q.prototype,e,{_managePreventDefault:function(s){var r=s.data,t,u,v=false;switch(s.type){case"tabKeyed":t=this.inputView.getHintValue();u=this.inputView.getInputValue();v=t&&t!==u;break;case"upKeyed":case"downKeyed":v=!r.shiftKey&&!r.ctrlKey&&!r.metaKey;break}v&&r.preventDefault()},_setLanguageDirection:function(){var r=this.inputView.getLanguageDirection();if(r!==this.dir){this.dir=r;this.$node.css("direction",r);this.dropdownView.setLanguageDirection(r)}},_updateHint:function(){var z=this.dropdownView.getFirstSuggestion(),u=z?z.value:null,s=this.dropdownView.isVisible(),v=this.inputView.isOverflow(),w,y,t,r,x;if(u&&s&&!v){w=this.inputView.getInputValue();y=w.replace(/\s{2,}/g," ").replace(/^\s+/g,"");t=k.escapeRegExChars(y);r=new RegExp("^(?:"+t+")(.*$)","i");x=r.exec(u);this.inputView.setHintValue(w+(x?x[1]:""))}},_clearHint:function(){this.inputView.setHintValue("")},_clearSuggestions:function(){this.dropdownView.clearSuggestions()},_setInputValueToQuery:function(){this.inputView.setInputValue(this.inputView.getQuery())},_setInputValueToSuggestionUnderCursor:function(r){var s=r.data;this.inputView.setInputValue(s.value,true)},_openDropdown:function(){this.dropdownView.open()},_closeDropdown:function(r){this.dropdownView[r.type==="blured"?"closeUnlessMouseIsOverDropdown":"close"]()},_moveDropdownCursor:function(s){var r=s.data;if(!r.shiftKey&&!r.ctrlKey&&!r.metaKey){this.dropdownView[s.type==="upKeyed"?"moveCursorUp":"moveCursorDown"]()}},_handleSelection:function(s){var r=s.type==="suggestionSelected",t=r?s.data:this.dropdownView.getSuggestionUnderCursor();if(t){this.inputView.setInputValue(t.value);r?this.inputView.focus():s.data.preventDefault();r&&k.isMsie()?k.defer(this.dropdownView.close):this.dropdownView.close();this.eventBus.trigger("selected",t.datum,t.dataset)}},_getSuggestions:function(){var s=this,r=this.inputView.getQuery();if(k.isBlankString(r)){return}k.each(this.datasets,function(u,t){t.getSuggestions(r,function(v){if(r===s.inputView.getQuery()){s.dropdownView.renderSuggestions(t,v)}})})},_autocomplete:function(r){var u,t,v,s,w;if(r.type==="rightKeyed"||r.type==="leftKeyed"){u=this.inputView.isCursorAtEnd();t=this.inputView.getLanguageDirection()==="ltr"?r.type==="leftKeyed":r.type==="rightKeyed";if(!u||t){return}}v=this.inputView.getQuery();s=this.inputView.getHintValue();if(s!==""&&v!==s){w=this.dropdownView.getFirstSuggestion();this.inputView.setInputValue(w.value);this.eventBus.trigger("autocompleted",w.datum,w.dataset)}},_propagateEvent:function(r){this.eventBus.trigger(r.type)},destroy:function(){this.inputView.destroy();this.dropdownView.destroy();o(this.$node);this.$node=null},setQuery:function(r){this.inputView.setQuery(r);this.inputView.setInputValue(r);this._clearHint();this._clearSuggestions();this._getSuggestions()}});return q;function m(w){var u=a(p.wrapper),r=a(p.dropdown),t=a(w),s=a(p.hint);u=u.css(n.wrapper);r=r.css(n.dropdown);s.css(n.hint).css({backgroundAttachment:t.css("background-attachment"),backgroundClip:t.css("background-clip"),backgroundColor:t.css("background-color"),backgroundImage:t.css("background-image"),backgroundOrigin:t.css("background-origin"),backgroundPosition:t.css("background-position"),backgroundRepeat:t.css("background-repeat"),backgroundSize:t.css("background-size")});t.data("ttAttrs",{dir:t.attr("dir"),autocomplete:t.attr("autocomplete"),spellcheck:t.attr("spellcheck"),style:t.attr("style")});t.addClass("tt-query").attr({autocomplete:"off",spellcheck:false}).css(n.query);try{!t.attr("dir")&&t.attr("dir","auto")}catch(v){}return t.wrap(u).parent().prepend(s).append(r)}function o(s){var r=s.find(".tt-query");k.each(r.data("ttAttrs"),function(t,u){k.isUndefined(u)?r.removeAttr(t):r.attr(t,u)});r.detach().removeData("ttAttrs").removeClass("tt-query").insertAfter(s);s.remove()}}();(function(){var m={},o="ttView",n;n={initialize:function(p){var q;p=k.isArray(p)?p:[p];if(p.length===0){a.error("no datasets provided")}q=k.map(p,function(t){var s=m[t.name]?m[t.name]:new b(t);if(t.name){m[t.name]=s}return s});return this.each(r);function r(){var s=a(this),t,u=new d({el:s});t=k.map(q,function(v){return v.initialize()});s.data(o,new j({input:s,eventBus:u=new d({el:s}),datasets:q}));a.when.apply(a,t).always(function(){k.defer(function(){u.trigger("initialized")})})}},destroy:function(){return this.each(p);function p(){var q=a(this),r=q.data(o);if(r){r.destroy();q.removeData(o)}}},setQuery:function(p){return this.each(q);function q(){var r=a(this).data(o);r&&r.setQuery(p)}}};jQuery.fn.typeahead=function(p){if(n[p]){return n[p].apply(this,[].slice.call(arguments,1))}else{return n.initialize.apply(this,arguments)}}})()})(window.jQuery);(function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b.autocompleteSearchResult=a(function(h,e,i,j,d){this.compilerInfo=[3,">= 1.0.0-rc.4"];i=i||h.helpers;d=d||{};var c="",m,g="function",f=this.escapeExpression,l=this;function k(p,o){var n="",q;n+='\n    <span class="time">\n      ';if(q=i.Date){q=q.call(p,{hash:{},data:o})}else{q=p.Date;q=typeof q===g?q.apply(p):q}n+=f(q)+" ";if(q=i.Time){q=q.call(p,{hash:{},data:o})}else{q=p.Time;q=typeof q===g?q.apply(p):q}n+=f(q)+'\n    </span>\n    <span class="channelName">\n      ';if(q=i.Channel){q=q.call(p,{hash:{},data:o})}else{q=p.Channel;q=typeof q===g?q.apply(p):q}n+=f(q)+"\n    </span>\n  ";return n}c+='<img src="';if(m=i.Image){m=m.call(e,{hash:{},data:d})}else{m=e.Image;m=typeof m===g?m.apply(e):m}c+=f(m)+'&amp;width=60&amp;height=42" width="60px" height="42px"/>\n<div class="description">\n  <p>';if(m=i.Title){m=m.call(e,{hash:{},data:d})}else{m=e.Title;m=typeof m===g?m.apply(e):m}c+=f(m)+"</p>\n  ";m=i.each.call(e,e.Details,{hash:{},inverse:l.noop,fn:l.program(1,k,d),data:d});if(m||m===0){c+=m}c+="\n</div>";return c})})();(function(a){a.fn.bPopup=function(G,I){function M(){a.isFunction(b.onOpen)&&b.onOpen.call(v);D=(x.data("bPopup")||0)+1;w="__bPopup"+D;E="auto"!==b.position[1];F="auto"!==b.position[0];B="fixed"===b.positionStyle;C=K(v,b.amsl);y=E?b.position[1]:C[1];z=F?b.position[0]:C[0];J=L();b.modal&&a('<div class="bModal '+w+'"></div>').css({"background-color":b.modalColor,height:"100%",left:0,opacity:0,position:"fixed",top:0,width:"100%","z-index":b.zIndex+D}).each(function(){b.appending&&a(this).appendTo(b.appendTo)}).animate({opacity:b.opacity},b.fadeSpeed);v.data("bPopup",b).data("id",w).css({left:!b.follow[0]&&F||B?z:A.scrollLeft()+z,position:b.positionStyle||"absolute",top:!b.follow[1]&&E||B?y:A.scrollTop()+y,"z-index":b.zIndex+D+1}).each(function(){b.appending&&a(this).appendTo(b.appendTo);if(null!=b.loadUrl){switch(b.contentContainer=a(b.contentContainer||v),b.content){case"iframe":a('<iframe scrolling="no" frameborder="0"></iframe>').attr("src",b.loadUrl).appendTo(b.contentContainer);break;default:b.contentContainer.load(b.loadUrl)}}}).fadeIn(b.fadeSpeed,function(){a.isFunction(I)&&I.call(v);N()})}function H(){b.modal&&a(".bModal."+v.data("id")).fadeOut(b.fadeSpeed,function(){a(this).remove()});v.stop().fadeOut(b.fadeSpeed,function(){null!=b.loadUrl&&b.contentContainer.empty()});x.data("bPopup",0<x.data("bPopup")-1?x.data("bPopup")-1:null);b.scrollBar||a("html").css("overflow","auto");a("."+b.closeClass).die("click."+w);a(".bModal."+w).die("click");A.unbind("keydown."+w);x.unbind("."+w);v.data("bPopup",null);a.isFunction(b.onClose)&&setTimeout(function(){b.onClose.call(v)},b.fadeSpeed);return !1}function N(){x.data("bPopup",D);a("."+b.closeClass).live("click."+w,H);b.modalClose&&a(".bModal."+w).live("click",H).css("cursor","pointer");(b.follow[0]||b.follow[1])&&x.bind("scroll."+w,function(){J&&v.stop().animate({left:b.follow[0]&&!B?A.scrollLeft()+z:z,top:b.follow[1]&&!B?A.scrollTop()+y:y},b.followSpeed)}).bind("resize."+w,function(){if(J=L()){C=K(v,b.amsl),b.follow[0]&&(z=F?z:C[0]),b.follow[1]&&(y=E?y:C[1]),v.stop().each(function(){B?a(this).css({left:z,top:y},b.followSpeed):a(this).animate({left:F?z:z+A.scrollLeft(),top:E?y:y+A.scrollTop()},b.followSpeed)})}});b.escClose&&A.bind("keydown."+w,function(c){27==c.which&&H()})}function K(e,f){var g=(x.width()-e.outerWidth(!0))/2,h=(x.height()-e.outerHeight(!0))/2-f;return[g,20>h?20:h]}function L(){return x.height()>v.outerHeight(!0)+20&&x.width()>v.outerWidth(!0)+20}a.isFunction(G)&&(I=G,G=null);var b=a.extend({},a.fn.bPopup.defaults,G);b.scrollBar||a("html").css("overflow","hidden");var v=this,A=a(document),x=a(window),D,w,J,E,F,B,C,y,z;this.close=function(){b=v.data("bPopup");H()};return this.each(function(){v.data("bPopup")||M()})};a.fn.bPopup.defaults={amsl:50,appending:!0,appendTo:"body",closeClass:"bClose",content:"ajax",contentContainer:null,escClose:!0,fadeSpeed:250,follow:[!0,!0],followSpeed:500,loadUrl:null,modal:!0,modalClose:!0,modalColor:"#000",onClose:null,onOpen:null,opacity:0.7,position:["auto","auto"],positionStyle:"absolute",scrollBar:!0,zIndex:9997}})(jQuery);Namespace("RT.utils").InputPlaceholder=new Class({initialize:function(a,c){a=document.getElement(a);var b=c||a.get("placeholder")||a.get("value");a.set("value",b);a.addEvents({focus:this.removeText.bind(a,b),blur:this.showText.bind(a,b)})},removeText:function(b,a){if(this.get("value")===b){this.set("value","")}},showText:function(b,a){if(this.get("value")===""){this.set("value",b)}}});var $searchBox=jQuery("input#keywords");$searchBox.typeahead([{header:"<h1>Upcoming Episodes</h1>",name:"episodes",remote:"/rt-service/newsearch/episode?q=%QUERY",template:Handlebars.templates.autocompleteSearchResult},{header:"<h1>Latest News</h1>",name:"articles",remote:"/rt-service/newsearch/article?q=%QUERY",template:Handlebars.templates.autocompleteSearchResult}]);$searchBox.on("typeahead:selected",function(a,b,c){document.location.href=b.Url});Namespace("RT.utils").WidgetLoader=new Class({Implements:[Options,Events],initialize:function(b,a){this.setOptions(a);this.widgets=$$(b);this.checkCookie()},options:{maxIntervals:4,timeOutDelay:500,onComplete:function(){}},requestWidget:function(c){var b=this;var a=0;Array.each(c,function(f,d){var e=f.get("data-widget-urls").split(";");Array.each(e,function(h,g){a=a+1;new Request({url:h,method:"get",evalScripts:true,onRequest:function(){f.adopt(new Element("img.loadspinner[src=/assets/images/ajax-loaders/apple-style-trans.gif]"))},onSuccess:function(j){if(f.getElement(".loadspinner")){f.getElement(".loadspinner").destroy()}a=a-1;if(!Browser.ie){var i=new Element("div",{html:j});f.adopt(i.getChildren())}else{f.appendChild(innerShiv(j))}if(a<1){b.fireEvent("complete")}f.removeClass("loading");b.fireEvent("loaded",f)},onTimeout:function(){if(f.getElement(".loadspinner")){f.getElement(".loadspinner").destroy()}a=a-1;if(a<1){this.fireEvent("complete")}f.removeClass("loading");f.addClass("loadFailed")},onFailure:function(i){if(f.getElement(".loadspinner")){f.getElement(".loadspinner").destroy()}a=a-1;if(a<1){this.fireEvent("complete")}f.removeClass("loading");f.addClass("loadFailed")}}).send()})})},checkCookie:function(){if(Cookie.read("purple")){this.requestWidget(this.widgets)}else{var b=0,c=this.options.maxIntervals;var a=setInterval(function(){if(Cookie.read("purple")||b>c){clearInterval(a);this.requestWidget(this.widgets)}b=b+1}.bind(this),this.options.timeOutDelay)}}});new RT.utils.WidgetLoader($$(".widget-container"),{});var loginLocationCookie=new Class(function(){var a=[/^\/$/i,/^\/film/i,/^\/tv/i,/^\/radio/i,/^\/news/i,/^\/blog/i,/^\/photos/i,/^\/episode/i,/^\/programme/i,/^\/search/i,/^\/person/i,/^\/watchlist/i,/^\/offers/i,/^\/win/i];var b=function(d){Cookie.write("RTCurrentPage",d)};var c=function(d){d=d.trim();if(d.indexOf("http:")>=0){d=d.substring(7)}return d.substring(d.indexOf("/"))};return{initialize:function(){var d=c(location.href);for(var e=0;e<a.length;e++){if(a[e].test(d)){b(d)}}}}}());new loginLocationCookie();Namespace("RT.utils").Dialog=new Class(function(){var e=function(f){var k=window,g=f.getDimensions(),l=k.getSize(),j=k.getScroll().y,m=l.y,n=l.x,h=(n/2)-(g.x/2),i=(m/2)+(j)-(g.y/2);f.setStyles({left:h>0?h:0,top:i>0?i:20,position:"absolute","z-index":10003})};var d=function(){var g=window.getScrollSize(),f=this;return new Element("div.overlay",{styles:{position:"absolute","z-index":10002,left:0,top:0,width:g.x,height:g.y},events:{click:function(){f.hide()}}}).hide()};var c=function(){var g=this;var f=new Element("div",{role:"dialog","aria-hidden":true,"class":this.options["class"]}).grab(new Element("div")).hide();new Element("a.dialog-close[role=button][href=#][title=Close][text=Close]",{styles:{position:"absolute",top:"-12px",right:"-12px"},events:{click:function(h){g.hide();h.preventDefault()}}}).inject(f);f.addClass("dialog");return f};var b=function(){var f=this;$(document).addEvent("keyup",function(g){if(g.key=="esc"){f.hide()}});window.addEvent("resize",function(){var g=window;e(f.dialog);f.overlay.setStyles({width:g.getSize().x,height:g.getScrollSize().y})})};var a=function(f){(typeOf(f)=="element")?$(this).getElement("div").grab(f):$(this).getElement("div").set("html",f)};return{Implements:[Options,Events],initialize:function(g,h){var f=$$(".overlay"),i;this.setOptions(h);this.dialog=c.call(this);(f.length==0?i=d.call(this):i=f);this.overlay=i;this.overlay.inject($(document.body));a.call(this,g);$(this).inject($(document.body));b.call(this)},options:{"class":null},show:function(f){if(f!=undefined){a.call(this,f)}e($(this));$(this).show();$(this).set("aria-hidden",false);this.overlay.show();this.fireEvent("dialogShown")},hide:function(){var f=$$(".dialog");f.hide();f.set("aria-hidden",true);this.overlay.hide();this.fireEvent("dialogHidden")},toElement:function(){return this.dialog}}}());Namespace("RT.personalisation").LoginStatus=new Class.Singleton(function(){var a="AuthToken";return{initialize:function(){if(this.userIsLogedIn()){}else{$$(".logedout-visibile").show()}},userIsLogedIn:function(){var b=Cookie.read(a);return b&&b!=""}}}());var imPolicyCookieOverlay={init:function(){var e=document.createElement("div");e.id="imPolicycookiemessage";e.innerHTML='<div class="imPolicycookieinner">We use cookies to improve your experience of our website. Cookies perform functions like recognising you each time you visit and delivering advertising messages that are relevant to you. Read more <a href="http://www.immediate.co.uk/cookies-policy" target="_blank">here</a></div><div class="overlayPolicycookieinner"></div>';var a="#imPolicycookiemessage{position:fixed;bottom:0;left:0;right:0; margin-left:auto; margin-right:auto; width:960px; display:none;}.imPolicycookieinner a{color:#fff;} .imPolicycookieinner{position:relative; background-color:#000; padding:5px 10px; z-index:10; color:#fff; font-family:arial, verdana, helvetica; font-size:13px; opacity:0.7; filter: alpha(opacity=70); text-align:left;} .overlayPolicycookieinner{float:left; position: absolute; bottom:0;left:0; right:0; margin-left:auto; margin-right:auto; width:960px; background-color:#000; z-index:0;}";var f=document.getElementsByTagName("head")[0];var b=document.createElement("style");b.type="text/css";b.media="screen";if(b.styleSheet){b.styleSheet.cssText=a}else{b.appendChild(document.createTextNode(a))}f.appendChild(b);var d=document.getElementsByTagName("body")[0];d.appendChild(e);var c=imPolicyCookieOverlay.readCookie("imPolicyCookieDisplay");if(!c){imPolicyCookieOverlay.showLayer("imPolicycookiemessage");setTimeout("imPolicyCookieOverlay.hideLayer('imPolicycookiemessage')",12000);imPolicyCookieOverlay.createCookie("imPolicyCookieDisplay","true",99)}},showLayer:function(a){if(document.all){document.all[a].style.display="block"}else{document.getElementById(a).style.display="block"}},hideLayer:function(a){if(document.all){document.all[a].style.display="none"}else{document.getElementById(a).style.display="none"}},createCookie:function(d,e,b){if(b){var a=new Date();a.setTime(a.getTime()+(b*24*60*60*1000));var c="; expires="+a.toGMTString()}else{var c=""}document.cookie=d+"="+e+c+"; path=/"},readCookie:function(e){var f=e+"=";var b=document.cookie.split(";");for(var d=0;d<b.length;d++){var a=b[d];while(a.charAt(0)==" "){a=a.substring(1,a.length)}if(a.indexOf(f)==0){return a.substring(f.length,a.length)}}return null},eraseCookie:function(a){imPolicyCookieOverlay.createCookie(a,"",-1)}};(function(a){a.fn.extend({setEqualHeight:function(c){var b={height:null,minHeight:0,maxHeight:null};c=a.extend(b,c);if(c.height!==null){this.height(c.height)}else{this.css("height","auto");this.each(function(){if(a(this).height()+1>c.minHeight){c.minHeight=a(this).height()+1}if(c.maxHeight!==null){if(c.minHeight>c.maxHeight){c.minHeight=c.maxHeight}}});if(c.minHeight>0){this.css("min-height",c.minHeight)}else{this.css("height","inherit")}if(c.maxHeight!=null&&c.maxHeight>0){this.css("max-height",c.maxHeight)}}return this}})})($j);(function(a){a.fn.extend({setEqualWidth:function(c){var b={width:null,minWidth:0,maxWidth:null};c=a.extend(b,c);if(c.width!==null){this.width(c.width)}else{this.css("width","auto");this.each(function(){if(a(this).width()+1>c.minWidth){c.minWidth=a(this).width()+1}if(c.maxWidth!==null){if(c.minWidth>c.maxWidth){c.minWidth=c.maxWidth}}});if(c.minWidth>0){this.css("min-width",c.minWidth)}else{this.css("width","inherit")}if(c.maxWidth!=null&&c.maxWidth>0){this.css("max-width",c.maxWidth)}}return this}})})($j);(function(a){a.fn.extend({equalHeight:function(c){var b={height:null,minHeight:0,maxHeight:null};c=a.extend(b,c);this.each(function(e){var d=a(this).children(".equal-height-item");if(d.length==0){d=a(this).children()}d.setEqualHeight(c)});return this}})})($j);(function(a){a.fn.extend({equalWidth:function(c){var b={width:null,minWidth:0,maxWidth:null};c=a.extend(b,c);this.each(function(e){var d=a(this).children(".equal-width-item");if(d.length==0){d=a(this).children()}d.setEqualWidth(c)});return this}})})($j);$j(document).ready(function(){$j("#site-nav li > div").hover(function(){$j(this).parent().toggleClass("hover")});$j(".ie7 .equal-height").equalHeight();$j(document).on("click","#signinoptions .radiotimes",function(h){h.preventDefault();$j("#signinoptions").hide();$j("#signinform").show()});$j(document).on("click","#signinform .loginpopup-cancelbutton",function(h){h.preventDefault();$j("#signinform").hide();$j("#signinoptions").show()});$j(document).on("click","#loginbutton",function(h){h.preventDefault();f(h)});$j(document).on("click","#registerbutton",function(h){h.preventDefault();g(h)});var a=null;var b=null;var c=null;function d(){$j(".loginpopup").hide();c=null;b=null;a=null;$j("#loginbutton").removeClass("popupopen");$j("#registerbutton").removeClass("popupopen");$j("#dashboard").removeClass("popupopen")}function f(h){if(b!=null){d();b=null}else{d();b=1;$j("#loginpopup").css("display","block");$j("#loginbutton").addClass("popupopen")}h.stopPropagation()}function g(h){if(c!=null){d();c=null}else{d();c=1;$j("#registerpopup").css("display","block");$j("#registerbutton").addClass("popupopen")}h.stopPropagation()}function e(h){if(a!=null){d();a=null}else{d();a=1;$j("#loggedinpopup").css("display","block");$j("#dashboard").addClass("popupopen")}if(h&&h.stopPropagation){h.stopPropagation()}}window.RT=window.RT||{};window.RT.login=window.RT.login||{};window.RT.login.showLoginPopup=f;$j(document).on("click","body",function(){d()});$j(document).on("click","#loginpopup",function(h){h.stopPropagation()});$j(document).on("click","#eyebrowmembername",function(h){h.preventDefault();e(h)});$j(document).on("click","#editprofilepic",function(h){Shadowbox.open(this);return false});if($j().dotdotdot){if(!$j("html").hasClass("ie7")){$j(".hideoverflow").dotdotdot()}$j(".img-text-list-item-text").dotdotdot();$j(".hideoverflow").addClass("overflow-height");$j("#full-width-content #slide header h1").dotdotdot()}$j(".vertical-center").each(function(){var h=parseInt($j(this).parent().css("height"));var i=parseInt($j(this).css("height"));if(h>0&&i>0){$j(this).css("margin-top",Math.round((h-(i+8))/2)+"px")}});if($j().tablight){$j(".tabbed").tablight()}});function LoadJCarouselForImageAndTextList(b,c){var a=$j(b);if(a.hasClass("one-column-list")){a.children("li").css("width",a.width())}$j(b).jcarousel({wrap:"circular",scroll:parseInt(c),animation:"slow",initCallback:JCarouselForImageAndTextListInitCallback})}function JCarouselForImageAndTextListInitCallback(a,c){if(c=="init"){a.buttonNext.bind("mousedown.disableTextSelect",function(){return false});var b=a.list.find(".img-text-list-item-image");if(b.length>0){var d=$j(b).outerHeight()/2;a.buttonNext.css("top",d);a.buttonPrev.css("top",d)}a.container.parent().removeClass("scrollable-carousel-wrapper")}else{if(c=="reset"){}}}var RTResponsiveheader=(function(a){var d={};d.config={navMainEl:a(".js-main-navigation"),navMainOpenClass:"js-main-navigation-open",navEl:a(".js-main-navigation .js-main-navigation-inner > ul"),itemEl:a(".js-main-navigation .js-main-navigation-inner > ul").find("> li"),subContainerEl:a(".subnav-container"),navToggle:a(".js-header-menu-toggle"),selectedSectionText:a(".js-main-navigation .selected > a").text(),headerTitleEl:a("#header .header-title"),mobileBreakpoint:768,navHeight:0};d.init=function(){f();g();e();c();b();i();h()};var h=function(){a(".share-links .morebtn").on("click",function(){var j=a(this).closest(".share-links").find("ul.extra");if(a(window).width()>d.config.mobileBreakpoint){a(j).toggleClass("visible right")}else{a(j).toggleClass("visible")}})};var f=function(){a(".js-log-in, .js-logged-in").live("click",function(j){j.preventDefault();d.config.navMainEl.removeClass(d.config.navMainOpenClass).removeAttr("style");if(a(window).width()>d.config.mobileBreakpoint){a(this).next(".dropdown").toggle()}else{e();a(this).next(".dropdown").animate({height:"toggle"},300)}})};var c=function(){d.config.navMainEl.css({display:"block",visibility:"hidden"});d.config.navHeight=a(".js-main-navigation-inner").outerHeight();d.config.navMainEl.css({visibility:"visible"});a(".main-navigation__mobile-subnav").css("min-height",d.config.navHeight)};var i=function(){d.config.navToggle.on("click",function(){var j;a(".js-log-in, .js-logged-in").next(".dropdown").removeAttr("style");d.config.navMainEl.toggleClass(d.config.navMainOpenClass);if(d.config.navMainEl.hasClass(d.config.navMainOpenClass)){j="0%"}else{j="-100%"}d.config.navMainEl.css("left",function(){return a(this).offset().left}).animate({left:j},300)});a(".primary-nav").on("click",function(k){if(a(window).width()<d.config.mobileBreakpoint){k.preventDefault()}var j=a(this).attr("data-id"),l=d.config.subContainerEl.find('.main-navigation__mobile-subnav[data-id="'+j+'"]');a(".main-navigation__mobile-subnav").removeClass("js-show-subnav");l.addClass("js-show-subnav");d.config.subContainerEl.css("left",function(){return a(this).offset().left}).animate({left:"0%"},300)});a(".js-close-subnav").on("click",function(){d.config.subContainerEl.css("left",function(){return a(this).offset().left}).animate({left:"120%"},300)});a(window).on("resize",function(){e()})};var e=function(){if(a(window).width()<=d.config.mobileBreakpoint){var j=a("#header").height()-a(".quick-navigation").height();a(".login-widget .dropdown").css("top",j);c()}else{a(".login-widget .dropdown").removeAttr("style")}};var b=function(){var l=a(".quick-links li"),k=a(".quick-links h3").outerWidth(),j=a(".quick-links"),m=0;a.each(l,function(){m+=a(this).outerWidth()+2});j.width(m+k)};var g=function(){var j=d.config.selectedSectionText;d.config.headerTitleEl.text(j)};return d})(jQuery);jQuery(document).ready(function(){RTResponsiveheader.init()});var RTGA=(function(a){var f={};f.init=function(){e();c();d();b()};var e=function(){a("#header .register").click(function(){_gaq.push(["_trackEvent","Registration","Register","1_Home_Button"])});a("#header .account-register a").live("click",function(){_gaq.push(["_trackEvent","Registration","Register","2_RadioTimes"])});a("#header .account-social a").live("click",function(){_gaq.push(["_trackEvent","Registration","Register","2_"+a(this).text()])});a(".register-page .register").click(function(){_gaq.push(["_trackEvent","Registration","Register","Register"])});a(".members-profile-container .action-btn").click(function(){_gaq.push(["_trackEvent","Registration","Register","Save"])})};var c=function(){a(".channel .programme-detail a").live("click",function(h){var k=a(this).closest(".programme-dialog").parent("li").find("a.short-title").data("hover");var m=k.Title;var l=k.EpisodeId;var j=k.Specialisation;var i=m+" ["+l+"]";var g=a(h.target);if(g.hasClass("read-more")){_gaq.push(["_trackEvent",j+"Listings","Hover_More_Click",i])}else{if(g.parent("h1").length){_gaq.push(["_trackEvent",j+"Listings","Hover_Title_Click",i])}else{if(g.parent("div.headlines").length){_gaq.push(["_trackEvent",j+"Listings","Hover_LatestNews_Click",i])}else{if(g.parent("li").length){_gaq.push(["_trackEvent",j+"Listings","Hover_News_Click",i]);_gaq.push(["_trackEvent",j+"Listings","Hover_News_Click",g.text()])}}}}})};var d=function(){a("#new-suggestions .programme-slot a").live("click",function(){var g=a(this).closest("article").find("h1").text();_gaq.push(["_trackEvent","tvListings","Recommendations",g])})};var b=function(){a(".latest-news a").live("click",function(){var g=a(this).attr("rel");var h=window.location.href;_gaq.push(["_trackEvent","Latest_News",h,g])})};return f})(jQuery);jQuery(document).ready(function(){RTGA.init()});
/*
 * jQuery Cookie Plugin v1.4.1
 * https://github.com/carhartl/jquery-cookie
 *
 * Copyright 2013 Klaus Hartl
 * Released under the MIT license
 */
(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof exports==="object"){a(require("jquery"))}else{a(jQuery)}}}(function(a){var f=/\+/g;function d(i){return b.raw?i:encodeURIComponent(i)}function c(i){return b.raw?i:decodeURIComponent(i)}function h(i){return d(b.json?JSON.stringify(i):String(i))}function e(j){if(j.indexOf('"')===0){j=j.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")}try{j=decodeURIComponent(j.replace(f," "));return b.json?JSON.parse(j):j}catch(i){}}function g(j,i){var k=b.raw?j:e(j);return a.isFunction(i)?i(k):k}var b=a.cookie=function(o,w,r){if(w!==undefined&&!a.isFunction(w)){r=a.extend({},b.defaults,r);if(typeof r.expires==="number"){var m=r.expires,v=r.expires=new Date();v.setTime(+v+m*86400000)}return(document.cookie=[d(o),"=",h(w),r.expires?"; expires="+r.expires.toUTCString():"",r.path?"; path="+r.path:"",r.domain?"; domain="+r.domain:"",r.secure?"; secure":""].join(""))}var u=o?undefined:{};var k=document.cookie?document.cookie.split("; "):[];for(var n=0,p=k.length;n<p;n++){var s=k[n].split("=");var q=c(s.shift());var j=s.join("=");if(o&&o===q){u=g(j,w);break}if(!o&&(j=g(j))!==undefined){u[q]=j}}return u};b.defaults={};a.removeCookie=function(i,j){if(a.cookie(i)===undefined){return false}a.cookie(i,"",a.extend({},j,{expires:-1}));return !a.cookie(i)}}));Namespace("RT.utils").LoginWidgetLoader=(function(a){var c=function(){return a.cookie("AuthToken")?true:false};var b=function(e){this.widget=a(e);if(c()){d(this.widget)}else{this.widget.show()}},d=function(f){var e=f.attr("data-widget-url");f.empty();f.addClass("loading");f.show();a.get(e,function(g){f.removeClass("loading");f.append(g)})};return{init:b}});new RT.utils.LoginWidgetLoader(jQuery).init(jQuery(".login-widget-container")[0]);Namespace("RT.personalisation").ChannelsCookie=new Class.Singleton(function(){var a=function(i,j,g){if(g){var f=new Date();f.setTime(f.getTime()+(g*24*60*60*1000));var h="; expires="+f.toGMTString()}else{var h=""}document.cookie=i+"="+j+h+"; path=/"};var d=function(j){var k=j+"=";var g=document.cookie.split(";");for(var h=0;h<g.length;h++){var f=g[h];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(k)==0){return f.substring(k.length,f.length)}}return null};var b=function(f){a(f,"",-1)};var c=function(g){var h=d(g);if(h==null){return null}var f=h.parseQueryString();if(f.channels){f.channels=f.channels.split(",")}if(f.channels==""){f.channels=[]}return f};var e=function(h,i,k,j){var g=c.bind(this)(h);if(g==null){g={}}var f=g.channels;if(f==null){f=[]}Object.each(i,function(l,m){Object.each(l,function(p,o){if(f.contains(o.toString())){var n=Object.filter(l,function(s,r,q){return s.contains(k)});if(Object.keys(n).length==1){f[f.indexOf(o)]=Object.keys(n)[0]}}})});g.channels=[].combine(f).join(",");if(g.channels==""){delete (g.channels)}g[j]=k;a(this.cookieName,unescape(Object.toQueryString(g)),366)};return{Implements:[Events],initialize:function(){this.addEvent("datarecieved",this.handleServerCookieResponse);this.addEvent("removeChannelDefaultCookie",this.handleServerCookieResponseDefaultCookieRemoveChannel);this.addEvent("updateTvChannels",this.handlerUpdateTvChannels);this.addEvent("updateTvChannelsAndReload",this.handlerUpdateTvChannelsAndReload);new Request.JSON({url:"/rt-service/personalisation/getregions?&type=.js",method:"get",onSuccess:function(f){this.serverRegions=f}.bind(this)}).send()},handlerUpdateTvChannels:function(f,g){},handlerUpdateTvChannelsAndReload:function(f,g){document.location.reload()},getChannelCookieValueForSelection:function(g){var f=c.bind(this)(this.cookieName);if(f==null){f={}}this.personalisationService.getChannelCookie(this,"datarecieved",g,f.bbcRegion,f.itvRegion)},setPersonalisationService:function(f){this.personalisationService=f},handleServerCookieResponse:function(f,g){a(this.cookieName,f.Value,366);document.location.reload()},handleServerCookieResponseDefaultCookieRemoveChannel:function(f,g){a(this.cookieName,f.Value,366);this.removeChannel(g.channelIdToRemove);document.location.reload()},updateTvChannelsAndReload:function(f,g){document.location.reload()},setCookieName:function(f){this.cookieName=f;if(d(f)!=null){a(f,d(f),366)}},getCookieValue:function(f){return d(f)},removeChannel:function(f){var g=c(this.cookieName);if(g!=null){g.channels.erase(f.toString());g.channels=g.channels.join(",");a(this.cookieName,unescape(Object.toQueryString(g)),366);this.updateProfile("updateTvChannelsAndReload","removeChannel")}else{var h=$("platform").getElement("li a").get("text");this.personalisationService.getChannelCookie(this,"removeChannelDefaultCookie",h,null,null,{channelIdToRemove:f})}},setRegion:function(f,g){if(f!=null){e.apply(this,[this.cookieName,this.serverRegions.bbcRegion,f,"bbcRegion"])}if(g!=null){e.apply(this,[this.cookieName,this.serverRegions.itvRegion,g,"itvRegion"])}},parse:function(){return c.bind(this)(this.cookieName)},setChannels:function(f){var g=c.bind(this)(this.cookieName);if(g==null){g={}}g.channels=f;a(this.cookieName,unescape(Object.toQueryString(g)),366);this.updateProfile("updateTvChannels","setChannels")},setPlatformAndChannels:function(h,f){var g=c.call(this,this.cookieName);if(g==null){g={}}g.platform=h;g.channels=f.join(",");a(this.cookieName,unescape(Object.toQueryString(g)),366);return this.updateProfile("updateTvChannelsAndReload","setPlatformAndChannels")},isLoggedIn:function(f){this.loggedIn=f},updateProfile:function(f){if(this.loggedIn){if(this.cookieName=="RadioChannels"){this.personalisationService.setRadioChannelsInProfile(this,f,null)}else{this.personalisationService.setTvChannelsInProfile(this,f,null)}return true}else{return false}}}}());Namespace("RT.services").PersonalisationService=new Class.Singleton(function(){var b="";var a=function(e,d){return b+e.substitute(d)};var c=function(e,d,f,g){var h={};new Request.JSON({url:a(g,h),method:"GET",noCache:true,onComplete:function(i){e.fireEvent(d,[i,f])}.bind(this)}).send()};return{Implements:Events,endpoints:{getCookie:"/getcookie?platform={platform}&bbcRegion={bbcRegion}&itvRegion={itvRegion}",setTvChannels:"/setusertvchannels",setRadioChannels:"/setuserradiochannels"},setServiceBaseUrl:function(d){b=d},getChannelCookie:function(g,e,i,d,f,h){var j=this.endpoints.getCookie;var k={platform:i,bbcRegion:d,itvRegion:f};new Request.JSON({url:a(j,k),method:"GET",onComplete:function(l){g.fireEvent(e,[l,h])}.bind(this)}).send()},setTvChannelsInProfile:function(e,d,f){c(e,d,f,this.endpoints.setTvChannels)},setRadioChannelsInProfile:function(e,d,f){c(e,d,f,this.endpoints.setRadioChannels)}}}());Namespace("RT.services").ScheduleService=new Class.Singleton(function(){var b="";var a=function(e,c,f,d){if(f==undefined){return b+e.substitute(c)}return b+e.substitute(c)+"&"+f};return{Implements:Events,endpoints:{schedule:"?startDate={startDate}&hours={hours}&totalWidthUnits={windowSize}&channels={channels}"},setServiceBaseUrl:function(c){b=c},setUserCookie:function(c){userCookieValue=c},userChannels:function(){return RT.personalisation.ChannelsCookie.parse(RT.personalisation.ChannelsCookie.cookieName).channels},getSchedule:function(h,f,k,g,i,o,l,d,j){var e=l+d;var m=this.endpoints.schedule;var c=this.userChannels().slice(l,e).join(",");var n={startDate:k,hours:g,windowSize:o,channels:c};new Request.JSON({url:a(m,n),method:"GET",onSuccess:function(p){if(i!=null){p=i(p)}h.fireEvent(f,[p,k,j])}.bind(this)}).send()},getPromoSlotSchedule:function(c,f,d,h,e,g,j){var i={startDate:h,hours:e,windowSize:j,channels:c};new Request.JSON({url:a(this.endpoints.schedule,i),method:"GET",onSuccess:function(k){if(g!=null){k=g(k)}f.fireEvent(d,[k,h])}.bind(this)}).send()},getTimestamp:function(c){return c.format("%d-%m-%Y %H:%M:%S")}}}());Namespace("RT.listings").EpgController=new Class(function(){var c=null;var d=function(e){var f=e.getHours();return e.clearTime().increment("hour",f)};var b=function(e){return e.replace(/&(?!amp;)/,"&amp;")};var a=function(i,h){var g={HoursLegend:"",ChannelsLegend:"",ChannelsMarkup:""};var e="";i.Channels.each(function(j){e+="<li>{channelName}</li>".substitute({channelName:j.DisplayName})});g.ChannelsLegend=b("<ul>{legendInner}</ul>".substitute({legendInner:e}));var f="";i.Legend.CurrentTimePeriodItems.each(function(j){f+="<li>{hour}</li>".substitute({hour:j})});g.HoursLegend=b('<ul data-starthour="{CurrentTimePeriodIdentifier}">{legendInner}</ul>'.substitute({legendInner:f,CurrentTimePeriodIdentifier:i.Legend.CurrentTimePeriodIdentifier}));i.Channels.each(function(j){var l="";j.TvListings.each(function(n){l+='<li data-episodeId="{EpisodeId}" data-programmeId="{ProgrammeId}" class="{ItemSpecialisationClassPrefix}-item{TvChoiceCssClass} {ContinuationClass} {PickProviders}" style="{Dimension}: {RelativeSize}px">{TvChoiceSpan}{InlineHeaderLink}{SpecialisationSpan}</li>'.substitute({EpisodeId:n.EpisodeId,ProgrammeId:n.ProgrammeId,ItemSpecialisationClassPrefix:n.Specialisation!=null?n.Specialisation:"tbc",RelativeSize:n.RelativeSize,Dimension:h?"height":"width",InlineHeaderLink:n.Specialisation!=null?'<a href="'+n.Link+"\" data-hover='{DataHover}' class='short-title'>"+n.Title+"</a>"+(n.FilmStarRating!=null?'<span class="image-replace rating rated'+n.FilmStarRating+'">'+n.FilmStarRating+"</span>":""):'<a class="tbc-item"><div>'+n.Title+"</div></a>",ContinuationClass:n.ContinuationState,TvChoiceCssClass:n.IsTvChoice?"-radiotimes-choice":"",TvChoiceSpan:n.IsTvChoice?'<span class="image-replace radiotimes-pick"><!--Radio Times TV Choice--></span>':"",SpecialisationSpan:n.Specialisation!=null?'<span class="image-replace '+n.Specialisation+'"></span>':"",PickProviders:n.IsPickForProvider.join(" ")}).substitute({DataHover:JSON.encode(n)})});var m="";j.Packages.each(function(n){if(n.EpgChannel){m+="<li>{EpgChannel} {Package}</li>".substitute(n)}});var k="<dl><dt>Channel options</dt>";if(j.WatchNow&&j.Media==0){k+='<dd class="live"><a href="{WatchNow}" target="_">Watch Live</a></dd>'.substitute(j)}else{if(j.WatchNow){k+='<dd class="live"><a href="{WatchNow}" target="_">Listen Live</a></dd>'.substitute(j)}}k+="</dl>";g.ChannelsMarkup+=b('<article data-channel-id="{ChannelId}"><div class="channel"><h1 class="channel-info-box {WatchLiveClass}"><span>{ChannelName}</span></h1><aside class="channel-info" style="display: none;"><h1>Channel numbers</h1><ul>{ChannelNumbers}</ul>{ChannelOptions}<a class="close" href="#">Close</a></aside><div><ul><li data-hours="{CurrentTimePeriodIdentifier}"><ul>{tvListingsInner}</ul></li></ul></div></div></article>'.substitute({ChannelId:j.Id,ChannelName:j.DisplayName,ChannelNumbers:m,ChannelOptions:k,CurrentTimePeriodIdentifier:i.Legend.CurrentTimePeriodIdentifier,WatchLiveClass:j.WatchNow?"watch-now":"",tvListingsInner:l}))});g.startHour=i.Legend.CurrentTimePeriodIdentifier;return g};return{Implements:[Events,Options],options:{ScheduleService:null,Now:null,WindowSize:3,UserCookie:"",ListingsAdvertRowIndexes:[],IsListView:false},initialize:function(e){this.setOptions(e);c=this;this.setOptions(e);if(this.options.Now==null){this.options.Now=new Date()}this.options.Now=d(this.options.Now)},transformToHtml:function(e){return a(e,this.options.IsListView)},setSc:function(e){this.sc=e;this.trackEvent();this.get()},setSd:function(e){this.sd=e;this.trackEvent();this.get()},trackEvent:function(){window._gaq.push(["_trackEvent",this.options.Specialization+"Listings","Navigate"+(this.options.IsListView?"List":"Grid"),"sc={sc}&sd={sd}".substitute(this)])},get:function(){if(this.options.IsListView){var h=this.options.ScheduleService.getTimestamp(Date.parse(this.sd).increment("hour",6));this.options.ScheduleService.getSchedule(c,"datarecieved",this.sd,6,this.transformToHtml.bind(this),864,this.sc,6,0);this.options.ScheduleService.getSchedule(c,"datarecieved",h,6,this.transformToHtml.bind(this),864,this.sc,6,1);for(var f=2;f<=this.options.ListingsAdvertRowIndexes.length;f++){this.options.ScheduleService.getSchedule(c,"datarecieved",h,6,this.transformToHtml.bind(this),864,this.sc,0,f)}}else{var e=0,g=0;this.options.ListingsAdvertRowIndexes.each(function(i){this.options.ScheduleService.getSchedule(c,"datarecieved",this.sd,3,this.transformToHtml.bind(this),720,e,i-e,g++);e=i},this);this.options.ScheduleService.getSchedule(c,"datarecieved",this.sd,3,this.transformToHtml.bind(this),720,e,999,g)}if(this.options.PromoSlotChannel!=null){this.options.ScheduleService.getPromoSlotSchedule(this.options.PromoSlotChannel,c,"promodatarecieved",this.sd,3,this.transformToHtml.bind(this),720)}},resetTime:function(e){this.options.Now=d(e);return this},setObjectToFireEvent:function(e){c=e},getTimestamp:function(e){var f=this.options.Now;if(isNaN(e)){if(e=="next"){f.increment("hour",2)}else{if(e=="previous"){f.decrement("hour",2)}}}else{f.set("hr",e)}return this.options.ScheduleService.getTimestamp(f)},getDate:function(){return this.options.Now.format("%d-%b-%Y")}}}());!function(){Element.NativeEvents.hashchange=2;var a=undefined;window.HashListener=new Class({Implements:[Options,Events],options:{blank_page:"blank.html",start:false},iframe:null,currentHash:"",firstLoad:true,handle:false,useIframe:(Browser.ie&&(typeof(document.documentMode)=="undefined"||document.documentMode<8)),ignoreLocationChange:false,initialize:function(c){var b=this;this.setOptions(c);if(Browser.opera&&window.history.navigationMode){window.history.navigationMode="compatible"}if(("onhashchange" in window)&&(typeof(document.documentMode)=="undefined"||document.documentMode>7)){window.addEvent("hashchange",function(){var d=b.getHash();if(d==b.currentHash){return}b.fireEvent("hashChanged",d);b.fireEvent("hash-changed",d)})}else{if(this.useIframe){this.initializeHistoryIframe()}}window.addEvent("unload",function(d){b.firstLoad=null});if(this.options.start){this.start()}},initializeHistoryIframe:function(){var c=this.getHash(),b;this.iframe=new IFrame({src:this.options.blank_page,styles:{position:"absolute",top:0,left:0,width:"1px",height:"1px",visibility:"hidden"}}).inject(document.body);b=(this.iframe.contentDocument)?this.iframe.contentDocument:this.iframe.contentWindow.document;b.open();b.write('<html><body id="state">'+c+"</body></html>");b.close();return},checkHash:function(){var c=this.getHash(),d,b;if(this.ignoreLocationChange){this.ignoreLocationChange=false;return}if(this.useIframe){b=(this.iframe.contentDocument)?this.iframe.contentDocumnet:this.iframe.contentWindow.document;d=b.body.innerHTML;if(d!=c){this.setHash(d);c=d}}if(this.currentLocation==c){return}this.currentLocation=c;this.fireEvent("hashChanged",c);this.fireEvent("hash-changed",c)},setHash:function(b){window.location.hash=this.currentLocation=b;if(("onhashchange" in window)&&(typeof(document.documentMode)=="undefined"||document.documentMode>7)){return}this.fireEvent("hashChanged",b);this.fireEvent("hash-changed",b)},getHash:function(){var b;if(Browser.firefox){b=/#(.*)$/.exec(window.location.href);return b&&b[1]?b[1]:""}else{if(Browser.safari||Browser.chrome){return decodeURI(window.location.hash.substr(1))}else{return window.location.hash.substr(1)}}},setIframeHash:function(c){var b=(this.iframe.contentDocument)?this.iframe.contentDocumnet:this.iframe.contentWindow.document;b.open();b.write('<html><body id="state">'+c+"</body></html>");b.close()},updateHash:function(b){if(document.id(b)){this.debug_msg("Exception: History locations can not have the same value as _any_ IDs that might be in the document, due to a bug in IE; please ask the developer to choose a history location that does not match any HTML IDs in this document. The following ID is already taken and cannot be a location: "+b)}this.ignoreLocationChange=true;if(this.useIframe){this.setIframeHash(b)}else{this.setHash(b)}},start:function(){this.handle=this.checkHash.periodical(100,this)},stop:function(){clearInterval(this.handle)}})}();!function(){var a=Events.prototype.fireEvent;var b=undefined;window.HistoryManager=new Class({Extends:HashListener,options:{delimiter:"",serializeHash:null,deserializeHash:null,compat:false},state:{},stateCache:{},initialize:function(c){this.parent(c);this.serializeHash=this.options.serializeHash||this.serializeHash;this.deserializeHash=this.options.deserializeHash||this.deserializeHash;this.addEvent("hashChanged",this.updateState.bind(this))},fireEvent:function(e,c,d){if(!d){d=1}a.apply(this,[e,c,d])},serializeHash:function(c){return JSON.encode(c)},deserializeHash:function(c){return JSON.decode(decodeURIComponent(c))},updateState:function(d){var c=this;if(this.options.delimiter){d=d.substr(this.options.delimiter.length)}d=this.deserializeHash(d);Object.each(this.state,function(i,g){var h,e,f;if(!d||d[g]===b){h=c.state[g];if(c.options.compat){c.fireEvent(g+"-removed",[h])}c.fireEvent(g+":removed",[h]);c.fireEvent(g,[h]);delete c.state[g];delete c.stateCache[g];if(d&&d[g]){delete d[g]}return}f=typeOf(d[g]);e=(f=="string"||f=="number"||f=="boolean")?d[g]:JSON.encode(d[g]);if(e!=c.stateCache[g]){h=d[g];c.state[g]=h;c.stateCache[g]=e;if(c.options.compat){c.fireEvent(g+"-updated",[h]);c.fireEvent(g+"-changed",[h])}c.fireEvent(g+":updated",[h]);c.fireEvent(g+":changed",[h]);c.fireEvent(g,[h])}delete d[g]});Object.each(d,function(f,e){c.state[e]=f;v_type=typeOf(d[e]);c.stateCache[e]=(v_type=="string"||v_type=="number"||v_type=="boolean")?f:JSON.encode(f);if(c.options.compat){c.fireEvent(e+"-added",[f]);c.fireEvent(e+"-changed",[f])}c.fireEvent(e+":added",[f]);c.fireEvent(e+":changed",[f]);c.fireEvent(e,[f])})},set:function(c,e){var d=Object.clone(this.state);d[c]=e;this.updateHash(this.options.delimiter+this.serializeHash(d));return this},remove:function(c){var d=Object.clone(this.state);delete d[c];this.updateHash(this.options.delimiter+this.serializeHash(d));return this}})}();Namespace("RT.utils").LoadingSpinner=new Class({Implements:Options,initialize:function(c){var a,b;this.setOptions(c);this.spinner=new Element("div",{"class":this.options.spinnerClass});if(typeOf(this.options.imgPath)=="string"){b=new Element("div.throbber");a=new Element("img",{src:this.options.imgPath});a.inject(b);this.spinner.grab(b)}if(typeOf(this.options.message)=="string"){this.spinner.grab(new Element("p",{text:this.options.message,"class":"loading-message"}))}},options:{spinnerClass:"loading",imgPath:null,message:null,position:"bottom"},showSpinner:function(a){if(typeOf(a)=="element"){this.target=a}$(this.spinner).inject(this.target,this.options.position)},hideSpinner:function(){$(this.spinner).destroy()}});(function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b.programmeDetailBox=a(function(h,e,i,j,d){this.compilerInfo=[3,">= 1.0.0-rc.4"];i=i||h.helpers;d=d||{};var c="",x,g="function",f=this.escapeExpression,w=this;function k(z,y){return" radio-times-choice"}function s(z,y){return'\n            <span class="image-replace radiotimes-pick">Radio Times TV Choice</span>\n        '}function t(A,z){var y="",B;y+='class="rt-choice-';if(B=i.Specialisation){B=B.call(A,{hash:{},data:z})}else{B=A.Specialisation;B=typeof B===g?B.apply(A):B}y+=f(B)+'-header"';return y}function u(A,z){var y="",B;y+='\n                <a href="';if(B=i.Link){B=B.call(A,{hash:{},data:z})}else{B=A.Link;B=typeof B===g?B.apply(A):B}y+=f(B)+'" data-id="';if(B=i.EpisodeId){B=B.call(A,{hash:{},data:z})}else{B=A.EpisodeId;B=typeof B===g?B.apply(A):B}y+=f(B)+'">';if(B=i.Title){B=B.call(A,{hash:{},data:z})}else{B=A.Title;B=typeof B===g?B.apply(A):B}if(B||B===0){y+=B}y+="</a>\n            ";return y}function v(A,z){var y="",B;y+="\n                ";if(B=i.Title){B=B.call(A,{hash:{},data:z})}else{B=A.Title;B=typeof B===g?B.apply(A):B}if(B||B===0){y+=B}y+="\n            ";return y}function l(A,z){var y="",B;y+='\n            <div class="rating rated';if(B=i.FilmStarRating){B=B.call(A,{hash:{},data:z})}else{B=A.FilmStarRating;B=typeof B===g?B.apply(A):B}y+=f(B)+'">';if(B=i.FilmStarRating){B=B.call(A,{hash:{},data:z})}else{B=A.FilmStarRating;B=typeof B===g?B.apply(A):B}y+=f(B)+"</div>\n        ";return y}function m(z,y){return'\n                <p class="repeat">Repeat</p>\n            '}function n(z,y){return'\n                <p class="new-series">New series</p>\n            '}function o(A,z){var y="",B;y+='\n                <a class="read-more" href="';if(B=i.Link){B=B.call(A,{hash:{},data:z})}else{B=A.Link;B=typeof B===g?B.apply(A):B}y+=f(B)+'">More</a>\n            ';return y}function p(A,z){var y="";y+='\n			<a href="/'+f((typeof A===g?A.apply(A):A))+'"><img class="provider-img" src=\'/assets/images/partners/'+f((typeof A===g?A.apply(A):A))+".png'></a>\n        ";return y}function q(A,z){var y="",B;y+='\n                <a href="';if(B=i.Link){B=B.call(A,{hash:{},data:z})}else{B=A.Link;B=typeof B===g?B.apply(A):B}y+=f(B)+'">\n            ';return y}function r(z,y){return"\n                </a>\n            "}c+='<aside class="programme-info">\n    <div class="programme-detail ';if(x=i.Specialisation){x=x.call(e,{hash:{},data:d})}else{x=e.Specialisation;x=typeof x===g?x.apply(e):x}c+=f(x);x=i["if"].call(e,e.IsTvChoice,{hash:{},inverse:w.noop,fn:w.program(1,k,d),data:d});if(x||x===0){c+=x}c+='">\n        ';x=i["if"].call(e,e.IsTvChoice,{hash:{},inverse:w.noop,fn:w.program(3,s,d),data:d});if(x||x===0){c+=x}c+="\n        <h1 ";x=i["if"].call(e,e.IsTvChoice,{hash:{},inverse:w.noop,fn:w.program(5,t,d),data:d});if(x||x===0){c+=x}c+=">\n            ";x=i["if"].call(e,e.Specialisation,{hash:{},inverse:w.program(9,v,d),fn:w.program(7,u,d),data:d});if(x||x===0){c+=x}c+='\n        </h1>\n      <div class="follow"></div>\n        ';x=i["if"].call(e,e.FilmStarRating,{hash:{},inverse:w.noop,fn:w.program(11,l,d),data:d});if(x||x===0){c+=x}c+='\n        <div class="time">\n            <time datetime="';if(x=i.StartTimeMF){x=x.call(e,{hash:{},data:d})}else{x=e.StartTimeMF;x=typeof x===g?x.apply(e):x}c+=f(x)+'">';if(x=i.StartTime){x=x.call(e,{hash:{},data:d})}else{x=e.StartTime;x=typeof x===g?x.apply(e):x}c+=f(x)+'</time> - <time datetime="';if(x=i.EndTimeMF){x=x.call(e,{hash:{},data:d})}else{x=e.EndTimeMF;x=typeof x===g?x.apply(e):x}c+=f(x)+'">';if(x=i.EndTime){x=x.call(e,{hash:{},data:d})}else{x=e.EndTime;x=typeof x===g?x.apply(e):x}c+=f(x)+"</time>\n            ";x=i["if"].call(e,e.IsRepeat,{hash:{},inverse:w.noop,fn:w.program(13,m,d),data:d});if(x||x===0){c+=x}c+="\n            ";x=i["if"].call(e,e.IsNewSeries,{hash:{},inverse:w.noop,fn:w.program(15,n,d),data:d});if(x||x===0){c+=x}c+='\n        </div>\n        <p class="channel-name">';if(x=i.Channel){x=x.call(e,{hash:{},data:d})}else{x=e.Channel;x=typeof x===g?x.apply(e):x}c+=f(x)+'</p>\n        <p class="description">\n            ';if(x=i.EpisodePositionInSeries){x=x.call(e,{hash:{},data:d})}else{x=e.EpisodePositionInSeries;x=typeof x===g?x.apply(e):x}c+=f(x)+"\n            ";if(x=i.Description){x=x.call(e,{hash:{},data:d})}else{x=e.Description;x=typeof x===g?x.apply(e):x}c+=f(x)+"\n            ";x=i["if"].call(e,e.Specialisation,{hash:{},inverse:w.noop,fn:w.program(17,o,d),data:d});if(x||x===0){c+=x}c+="\n        </p>\n        ";x=i.each.call(e,e.IsPickForProvider,{hash:{},inverse:w.noop,fn:w.program(19,p,d),data:d});if(x||x===0){c+=x}c+='\n        <div class="figure">\n            ';x=i["if"].call(e,e.Specialisation,{hash:{},inverse:w.noop,fn:w.program(21,q,d),data:d});if(x||x===0){c+=x}c+='\n                    <img src="';if(x=i.Image){x=x.call(e,{hash:{},data:d})}else{x=e.Image;x=typeof x===g?x.apply(e):x}c+=f(x)+'" alt="';if(x=i.Title){x=x.call(e,{hash:{},data:d})}else{x=e.Title;x=typeof x===g?x.apply(e):x}c+=f(x)+'" height="100" width="130">\n            ';x=i["if"].call(e,e.Specialisation,{hash:{},inverse:w.noop,fn:w.program(23,r,d),data:d});if(x||x===0){c+=x}c+="\n        </div>\n    </div>\n</aside>\n";return c})})();(function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b.programmeDetailBoxHeadlines=a(function(h,e,i,j,d){this.compilerInfo=[3,">= 1.0.0-rc.4"];i=i||h.helpers;d=d||{};var c="",m,g="function",f=this.escapeExpression,l=this;function k(p,o){var n="",q;n+='\n    <li>\n        <a href="'+f(((q=p.Location),typeof q===g?q.apply(p):q))+'">'+f(((q=p.Headline),typeof q===g?q.apply(p):q))+"</a>\n    </li>\n    ";return n}c+='<a href="/news">Latest News</a>\n<ul>\n    ';m=i.each.call(e,e,{hash:{},inverse:l.noop,fn:l.program(1,k,d),data:d});if(m||m===0){c+=m}c+="\n</ul>";return c})})();Namespace("RT.listings").ProgrammeDetailBox=new Class({Implements:Options,initialize:function(a,b){this.setOptions(b);this.container=$$(a);this.template=Handlebars.templates.programmeDetailBox;this.headlinesTemplate=Handlebars.templates.programmeDetailBoxHeadlines;this.container.addEvents({"mouseenter:relay(ul ul > li[data-episodeid] > a)":this.showProgrammeDialog.bind(this),"mouseleave:relay(ul ul > li[data-episodeid])":this.hideProgrammeDialog.bind(this)})},options:{relativeContainer:"content",hoverOnDelay:0,hoverOffDelay:100,overlap:0,overlapStart:"bottom",horizontalOffset:0,showNews:true},showProgrammeDialog:function(c,b){var d=b.getParent("li");var f=d.getElement("a.programme-dialog");if(d.hasClass("hover")||d.hasClass("tbc-item")&&d.get("text").indexOf("Close")>-1){return}d.addClass("hover");if(f!==null){f.show();return}var h=JSON.decode(b.get("data-hover"));if(h===null){return}h.Channel=(h.Channel?d.getParent(".channel > h1").get("text"):"");h.Description=(h.Description?h.Description.limitText(14,"...").cleanHtml():"");var g=new Element("a",{html:this.template(h),href:b.get("href"),"class":"programme-dialog"}).inject(d,"bottom");var e=this.getDialogPosition(d);var a=g.getElement("aside");a.setStyles({top:e.top,left:e.left});a.show();this.logProgrammeHover(a);this.fetchNewsArticles(a)},hideProgrammeDialog:function(b,a){if(!a.hasClass("hover")){return}a.getElement("a.programme-dialog").hide();a.removeClass("hover");this.clearProgrammeHover(a)},getDialogPosition:function(b){if(b.getElement("aside").length===0){return false}var c=b.getCoordinates(document.id(this.options.relativeContainer));var a=b.getElement("aside").getDimensions();return{top:c[this.options.overlapStart]+this.options.overlap,left:(c.left-(a.width/2))+(c.width/2)+this.options.horizontalOffset}},logProgrammeHover:function(a){var b=function(){var d=a.getElement("h1").get("text").trim();var e=a.getElement("h1 > a").get("data-id");var c=d+" ["+e+"]";voila.logHover({content:e});_gaq.push(["_trackEvent",this.options.specialization+"Listings","Hover",c])}.delay(1500,this);a.getParent("li").store("ajaxTimeout",b)},clearProgrammeHover:function(a){clearTimeout(a.retrieve("ajaxTimeout"))},newsArticlesReceived:function(b,a){if(b.length>0){var c=new Element("div",{html:this.headlinesTemplate(b).trim(),"class":"headlines"});a.getElement(".programme-detail").grab(c)}},fetchNewsArticles:function(a){if(!a.getElement(".headlines")&&this.options.showNews){var b=a.getParent("li");var c=b.get("data-programmeId")||b.get("data-episodeId");var d=new Request.JSON({url:"/rt-service/news/forprogramme?id="+c,onSuccess:function(e){this.newsArticlesReceived.call(this,e,a)}.bind(this)});d.get()}}});Namespace("RT.listings").ChannelDetailBox=new Class(function(){function b(){var d=this.detailBoxes();if(d.isDisplayed().contains(true)){this.hide(d)}this.somethingShown=false}function c(d){var e={};return d&&e.toString.call(d)=="[object Function]"}function a(){var d=this;this.headersRoot.addEvent("click:relay("+d.headersLiveSelector+")",function(f,h){var g=h.headers().indexOf(this);var e=h.detailBoxes()[g];if(e.getElement("h1")!=null){(e.isDisplayed()?h.hide(e):h.show(e))}f.stop()}.bindEvent(d));this.detailsRoot.addEvent("click:relay("+d.detailsLiveSelector+" .close)",function(e,f){f.hide(this.getParent(".channel-info"));e.stop()}.bindEvent(d));this.detailsRoot.addEvent("click:relay("+d.detailsLiveSelector+")",function(e){e.stopPropagation()});$(document).addEvent("click",function(e,f){b.call(f)}.bindEvent(this))}return{Implements:Options,initialize:function(g,f,e,d,h){this.setOptions(h);this.headersRoot=$$(g);this.detailsRoot=$$(e);this.headersLiveSelector=f;this.detailsLiveSelector=d;this.headers=function(){return $$(f)};this.detailBoxes=function(){return $$(d)};a.call(this)},options:{fx:{mode:"both",duration:200}},show:function(d){if(d){if(!d.getElement(".close")){new Element("a.close[text=Close][href=#]").inject(d)}this.somethingShown=true;b.call(this);d.getParent().addClass("info-open");d.reveal(this.options.fx)}},hide:function(d){if(d){this.detailBoxes().getParent().removeClass("info-open");var e=($$("html")[0].hasClass("ie7")||$$("html")[0].hasClass("ie8")||$$("html")[0].hasClass("ie9"));if(e&&d.nodeType!="1"&&c(d)){d().dissolve(this.options.fx);return}d.dissolve(this.options.fx);return}}}}());Namespace("RT.utils").DateTimeHelper=new Class(function(){Date.clearParsers();Date.defineParser("%d-%m-%Y %H:%M:%S");Date.defineParser("%Y-%m-%d %H:%M:%S%Z");return{convertHourTo24:function(c){var d=c.replace(/\d/g,"").toLowerCase(),a=parseInt(c,10),b=(d=="am");a-=(b&&a==12)?12:0;a+=(b)?0:12;if(a<10){a="0"+a}if(a==24){a=12}return parseFloat(a)},urlHasDate:function(a){if(a==undefined){a=window.location.search}a=decodeURI(a);return/[&\?]sd=(\d\d-\d\d-\d\d\d\d) (\d\d:\d\d:\d\d)/.exec(a)},dateFromUrl:function(b){if(b==undefined){b=window.location.search}var a=this.urlHasDate(b);if(a==null){return new Date()}else{a=Array.from(a);a.erase("%20").shift();return Date.parse(a.join(" "))}}}}());Namespace("RT.listings").Timeline=new Class({timeline:null,updateTimeline:function(e){if(typeOf(e)!="string"){return}var d=(!this.timeline)?this.timeline=$(this.options.timelineId):this.timeline,g=this.timeline.getElements("li"),h,c,a,f=$$(g.getElements("a").flatten()),b=g.filter(".current");e=e.toLowerCase();if(e=="0am"){e="12am"}this.timeline.getElements(".current, .alt").removeClassAll();h=f.filter('[data-time="'+e+'"]');h.getParent().addClass("current");c=g.indexOf(this.timeline.getElement(".current"));a=Array.slice(g,c+1,c+this.options.windowSizeInHours);$$(a).addClass("alt")},options:{timelineId:"timeline",windowSizeInHours:3}});Namespace("RT.ads").AdRefresh=new Class({skipNextRefresh:false,refresh:function(){if(!this.skipNextRefresh){googletag.cmd.push(function(){googletag.pubads().refresh()})}else{this.skipNextRefresh=false}}});Namespace("RT.listings").HourOverlay=new Class({initialize:function(a,b){this.grid=$(a);this.hours=$(b);this.isVisible=false;this.setHeights();this.placeholder=new Element("div");this.placeholder.inject(this.hours,"after");this.checkScroll.periodical(500,this);this.checkHoursPosAfterAddsLoad.periodical(2000,this)},checkScroll:function(){var a=window.getScroll().y;if(a>this.hoursTopPos&&a<this.gridBottomPos){if(!this.isVisible){this.grid.addClass("scrolling");this.placeholder.addClass("height");this.isVisible=true}}else{if(this.isVisible){this.grid.removeClass("scrolling");this.placeholder.removeClass("height");this.isVisible=false}}},checkHoursPosAfterAddsLoad:function(){this.setHeights()},setHeights:function(){if(!this.isVisible){this.hoursTopPos=this.hours.getCoordinates().top}this.gridBottomPos=(this.grid.getNext()||this.grid.getParent().getNext()).getCoordinates().top}});!function(){function a(b,d){var c=b.getStyle(d);return c=="auto"?0:c.toInt()}window.Carousel=new Class({Implements:[Options,Events],options:{link:"cancel",mode:"horizontal",animation:"Move",scroll:4,distance:1,fastInitialize:false,fx:{link:"cancel",transition:"sine:out",duration:500}},plugins:{},initialize:function(c){this.addEvent("change",function(d){this.current=d}.bind(this)).setOptions(c);["previous","next"].each(function(d){if($(this.options[d])){$(this.options[d]).addEvent("click",function(f){f.stop();this[d]()}.bind(this))}},this);this.elements=$(c.container).getChildren(c.selector);this.current=0;if(this.options.fastInitialize){var b=this.options.fx.duration;this.options.fx.duration=0;this.anim=new this.plugins[this.options.animation](this);this.move(this.options.current||0);this.options.fx.duration=b;this.anim=new this.plugins[this.options.animation](this)}else{this.anim=new this.plugins[this.options.animation](this);this.move(this.options.current||0)}},isVisible:function(d){if(typeOf($(d))=="element"){d=this.elements.indexOf($(d))}var e=this.elements.length,b=this.current,f=this.options.scroll;if(b<=d&&d<b+f){return true}if(this.options.circular){for(var c=1;c<f;c++){if((c+b)%e==d){return true}}}return false},first:function(){return this.current},previous:function(b){return this.move(this.current-this.options.distance,b)},next:function(b){return this.move(this.current+this.options.distance,b)},move:function(g,d){var e=this.elements,c=this.current,h=e.length,i=this.options.scroll;if(typeOf($(g))=="element"){g=e.indexOf($(g));this.setStyles({display:"none",position:"absolute"})}if(!this.options.circular){if(g>h-i){g=h-i}}else{if(g<0){g+=h}g%=Math.max(h,1)}if(g<0||h<=i||g>=h){return this}if(d==undefined){var f=c<g?g-c:e.length-c+g,b=c>g?c-g:c+e.length-g;d=Math.abs(f)<=Math.abs(b)?1:-1}this.anim.move(this,g,d);return this}});Carousel.prototype.plugins.Move=new Class({initialize:function(b){var f=this.up=b.options.mode=="vertical",d=this.options=b.options,c=this.elements=b.elements;if(c.length!==0){var e=c[0].getParent();e.setStyles({height:c[0].setStyle("display","block").getStyle("height"),position:"relative",overflow:"hidden"}).getStyle("padding"+(this.up?"Top":"Left"));c.each(function(g){g.setStyles({display:"block",position:"absolute"})});this.property="offset"+(f?"Top":"Left");this.margin=f?["marginTop","marginBottom"]:["marginLeft","marginRight"];this.padding=a(e,f?"paddingTop":"paddingLeft");this.pad=a(e,"paddingLeft");this.reorder(0,1).fx=new Fx.Elements(c,d.fx).addEvents({onStart:function(){b.active=true},onComplete:function(){b.active=false}})}},reorder:function(h,b){var j=this.options,m=this.elements,l,n,f=pos=this.padding,k=this.pad,d,e,g=m.length,c=j.mode=="horizontal",o=c?"offsetWidth":"offsetHeight";if(b==-1){for(d=g;d>j.scroll-1;d--){e=(d+h+g)%g;n=l;l=m[e];if(n){pos-=a(n,this.margin[0])}if(c){l.setStyle("left",pos)}else{l.setStyles({left:k,top:pos})}pos-=(l[o]+a(l,this.margin[1]))}pos=f+l[o]+a(l,this.margin[0]);for(d=1;d<j.scroll;d++){e=(d+h+g)%g;n=l;l=m[e];if(n){pos+=a(n,this.margin[1])}if(c){l.setStyle("left",pos)}else{l.setStyles({left:k,top:pos})}pos+=l[o]+a(l,this.margin[0])}}else{if(b==1){for(d=0;d<g;d++){e=(d+h+g)%g;n=l;l=m[e];if(c){l.setStyle("left",pos)}else{l.setStyles({left:k,top:pos})}pos+=l[o]+a(l,this.margin[0]);if(n){pos+=a(n,this.margin[1])}}}}return this},move:function(b,c,d){var e={},h=this.up,g=this.property,f;if(this.options.circular){this.reorder(b.current,d)}f=b.elements[c][g]-this.padding;b.elements.each(function(i,j){e[j]=h?{top:i[g]-f}:{left:i[g]-f}});this.fx.cancel().start(e).chain(function(){b.fireEvent("change",c)})}})}();Namespace("RT.listings").DayNavigation=new Class(function(){return{Implements:[Events,RT.utils.DateTimeHelper],initialize:function(){var d=$("day-navigation");if(d==null){return}var b=d.getElement(".slide");b.addClass("active");var a=this.dateFromUrl(window.location.href).format("%d-%m-%Y");var c=4;b.getElements("li").each(function(f,g){if(f.get("data-date")==a){c=b.getElements("div").indexOf(f.getParent("div"))-1}});this.dayLinks=$("day-navigation").getElements(".slide a");var e=this;this.dayLinks.each(function(f){f.addEvent("click",e.dayClicked.bindEvent(e))});this.navLinks=d.getElements(".tabs a");this.carousel=new Carousel({container:"slide",scroll:1,circular:false,current:c,previous:this.navLinks[0],next:this.navLinks[1],interval:10,fastInitialize:true,onChange:function(f){var g=$$(".tabs li.next");var h=$$(".tabs li.previous");if(f==5){g.hide()}else{g.show()}if(f==0){h.hide()}else{h.show()}}});b.setStyle("height","36px")},dayClicked:function(b,c){b.preventDefault();var a=c.dateFromUrl(this.getProperty("href"));c.fireEvent("change",a)},updateTimeInDayLinks:function(b){var a=this.convertHourTo24(b);this.dayLinks.each(function(c){var e=c.getProperty("href");if(this.urlHasDate(e)){var d=this.dateFromUrl(e);d.set("hours",a);c.setProperty("href","?sd="+d.format("%d-%m-%Y %H:%M:%S"))}},this)},updateHighlighting:function(c){$("day-navigation").getElements(".current").removeClass("current");var d=$$("#day-navigation li[data-date="+c.format("%d-%m-%Y")+"]");if(d){d.addClass("current");var b=d.getParent("div")[0];var f=b.getParent();var a=f.getChildren();var e=a.indexOf(b);if(!this.carousel.isVisible(e)){this.carousel.move(e)}}}}}());Namespace("RT.listings").ViewSwitcher=new Class(function(){var b=function(f,g){f.preventDefault();if(this.hasClass("current")){return}e(this.innerHTML,g)};var e=function(g,f){if(a(f)==g){return}f.cookie.set(f.key,g);f.cookie.set("NeedsSaving",true);f.cookie.save();c(f);window.location.reload()};var a=function(f){return f.cookie.get(f.key)};var c=function(f){f.links.each(function(g){g.toggleClass("current",g.innerHTML=="Grid"?!f.isListView():f.isListView())})};var d=function(g){($("tv-listings")||$("radio-listings")).toggleClass("list-view",g.isListView());var f=g.isListView()?new RT.listings.ChannelDetailBox("#hours","div > ul > li > ul > li","#channels","aside.channel-info"):new RT.listings.ChannelDetailBox("#channels",".channel-info-box","#channels","aside.channel-info");Namespace("RT").programmeSorting=g.isListView()?null:new RT.listings.ProgrammeSorting(".sortable",f)};return{initialize:function(f,h){var g=this;this.section=f;this.tvGrid=h;this.links=this.section.getElements("a");this.links.each(function(i){i.addEvent("click",b.bindEvent(g))});this.key=document.location.href.indexOf("tv")>0?"TVListingsMode":"RadioListingsMode";this.cookie=new Hash.Cookie("UserChoices");c(this);f.show();d(this)},isListView:function(){return a(this)!=null&&a(this).match(/list/i)!=null}}}());Namespace("RT.listings").TvGrid=new Class(function(){var a=function(d,b,c){d.replaceChild(b,c);c.destroy()};return{Implements:[Events,Options,RT.listings.Timeline,RT.utils.DateTimeHelper],initialize:function(c,d,j,f,e,i,b,h){this.setOptions(h);this.expandText();this.channels=c.getElements(".channels div > ul");this.hours=d.getElements("div > ul");this.elements=[].combine(this.hours).combine(this.channels);this.dayNavigation=b;this.navPrev=d.getElement("nav li:first-child a");this.navNext=d.getElement("nav li + li a");this.timeline=j;this.viewSwitcher=new RT.listings.ViewSwitcher($("view-switcher"),this);this.options.IsListView=this.viewSwitcher.isListView();this.options.PromoSlot=$$(".listings-promo-channel")[0];this.options.PromoSlotChannel=this.options.PromoSlot?this.options.PromoSlot.get("data-channel-id"):null;Namespace("RT").listingsController=new RT.listings.EpgController(this.options);this.options.windowSizeInHours=this.options.IsListView?12:3;var g=RT.listingsController.getTimestamp(f.getHours());RT.listingsController.resetTime(f);RT.listingsController.sd=g;RT.listingsController.sc=e;new RT.listings.HourOverlay(c,d);this.ads=new RT.ads.AdRefresh();this.ads.skipNextRefresh=true;this.specialization=i;RT.listingsController.setObjectToFireEvent(this);this.dayNavigation.addEvent("change",this.jumpToDate.bindEvent(this));this.addEvent("datarecieved",this.addNewProgrammeData);this.addEvent("promodatarecieved",this.addNewPromoProgrammeData);this.navPrev.addEvent("click",this.navigatePrev.bindEvent(this));this.navNext.addEvent("click",this.navigateNext.bindEvent(this));this.timeline.addEvent("click:relay(ul a)",this.jumpToHour.bindEvent(this));this.History=new HistoryManager();this.History.addEvent("sd:changed",function(k){RT.listingsController.setSd(k)});this.History.addEvent("sd:removed",function(){RT.listingsController.setSd(g)});this.History.addEvent("sc:changed",function(k){RT.listingsController.setSc(k)});this.History.addEvent("sc:removed",function(){RT.listingsController.setSc(e)});this.History.start();if(this.options.IsListView){this.showHideNavigationArrows()}this.loadListings()},options:{},loadListings:function(){if(RT.personalisation.ChannelsCookie.parse(RT.personalisation.ChannelsCookie.cookieName)){if(this.options.IsListView!=this.viewSwitcher.isListView()){window.location.href=window.location.href}RT.listingsController.get()}else{this.loadListings.delay(100,this)}},showHideNavigationArrows:function(){if(RT.listingsController.sc<=0){this.navPrev.getParent().hide()}else{this.navPrev.getParent().show()}if(RT.listingsController.sc+6>=RT.services.ScheduleService.userChannels().length){this.navNext.getParent().hide()}else{this.navNext.getParent().show()}},showSpinners:function(){$$("#channels div.listings").addClass("loading")},navigateNext:function(b,c){c.showSpinners();if(c.options.IsListView){c.History.set("sc",RT.listingsController.sc+6)}else{c.History.set("sd",RT.listingsController.getTimestamp("next"))}b.preventDefault()},navigatePrev:function(b,c){c.showSpinners();if(c.options.IsListView){c.History.set("sc",RT.listingsController.sc-6)}else{c.History.set("sd",RT.listingsController.getTimestamp("previous"))}b.preventDefault()},jumpToHour:function(b,d){b.preventDefault();if(this.getParent().hasClass("current")){return}var c=d.convertHourTo24(this.get("data-time"));d.showSpinners();d.History.set("sd",RT.listingsController.getTimestamp(c))},jumpToDate:function(b,c){c.History.set("sd",RT.services.ScheduleService.getTimestamp(b))},expandText:function(){$$("li.tv-item,li.film-item,li.radio-item,li.tbc-item,li.tv-item-radiotimes-choice,li.film-item-radiotimes-choice,li.radio-item-radiotimes-choice").each(function(d){var b=parseInt(d.getStyle("height"));var c=d.hasClass("continued");d.toggleClass("hideText",b<(c?37:19));d.toggleClass("multilineText",b>(c?55:37))})},addNewProgrammeData:function(b,j,h,g){g=g||"#channels div.listings";var i=$$(g);if(b.ChannelsMarkup!=""){var c={Legend:"",ChannelsMarkup:""};c.Legend=innerShiv("<li>"+(this.options.IsListView?b.ChannelsLegend:b.HoursLegend)+"</li>",true);var d='<div class="hours-list-view"><ul><li></li><li></li><li></li><li></li><li></li><li></li></ul></div>';i[h].innerHTML=this.options.IsListView?d+b.ChannelsMarkup:b.ChannelsMarkup;i[h].removeClass("loading");a(this.hours[0],c.Legend,this.hours[0].getElement("li"));if(this.options.IsListView){var f=i[h].getElement("div.hours-list-view");f.set("html",b.HoursLegend);this.showHideNavigationArrows();this.expandText()}else{Namespace("RT").programmeSorting.attachEvents();i[h].setStyle("min-height",i[h].getSize().y+"px")}}else{i[h].innerHTML="";i[h].removeClass("loading");var e=i[h].getNext();if(e&&e.hasClass("mpu")){e.dispose()}}if(h==0){this.updateTimeline(b.startHour);this.dayNavigation.updateTimeInDayLinks.bind(this.dayNavigation)(b.startHour);this.dayNavigation.updateHighlighting.bind(this.dayNavigation)(Date.parse(j));(function(){this.ads.refresh()}).delay(500,this);RT.listingsController.resetTime(Date.parse(j))}this.fireEvent("listingsUpdated",i[h])},addNewPromoProgrammeData:function(b){this.options.PromoSlot.innerHTML=b.ChannelsMarkup;this.fireEvent("listingsUpdated",this.options.PromoSlot)}}}());Scroller.implement({scroll:function(){var c=this.element,g=c.getSize(),e=c.getScroll(),d=c!=this.docBody&&c!=window?c.getOffsets():{x:0,y:0},f=c.getScrollSize(),b={x:0,y:0},h=this.options.area.top||this.options.area,a=this.options.area.bottom||this.options.area;for(var i in this.page){if(this.page[i]<(h+d[i])&&e[i]!=0){b[i]=(this.page[i]-h-d[i])*this.options.velocity}else{if(this.page[i]+a>(g[i]+d[i])&&e[i]+g[i]!=f[i]){b[i]=(this.page[i]-g[i]+a-d[i])*this.options.velocity}}b[i]=b[i].round()}if(b.y||b.x){this.fireEvent("change",[e.x+b.x,e.y+b.y])}}});Namespace("RT.listings").ProgrammeSorting=new Class({Implements:Options,initialize:function(d,a,c){var e=this;this.setOptions(c);this.sortable=$$(d);this.selector=d+" "+this.options.sortableElementType;this.channels=$$(this.selector);this.body=$(document.body);this.channelDetail=a;this.Sortables=new Sortables(this.sortable,{clone:true,revert:{duration:300,transition:"bounce:out"},handle:".channel > h1 span",onStart:this.startDragging.bind(this),onComplete:this.stopDragging.bind(this)});var b=($$("html")[0].hasClass("ie7"));if(b){this.sortable.addEvent("click",function(i){var m=e.channelDetail.detailBoxes();var h=arguments[0]||window.event,k=h.target||h.srcElement;var f=k.getParent().getParent().getElement("aside");var l=k.getParent().getParent().getParent().getParent();var n=l.getElements(".channel-info");var j=n.indexOf(f);var g=e.channelDetail.detailBoxes()[j];e.channelDetail.show(f)})}this.Scroller=new Scroller(window,{area:60})},options:{sortableElementType:"article"},attachEvents:function(){this.Sortables.addItems($$(this.selector))},updateChannelOrder:function(){var a=$$(this.selector).get("data-channel-id").join();RT.personalisation.ChannelsCookie.setChannels(a)},startDragging:function(b,a){this.body.setStyle("overflow","hidden");a.getElement(".channel-info").destroy();a.addClass("moving");b.store("parent",b.getParent());this.Scroller.start();if(this.channelDetail){this.channelDetail.hide(this.channelDetail.detailBoxes)}},stopDragging:function(b,a){this.body.setStyle("overflow","visible");setTimeout(function(){this.updateChannelOrder()}.bind(this),500);this.rearrangeChannels(b);this.Scroller.stop()},rearrangeChannels:function(c){if(!c.retrieve("parent")){return}var b=c.getParent().get("data-limit"),j=c.retrieve("parent"),h,g,i=j.get("data-limit"),e=c.getSiblings(":last-child")[0]||c.getPrevious(),d=c.getSiblings(":first-child")[0]||c.getNext(),l=this.sortable[0],f=this.sortable[1],k=this.sortable[2],a=c.getSiblings().length+1;if(b==5){if(a>5&&i!=5){e.dispose();f.grab(e,"top")}if(i==null){h=f.getLast().dispose();k.grab(h,"top")}}else{if(b==10){if(a>10&&i==null){e.dispose();k.grab(e,"top")}if(i==5){d.dispose();l.grab(d,"bottom")}}else{if(i==10){d.dispose();f.grab(d,"bottom")}if(i==5){d.dispose();f.grab(d,"bottom");g=f.getFirst().dispose();l.grab(g,"bottom")}}}}});Namespace("RT.listings").WatchlistDecorator=new Class({decorateListings:function(a,b){if(b.data){b.doDecoration.call(b,a)}else{b.queue.push(a)}},dataReceived:function(a){this.data=a;this.queue.forEach(function(b){this.doDecoration(b)}.bind(this))},doDecoration:function(a){a.getElements("li[data-episodeid]").forEach(function(d){var b=d.get("data-episodeId");var e=d.get("data-programmeId");var c=(this.data.FollowedProgrammes.contains(e)||this.data.Watching.contains(b))&&!this.data.Removed.contains(b);d.toggleClass("watching",c);d.toggleClass("notwatching",!c)}.bind(this))},updateAfterFollow:function(d,c){var a=c?this.data.FollowedProgrammes:this.data.Watching;a.push(d);var e=c?"li[data-programmeid="+d+"]":"li[data-episodeid="+d+"]";var b=$$(e);b.toggleClass("watching",true);b.toggleClass("notwatching",false)},updateAfterUnfollow:function(e,d){var a=d?this.data.FollowedProgrammes:this.data.Watching;var c=a.indexOf(e);if(c>-1){a.splice(c,1)}var f=d?"li[data-programmeid="+e+"]":"li[data-episodeid="+e+"]";var b=$$(f);b.toggleClass("watching",false);b.toggleClass("notwatching",true)},sendRequest:function(){var a=document.cookie.indexOf("purple")>=0;if(a&&this.requestsSent++<=10){var b=new Request.JSON({url:"/rt-service/watchlist/watching",onSuccess:this.dataReceived.bind(this),onFailure:function(){this.sendRequest.delay(100*this.requestsSent,this)}.bind(this)});b.send()}},initialize:function(a){this.queue=[];a.addEvent("listingsUpdated",this.decorateListings.bindEvent(this));this.requestsSent=0;this.sendRequest();$subscribe("/event/follow",this.updateAfterFollow.bind(this));$subscribe("/event/unfollow",this.updateAfterUnfollow.bind(this))}});Namespace("RT.listings").ProvisionalListingsWarning=new Class({showWarningIfNeeded:function(){var d=window.location.hash.substr(1);if(d.length>0){var f=JSON.parse(window.location.hash.substr(1))["sd"].split(/[-\s]/);var e=new Date(f[2],f[1]-1,f[0]);var g=new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate());var b=g.getDay();var c=(e-g)/(1000*60*60*24);var a=(b>3)||((b+c)<13);$("grid").toggleClass("provisional",!a)}},initialize:function(a){a.addEvent("listingsUpdated",this.showWarningIfNeeded.bindEvent(this))}});Namespace("RT.listings").WatchlistAddRemove=new Class({toggleWatching:function(b){var f=b.target.getParent("li");var c=f.get("data-episodeid");var g=f.get("data-programmeid");var i=g||c;var d=i==g;var a=f.hasClass("watching");var h=new Request({url:a?"/rt-service/action/unfollow":"/rt-service/action/follow",onSuccess:function(){var e=a?this.unfollowed:this.followed;e.call(this,i,d)}.bind(this)});h.options.url+="?id="+i;h.send();b.stop()},followed:function(b,a){$publish("/event/follow",[b,a]);_gaq.push(["_trackEvent","listings","Follow",b])},unfollowed:function(b,a){$publish("/event/unfollow",[b,a]);_gaq.push(["_trackEvent","listings","Unfollow",b])},initialize:function(a){this.container=a;this.container.addEvents({"click:relay(ul ul > li div.follow)":this.toggleWatching.bind(this)})}});Namespace("RT.watchlist").HeartBlinker=new Class({blink:function(){var b=this;var a=$$(".watchlistbutton a")[0];if(!b.isTransitioning){b.isTransitioning=true;a.addClass("highlight");(function(){a.addClass("highlight-off");(function(){a.removeClass("highlight");a.removeClass("highlight-off");b.isTransitioning=false}).delay(3000)}).delay(500)}},initialize:function(){$subscribe("/event/follow",this.blink.bind(this))}});Namespace("RT.programmes").SignInPrompt=new Class({Implements:Options,initialize:function(b){this.setOptions(b);$subscribe(this.options.subscriptionEvent,this.checkCookie.bind(this));var a=this.options.dialogMarkup.substitute({content:this.options.dialogText});this.dialog=new RT.utils.Dialog(a,{"class":"signin-prompt",id:"signin-prompt"});this.dialogEvents()},options:{follows:5,cookieTotalFollows:"totalFollowClicks",cookieDialogShown:"watchlistDialogAlreadyShown",dialogText:"We recommend you sign in to save your changes",dialogMarkup:'<h1>Radio Times</h1><p>{content}</p><ul><li><a href="#" class="later">Later</a></li><li><a href="#" class="signin">Sign In</a></li></ul>',subscriptionEvent:"/event/prompt"},checkCookie:function(){var b,d=this.options.cookieTotalFollows,a=this.options.cookieDialogShown;var c=Cookie.read("AuthToken");if(c||Cookie.read(a)){Cookie.dispose(d);return}b=parseInt(Cookie.read(d));(!b)?Cookie.write(d,1):Cookie.write(d,(b+1));if(Cookie.read(d)>this.options.follows){this.dialog.show();Cookie.write(a,true)}},dialogEvents:function(){var b=$(this.dialog),d=this,a=b.getElement("li:first-child"),c=b.getElement("li + li");a.addEvent("click",function(e){d.dialog.hide();e.preventDefault()});c.addEvent("click",function(e){d.dialog.hide();window.location.href="/members/join"})}});Namespace("RT.channels").Channels=new Class(function(){return{Implements:[Options,Events],initialize:function(c,d,a,b){c.show();this.channelsCookie=RT.personalisation.ChannelsCookie;this.setOptions(d);this.container=$$(c);this.form=this.container.getElement(this.options.formSelector);this.buttonStateEvent(a,b);this.submitting=new RT.utils.LoadingSpinner({imgPath:"/assets/images/ajax-loaders/apple-style-trans.gif",message:"Updating Listings..."})},options:{formSelector:".form"},submitForm:function(a){a.preventDefault()},getFakeRadio:function(b){var a=$(b);if(a){var c=a.getElements("li.pressed a");return c.length==1?c[0].get("text"):null}},setFakeRadio:function(d,b){var c=$(d);if(c){var a=c.getElements("li").filter(function(e){return(e.get("text").clean()==b)});if(a!=null&&a.length&&a.length==1){a[0].getSiblings().removeClass("pressed");a[0].set("class","pressed")}}},unsetAllFakeRadios:function(b){var a=$(b);if(a){a.getElements("li").removeClass("pressed")}},buttonStateEvent:function(b,a){var c=this;Array.each(b,function(d){var e=this.container.getElement('ul[id="{id}"]'.substitute({id:d}));if(e&&e.addEvent){e.addEvent("click:relay(li a)",function(f){var g=$(this).getParent();g.getSiblings().removeClass("pressed");g.addClass("pressed");f.preventDefault();if(a){a.bind(c)(g)}})}},this)}}}());Namespace("RT.channels").Packages=new Class(function(){function a(p){var o;if(!Browser.ie){o=new Element("div",{html:p})}else{o=new Element("div");var q=innerShiv(p);o.appendChild(q)}this.mainchannels.grab(o.getElement("ul#platform-channels-main"),"top");if(this.otherchannels){this.otherchannels.adopt(o.getElement("ul#platform-channels-others"))}this.mainchannels.getElements("li a").addEvent("click",function(r){r.preventDefault();this.getParent().toggleClass("pressed")})}function c(){if(this.mainchannels.getElement("ul#platform-channels-main")){this.mainchannels.getElement("ul#platform-channels-main").dispose()}if(this.mainchannels.getElement("ul#platform-channels-others")){this.mainchannels.getElement("ul#platform-channels-others").dispose()}}function b(){c.bind(this)();this.loading.showSpinner(this.mainchannels)}function h(){this.loading.hideSpinner()}function e(o){a.bind(this)(o);if(!this._userHasChangedPlatform){d.bind(this)(this.mainchannels)}if(this.otherchannels){i.bind(this)(this.otherchannels)}}function j(o){a.call(this,'<p class="error">There was a problem loading the channels for your '+this.options.specialization+" provider, please try again shortly</p>")}function d(p){var o=this.channelsCookie.parse.call(RT.personalisation.ChannelsCookie);if(o!=null&&o.channels!=null){p.getElements("li").map(function(s){if(s.isDisplayed()){var q=s.getElement("a");var r=q.get("data-channelid");if(!o.channels.contains(r)){s.removeClass("pressed")}}})}}function i(p){var o=this.channelsCookie.parse.call(RT.personalisation.ChannelsCookie);if(o!=null&&o.channels!=null&&o.platform==this.getFakeRadio("platform")){p.getElements("li").map(function(s){if(s.isDisplayed()){var q=s.getElement("a");var r=q.get("data-channelid");if(o.channels.contains(r)){s.addClass("pressed")}}})}}function m(o,p){var q=[];Array.each(o,function(r,s){if(p.some(function(t){return t.channelId==r})){q.push(r)}});Array.each(p,function(r,s){if(!q.contains(r.channelId)){q.push(r.channelId)}});return q}function l(q){var p=RT.personalisation.ChannelsCookie.parse(RT.personalisation.ChannelsCookie.cookieName).channels;var s=q.getElements("li.pressed").map(function(u){var t=u.getElement("a");return{channelId:t.get("data-channelid"),epg:t.get("data-epg")}});var r;var o=this.channelsCookie.parse.call(RT.personalisation.ChannelsCookie);if(o!=null&&o.channels!=null&&o.platform==this.getFakeRadio("platform")){r=m(p,s)}else{r=f(s)}if(!this.channelsCookie.setPlatformAndChannels.call(RT.personalisation.ChannelsCookie,this.getFakeRadio("platform"),r)){document.location.reload()}}function n(){var o=this.getFakeRadio("platform");if(o==""){return}new Request({method:"get",onRequest:b.bind(this),onComplete:h.bind(this),onFailure:j.bind(this),url:"/Endpoints/PlatformChannels.aspx?platform={platform}&specialisation={specialisation}".substitute({platform:o,specialisation:this.options.specialization}),onSuccess:e.bind(this)}).send()}function k(o){if(typeof(this.currentPlatform)!="undefined"&&o!=this.currentPlatform){this.showChangePackageWarningMessage.bind(this)();if(this.mainchannels.isDisplayed()){this.hideAddingChannelsInformationMessage()}}else{this.hideChangePackageWarningMessage.bind(this)();if(this.mainchannels.isDisplayed()){this.showAddingChannelsInformationMessage()}}}function f(o){var p=[];o.sort(function(q,r){return q.epg-r.epg});o.forEach(function(q){p.push(q.channelId)});return p}function g(o){this._userHasChangedPlatform=true;k.bind(this)(o.get("text"));if(this.mainchannels.isDisplayed()){n.bind(this)()}}return{Implements:[Events],Extends:RT.channels.Channels,initialize:function(p,r,q){this.tabSwitcher=r;this.parent(p,q,["platform"],g);var o=this.channelsCookie.parse.bind(RT.personalisation.ChannelsCookie)();if(o&&o.platform){this.currentPlatform=o.platform;this.setFakeRadio("platform",o.platform)}else{this.currentPlatform="Popular channels";this.setFakeRadio("platform",this.currentPlatform)}this.submitBtn=this.form.getElement("button#submitChannelButton");this.cancelBtn=this.form.getElement("button#cancelChannelButton");this.submitBtn.addEvent("click",this.submitForm.bindEvent(this));this.cancelBtn.addEvent("click",this.cancelAllChanges.bindEvent(this));this.submitBtn=this.form.getElement("button#submitChannelButtonTop");this.cancelBtn=this.form.getElement("button#cancelChannelButtonTop");this.submitBtn.addEvent("click",this.submitForm.bindEvent(this));this.cancelBtn.addEvent("click",this.cancelAllChanges.bindEvent(this));this.submitBtn=this.form.getElement("button#submitChannelButtonMiddle");this.cancelBtn=this.form.getElement("button#cancelChannelButtonMiddle");this.submitBtn.addEvent("click",this.submitForm.bindEvent(this));this.cancelBtn.addEvent("click",this.cancelAllChanges.bindEvent(this));this.channelConfirmationMessage=this.container.getElement("#channel-confirmation")[0];this.mainchannels=this.container.getElement("#mainchannels")[0];this.otherchannels=this.container.getElement("#otherchannels")[0];if(this.otherchannels){this.otherchannelsheading=this.otherchannels.getElement("h1")[0]}this.loading=new RT.utils.LoadingSpinner({imgPath:"/assets/images/ajax-loaders/apple-style-trans.gif",message:"Fetching your channels..."});n.call(this);this.showhideotherchannels=this.form.getElement("#showhideotherchannels")[0];if(this.showhideotherchannels){this.showhideotherchannels.addEvent("click",this.hdl_showhideotherchannels.bindEvent(this))}this.mainchannelsselectall=this.container.getElement("#mainchannelsselectall")[0];this.mainchannelsselectall.addEvent("click",this.selectAllChannels.bindEvent(this));this.mainchannelsdeselectall=this.container.getElement("#mainchannelsdeselectall")[0];this.mainchannelsdeselectall.addEvent("click",this.deselectAllChannels.bindEvent(this));this.cancelBtn.addEvent("mouseenter",this.addButtonHoverState.bindEvent(this));this.submitBtn.addEvent("mouseenter",this.addButtonHoverState.bindEvent(this));this.cancelBtn.addEvent("mouseout",this.removeButtonHoverState.bindEvent(this));this.submitBtn.addEvent("mouseout",this.removeButtonHoverState.bindEvent(this))},options:{},submitForm:function(o,p){o.preventDefault();p.submitting.showSpinner(p.container[0]);p.hideChangePackageWarningMessage();p.hideAddingChannelsInformationMessage();p.hideLoginInformationMessage();l.call(p,p.mainchannels);_gaq.push(["_trackEvent",p.options.specialization+"Listings","Personalise",p.getFakeRadio("platform")])},cancelAllChanges:function(o,p){if(o){o.preventDefault()}if(typeof(p.currentPlatform)!="undefined"&&p.currentPlatform!=""){p.setFakeRadio("platform",p.currentPlatform)}else{p.unsetAllFakeRadios("platform");n.call(p)}p.hideChangePackageWarningMessage();p.hideAddingChannelsInformationMessage();p.tabSwitcher.closeAllTabs();if(p.otherchannels&&p.otherchannels.isDisplayed()){p.otherchannels.toggle()}},showChangePackageWarningMessage:function(){this.channelConfirmationMessage.show();this.hideAddingChannelsInformationMessage()},hideChangePackageWarningMessage:function(){this.channelConfirmationMessage.hide()},showAddingChannelsInformationMessage:function(){if(!this.channelConfirmationMessage.isDisplayed()){this.form.getElement("#new-channel-information").show()}},hideAddingChannelsInformationMessage:function(){this.form.getElement("#new-channel-information").hide()},hideLoginInformationMessage:function(){var o=this.form.getElement(".login-information");if(o[0]!=null){o.hide()}},selectAllChannels:function(o,p){o.preventDefault();p.mainchannels.getElements("ul#platform-channels-main li").addClass("pressed")},deselectAllChannels:function(o,p){o.preventDefault();p.mainchannels.getElements("ul#platform-channels-main li").removeClass("pressed")},addButtonHoverState:function(){this.addClass("hover")},removeButtonHoverState:function(){this.removeClass("hover")},hdl_showhideotherchannels:function(o,p){o.preventDefault();p.otherchannels.toggle();if(p.otherchannels.isDisplayed()){p.showhideotherchannels.set("text","Show less");p.showhideotherchannels.addClass("active")}else{p.showhideotherchannels.set("text","Show more");p.showhideotherchannels.removeClass("active")}}}}());Namespace("RT.channels").Regions=new Class(function(){return{Implements:[Events],Extends:RT.channels.Channels,initialize:function(a,d,c){if(a){a.show();this.tabSwitcher=d;this.parent(a,c,["bbcRegion","itvRegion"]);var b=this.channelsCookie.parse.bind(RT.personalisation.ChannelsCookie)();if(b!=null){this.setFakeRadio("bbcRegion",(b.bbcRegion===undefined?"BBC London":b.bbcRegion));this.setFakeRadio("itvRegion",(b.itvRegion===undefined?"ITV London":b.itvRegion))}this.form.getElement("button#submitRegionButton").addEvent("click",this.submitForm.bindEvent(this));this.form.getElement("button#cancelRegionButton").addEvent("click",this.cancelAllChanges.bindEvent(this))}},options:{},submitForm:function(c,e){c.preventDefault();e.submitting.showSpinner(e.container[0]);var a=e.getFakeRadio("bbcRegion");var d=e.getFakeRadio("itvRegion");var b=e.channelsCookie.parse.bind(RT.personalisation.ChannelsCookie)();e.channelsCookie.setRegion.bind(RT.personalisation.ChannelsCookie)(a,d);e.hideLoginInformationMessage();if(b!=null&&b.channels.length>0){if(!e.channelsCookie.updateProfile.bind(RT.personalisation.ChannelsCookie)("updateTvChannelsAndReload","Regions.submitForm")){document.location.reload()}}else{e.channelsCookie.getChannelCookieValueForSelection.bind(RT.personalisation.ChannelsCookie)("")}},cancelAllChanges:function(b,c){if(b){b.preventDefault()}c.tabSwitcher.closeAllTabs();var a=c.channelsCookie.parse.bind(RT.personalisation.ChannelsCookie)();if(a!=null&&a.channels!=null){if(typeof(a.bbcRegion)!="undefined"&&a.bbcRegion!=""){c.setFakeRadio("bbcRegion",a.bbcRegion)}else{c.unsetAllFakeRadios("bbcRegion")}if(typeof(a.itvRegion)!="undefined"&&a.itvRegion!=""){c.setFakeRadio("itvRegion",a.itvRegion)}else{c.unsetAllFakeRadios("itvRegion")}}},hideLoginInformationMessage:function(){var a=this.form.getElement(".login-information");if(a[0]!=null){a.hide()}}}}());Namespace("RT.channels").TabSwitcher=new Class({Implements:Options,initialize:function(a,b){this.setOptions(b);this.containers=$$(a);this.containers.getElement("h1 > a").addEvent("click",this.switchTabs.bindEvent(this));var c=this;this.containers.each(function(d){if(document.location.href.contains(d.id)){c.switchTabs.call(d.getElement("a"),null,c)}})},options:{formSelector:".form",displayClass:"open",channelSelector:".edit-channels"},switchTabs:function(c,i){var d=i.options.formSelector,b=i.options.displayClass,a=i.options.channelSelector;var e=$(this).getParents(a)[0],f=e.getElement(d),g=e.getSiblings(a)[0],h=g?g.getElement(d):null;if(f.isDisplayed()){f.hide();e.removeClass(b)}else{if(h){h.hide()}if(g){g.removeClass(b)}f.show();e.addClass(b)}if(c){c.preventDefault()}},closeAllTabs:function(){var c=this.options.formSelector,b=this.options.displayClass,a=this.options.channelSelector;this.containers.each(function(d){var e=d;var f=d.getElement(c);f.hide();e.removeClass(b)})}});(function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&typeof define.amd=="object"?define(b):this[a]=b()})("Voila",function(){var a="Submitted. Please check your browsers network log to confirm success.",h=function(k,z){function j(i){w=setTimeout(function(){var l=null,e=i.target.attributes;for(p=e.length;p--;){e[p].nodeName==="data-content"&&(l=e[p].nodeValue)}v.logHover(l,function(n){n.error})},A)}function m(){clearTimeout(w)}var v=this,x=null,p=0,y=0,w=null,A=250;if(!k){throw new Error("No arguments supplied")}this.apiKey=null;this.version="1.0";this.content=null;this.url="https://voila.metabroadcast.com";this.hoverItems=[];this.trackingId=null;this.referrer=null;this.logging=!0;this.userCookie={name:!1,value:!1};this.timeout=2000;k&&k.hoverTimeout&&(A=k.hoverTimeout);k&&k.apiKey&&(this.apiKey=k.apiKey);k&&k.version&&(this.version=k.version);k&&k.content&&(this.content=k.content);k&&k.host&&(k&&k.host.indexOf("http")===-1?this.url="https://"+k.host:this.url=k.host);if(k&&k.hoverItems){for(p=k.hoverItems.length;p--;){x=qwery(k.hoverItems[p]);for(y=x.length;y--;){try{x[y].addEventListener("mouseover",j);x[y].addEventListener("mouseout",m)}catch(q){x[y].attachEvent("mouseover",j);x[y].attachEvent("mouseout",m)}this.hoverItems.push(x[y])}}}k&&k.trackingId&&(this.parent=k.trackingId);document.referrer&&(this.referrer=document.referrer);k&&typeof k.logging!="undefined"&&(this.logging=k.logging);k&&k.userCookieName&&(this.userCookie.name=k.userCookieName);k&&k.timeout&&(this.timeout=k.timeout)};h.prototype.pageLoad=function(i){var j=this;j.content?j.getTracking(function(e){if(!e.error){j.trackingId=e.success;j.logging===!0&&j.logLoad()}i&&i(e)}):j.logLoad(function(){i&&i({success:null})})};h.prototype.setContentId=function(i){this.content=i};h.prototype.setContentUri=function(i){this.content=i};h.prototype.getContent=function(j,u){var l=this,p=l.content,k=new jXHR,q=l.url+"/"+l.version+"/content?apiKey="+l.apiKey;j&&j.content&&(p=j.content);p.indexOf("http")!==-1?q+="&uri="+p:q+="&id="+p;j&&j.annotations&&(q+="&annotations="+j.annotations.join(","));var m=l.getCookie(l.userCookie.name);m&&(q+="&X-User-Id="+m);k.timeout=l.timeout;k.onerror=function(i,o){u&&u({error:i})};k.onreadystatechange=function(i){k.readyState===4&&u&&u({success:i})};q+="&callback=?";k.open("GET",q);k.send()};h.prototype.getTracking=function(j){var o=this,l=new jXHR,m=o.url+"/"+o.version+"/tracking?apiKey="+o.apiKey;l.timeout=o.timeout;l.onerror=function(i,e){j&&j({error:i})};l.onreadystatechange=function(e){if(l.readyState===4){if(e.tracking_id){o.trackingId=e.tracking_id;j&&j({success:e.tracking_id});return}j&&j({error:"No tracking id found"})}};o.content&&(o.content.indexOf("http")!==-1?m+="&contentUri="+o.content:m+="&contentId="+o.content);o.parent&&(m+="&parentTrackingId="+o.parent);var k=o.getCookie(o.userCookie.name);k&&(m+="&X-User-Id="+k);m+="&callback=?";l.open("GET",m);l.send()};h.prototype.logLoad=function(j){var u=this,l=new jXHR,p=null,k=!1,q=u.url;l.timeout=u.timeout;l.onerror=function(i,e){j&&j({error:i})};q=q+"/"+u.version+"/log?apiKey="+encodeURIComponent(u.apiKey)+"&event=page-load";u.trackingId&&(q+="&tracking_id="+encodeURIComponent(u.trackingId));if(u.content){k||(k=[]);u.content.indexOf("http")!==-1?q+="&x-purple-external-uri="+encodeURIComponent(u.content):q+="&x-purple-id="+encodeURIComponent(u.content)}var m=u.getCookie(u.userCookie.name);m&&(q+="&X-User-Id="+encodeURIComponent(m));u.referrer&&(q+="&referrer="+encodeURIComponent(u.referrer));q+="&cb="+(new Date).getTime();l.open("GET",q);l.send()};h.prototype.logHover=function(j,u){var l=this,p=new jXHR,k=l.content,q=l.url;p.timeout=l.timeout;p.onerror=function(i,o){u&&u({error:i})};q=q+"/"+l.version+"/log?apiKey="+encodeURIComponent(l.apiKey)+"&event=tv-listings-hover";l.trackingId&&(q+="&tracking_id="+encodeURIComponent(l.trackingId));j&&j.content&&(k=j.content);k.indexOf("http")!==-1?q+="&x-purple-external-uri="+encodeURIComponent(k):q+="&x-purple-id="+encodeURIComponent(k);var m=l.getCookie(l.userCookie.name);m&&(q+="&X-User-Id="+encodeURIComponent(m));l.referrer&&(q+="&referrer="+encodeURIComponent(l.referrer));q+="&cb="+(new Date).getTime();p.open("GET",q);p.send()};h.prototype.watching=function(j,u){var l=this,p=new jXHR,k=l.content,q=l.url;p.timeout=l.timeout;p.onerror=function(i,o){u&&u({error:i})};q=q+"/"+l.version+"/log?apiKey="+encodeURIComponent(l.apiKey)+"&event=content-play";l.trackingId&&(q+="&tracking_id="+encodeURIComponent(l.trackingId));j&&j.content&&(k=j.content);k.indexOf("http")!==-1?q+="&x-purple-external-uri="+encodeURIComponent(k):q+="&x-purple-id="+encodeURIComponent(k);var m=l.getCookie(l.userCookie.name);m&&(q+="&X-User-Id="+encodeURIComponent(m));l.referrer&&(q+="&referrer="+encodeURIComponent(l.referrer));q+="&cb="+(new Date).getTime();p.open("GET",q);p.send()};h.prototype.notWatching=function(i,j){j&&j({success:!0})};h.prototype.currentlyWatching=function(i,j){j&&j({success:!0})};h.prototype.suggestionsFeedback=function(j,o){var l=this,m=l.url;m=m+"/"+l.version+"/suggestions/feedback/me/@self?apiKey="+l.apiKey;l.trackingId&&(m+="&tracking_id="+encodeURIComponent(l.trackingId));j&&j.id&&(m+="&id="+encodeURIComponent(j.id));j&&j.action&&(m+="&action="+encodeURIComponent(j.action));var k=l.getCookie(l.userCookie.name);k&&(m+="&X-User-Id="+encodeURIComponent(k));l.referrer&&(m+="&referrer="+encodeURIComponent(l.referrer));m+="&cb="+(new Date).getTime();ajax.open("GET",m);ajax.send()};h.prototype.cookieOptOut=function(i){var l=this,j=new jXHR,k=l.url+"/"+l.version+"/optout/set?apiKey="+l.apiKey+"&callback=?";j.timeout=l.timeout;j.onerror=function(m,e){i&&i({error:m})};j.onreadystatechange=function(e){j.readyState===4&&i&&i({success:e})};j.open("GET",k);j.send()};h.prototype.cookieOptIn=function(i){var l=this,j=new jXHR,k=l.url+"/"+l.version+"/optout/remove?apiKey="+l.apiKey+"&callback=?";j.timeout=l.timeout;j.onerror=function(m,e){i&&i({error:m})};j.onreadystatechange=function(e){j.readyState===4&&i&&i({success:e})};j.open("GET",k);j.send()};h.prototype.cookieOptStatus=function(i){var l=this,j=new jXHR,k=l.url+"/"+l.version+"/optout?apiKey="+l.apiKey+"&callback=?";j.timeout=l.timeout;j.onerror=function(m,e){i&&i({error:m})};j.onreadystatechange=function(e){j.readyState===4&&i&&i({success:e})};j.open("GET",k);j.send()};h.prototype.getCookie=function(j){var v=this,l=v.userCookie.name,p=document.cookie,k={},q=!1;j&&(l=j);if(p.length>0&&p.indexOf(";")!==-1){p=p.split(";");for(var m=p.length;m--;){p[m].substr(0,1)===" "&&(p[m]=p[m].substr(1));if(p[m].indexOf("=")!==-1){p[m]=p[m].split("=");var w=p[m][0];k[w]=!1;p[m].splice(0,1);p[m].length>1?p[m]=p[m].join("="):p[m]=p[m][0];k[w]=p[m]}}k[j]&&(q=k[j])}return q};var c=function(j){qwery("#voilaframe").length!==0&&f();var m=document.createElement("iframe"),l='<!DOCTYPE html><html><head><link rel="canonical" href="'+window.location.href+'" /></head><body></body></html>';m.setAttribute("id","voilaframe");m.name="voilaframe";m.style.width=0;m.style.height=0;m.style.visibility="hidden";m.style.borderWidth=0;m.style.position="absolute";m.style.left="-9999px";m.style.top="-9999px";m.src="about:blank";try{m.contentWindow.document.open("text/html","replace");m.contentWindow.document.write(l);m.contentWindow.document.close()}catch(k){}document.body.appendChild(m);m.contentWindow.name="voilaframe";j&&j({success:m});return m},f=function(){document.body.removeChild(qwery("#voilaframe")[0])},b=function(i){var l=this,j=0,k=null;if(!i||!i.url||!i.id){return !1}k=qwery("#"+i.id);k.length>0&&g(i.id);k=document.createElement("form");k.setAttribute("id",i.id);k.setAttribute("target","voilaframe");k.setAttribute("method","POST");k.setAttribute("action",i.url+"&cb="+(new Date).getTime());k.style.width=0;k.style.height=0;k.style.visibility="hidden";k.style.borderWidth=0;k.style.position="absolute";k.style.left="-9999px";k.style.top="-9999px";if(i&&i.inputs){for(j=i.inputs.length;j--;){k.appendChild(d(i.inputs[j]))}}document.body.appendChild(k);return k},g=function(i){document.body.removeChild(qwery("#"+i)[0])},d=function(i){var j=document.createElement("input");j.setAttribute("type","hidden");j.setAttribute("name",i.name);j.setAttribute("value",i.value);return j};return h});(function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&typeof define.amd=="object"?define(b):this[a]=b()})("qwery",function(){function aC(){this.c={}}function aj(a){return ad.g(a)||ad.s(a,"(^|\\s+)"+a+"(\\s+|$)",1)}function aL(a,d){var b=0,c=a.length;for(;b<c;b++){d(a[b])}}function at(a){for(var d=[],b=0,c=a.length;b<c;++b){aa(a[b])?d=d.concat(a[b]):d[d.length]=a[b]}return d}function af(a){var d=0,b=a.length,c=[];for(;d<b;d++){c[d]=a[d]}return c}function ax(a){while(a=a.previousSibling){if(a[aW]==1){break}}return a}function ao(a){return a.match(ah)}function av(o,D,z,B,w,C,f,k,u,A,l){var E,x,q,F,j;if(this[aW]!==1){return !1}if(D&&D!=="*"&&this[aI]&&this[aI].toLowerCase()!==D){return !1}if(z&&(x=z.match(an))&&x[1]!==this.id){return !1}if(z&&(j=z.match(aB))){for(E=j.length;E--;){if(!aj(j[E].slice(1)).test(this.className)){return !1}}}if(u&&aN.pseudos[u]&&!aN.pseudos[u](this,l)){return !1}if(B&&!f){F=this.attributes;for(q in F){if(Object.prototype.hasOwnProperty.call(F,q)&&(F[q].name||q)==w){return this}}}return B&&!aP(C,a7(this,w)||"",f)?!1:this}function aM(a){return aJ.g(a)||aJ.s(a,a.replace(ae,"\\$1"))}function aP(a,c,b){switch(a){case"=":return c==b;case"^=":return c.match(aE.g("^="+b)||aE.s("^="+b,"^"+aM(b),1));case"$=":return c.match(aE.g("$="+b)||aE.s("$="+b,aM(b)+"$",1));case"*=":return c.match(aE.g(b)||aE.s(b,aM(b),1));case"~=":return c.match(aE.g("~="+b)||aE.s("~="+b,"(?:^|\\s+)"+aM(b)+"(?:\\s+|$)",1));case"|=":return c.match(aE.g("|="+b)||aE.s("|="+b,"^"+aM(b)+"(-|$)",1))}return 0}function aX(j,B){var x=[],r=[],A,b,k,u,q,z,c,C,w=B,o=ab.g(j)||ab.s(j,j.split(aG)),D=j.match(aU);if(!o.length){return x}u=(o=o.slice(0)).pop();o.length&&(k=o[o.length-1].match(ag))&&(w=aA(B,k[1]));if(!w){return x}c=ao(u);z=w!==B&&w[aW]!==9&&D&&/^[+~]$/.test(D[D.length-1])?function(a){while(w=w.nextSibling){w[aW]==1&&(c[1]?c[1]==w[aI].toLowerCase():1)&&(a[a.length]=w)}return a}([]):w[aO](c[1]||"*");for(A=0,b=z.length;A<b;A++){if(C=av.apply(z[A],c)){x[x.length]=C}}if(!o.length){return x}aL(x,function(a){a1(a,o,D)&&(r[r.length]=a)});return r}function a6(a,g,c){if(a3(g)){return a==g}if(aa(g)){return !!~at(g).indexOf(a)}var d=g.split(","),b,f;while(g=d.pop()){b=ab.g(g)||ab.s(g,g.split(aG));f=g.match(aU);b=b.slice(0);if(av.apply(a,ao(b.pop()))&&(!b.length||a1(a,b,f,c))){return !0}}return !1}function a1(a,g,c,d){function f(h,j,i){while(i=az[c[j]](i,h)){if(a3(i)&&av.apply(i,ao(g[j]))){if(!j){return i}if(b=f(i,j-1,i)){return b}}}}var b;return(b=f(a,g.length-1,a))&&(!d||a5(b,d))}function a3(a,b){return a&&typeof a=="object"&&(b=a[aW])&&(b==1||b==9)}function aZ(a){var d=[],b,c;a:for(b=0;b<a.length;++b){for(c=0;c<d.length;++c){if(d[c]==a[b]){continue a}}d[d.length]=a[b]}return d}function aa(a){return typeof a=="object"&&isFinite(a.length)}function ay(a){return a?typeof a=="string"?aN(a)[0]:!a[aW]&&aa(a)?a[0]:a:ak}function aA(a,c,b){return a[aW]===9?a.getElementById(c):a.ownerDocument&&((b=a.ownerDocument.getElementById(c))&&a5(b,a)&&b||!a5(a,a.ownerDocument)&&ac('[id="'+c+'"]',a)[0])}function aN(a,f){var b,d,c=ay(f);if(!c||!a){return[]}if(a===window||a3(a)){return !f||a!==window&&a3(c)&&a5(a,c)?[a]:[]}if(a&&aa(a)){return at(a)}if(b=a.match(a2)){if(b[1]){return(d=aA(c,b[1]))?[d]:[]}if(b[2]){return af(c[aO](b[2]))}if(am&&b[3]){return af(c[aF](b[3]))}}return ac(a,c)}function aq(a,b){return function(d){var e,c;if(aY.test(d)){if(a[aW]!==9){(c=e=a.getAttribute("id"))||a.setAttribute("id",c="__qwerymeupscotty");d='[id="'+c+'"]'+d;b(a.parentNode||a,d,!0);e||a.removeAttribute("id")}return}d.length&&b(a,d,!1)}}var ak=document,aT=ak.documentElement,aF="getElementsByClassName",aO="getElementsByTagName",au="querySelectorAll",aR="useNativeQSA",aI="tagName",aW="nodeType",ac,an=/#([\w\-]+)/,aB=/\.[\w\-]+/g,ag=/^#([\w\-]+)$/,ar=/^\.([\w\-]+)$/,aK=/^([\w\-]+)$/,ai=/^([\w]+)?\.([\w\-]+)$/,aY=/(^|,)\s*[>~+]/,aD=/^\s+|\s*([,\s\+\~>]|$)\s*/g,ap=/[\s\>\+\~]/,a4=/(?![\s\w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^'"]*\]|[\s\w\+\-]*\))/,ae=/([.*+?\^=!:${}()|\[\]\/\\])/g,a0=/^(\*|[a-z0-9]+)?(?:([\.\#]+[\w\-\.#]+)?)/,al=/\[([\w\-]+)(?:([\|\^\$\*\~]?\=)['"]?([ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+)["']?)?\]/,aS=/:([\w\-]+)(\(['"]?([^()]+)['"]?\))?/,a2=new RegExp(ag.source+"|"+aK.source+"|"+ar.source),aU=new RegExp("("+ap.source+")"+a4.source,"g"),aG=new RegExp(ap.source+a4.source),ah=new RegExp(a0.source+"("+al.source+")?("+aS.source+")?"),az={" ":function(a){return a&&a!==aT&&a.parentNode},">":function(a,b){return a&&a.parentNode==b.parentNode&&a.parentNode},"~":function(a){return a&&a.previousSibling},"+":function(a,d,b,c){return a?(b=ax(a))&&(c=ax(d))&&b==c&&b:!1}};aC.prototype={g:function(a){return this.c[a]||undefined},s:function(a,c,b){c=b?new RegExp(c):c;return this.c[a]=c}};var ad=new aC,aJ=new aC,aE=new aC,ab=new aC,a5="compareDocumentPosition" in aT?function(a,b){return(b.compareDocumentPosition(a)&16)==16}:"contains" in aT?function(a,b){b=b[aW]===9||b==window?aT:b;return b!==a&&b.contains(a)}:function(a,b){while(a=a.parentNode){if(a===b){return 1}}return 0},a7=function(){var a=ak.createElement("p");return(a.innerHTML='<a href="#x">x</a>')&&a.firstChild.getAttribute("href")!="#x"?function(b,c){return c==="class"?b.className:c==="href"||c==="src"?b.getAttribute(c,2):b.getAttribute(c)}:function(b,c){return b.getAttribute(c)}}(),am=!!ak[aF],aV=ak.querySelector&&ak[au],aH=function(a,g){var b=[],d,f;try{if(g[aW]===9||!aY.test(a)){return af(g[au](a))}aL(d=a.split(","),aq(g,function(h,i){f=h[au](i);f.length==1?b[b.length]=f.item(0):f.length&&(b=b.concat(af(f)))}));return d.length>1&&b.length>1?aZ(b):b}catch(c){}return aQ(a,g)},aQ=function(c,p){var j=[],g,m,k,b,d,h;c=c.replace(aD,"$1");if(m=c.match(ai)){d=aj(m[2]);g=p[aO](m[1]||"*");for(k=0,b=g.length;k<b;k++){d.test(g[k].className)&&(j[j.length]=g[k])}return j}aL(h=c.split(","),aq(p,function(a,l,f){d=aX(l,a);for(k=0,b=d.length;k<b;k++){if(a[aW]===9||f||a5(d[k],p)){j[j.length]=d[k]}}}));return h.length>1&&j.length>1?aZ(j):j},aw=function(a){typeof a[aR]!="undefined"&&(ac=a[aR]?aV?aH:aQ:aQ)};aw({useNativeQSA:!0});aN.configure=aw;aN.uniq=aZ;aN.is=a6;aN.pseudos={};return aN});(function(a){var d=a.setTimeout,b=a.document,c=0;a.jXHR=function(){function j(){try{v.parentNode.removeChild(v)}catch(f){}}function n(){t=!1;m="";j();v=null;r(0)}function g(f){try{e.onerror.call(e,f,m)}catch(h){throw new Error(f)}}function k(){if(this.readyState&&this.readyState!=="complete"&&this.readyState!=="loaded"||t){return}this.onload=this.onreadystatechange=null;t=!0;e.readyState!==4&&e.readyState===2&&g("Script failed to load ["+m+"].");j()}function r(f,h){h=h||[];e.readyState=f;typeof e.onreadystatechange=="function"&&e.onreadystatechange.apply(e,h)}var m,t,q,v,e=null;e={onerror:null,onreadystatechange:null,readyState:0,open:function(h,f){n();internal_callback="cb"+c++;(function(i){a.jXHR[i]=function(){try{r.call(e,4,arguments)}catch(l){e.readyState=-1;g("Script failed to run ["+m+"].")}a.jXHR[i]=null}})(internal_callback);m=f.replace(/=\?/,"=jXHR."+internal_callback);r(1)},send:function(){d(function(){v=b.createElement("script");v.setAttribute("type","text/javascript");v.onload=v.onreadystatechange=function(){k.call(v)};v.setAttribute("src",m);b.getElementsByTagName("head")[0].appendChild(v)},0);r(2)},setRequestHeader:function(){},getResponseHeader:function(){return""},getAllResponseHeaders:function(){return[]}};n();return e}})(window);