var Prototype={Version:"1.6.0.2",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div").__proto__&&document.createElement("div").__proto__!==document.createElement("form").__proto__},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(A){return A
}};
if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false
}var Class={create:function(){var E=null,D=$A(arguments);
if(Object.isFunction(D[0])){E=D.shift()
}function A(){this.initialize.apply(this,arguments)
}Object.extend(A,Class.Methods);
A.superclass=E;
A.subclasses=[];
if(E){var B=function(){};
B.prototype=E.prototype;
A.prototype=new B;
E.subclasses.push(A)
}for(var C=0;
C<D.length;
C++){A.addMethods(D[C])
}if(!A.prototype.initialize){A.prototype.initialize=Prototype.emptyFunction
}A.prototype.constructor=A;
return A
}};
Class.Methods={addMethods:function(G){var C=this.superclass&&this.superclass.prototype;
var B=Object.keys(G);
if(!Object.keys({toString:true}).length){B.push("toString","valueOf")
}for(var A=0,D=B.length;
A<D;
A++){var F=B[A],E=G[F];
if(C&&Object.isFunction(E)&&E.argumentNames().first()=="$super"){var H=E,E=Object.extend((function(I){return function(){return C[I].apply(this,arguments)
}
})(F).wrap(H),{valueOf:function(){return H
},toString:function(){return H.toString()
}})
}this.prototype[F]=E
}return this
}};
var Abstract={};
Object.extend=function(A,C){for(var B in C){A[B]=C[B]
}return A
};
Object.extend(Object,{inspect:function(A){try{if(Object.isUndefined(A)){return"undefined"
}if(A===null){return"null"
}return A.inspect?A.inspect():String(A)
}catch(B){if(B instanceof RangeError){return"..."
}throw B
}},toJSON:function(A){var C=typeof A;
switch(C){case"undefined":case"function":case"unknown":return ;
case"boolean":return A.toString()
}if(A===null){return"null"
}if(A.toJSON){return A.toJSON()
}if(Object.isElement(A)){return 
}var B=[];
for(var E in A){var D=Object.toJSON(A[E]);
if(!Object.isUndefined(D)){B.push(E.toJSON()+": "+D)
}}return"{"+B.join(", ")+"}"
},toQueryString:function(A){return $H(A).toQueryString()
},toHTML:function(A){return A&&A.toHTML?A.toHTML():String.interpret(A)
},keys:function(A){var B=[];
for(var C in A){B.push(C)
}return B
},values:function(B){var A=[];
for(var C in B){A.push(B[C])
}return A
},clone:function(A){return Object.extend({},A)
},isElement:function(A){return A&&A.nodeType==1
},isArray:function(A){return A!=null&&typeof A=="object"&&"splice" in A&&"join" in A
},isHash:function(A){return A instanceof Hash
},isFunction:function(A){return typeof A=="function"
},isString:function(A){return typeof A=="string"
},isNumber:function(A){return typeof A=="number"
},isUndefined:function(A){return typeof A=="undefined"
}});
Object.extend(Function.prototype,{argumentNames:function(){var A=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
return A.length==1&&!A[0]?[]:A
},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this
}var A=this,C=$A(arguments),B=C.shift();
return function(){return A.apply(B,C.concat($A(arguments)))
}
},bindAsEventListener:function(){var A=this,C=$A(arguments),B=C.shift();
return function(D){return A.apply(B,[D||window.event].concat(C))
}
},curry:function(){if(!arguments.length){return this
}var A=this,B=$A(arguments);
return function(){return A.apply(this,B.concat($A(arguments)))
}
},delay:function(){var A=this,B=$A(arguments),C=B.shift()*1000;
return window.setTimeout(function(){return A.apply(A,B)
},C)
},wrap:function(B){var A=this;
return function(){return B.apply(this,[A.bind(this)].concat($A(arguments)))
}
},methodize:function(){if(this._methodized){return this._methodized
}var A=this;
return this._methodized=function(){return A.apply(null,[this].concat($A(arguments)))
}
}});
Function.prototype.defer=Function.prototype.delay.curry(0.01);
Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'
};
var Try={these:function(){var C;
for(var B=0,D=arguments.length;
B<D;
B++){var A=arguments[B];
try{C=A();
break
}catch(E){}}return C
}};
RegExp.prototype.match=RegExp.prototype.test;
RegExp.escape=function(A){return String(A).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")
};
var PeriodicalExecuter=Class.create({initialize:function(B,A){this.callback=B;
this.frequency=A;
this.currentlyExecuting=false;
this.registerCallback()
},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)
},execute:function(){this.callback(this)
},stop:function(){if(!this.timer){return 
}clearInterval(this.timer);
this.timer=null
},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;
this.execute()
}finally{this.currentlyExecuting=false
}}}});
Object.extend(String,{interpret:function(A){return A==null?"":String(A)
},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});
Object.extend(String.prototype,{gsub:function(E,C){var A="",D=this,B;
C=arguments.callee.prepareReplacement(C);
while(D.length>0){if(B=D.match(E)){A+=D.slice(0,B.index);
A+=String.interpret(C(B));
D=D.slice(B.index+B[0].length)
}else{A+=D,D=""
}}return A
},sub:function(C,A,B){A=this.gsub.prepareReplacement(A);
B=Object.isUndefined(B)?1:B;
return this.gsub(C,function(D){if(--B<0){return D[0]
}return A(D)
})
},scan:function(B,A){this.gsub(B,A);
return String(this)
},truncate:function(B,A){B=B||30;
A=Object.isUndefined(A)?"...":A;
return this.length>B?this.slice(0,B-A.length)+A:String(this)
},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")
},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")
},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")
},extractScripts:function(){var B=new RegExp(Prototype.ScriptFragment,"img");
var A=new RegExp(Prototype.ScriptFragment,"im");
return(this.match(B)||[]).map(function(C){return(C.match(A)||["",""])[1]
})
},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)
})
},escapeHTML:function(){var A=arguments.callee;
A.text.data=this;
return A.div.innerHTML
},unescapeHTML:function(){var A=new Element("div");
A.innerHTML=this.stripTags();
return A.childNodes[0]?(A.childNodes.length>1?$A(A.childNodes).inject("",function(B,C){return B+C.nodeValue
}):A.childNodes[0].nodeValue):""
},toQueryParams:function(B){var A=this.strip().match(/([^?#]*)(#.*)?$/);
if(!A){return{}
}return A[1].split(B||"&").inject({},function(E,F){if((F=F.split("="))[0]){var C=decodeURIComponent(F.shift());
var D=F.length>1?F.join("="):F[0];
if(D!=undefined){D=decodeURIComponent(D)
}if(C in E){if(!Object.isArray(E[C])){E[C]=[E[C]]
}E[C].push(D)
}else{E[C]=D
}}return E
})
},toArray:function(){return this.split("")
},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)
},times:function(A){return A<1?"":new Array(A+1).join(this)
},camelize:function(){var D=this.split("-"),A=D.length;
if(A==1){return D[0]
}var C=this.charAt(0)=="-"?D[0].charAt(0).toUpperCase()+D[0].substring(1):D[0];
for(var B=1;
B<A;
B++){C+=D[B].charAt(0).toUpperCase()+D[B].substring(1)
}return C
},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()
},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()
},dasherize:function(){return this.gsub(/_/,"-")
},inspect:function(B){var A=this.gsub(/[\x00-\x1f\\]/,function(C){var D=String.specialChar[C[0]];
return D?D:"\\u00"+C[0].charCodeAt().toPaddedString(2,16)
});
if(B){return'"'+A.replace(/"/g,'\\"')+'"'
}return"'"+A.replace(/'/g,"\\'")+"'"
},toJSON:function(){return this.inspect(true)
},unfilterJSON:function(A){return this.sub(A||Prototype.JSONFilter,"#{1}")
},isJSON:function(){var A=this;
if(A.blank()){return false
}A=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");
return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(A)
},evalJSON:function(sanitize){var json=this.unfilterJSON();
try{if(!sanitize||json.isJSON()){return eval("("+json+")")
}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())
},include:function(A){return this.indexOf(A)>-1
},startsWith:function(A){return this.indexOf(A)===0
},endsWith:function(A){var B=this.length-A.length;
return B>=0&&this.lastIndexOf(A)===B
},empty:function(){return this==""
},blank:function(){return/^\s*$/.test(this)
},interpolate:function(A,B){return new Template(this,B).evaluate(A)
}});
if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")
},unescapeHTML:function(){return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")
}})
}String.prototype.gsub.prepareReplacement=function(B){if(Object.isFunction(B)){return B
}var A=new Template(B);
return function(C){return A.evaluate(C)
}
};
String.prototype.parseQuery=String.prototype.toQueryParams;
Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});
with(String.prototype.escapeHTML){div.appendChild(text)
}var Template=Class.create({initialize:function(A,B){this.template=A.toString();
this.pattern=B||Template.Pattern
},evaluate:function(A){if(Object.isFunction(A.toTemplateReplacements)){A=A.toTemplateReplacements()
}return this.template.gsub(this.pattern,function(D){if(A==null){return""
}var F=D[1]||"";
if(F=="\\"){return D[2]
}var B=A,G=D[3];
var E=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
D=E.exec(G);
if(D==null){return F
}while(D!=null){var C=D[1].startsWith("[")?D[2].gsub("\\\\]","]"):D[1];
B=B[C];
if(null==B||""==D[3]){break
}G=G.substring("["==D[3]?D[1].length:D[0].length);
D=E.exec(G)
}return F+String.interpret(B)
})
}});
Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
var $break={};
var Enumerable={each:function(C,B){var A=0;
C=C.bind(B);
try{this._each(function(E){C(E,A++)
})
}catch(D){if(D!=$break){throw D
}}return this
},eachSlice:function(D,C,B){C=C?C.bind(B):Prototype.K;
var A=-D,E=[],F=this.toArray();
while((A+=D)<F.length){E.push(F.slice(A,A+D))
}return E.collect(C,B)
},all:function(C,B){C=C?C.bind(B):Prototype.K;
var A=true;
this.each(function(E,D){A=A&&!!C(E,D);
if(!A){throw $break
}});
return A
},any:function(C,B){C=C?C.bind(B):Prototype.K;
var A=false;
this.each(function(E,D){if(A=!!C(E,D)){throw $break
}});
return A
},collect:function(C,B){C=C?C.bind(B):Prototype.K;
var A=[];
this.each(function(E,D){A.push(C(E,D))
});
return A
},detect:function(C,B){C=C.bind(B);
var A;
this.each(function(E,D){if(C(E,D)){A=E;
throw $break
}});
return A
},findAll:function(C,B){C=C.bind(B);
var A=[];
this.each(function(E,D){if(C(E,D)){A.push(E)
}});
return A
},grep:function(D,C,B){C=C?C.bind(B):Prototype.K;
var A=[];
if(Object.isString(D)){D=new RegExp(D)
}this.each(function(F,E){if(D.match(F)){A.push(C(F,E))
}});
return A
},include:function(A){if(Object.isFunction(this.indexOf)){if(this.indexOf(A)!=-1){return true
}}var B=false;
this.each(function(C){if(C==A){B=true;
throw $break
}});
return B
},inGroupsOf:function(B,A){A=Object.isUndefined(A)?null:A;
return this.eachSlice(B,function(C){while(C.length<B){C.push(A)
}return C
})
},inject:function(A,C,B){C=C.bind(B);
this.each(function(E,D){A=C(A,E,D)
});
return A
},invoke:function(B){var A=$A(arguments).slice(1);
return this.map(function(C){return C[B].apply(C,A)
})
},max:function(C,B){C=C?C.bind(B):Prototype.K;
var A;
this.each(function(E,D){E=C(E,D);
if(A==null||E>=A){A=E
}});
return A
},min:function(C,B){C=C?C.bind(B):Prototype.K;
var A;
this.each(function(E,D){E=C(E,D);
if(A==null||E<A){A=E
}});
return A
},partition:function(D,B){D=D?D.bind(B):Prototype.K;
var C=[],A=[];
this.each(function(F,E){(D(F,E)?C:A).push(F)
});
return[C,A]
},pluck:function(B){var A=[];
this.each(function(C){A.push(C[B])
});
return A
},reject:function(C,B){C=C.bind(B);
var A=[];
this.each(function(E,D){if(!C(E,D)){A.push(E)
}});
return A
},sortBy:function(B,A){B=B.bind(A);
return this.map(function(D,C){return{value:D,criteria:B(D,C)}
}).sort(function(F,E){var D=F.criteria,C=E.criteria;
return D<C?-1:D>C?1:0
}).pluck("value")
},toArray:function(){return this.map()
},zip:function(){var B=Prototype.K,A=$A(arguments);
if(Object.isFunction(A.last())){B=A.pop()
}var C=[this].concat(A).map($A);
return this.map(function(E,D){return B(C.pluck(D))
})
},size:function(){return this.toArray().length
},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">"
}};
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});
function $A(C){if(!C){return[]
}if(C.toArray){return C.toArray()
}var B=C.length||0,A=new Array(B);
while(B--){A[B]=C[B]
}return A
}if(Prototype.Browser.WebKit){$A=function(C){if(!C){return[]
}if(!(Object.isFunction(C)&&C=="[object NodeList]")&&C.toArray){return C.toArray()
}var B=C.length||0,A=new Array(B);
while(B--){A[B]=C[B]
}return A
}
}Array.from=$A;
Object.extend(Array.prototype,Enumerable);
if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse
}Object.extend(Array.prototype,{_each:function(B){for(var A=0,C=this.length;
A<C;
A++){B(this[A])
}},clear:function(){this.length=0;
return this
},first:function(){return this[0]
},last:function(){return this[this.length-1]
},compact:function(){return this.select(function(A){return A!=null
})
},flatten:function(){return this.inject([],function(B,A){return B.concat(Object.isArray(A)?A.flatten():[A])
})
},without:function(){var A=$A(arguments);
return this.select(function(B){return !A.include(B)
})
},reverse:function(A){return(A!==false?this:this.toArray())._reverse()
},reduce:function(){return this.length>1?this:this[0]
},uniq:function(A){return this.inject([],function(D,C,B){if(0==B||(A?D.last()!=C:!D.include(C))){D.push(C)
}return D
})
},intersect:function(A){return this.uniq().findAll(function(B){return A.detect(function(C){return B===C
})
})
},clone:function(){return[].concat(this)
},size:function(){return this.length
},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"
},toJSON:function(){var A=[];
this.each(function(B){var C=Object.toJSON(B);
if(!Object.isUndefined(C)){A.push(C)
}});
return"["+A.join(", ")+"]"
}});
if(Object.isFunction(Array.prototype.forEach)){Array.prototype._each=Array.prototype.forEach
}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(C,A){A||(A=0);
var B=this.length;
if(A<0){A=B+A
}for(;
A<B;
A++){if(this[A]===C){return A
}}return -1
}
}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(B,A){A=isNaN(A)?this.length:(A<0?this.length+A:A)+1;
var C=this.slice(0,A).reverse().indexOf(B);
return(C<0)?C:A-C-1
}
}Array.prototype.toArray=Array.prototype.clone;
function $w(A){if(!Object.isString(A)){return[]
}A=A.strip();
return A?A.split(/\s+/):[]
}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var E=[];
for(var B=0,C=this.length;
B<C;
B++){E.push(this[B])
}for(var B=0,C=arguments.length;
B<C;
B++){if(Object.isArray(arguments[B])){for(var A=0,D=arguments[B].length;
A<D;
A++){E.push(arguments[B][A])
}}else{E.push(arguments[B])
}}return E
}
}Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)
},succ:function(){return this+1
},times:function(A){$R(0,this,true).each(A);
return this
},toPaddedString:function(C,B){var A=this.toString(B||10);
return"0".times(C-A.length)+A
},toJSON:function(){return isFinite(this)?this.toString():"null"
}});
$w("abs round ceil floor").each(function(A){Number.prototype[A]=Math[A].methodize()
});
function $H(A){return new Hash(A)
}var Hash=Class.create(Enumerable,(function(){function A(B,C){if(Object.isUndefined(C)){return B
}return B+"="+encodeURIComponent(String.interpret(C))
}return{initialize:function(B){this._object=Object.isHash(B)?B.toObject():Object.clone(B)
},_each:function(C){for(var B in this._object){var D=this._object[B],E=[B,D];
E.key=B;
E.value=D;
C(E)
}},set:function(B,C){return this._object[B]=C
},get:function(B){return this._object[B]
},unset:function(B){var C=this._object[B];
delete this._object[B];
return C
},toObject:function(){return Object.clone(this._object)
},keys:function(){return this.pluck("key")
},values:function(){return this.pluck("value")
},index:function(C){var B=this.detect(function(D){return D.value===C
});
return B&&B.key
},merge:function(B){return this.clone().update(B)
},update:function(B){return new Hash(B).inject(this,function(C,D){C.set(D.key,D.value);
return C
})
},toQueryString:function(){return this.map(function(D){var C=encodeURIComponent(D.key),B=D.value;
if(B&&typeof B=="object"){if(Object.isArray(B)){return B.map(A.curry(C)).join("&")
}}return A(C,B)
}).join("&")
},inspect:function(){return"#<Hash:{"+this.map(function(B){return B.map(Object.inspect).join(": ")
}).join(", ")+"}>"
},toJSON:function(){return Object.toJSON(this.toObject())
},clone:function(){return new Hash(this)
}}
})());
Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;
Hash.from=$H;
var ObjectRange=Class.create(Enumerable,{initialize:function(C,A,B){this.start=C;
this.end=A;
this.exclusive=B
},_each:function(A){var B=this.start;
while(this.include(B)){A(B);
B=B.succ()
}},include:function(A){if(A<this.start){return false
}if(this.exclusive){return A<this.end
}return A<=this.end
}});
var $R=function(C,A,B){return new ObjectRange(C,A,B)
};
var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()
},function(){return new ActiveXObject("Msxml2.XMLHTTP")
},function(){return new ActiveXObject("Microsoft.XMLHTTP")
})||false
},activeRequestCount:0};
Ajax.Responders={responders:[],_each:function(A){this.responders._each(A)
},register:function(A){if(!this.include(A)){this.responders.push(A)
}},unregister:function(A){this.responders=this.responders.without(A)
},dispatch:function(D,B,C,A){this.each(function(E){if(Object.isFunction(E[D])){try{E[D].apply(E,[B,C,A])
}catch(F){}}})
}};
Object.extend(Ajax.Responders,Enumerable);
Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++
},onComplete:function(){Ajax.activeRequestCount--
}});
Ajax.Base=Class.create({initialize:function(A){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};
Object.extend(this.options,A||{});
this.options.method=this.options.method.toLowerCase();
if(Object.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()
}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()
}}}});
Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,B,A){$super(A);
this.transport=Ajax.getTransport();
this.request(B)
},request:function(B){this.url=B;
this.method=this.options.method;
var D=Object.clone(this.options.parameters);
if(!["get","post"].include(this.method)){D._method=this.method;
this.method="post"
}this.parameters=D;
if(D=Object.toQueryString(D)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+D
}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){D+="&_="
}}}try{var A=new Ajax.Response(this);
if(this.options.onCreate){this.options.onCreate(A)
}Ajax.Responders.dispatch("onCreate",this,A);
this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);
if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)
}this.transport.onreadystatechange=this.onStateChange.bind(this);
this.setRequestHeaders();
this.body=this.method=="post"?(this.options.postBody||D):null;
this.transport.send(this.body);
if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()
}}catch(C){this.dispatchException(C)
}},onStateChange:function(){var A=this.transport.readyState;
if(A>1&&!((A==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)
}},setRequestHeaders:function(){var E={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};
if(this.method=="post"){E["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");
if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){E.Connection="close"
}}if(typeof this.options.requestHeaders=="object"){var C=this.options.requestHeaders;
if(Object.isFunction(C.push)){for(var B=0,D=C.length;
B<D;
B+=2){E[C[B]]=C[B+1]
}}else{$H(C).each(function(F){E[F.key]=F.value
})
}}for(var A in E){this.transport.setRequestHeader(A,E[A])
}},success:function(){var A=this.getStatus();
return !A||(A>=200&&A<300)
},getStatus:function(){try{return this.transport.status||0
}catch(A){return 0
}},respondToReadyState:function(A){var C=Ajax.Request.Events[A],B=new Ajax.Response(this);
if(C=="Complete"){try{this._complete=true;
(this.options["on"+B.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(B,B.headerJSON)
}catch(D){this.dispatchException(D)
}var E=B.getHeader("Content-type");
if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&E&&E.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()
}}try{(this.options["on"+C]||Prototype.emptyFunction)(B,B.headerJSON);
Ajax.Responders.dispatch("on"+C,this,B,B.headerJSON)
}catch(D){this.dispatchException(D)
}if(C=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction
}},isSameOrigin:function(){var A=this.url.match(/^\s*https?:\/\/[^\/]*/);
return !A||(A[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))
},getHeader:function(A){try{return this.transport.getResponseHeader(A)||null
}catch(B){return null
}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())
}catch(e){this.dispatchException(e)
}},dispatchException:function(A){(this.options.onException||Prototype.emptyFunction)(this,A);
Ajax.Responders.dispatch("onException",this,A)
}});
Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
Ajax.Response=Class.create({initialize:function(C){this.request=C;
var D=this.transport=C.transport,A=this.readyState=D.readyState;
if((A>2&&!Prototype.Browser.IE)||A==4){this.status=this.getStatus();
this.statusText=this.getStatusText();
this.responseText=String.interpret(D.responseText);
this.headerJSON=this._getHeaderJSON()
}if(A==4){var B=D.responseXML;
this.responseXML=Object.isUndefined(B)?null:B;
this.responseJSON=this._getResponseJSON()
}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""
}catch(A){return""
}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()
}catch(A){return null
}},getResponseHeader:function(A){return this.transport.getResponseHeader(A)
},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()
},_getHeaderJSON:function(){var A=this.getHeader("X-JSON");
if(!A){return null
}A=decodeURIComponent(escape(A));
try{return A.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())
}catch(B){this.request.dispatchException(B)
}},_getResponseJSON:function(){var A=this.request.options;
if(!A.evalJSON||(A.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null
}try{return this.responseText.evalJSON(A.sanitizeJSON||!this.request.isSameOrigin())
}catch(B){this.request.dispatchException(B)
}}});
Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,A,C,B){this.container={success:(A.success||A),failure:(A.failure||(A.success?null:A))};
B=Object.clone(B);
var D=B.onComplete;
B.onComplete=(function(E,F){this.updateContent(E.responseText);
if(Object.isFunction(D)){D(E,F)
}}).bind(this);
$super(C,B)
},updateContent:function(D){var C=this.container[this.success()?"success":"failure"],A=this.options;
if(!A.evalScripts){D=D.stripScripts()
}if(C=$(C)){if(A.insertion){if(Object.isString(A.insertion)){var B={};
B[A.insertion]=D;
C.insert(B)
}else{A.insertion(C,D)
}}else{C.update(D)
}}}});
Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,A,C,B){$super(B);
this.onComplete=this.options.onComplete;
this.frequency=(this.options.frequency||2);
this.decay=(this.options.decay||1);
this.updater={};
this.container=A;
this.url=C;
this.start()
},start:function(){this.options.onComplete=this.updateComplete.bind(this);
this.onTimerEvent()
},stop:function(){this.updater.options.onComplete=undefined;
clearTimeout(this.timer);
(this.onComplete||Prototype.emptyFunction).apply(this,arguments)
},updateComplete:function(A){if(this.options.decay){this.decay=(A.responseText==this.lastText?this.decay*this.options.decay:1);
this.lastText=A.responseText
}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)
},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)
}});
function $(B){if(arguments.length>1){for(var A=0,D=[],C=arguments.length;
A<C;
A++){D.push($(arguments[A]))
}return D
}if(Object.isString(B)){B=document.getElementById(B)
}return Element.extend(B)
}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(F,A){var C=[];
var E=document.evaluate(F,$(A)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
for(var B=0,D=E.snapshotLength;
B<D;
B++){C.push(Element.extend(E.snapshotItem(B)))
}return C
}
}if(!window.Node){var Node={}
}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})
}(function(){var A=this.Element;
this.Element=function(D,C){C=C||{};
D=D.toLowerCase();
var B=Element.cache;
if(Prototype.Browser.IE&&C.name){D="<"+D+' name="'+C.name+'">';
delete C.name;
return Element.writeAttribute(document.createElement(D),C)
}if(!B[D]){B[D]=Element.extend(document.createElement(D))
}return Element.writeAttribute(B[D].cloneNode(false),C)
};
Object.extend(this.Element,A||{})
}).call(window);
Element.cache={};
Element.Methods={visible:function(A){return $(A).style.display!="none"
},toggle:function(A){A=$(A);
Element[Element.visible(A)?"hide":"show"](A);
return A
},hide:function(A){$(A).style.display="none";
return A
},show:function(A){$(A).style.display="";
return A
},remove:function(A){A=$(A);
A.parentNode.removeChild(A);
return A
},update:function(A,B){A=$(A);
if(B&&B.toElement){B=B.toElement()
}if(Object.isElement(B)){return A.update().insert(B)
}B=Object.toHTML(B);
A.innerHTML=B.stripScripts();
B.evalScripts.bind(B).defer();
return A
},replace:function(B,C){B=$(B);
if(C&&C.toElement){C=C.toElement()
}else{if(!Object.isElement(C)){C=Object.toHTML(C);
var A=B.ownerDocument.createRange();
A.selectNode(B);
C.evalScripts.bind(C).defer();
C=A.createContextualFragment(C.stripScripts())
}}B.parentNode.replaceChild(C,B);
return B
},insert:function(C,E){C=$(C);
if(Object.isString(E)||Object.isNumber(E)||Object.isElement(E)||(E&&(E.toElement||E.toHTML))){E={bottom:E}
}var D,F,B,G;
for(var A in E){D=E[A];
A=A.toLowerCase();
F=Element._insertionTranslations[A];
if(D&&D.toElement){D=D.toElement()
}if(Object.isElement(D)){F(C,D);
continue
}D=Object.toHTML(D);
B=((A=="before"||A=="after")?C.parentNode:C).tagName.toUpperCase();
G=Element._getContentFromAnonymousElement(B,D.stripScripts());
if(A=="top"||A=="after"){G.reverse()
}G.each(F.curry(C));
D.evalScripts.bind(D).defer()
}return C
},wrap:function(B,C,A){B=$(B);
if(Object.isElement(C)){$(C).writeAttribute(A||{})
}else{if(Object.isString(C)){C=new Element(C,A)
}else{C=new Element("div",C)
}}if(B.parentNode){B.parentNode.replaceChild(C,B)
}C.appendChild(B);
return C
},inspect:function(B){B=$(B);
var A="<"+B.tagName.toLowerCase();
$H({id:"id",className:"class"}).each(function(F){var E=F.first(),C=F.last();
var D=(B[E]||"").toString();
if(D){A+=" "+C+"="+D.inspect(true)
}});
return A+">"
},recursivelyCollect:function(A,C){A=$(A);
var B=[];
while(A=A[C]){if(A.nodeType==1){B.push(Element.extend(A))
}}return B
},ancestors:function(A){return $(A).recursivelyCollect("parentNode")
},descendants:function(A){return $(A).select("*")
},firstDescendant:function(A){A=$(A).firstChild;
while(A&&A.nodeType!=1){A=A.nextSibling
}return $(A)
},immediateDescendants:function(A){if(!(A=$(A).firstChild)){return[]
}while(A&&A.nodeType!=1){A=A.nextSibling
}if(A){return[A].concat($(A).nextSiblings())
}return[]
},previousSiblings:function(A){return $(A).recursivelyCollect("previousSibling")
},nextSiblings:function(A){return $(A).recursivelyCollect("nextSibling")
},siblings:function(A){A=$(A);
return A.previousSiblings().reverse().concat(A.nextSiblings())
},match:function(B,A){if(Object.isString(A)){A=new Selector(A)
}return A.match($(B))
},up:function(B,D,A){B=$(B);
if(arguments.length==1){return $(B.parentNode)
}var C=B.ancestors();
return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)
},down:function(B,C,A){B=$(B);
if(arguments.length==1){return B.firstDescendant()
}return Object.isNumber(C)?B.descendants()[C]:B.select(C)[A||0]
},previous:function(B,D,A){B=$(B);
if(arguments.length==1){return $(Selector.handlers.previousElementSibling(B))
}var C=B.previousSiblings();
return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)
},next:function(C,D,B){C=$(C);
if(arguments.length==1){return $(Selector.handlers.nextElementSibling(C))
}var A=C.nextSiblings();
return Object.isNumber(D)?A[D]:Selector.findElement(A,D,B)
},select:function(){var A=$A(arguments),B=$(A.shift());
return Selector.findChildElements(B,A)
},adjacent:function(){var A=$A(arguments),B=$(A.shift());
return Selector.findChildElements(B.parentNode,A).without(B)
},identify:function(B){B=$(B);
var C=B.readAttribute("id"),A=arguments.callee;
if(C){return C
}do{C="anonymous_element_"+A.counter++
}while($(C));
B.writeAttribute("id",C);
return C
},readAttribute:function(C,A){C=$(C);
if(Prototype.Browser.IE){var B=Element._attributeTranslations.read;
if(B.values[A]){return B.values[A](C,A)
}if(B.names[A]){A=B.names[A]
}if(A.include(":")){return(!C.attributes||!C.attributes[A])?null:C.attributes[A].value
}}return C.getAttribute(A)
},writeAttribute:function(E,C,F){E=$(E);
var B={},D=Element._attributeTranslations.write;
if(typeof C=="object"){B=C
}else{B[C]=Object.isUndefined(F)?true:F
}for(var A in B){C=D.names[A]||A;
F=B[A];
if(D.values[A]){C=D.values[A](E,F)
}if(F===false||F===null){E.removeAttribute(C)
}else{if(F===true){E.setAttribute(C,C)
}else{E.setAttribute(C,F)
}}}return E
},getHeight:function(A){return $(A).getDimensions().height
},getWidth:function(A){return $(A).getDimensions().width
},classNames:function(A){return new Element.ClassNames(A)
},hasClassName:function(A,B){if(!(A=$(A))){return 
}var C=A.className;
return(C.length>0&&(C==B||new RegExp("(^|\\s)"+B+"(\\s|$)").test(C)))
},addClassName:function(A,B){if(!(A=$(A))){return 
}if(!A.hasClassName(B)){A.className+=(A.className?" ":"")+B
}return A
},removeClassName:function(A,B){if(!(A=$(A))){return 
}A.className=A.className.replace(new RegExp("(^|\\s+)"+B+"(\\s+|$)")," ").strip();
return A
},toggleClassName:function(A,B){if(!(A=$(A))){return 
}return A[A.hasClassName(B)?"removeClassName":"addClassName"](B)
},cleanWhitespace:function(B){B=$(B);
var C=B.firstChild;
while(C){var A=C.nextSibling;
if(C.nodeType==3&&!/\S/.test(C.nodeValue)){B.removeChild(C)
}C=A
}return B
},empty:function(A){return $(A).innerHTML.blank()
},descendantOf:function(D,C){D=$(D),C=$(C);
var F=C;
if(D.compareDocumentPosition){return(D.compareDocumentPosition(C)&8)===8
}if(D.sourceIndex&&!Prototype.Browser.Opera){var E=D.sourceIndex,B=C.sourceIndex,A=C.nextSibling;
if(!A){do{C=C.parentNode
}while(!(A=C.nextSibling)&&C.parentNode)
}if(A&&A.sourceIndex){return(E>B&&E<A.sourceIndex)
}}while(D=D.parentNode){if(D==F){return true
}}return false
},scrollTo:function(A){A=$(A);
var B=A.cumulativeOffset();
window.scrollTo(B[0],B[1]);
return A
},getStyle:function(B,C){B=$(B);
C=C=="float"?"cssFloat":C.camelize();
var D=B.style[C];
if(!D){var A=document.defaultView.getComputedStyle(B,null);
D=A?A[C]:null
}if(C=="opacity"){return D?parseFloat(D):1
}return D=="auto"?null:D
},getOpacity:function(A){return $(A).getStyle("opacity")
},setStyle:function(B,C){B=$(B);
var E=B.style,A;
if(Object.isString(C)){B.style.cssText+=";"+C;
return C.include("opacity")?B.setOpacity(C.match(/opacity:\s*(\d?\.?\d*)/)[1]):B
}for(var D in C){if(D=="opacity"){B.setOpacity(C[D])
}else{E[(D=="float"||D=="cssFloat")?(Object.isUndefined(E.styleFloat)?"cssFloat":"styleFloat"):D]=C[D]
}}return B
},setOpacity:function(A,B){A=$(A);
A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;
return A
},getDimensions:function(C){C=$(C);
var G=$(C).getStyle("display");
if(G!="none"&&G!=null){return{width:C.offsetWidth,height:C.offsetHeight}
}var B=C.style;
var F=B.visibility;
var D=B.position;
var A=B.display;
B.visibility="hidden";
B.position="absolute";
B.display="block";
var H=C.clientWidth;
var E=C.clientHeight;
B.display=A;
B.position=D;
B.visibility=F;
return{width:H,height:E}
},makePositioned:function(A){A=$(A);
var B=Element.getStyle(A,"position");
if(B=="static"||!B){A._madePositioned=true;
A.style.position="relative";
if(window.opera){A.style.top=0;
A.style.left=0
}}return A
},undoPositioned:function(A){A=$(A);
if(A._madePositioned){A._madePositioned=undefined;
A.style.position=A.style.top=A.style.left=A.style.bottom=A.style.right=""
}return A
},makeClipping:function(A){A=$(A);
if(A._overflow){return A
}A._overflow=Element.getStyle(A,"overflow")||"auto";
if(A._overflow!=="hidden"){A.style.overflow="hidden"
}return A
},undoClipping:function(A){A=$(A);
if(!A._overflow){return A
}A.style.overflow=A._overflow=="auto"?"":A._overflow;
A._overflow=null;
return A
},cumulativeOffset:function(B){var A=0,C=0;
do{A+=B.offsetTop||0;
C+=B.offsetLeft||0;
B=B.offsetParent
}while(B);
return Element._returnOffset(C,A)
},positionedOffset:function(B){var A=0,D=0;
do{A+=B.offsetTop||0;
D+=B.offsetLeft||0;
B=B.offsetParent;
if(B){if(B.tagName=="BODY"){break
}var C=Element.getStyle(B,"position");
if(C!=="static"){break
}}}while(B);
return Element._returnOffset(D,A)
},absolutize:function(B){B=$(B);
if(B.getStyle("position")=="absolute"){return 
}var D=B.positionedOffset();
var F=D[1];
var E=D[0];
var C=B.clientWidth;
var A=B.clientHeight;
B._originalLeft=E-parseFloat(B.style.left||0);
B._originalTop=F-parseFloat(B.style.top||0);
B._originalWidth=B.style.width;
B._originalHeight=B.style.height;
B.style.position="absolute";
B.style.top=F+"px";
B.style.left=E+"px";
B.style.width=C+"px";
B.style.height=A+"px";
return B
},relativize:function(A){A=$(A);
if(A.getStyle("position")=="relative"){return 
}A.style.position="relative";
var C=parseFloat(A.style.top||0)-(A._originalTop||0);
var B=parseFloat(A.style.left||0)-(A._originalLeft||0);
A.style.top=C+"px";
A.style.left=B+"px";
A.style.height=A._originalHeight;
A.style.width=A._originalWidth;
return A
},cumulativeScrollOffset:function(B){var A=0,C=0;
do{A+=B.scrollTop||0;
C+=B.scrollLeft||0;
B=B.parentNode
}while(B);
return Element._returnOffset(C,A)
},getOffsetParent:function(A){if(A.offsetParent){return $(A.offsetParent)
}if(A==document.body){return $(A)
}while((A=A.parentNode)&&A!=document.body){if(Element.getStyle(A,"position")!="static"){return $(A)
}}return $(document.body)
},viewportOffset:function(D){var A=0,C=0;
var B=D;
do{A+=B.offsetTop||0;
C+=B.offsetLeft||0;
if(B.offsetParent==document.body&&Element.getStyle(B,"position")=="absolute"){break
}}while(B=B.offsetParent);
B=D;
do{if(!Prototype.Browser.Opera||B.tagName=="BODY"){A-=B.scrollTop||0;
C-=B.scrollLeft||0
}}while(B=B.parentNode);
return Element._returnOffset(C,A)
},clonePosition:function(B,D){var A=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});
D=$(D);
var E=D.viewportOffset();
B=$(B);
var F=[0,0];
var C=null;
if(Element.getStyle(B,"position")=="absolute"){C=B.getOffsetParent();
F=C.viewportOffset()
}if(C==document.body){F[0]-=document.body.offsetLeft;
F[1]-=document.body.offsetTop
}if(A.setLeft){B.style.left=(E[0]-F[0]+A.offsetLeft)+"px"
}if(A.setTop){B.style.top=(E[1]-F[1]+A.offsetTop)+"px"
}if(A.setWidth){B.style.width=D.offsetWidth+"px"
}if(A.setHeight){B.style.height=D.offsetHeight+"px"
}return B
}};
Element.Methods.identify.counter=1;
Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});
Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};
if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(D,B,C){switch(C){case"left":case"top":case"right":case"bottom":if(D(B,"position")==="static"){return null
}case"height":case"width":if(!Element.visible(B)){return null
}var E=parseInt(D(B,C),10);
if(E!==B["offset"+C.capitalize()]){return E+"px"
}var A;
if(C==="height"){A=["border-top-width","padding-top","padding-bottom","border-bottom-width"]
}else{A=["border-left-width","padding-left","padding-right","border-right-width"]
}return A.inject(E,function(F,G){var H=D(B,G);
return H===null?F:F-parseInt(H,10)
})+"px";
default:return D(B,C)
}});
Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(C,A,B){if(B==="title"){return A.title
}return C(A,B)
})
}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(C,B){B=$(B);
var A=B.getStyle("position");
if(A!=="static"){return C(B)
}B.setStyle({position:"relative"});
var D=C(B);
B.setStyle({position:A});
return D
});
$w("positionedOffset viewportOffset").each(function(A){Element.Methods[A]=Element.Methods[A].wrap(function(E,C){C=$(C);
var B=C.getStyle("position");
if(B!=="static"){return E(C)
}var D=C.getOffsetParent();
if(D&&D.getStyle("position")==="fixed"){D.setStyle({zoom:1})
}C.setStyle({position:"relative"});
var F=E(C);
C.setStyle({position:B});
return F
})
});
Element.Methods.getStyle=function(A,B){A=$(A);
B=(B=="float"||B=="cssFloat")?"styleFloat":B.camelize();
var C=A.style[B];
if(!C&&A.currentStyle){C=A.currentStyle[B]
}if(B=="opacity"){if(C=(A.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(C[1]){return parseFloat(C[1])/100
}}return 1
}if(C=="auto"){if((B=="width"||B=="height")&&(A.getStyle("display")!="none")){return A["offset"+B.capitalize()]+"px"
}return null
}return C
};
Element.Methods.setOpacity=function(B,E){function F(G){return G.replace(/alpha\([^\)]*\)/gi,"")
}B=$(B);
var A=B.currentStyle;
if((A&&!A.hasLayout)||(!A&&B.style.zoom=="normal")){B.style.zoom=1
}var D=B.getStyle("filter"),C=B.style;
if(E==1||E===""){(D=F(D))?C.filter=D:C.removeAttribute("filter");
return B
}else{if(E<0.00001){E=0
}}C.filter=F(D)+"alpha(opacity="+(E*100)+")";
return B
};
Element._attributeTranslations={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(A,B){return A.getAttribute(B,2)
},_getAttrNode:function(A,C){var B=A.getAttributeNode(C);
return B?B.value:""
},_getEv:function(A,B){B=A.getAttribute(B);
return B?B.toString().slice(23,-2):null
},_flag:function(A,B){return $(A).hasAttribute(B)?B:null
},style:function(A){return A.style.cssText.toLowerCase()
},title:function(A){return A.title
}}}};
Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(A,B){A.checked=!!B
},style:function(A,B){A.style.cssText=B?B:""
}}};
Element._attributeTranslations.has={};
$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc").each(function(A){Element._attributeTranslations.write.names[A.toLowerCase()]=A;
Element._attributeTranslations.has[A.toLowerCase()]=A
});
(function(A){Object.extend(A,{href:A._getAttr,src:A._getAttr,type:A._getAttr,action:A._getAttrNode,disabled:A._flag,checked:A._flag,readonly:A._flag,multiple:A._flag,onload:A._getEv,onunload:A._getEv,onclick:A._getEv,ondblclick:A._getEv,onmousedown:A._getEv,onmouseup:A._getEv,onmouseover:A._getEv,onmousemove:A._getEv,onmouseout:A._getEv,onfocus:A._getEv,onblur:A._getEv,onkeypress:A._getEv,onkeydown:A._getEv,onkeyup:A._getEv,onsubmit:A._getEv,onreset:A._getEv,onselect:A._getEv,onchange:A._getEv})
})(Element._attributeTranslations.read.values)
}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(A,B){A=$(A);
A.style.opacity=(B==1)?0.999999:(B==="")?"":(B<0.00001)?0:B;
return A
}
}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(A,B){A=$(A);
A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;
if(B==1){if(A.tagName=="IMG"&&A.width){A.width++;
A.width--
}else{try{var D=document.createTextNode(" ");
A.appendChild(D);
A.removeChild(D)
}catch(C){}}}return A
};
Element.Methods.cumulativeOffset=function(B){var A=0,C=0;
do{A+=B.offsetTop||0;
C+=B.offsetLeft||0;
if(B.offsetParent==document.body){if(Element.getStyle(B,"position")=="absolute"){break
}}B=B.offsetParent
}while(B);
return Element._returnOffset(C,A)
}
}}}}if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(B,C){B=$(B);
if(C&&C.toElement){C=C.toElement()
}if(Object.isElement(C)){return B.update().insert(C)
}C=Object.toHTML(C);
var A=B.tagName.toUpperCase();
if(A in Element._insertionTranslations.tags){$A(B.childNodes).each(function(D){B.removeChild(D)
});
Element._getContentFromAnonymousElement(A,C.stripScripts()).each(function(D){B.appendChild(D)
})
}else{B.innerHTML=C.stripScripts()
}C.evalScripts.bind(C).defer();
return B
}
}if("outerHTML" in document.createElement("div")){Element.Methods.replace=function(C,E){C=$(C);
if(E&&E.toElement){E=E.toElement()
}if(Object.isElement(E)){C.parentNode.replaceChild(E,C);
return C
}E=Object.toHTML(E);
var D=C.parentNode,B=D.tagName.toUpperCase();
if(Element._insertionTranslations.tags[B]){var F=C.next();
var A=Element._getContentFromAnonymousElement(B,E.stripScripts());
D.removeChild(C);
if(F){A.each(function(G){D.insertBefore(G,F)
})
}else{A.each(function(G){D.appendChild(G)
})
}}else{C.outerHTML=E.stripScripts()
}E.evalScripts.bind(E).defer();
return C
}
}Element._returnOffset=function(B,C){var A=[B,C];
A.left=B;
A.top=C;
return A
};
Element._getContentFromAnonymousElement=function(C,B){var D=new Element("div"),A=Element._insertionTranslations.tags[C];
if(A){D.innerHTML=A[0]+B+A[1];
A[2].times(function(){D=D.firstChild
})
}else{D.innerHTML=B
}return $A(D.childNodes)
};
Element._insertionTranslations={before:function(A,B){A.parentNode.insertBefore(B,A)
},top:function(A,B){A.insertBefore(B,A.firstChild)
},bottom:function(A,B){A.appendChild(B)
},after:function(A,B){A.parentNode.insertBefore(B,A.nextSibling)
},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};
(function(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})
}).call(Element._insertionTranslations);
Element.Methods.Simulated={hasAttribute:function(A,C){C=Element._attributeTranslations.has[C]||C;
var B=$(A).getAttributeNode(C);
return B&&B.specified
}};
Element.Methods.ByTag={};
Object.extend(Element,Element.Methods);
if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div").__proto__){window.HTMLElement={};
window.HTMLElement.prototype=document.createElement("div").__proto__;
Prototype.BrowserFeatures.ElementExtensions=true
}Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions){return Prototype.K
}var A={},B=Element.Methods.ByTag;
var C=Object.extend(function(F){if(!F||F._extendedByPrototype||F.nodeType!=1||F==window){return F
}var D=Object.clone(A),E=F.tagName,H,G;
if(B[E]){Object.extend(D,B[E])
}for(H in D){G=D[H];
if(Object.isFunction(G)&&!(H in F)){F[H]=G.methodize()
}}F._extendedByPrototype=Prototype.emptyFunction;
return F
},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(A,Element.Methods);
Object.extend(A,Element.Methods.Simulated)
}}});
C.refresh();
return C
})();
Element.hasAttribute=function(A,B){if(A.hasAttribute){return A.hasAttribute(B)
}return Element.Methods.Simulated.hasAttribute(A,B)
};
Element.addMethods=function(C){var I=Prototype.BrowserFeatures,D=Element.Methods.ByTag;
if(!C){Object.extend(Form,Form.Methods);
Object.extend(Form.Element,Form.Element.Methods);
Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})
}if(arguments.length==2){var B=C;
C=arguments[1]
}if(!B){Object.extend(Element.Methods,C||{})
}else{if(Object.isArray(B)){B.each(H)
}else{H(B)
}}function H(F){F=F.toUpperCase();
if(!Element.Methods.ByTag[F]){Element.Methods.ByTag[F]={}
}Object.extend(Element.Methods.ByTag[F],C)
}function A(L,K,F){F=F||false;
for(var N in L){var M=L[N];
if(!Object.isFunction(M)){continue
}if(!F||!(N in K)){K[N]=M.methodize()
}}}function E(L){var F;
var K={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};
if(K[L]){F="HTML"+K[L]+"Element"
}if(window[F]){return window[F]
}F="HTML"+L+"Element";
if(window[F]){return window[F]
}F="HTML"+L.capitalize()+"Element";
if(window[F]){return window[F]
}window[F]={};
window[F].prototype=document.createElement(L).__proto__;
return window[F]
}if(I.ElementExtensions){A(Element.Methods,HTMLElement.prototype);
A(Element.Methods.Simulated,HTMLElement.prototype,true)
}if(I.SpecificElementExtensions){for(var J in Element.Methods.ByTag){var G=E(J);
if(Object.isUndefined(G)){continue
}A(D[J],G.prototype)
}}Object.extend(Element,Element.Methods);
delete Element.ByTag;
if(Element.extend.refresh){Element.extend.refresh()
}Element.cache={}
};
document.viewport={getDimensions:function(){var A={};
var C=Prototype.Browser;
$w("width height").each(function(E){var B=E.capitalize();
A[E]=(C.WebKit&&!document.evaluate)?self["inner"+B]:(C.Opera)?document.body["client"+B]:document.documentElement["client"+B]
});
return A
},getWidth:function(){return this.getDimensions().width
},getHeight:function(){return this.getDimensions().height
},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)
}};
var Selector=Class.create({initialize:function(A){this.expression=A.strip();
this.compileMatcher()
},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath){return false
}var A=this.expression;
if(Prototype.Browser.WebKit&&(A.include("-of-type")||A.include(":empty"))){return false
}if((/(\[[\w-]*?:|:checked)/).test(this.expression)){return false
}return true
},compileMatcher:function(){if(this.shouldUseXPath()){return this.compileXPathMatcher()
}var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;
if(Selector._cache[e]){this.matcher=Selector._cache[e];
return 
}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];
while(e&&le!=e&&(/\S/).test(e)){le=e;
for(var i in ps){p=ps[i];
if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));
e=e.replace(m[0],"");
break
}}}this.matcher.push("return h.unique(n);\n}");
eval(this.matcher.join("\n"));
Selector._cache[this.expression]=this.matcher
},compileXPathMatcher:function(){var E=this.expression,F=Selector.patterns,B=Selector.xpath,D,A;
if(Selector._cache[E]){this.xpath=Selector._cache[E];
return 
}this.matcher=[".//*"];
while(E&&D!=E&&(/\S/).test(E)){D=E;
for(var C in F){if(A=E.match(F[C])){this.matcher.push(Object.isFunction(B[C])?B[C](A):new Template(B[C]).evaluate(A));
E=E.replace(A[0],"");
break
}}}this.xpath=this.matcher.join("");
Selector._cache[this.expression]=this.xpath
},findElements:function(A){A=A||document;
if(this.xpath){return document._getElementsByXPath(this.xpath,A)
}return this.matcher(A)
},match:function(H){this.tokens=[];
var L=this.expression,A=Selector.patterns,E=Selector.assertions;
var B,D,F;
while(L&&B!==L&&(/\S/).test(L)){B=L;
for(var I in A){D=A[I];
if(F=L.match(D)){if(E[I]){this.tokens.push([I,Object.clone(F)]);
L=L.replace(F[0],"")
}else{return this.findElements(document).include(H)
}}}}var K=true,C,J;
for(var I=0,G;
G=this.tokens[I];
I++){C=G[0],J=G[1];
if(!Selector.assertions[C](H,J)){K=false;
break
}}return K
},toString:function(){return this.expression
},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"
}});
Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(A){if(A[1]=="*"){return""
}return"[local-name()='"+A[1].toLowerCase()+"' or local-name()='"+A[1].toUpperCase()+"']"
},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(A){A[1]=A[1].toLowerCase();
return new Template("[@#{1}]").evaluate(A)
},attr:function(A){A[1]=A[1].toLowerCase();
A[3]=A[5]||A[6];
return new Template(Selector.xpath.operators[A[2]]).evaluate(A)
},pseudo:function(A){var B=Selector.xpath.pseudos[A[1]];
if(!B){return""
}if(Object.isFunction(B)){return B(A)
}return new Template(Selector.xpath.pseudos[A[1]]).evaluate(A)
},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",checked:"[@checked]",disabled:"[@disabled]",enabled:"[not(@disabled)]",not:function(B){var H=B[6],G=Selector.patterns,A=Selector.xpath,E,C;
var F=[];
while(H&&E!=H&&(/\S/).test(H)){E=H;
for(var D in G){if(B=H.match(G[D])){C=Object.isFunction(A[D])?A[D](B):new Template(A[D]).evaluate(B);
F.push("("+C.substring(1,C.length-1)+")");
H=H.replace(B[0],"");
break
}}}return"[not("+F.join(" and ")+")]"
},"nth-child":function(A){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",A)
},"nth-last-child":function(A){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",A)
},"nth-of-type":function(A){return Selector.xpath.pseudos.nth("position() ",A)
},"nth-last-of-type":function(A){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",A)
},"first-of-type":function(A){A[6]="1";
return Selector.xpath.pseudos["nth-of-type"](A)
},"last-of-type":function(A){A[6]="1";
return Selector.xpath.pseudos["nth-last-of-type"](A)
},"only-of-type":function(A){var B=Selector.xpath.pseudos;
return B["first-of-type"](A)+B["last-of-type"](A)
},nth:function(E,C){var F,G=C[6],B;
if(G=="even"){G="2n+0"
}if(G=="odd"){G="2n+1"
}if(F=G.match(/^(\d+)$/)){return"["+E+"= "+F[1]+"]"
}if(F=G.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(F[1]=="-"){F[1]=-1
}var D=F[1]?Number(F[1]):1;
var A=F[2]?Number(F[2]):0;
B="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";
return new Template(B).evaluate({fragment:E,a:D,b:A})
}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(A){A[3]=(A[5]||A[6]);
return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(A)
},pseudo:function(A){if(A[6]){A[6]=A[6].replace(/"/g,'\\"')
}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(A)
},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(A,B){return B[1].toUpperCase()==A.tagName.toUpperCase()
},className:function(A,B){return Element.hasClassName(A,B[1])
},id:function(A,B){return A.id===B[1]
},attrPresence:function(A,B){return Element.hasAttribute(A,B[1])
},attr:function(B,C){var A=Element.readAttribute(B,C[1]);
return A&&Selector.operators[C[2]](A,C[5]||C[6])
}},handlers:{concat:function(B,A){for(var C=0,D;
D=A[C];
C++){B.push(D)
}return B
},mark:function(A){var D=Prototype.emptyFunction;
for(var B=0,C;
C=A[B];
B++){C._countedByPrototype=D
}return A
},unmark:function(A){for(var B=0,C;
C=A[B];
B++){C._countedByPrototype=undefined
}return A
},index:function(A,D,G){A._countedByPrototype=Prototype.emptyFunction;
if(D){for(var B=A.childNodes,E=B.length-1,C=1;
E>=0;
E--){var F=B[E];
if(F.nodeType==1&&(!G||F._countedByPrototype)){F.nodeIndex=C++
}}}else{for(var E=0,C=1,B=A.childNodes;
F=B[E];
E++){if(F.nodeType==1&&(!G||F._countedByPrototype)){F.nodeIndex=C++
}}}},unique:function(B){if(B.length==0){return B
}var D=[],E;
for(var C=0,A=B.length;
C<A;
C++){if(!(E=B[C])._countedByPrototype){E._countedByPrototype=Prototype.emptyFunction;
D.push(Element.extend(E))
}}return Selector.handlers.unmark(D)
},descendant:function(A){var D=Selector.handlers;
for(var C=0,B=[],E;
E=A[C];
C++){D.concat(B,E.getElementsByTagName("*"))
}return B
},child:function(A){var E=Selector.handlers;
for(var D=0,C=[],F;
F=A[D];
D++){for(var B=0,G;
G=F.childNodes[B];
B++){if(G.nodeType==1&&G.tagName!="!"){C.push(G)
}}}return C
},adjacent:function(A){for(var C=0,B=[],E;
E=A[C];
C++){var D=this.nextElementSibling(E);
if(D){B.push(D)
}}return B
},laterSibling:function(A){var D=Selector.handlers;
for(var C=0,B=[],E;
E=A[C];
C++){D.concat(B,Element.nextSiblings(E))
}return B
},nextElementSibling:function(A){while(A=A.nextSibling){if(A.nodeType==1){return A
}}return null
},previousElementSibling:function(A){while(A=A.previousSibling){if(A.nodeType==1){return A
}}return null
},tagName:function(A,H,C,B){var I=C.toUpperCase();
var E=[],G=Selector.handlers;
if(A){if(B){if(B=="descendant"){for(var F=0,D;
D=A[F];
F++){G.concat(E,D.getElementsByTagName(C))
}return E
}else{A=this[B](A)
}if(C=="*"){return A
}}for(var F=0,D;
D=A[F];
F++){if(D.tagName.toUpperCase()===I){E.push(D)
}}return E
}else{return H.getElementsByTagName(C)
}},id:function(B,A,H,F){var G=$(H),D=Selector.handlers;
if(!G){return[]
}if(!B&&A==document){return[G]
}if(B){if(F){if(F=="child"){for(var C=0,E;
E=B[C];
C++){if(G.parentNode==E){return[G]
}}}else{if(F=="descendant"){for(var C=0,E;
E=B[C];
C++){if(Element.descendantOf(G,E)){return[G]
}}}else{if(F=="adjacent"){for(var C=0,E;
E=B[C];
C++){if(Selector.handlers.previousElementSibling(G)==E){return[G]
}}}else{B=D[F](B)
}}}}for(var C=0,E;
E=B[C];
C++){if(E==G){return[G]
}}return[]
}return(G&&Element.descendantOf(G,A))?[G]:[]
},className:function(B,A,C,D){if(B&&D){B=this[D](B)
}return Selector.handlers.byClassName(B,A,C)
},byClassName:function(C,B,F){if(!C){C=Selector.handlers.descendant([B])
}var H=" "+F+" ";
for(var E=0,D=[],G,A;
G=C[E];
E++){A=G.className;
if(A.length==0){continue
}if(A==F||(" "+A+" ").include(H)){D.push(G)
}}return D
},attrPresence:function(C,B,A,G){if(!C){C=B.getElementsByTagName("*")
}if(C&&G){C=this[G](C)
}var E=[];
for(var D=0,F;
F=C[D];
D++){if(Element.hasAttribute(F,A)){E.push(F)
}}return E
},attr:function(A,I,H,J,C,B){if(!A){A=I.getElementsByTagName("*")
}if(A&&B){A=this[B](A)
}var K=Selector.operators[C],F=[];
for(var E=0,D;
D=A[E];
E++){var G=Element.readAttribute(D,H);
if(G===null){continue
}if(K(G,J)){F.push(D)
}}return F
},pseudo:function(B,C,E,A,D){if(B&&D){B=this[D](B)
}if(!B){B=A.getElementsByTagName("*")
}return Selector.pseudos[C](B,E,A)
}},pseudos:{"first-child":function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(Selector.handlers.previousElementSibling(E)){continue
}C.push(E)
}return C
},"last-child":function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(Selector.handlers.nextElementSibling(E)){continue
}C.push(E)
}return C
},"only-child":function(B,G,A){var E=Selector.handlers;
for(var D=0,C=[],F;
F=B[D];
D++){if(!E.previousElementSibling(F)&&!E.nextElementSibling(F)){C.push(F)
}}return C
},"nth-child":function(B,C,A){return Selector.pseudos.nth(B,C,A)
},"nth-last-child":function(B,C,A){return Selector.pseudos.nth(B,C,A,true)
},"nth-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,false,true)
},"nth-last-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,true,true)
},"first-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,false,true)
},"last-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,true,true)
},"only-of-type":function(B,D,A){var C=Selector.pseudos;
return C["last-of-type"](C["first-of-type"](B,D,A),D,A)
},getIndices:function(B,A,C){if(B==0){return A>0?[A]:[]
}return $R(1,C).inject([],function(D,E){if(0==(E-A)%B&&(E-A)/B>=0){D.push(E)
}return D
})
},nth:function(A,L,N,K,C){if(A.length==0){return[]
}if(L=="even"){L="2n+0"
}if(L=="odd"){L="2n+1"
}var J=Selector.handlers,I=[],B=[],E;
J.mark(A);
for(var H=0,D;
D=A[H];
H++){if(!D.parentNode._countedByPrototype){J.index(D.parentNode,K,C);
B.push(D.parentNode)
}}if(L.match(/^\d+$/)){L=Number(L);
for(var H=0,D;
D=A[H];
H++){if(D.nodeIndex==L){I.push(D)
}}}else{if(E=L.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(E[1]=="-"){E[1]=-1
}var O=E[1]?Number(E[1]):1;
var M=E[2]?Number(E[2]):0;
var P=Selector.pseudos.getIndices(O,M,A.length);
for(var H=0,D,F=P.length;
D=A[H];
H++){for(var G=0;
G<F;
G++){if(D.nodeIndex==P[G]){I.push(D)
}}}}}J.unmark(A);
J.unmark(B);
return I
},empty:function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(E.tagName=="!"||(E.firstChild&&!E.innerHTML.match(/^\s*$/))){continue
}C.push(E)
}return C
},not:function(A,D,I){var G=Selector.handlers,J,C;
var H=new Selector(D).findElements(I);
G.mark(H);
for(var F=0,E=[],B;
B=A[F];
F++){if(!B._countedByPrototype){E.push(B)
}}G.unmark(H);
return E
},enabled:function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(!E.disabled){C.push(E)
}}return C
},disabled:function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(E.disabled){C.push(E)
}}return C
},checked:function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(E.checked){C.push(E)
}}return C
}},operators:{"=":function(B,A){return B==A
},"!=":function(B,A){return B!=A
},"^=":function(B,A){return B.startsWith(A)
},"$=":function(B,A){return B.endsWith(A)
},"*=":function(B,A){return B.include(A)
},"~=":function(B,A){return(" "+B+" ").include(" "+A+" ")
},"|=":function(B,A){return("-"+B.toUpperCase()+"-").include("-"+A.toUpperCase()+"-")
}},split:function(B){var A=[];
B.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(C){A.push(C[1].strip())
});
return A
},matchElements:function(F,G){var E=$$(G),D=Selector.handlers;
D.mark(E);
for(var C=0,B=[],A;
A=F[C];
C++){if(A._countedByPrototype){B.push(A)
}}D.unmark(E);
return B
},findElement:function(B,C,A){if(Object.isNumber(C)){A=C;
C=false
}return Selector.matchElements(B,C||"*")[A||0]
},findChildElements:function(E,G){G=Selector.split(G.join(","));
var D=[],F=Selector.handlers;
for(var C=0,B=G.length,A;
C<B;
C++){A=new Selector(G[C].strip());
F.concat(D,A.findElements(E))
}return(B>1)?F.unique(D):D
}});
if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(B,A){for(var C=0,D;
D=A[C];
C++){if(D.tagName!=="!"){B.push(D)
}}return B
},unmark:function(A){for(var B=0,C;
C=A[B];
B++){C.removeAttribute("_countedByPrototype")
}return A
}})
}function $$(){return Selector.findChildElements(document,$A(arguments))
}var Form={reset:function(A){$(A).reset();
return A
},serializeElements:function(G,B){if(typeof B!="object"){B={hash:!!B}
}else{if(Object.isUndefined(B.hash)){B.hash=true
}}var C,F,A=false,E=B.submit;
var D=G.inject({},function(H,I){if(!I.disabled&&I.name){C=I.name;
F=$(I).getValue();
if(F!=null&&(I.type!="submit"||(!A&&E!==false&&(!E||C==E)&&(A=true)))){if(C in H){if(!Object.isArray(H[C])){H[C]=[H[C]]
}H[C].push(F)
}else{H[C]=F
}}}return H
});
return B.hash?D:Object.toQueryString(D)
}};
Form.Methods={serialize:function(B,A){return Form.serializeElements(Form.getElements(B),A)
},getElements:function(A){return $A($(A).getElementsByTagName("*")).inject([],function(B,C){if(Form.Element.Serializers[C.tagName.toLowerCase()]){B.push(Element.extend(C))
}return B
})
},getInputs:function(G,C,D){G=$(G);
var A=G.getElementsByTagName("input");
if(!C&&!D){return $A(A).map(Element.extend)
}for(var E=0,H=[],F=A.length;
E<F;
E++){var B=A[E];
if((C&&B.type!=C)||(D&&B.name!=D)){continue
}H.push(Element.extend(B))
}return H
},disable:function(A){A=$(A);
Form.getElements(A).invoke("disable");
return A
},enable:function(A){A=$(A);
Form.getElements(A).invoke("enable");
return A
},findFirstElement:function(B){var C=$(B).getElements().findAll(function(D){return"hidden"!=D.type&&!D.disabled
});
var A=C.findAll(function(D){return D.hasAttribute("tabIndex")&&D.tabIndex>=0
}).sortBy(function(D){return D.tabIndex
}).first();
return A?A:C.find(function(D){return["input","select","textarea"].include(D.tagName.toLowerCase())
})
},focusFirstElement:function(A){A=$(A);
A.findFirstElement().activate();
return A
},request:function(B,A){B=$(B),A=Object.clone(A||{});
var D=A.parameters,C=B.readAttribute("action")||"";
if(C.blank()){C=window.location.href
}A.parameters=B.serialize(true);
if(D){if(Object.isString(D)){D=D.toQueryParams()
}Object.extend(A.parameters,D)
}if(B.hasAttribute("method")&&!A.method){A.method=B.method
}return new Ajax.Request(C,A)
}};
Form.Element={focus:function(A){$(A).focus();
return A
},select:function(A){$(A).select();
return A
}};
Form.Element.Methods={serialize:function(A){A=$(A);
if(!A.disabled&&A.name){var B=A.getValue();
if(B!=undefined){var C={};
C[A.name]=B;
return Object.toQueryString(C)
}}return""
},getValue:function(A){A=$(A);
var B=A.tagName.toLowerCase();
return Form.Element.Serializers[B](A)
},setValue:function(A,B){A=$(A);
var C=A.tagName.toLowerCase();
Form.Element.Serializers[C](A,B);
return A
},clear:function(A){$(A).value="";
return A
},present:function(A){return $(A).value!=""
},activate:function(A){A=$(A);
try{A.focus();
if(A.select&&(A.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(A.type))){A.select()
}}catch(B){}return A
},disable:function(A){A=$(A);
A.blur();
A.disabled=true;
return A
},enable:function(A){A=$(A);
A.disabled=false;
return A
}};
var Field=Form.Element;
var $F=Form.Element.Methods.getValue;
Form.Element.Serializers={input:function(A,B){switch(A.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(A,B);
default:return Form.Element.Serializers.textarea(A,B)
}},inputSelector:function(A,B){if(Object.isUndefined(B)){return A.checked?A.value:null
}else{A.checked=!!B
}},textarea:function(A,B){if(Object.isUndefined(B)){return A.value
}else{A.value=B
}},select:function(D,A){if(Object.isUndefined(A)){return this[D.type=="select-one"?"selectOne":"selectMany"](D)
}else{var C,F,G=!Object.isArray(A);
for(var B=0,E=D.length;
B<E;
B++){C=D.options[B];
F=this.optionValue(C);
if(G){if(F==A){C.selected=true;
return 
}}else{C.selected=A.include(F)
}}}},selectOne:function(B){var A=B.selectedIndex;
return A>=0?this.optionValue(B.options[A]):null
},selectMany:function(D){var A,E=D.length;
if(!E){return null
}for(var C=0,A=[];
C<E;
C++){var B=D.options[C];
if(B.selected){A.push(this.optionValue(B))
}}return A
},optionValue:function(A){return Element.extend(A).hasAttribute("value")?A.value:A.text
}};
Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,A,B,C){$super(C,B);
this.element=$(A);
this.lastValue=this.getValue()
},execute:function(){var A=this.getValue();
if(Object.isString(this.lastValue)&&Object.isString(A)?this.lastValue!=A:String(this.lastValue)!=String(A)){this.callback(this.element,A);
this.lastValue=A
}}});
Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)
}});
Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)
}});
Abstract.EventObserver=Class.create({initialize:function(A,B){this.element=$(A);
this.callback=B;
this.lastValue=this.getValue();
if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()
}else{this.registerCallback(this.element)
}},onElementEvent:function(){var A=this.getValue();
if(this.lastValue!=A){this.callback(this.element,A);
this.lastValue=A
}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)
},registerCallback:function(A){if(A.type){switch(A.type.toLowerCase()){case"checkbox":case"radio":Event.observe(A,"click",this.onElementEvent.bind(this));
break;
default:Event.observe(A,"change",this.onElementEvent.bind(this));
break
}}}});
Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)
}});
Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)
}});
if(!window.Event){var Event={}
}Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{},relatedTarget:function(B){var A;
switch(B.type){case"mouseover":A=B.fromElement;
break;
case"mouseout":A=B.toElement;
break;
default:return null
}return Element.extend(A)
}});
Event.Methods=(function(){var A;
if(Prototype.Browser.IE){var B={0:1,1:4,2:2};
A=function(D,C){return D.button==B[C]
}
}else{if(Prototype.Browser.WebKit){A=function(D,C){switch(C){case 0:return D.which==1&&!D.metaKey;
case 1:return D.which==1&&D.metaKey;
default:return false
}}
}else{A=function(D,C){return D.which?(D.which===C+1):(D.button===C)
}
}}return{isLeftClick:function(C){return A(C,0)
},isMiddleClick:function(C){return A(C,1)
},isRightClick:function(C){return A(C,2)
},element:function(D){var C=Event.extend(D).target;
return Element.extend(C.nodeType==Node.TEXT_NODE?C.parentNode:C)
},findElement:function(D,F){var C=Event.element(D);
if(!F){return C
}var E=[C].concat(C.ancestors());
return Selector.findElement(E,F,0)
},pointer:function(C){return{x:C.pageX||(C.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),y:C.pageY||(C.clientY+(document.documentElement.scrollTop||document.body.scrollTop))}
},pointerX:function(C){return Event.pointer(C).x
},pointerY:function(C){return Event.pointer(C).y
},stop:function(C){Event.extend(C);
C.preventDefault();
C.stopPropagation();
C.stopped=true
}}
})();
Event.extend=(function(){var A=Object.keys(Event.Methods).inject({},function(B,C){B[C]=Event.Methods[C].methodize();
return B
});
if(Prototype.Browser.IE){Object.extend(A,{stopPropagation:function(){this.cancelBubble=true
},preventDefault:function(){this.returnValue=false
},inspect:function(){return"[object Event]"
}});
return function(B){if(!B){return false
}if(B._extendedByPrototype){return B
}B._extendedByPrototype=Prototype.emptyFunction;
var C=Event.pointer(B);
Object.extend(B,{target:B.srcElement,relatedTarget:Event.relatedTarget(B),pageX:C.x,pageY:C.y});
return Object.extend(B,A)
}
}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents").__proto__;
Object.extend(Event.prototype,A);
return Prototype.K
}})();
Object.extend(Event,(function(){var B=Event.cache;
function C(J){if(J._prototypeEventID){return J._prototypeEventID[0]
}arguments.callee.id=arguments.callee.id||1;
return J._prototypeEventID=[++arguments.callee.id]
}function G(J){if(J&&J.include(":")){return"dataavailable"
}return J
}function A(J){return B[J]=B[J]||{}
}function F(L,J){var K=A(L);
return K[J]=K[J]||[]
}function H(K,J,L){var O=C(K);
var N=F(O,J);
if(N.pluck("handler").include(L)){return false
}var M=function(P){if(!Event||!Event.extend||(P.eventName&&P.eventName!=J)){return false
}Event.extend(P);
L.call(K,P)
};
M.handler=L;
N.push(M);
return M
}function I(M,J,K){var L=F(M,J);
return L.find(function(N){return N.handler==K
})
}function D(M,J,K){var L=A(M);
if(!L[J]){return false
}L[J]=L[J].without(I(M,J,K))
}function E(){for(var K in B){for(var J in B[K]){B[K][J]=null
}}}if(window.attachEvent){window.attachEvent("onunload",E)
}return{observe:function(L,J,M){L=$(L);
var K=G(J);
var N=H(L,J,M);
if(!N){return L
}if(L.addEventListener){L.addEventListener(K,N,false)
}else{L.attachEvent("on"+K,N)
}return L
},stopObserving:function(L,J,M){L=$(L);
var O=C(L),K=G(J);
if(!M&&J){F(O,J).each(function(P){L.stopObserving(J,P.handler)
});
return L
}else{if(!J){Object.keys(A(O)).each(function(P){L.stopObserving(P)
});
return L
}}var N=I(O,J,M);
if(!N){return L
}if(L.removeEventListener){L.removeEventListener(K,N,false)
}else{L.detachEvent("on"+K,N)
}D(O,J,M);
return L
},fire:function(L,K,J){L=$(L);
if(L==document&&document.createEvent&&!L.dispatchEvent){L=document.documentElement
}var M;
if(document.createEvent){M=document.createEvent("HTMLEvents");
M.initEvent("dataavailable",true,true)
}else{M=document.createEventObject();
M.eventType="ondataavailable"
}M.eventName=K;
M.memo=J||{};
if(document.createEvent){L.dispatchEvent(M)
}else{L.fireEvent(M.eventType,M)
}return Event.extend(M)
}}
})());
Object.extend(Event,Event.Methods);
Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});
Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize(),loaded:false});
(function(){var B;
function A(){if(document.loaded){return 
}if(B){window.clearInterval(B)
}document.fire("dom:loaded");
document.loaded=true
}if(document.addEventListener){if(Prototype.Browser.WebKit){B=window.setInterval(function(){if(/loaded|complete/.test(document.readyState)){A()
}},0);
Event.observe(window,"load",A)
}else{document.addEventListener("DOMContentLoaded",A,false)
}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;
A()
}}
}})();
Hash.toQueryString=Object.toQueryString;
var Toggle={display:Element.toggle};
Element.Methods.childOf=Element.Methods.descendantOf;
var Insertion={Before:function(A,B){return Element.insert(A,{before:B})
},Top:function(A,B){return Element.insert(A,{top:B})
},Bottom:function(A,B){return Element.insert(A,{bottom:B})
},After:function(A,B){return Element.insert(A,{after:B})
}};
var $continue=new Error('"throw $continue" is deprecated, use "return" instead');
var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;
this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0
},within:function(B,A,C){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(B,A,C)
}this.xcomp=A;
this.ycomp=C;
this.offset=Element.cumulativeOffset(B);
return(C>=this.offset[1]&&C<this.offset[1]+B.offsetHeight&&A>=this.offset[0]&&A<this.offset[0]+B.offsetWidth)
},withinIncludingScrolloffsets:function(B,A,D){var C=Element.cumulativeScrollOffset(B);
this.xcomp=A+C[0]-this.deltaX;
this.ycomp=D+C[1]-this.deltaY;
this.offset=Element.cumulativeOffset(B);
return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+B.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+B.offsetWidth)
},overlap:function(B,A){if(!B){return 0
}if(B=="vertical"){return((this.offset[1]+A.offsetHeight)-this.ycomp)/A.offsetHeight
}if(B=="horizontal"){return((this.offset[0]+A.offsetWidth)-this.xcomp)/A.offsetWidth
}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(A){Position.prepare();
return Element.absolutize(A)
},relativize:function(A){Position.prepare();
return Element.relativize(A)
},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(B,C,A){A=A||{};
return Element.clonePosition(C,B,A)
}};
if(!document.getElementsByClassName){document.getElementsByClassName=function(B){function A(C){return C.blank()?null:"[contains(concat(' ', @class, ' '), ' "+C+" ')]"
}B.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(C,E){E=E.toString().strip();
var D=/\s/.test(E)?$w(E).map(A).join(""):A(E);
return D?document._getElementsByXPath(".//*"+D,C):[]
}:function(E,F){F=F.toString().strip();
var G=[],H=(/\s/.test(F)?$w(F):null);
if(!H&&!F){return G
}var C=$(E).getElementsByTagName("*");
F=" "+F+" ";
for(var D=0,J,I;
J=C[D];
D++){if(J.className&&(I=" "+J.className+" ")&&(I.include(F)||(H&&H.all(function(K){return !K.toString().blank()&&I.include(" "+K+" ")
})))){G.push(Element.extend(J))
}}return G
};
return function(D,C){return $(C||document.body).getElementsByClassName(D)
}
}(Element.Methods)
}Element.ClassNames=Class.create();
Element.ClassNames.prototype={initialize:function(A){this.element=$(A)
},_each:function(A){this.element.className.split(/\s+/).select(function(B){return B.length>0
})._each(A)
},set:function(A){this.element.className=A
},add:function(A){if(this.include(A)){return 
}this.set($A(this).concat(A).join(" "))
},remove:function(A){if(!this.include(A)){return 
}this.set($A(this).without(A).join(" "))
},toString:function(){return $A(this).join(" ")
}};
Object.extend(Element.ClassNames.prototype,Enumerable);
Element.addMethods();/*
 * jQuery JavaScript Library v1.4.2
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Sat Feb 13 22:33:48 2010 -0500
 */
(function(An,v){function Az(){if(!AF.isReady){try{x.documentElement.doScroll("left")
}catch(A){setTimeout(Az,1);
return 
}AF.ready()
}}function t(F,A){A.src?AF.ajax({url:A.src,async:false,dataType:"script"}):AF.globalEval(A.text||A.textContent||A.innerHTML||"");
A.parentNode&&A.parentNode.removeChild(A)
}function AN(F,A,O,K,L,G){var J=F.length;
if(typeof A==="object"){for(var N in A){AN(F,N,A[N],K,L,O)
}return F
}if(O!==v){K=!G&&K&&AF.isFunction(O);
for(N=0;
N<J;
N++){L(F[N],A,K?O.call(F[N],N,L(F[N],A)):O,G)
}return F
}return J?L(F[0],A):v
}function Ae(){return(new Date).getTime()
}function AM(){return false
}function AK(){return true
}function Aj(F,A,G){G[0].type=F;
return AF.event.handle.apply(A,G)
}function AE(R){var Q,P=[],N=[],O=arguments,K,L,F,J,G,A;
L=AF.data(this,"events");
if(!(R.liveFired===this||!L||!L.live||R.button&&R.type==="click")){R.liveFired=this;
var T=L.live.slice(0);
for(J=0;
J<T.length;
J++){L=T[J];
L.origType.replace(AW,"")===R.type?N.push(L.selector):T.splice(J--,1)
}K=AF(R.target).closest(N,R.currentTarget);
G=0;
for(A=K.length;
G<A;
G++){for(J=0;
J<T.length;
J++){L=T[J];
if(K[G].selector===L.selector){F=K[G].elem;
N=null;
if(L.preType==="mouseenter"||L.preType==="mouseleave"){N=AF(R.relatedTarget).closest(L.selector)[0]
}if(!N||N!==F){P.push({elem:F,handleObj:L})
}}}}G=0;
for(A=P.length;
G<A;
G++){K=P[G];
R.currentTarget=K.elem;
R.data=K.handleObj.data;
R.handleObj=K.handleObj;
if(K.handleObj.origHandler.apply(K.elem,O)===false){Q=false;
break
}}return Q
}}function o(F,A){return"live."+(F&&F!=="*"?F+".":"")+A.replace(/\./g,"`").replace(/ /g,"&")
}function b(A){return !A||!A.parentNode||A.parentNode.nodeType===11
}function BG(F,A){var G=0;
A.each(function(){if(this.nodeName===(F[G]&&F[G].nodeName)){var L=AF.data(F[G++]),N=AF.data(this,L);
if(L=L&&L.events){delete N.handle;
N.events={};
for(var J in L){for(var K in L[J]){AF.event.add(this,J,L[J][K],L[J][K].data)
}}}}})
}function A2(F,A,L){var J,K,G;
A=A&&A[0]?A[0].ownerDocument||A[0]:x;
if(F.length===1&&typeof F[0]==="string"&&F[0].length<512&&A===x&&!Ao.test(F[0])&&(AF.support.checkClone||!AI.test(F[0]))){K=true;
if(G=AF.fragments[F[0]]){if(G!==1){J=G
}}}if(!J){J=A.createDocumentFragment();
AF.clean(F,A,J,L)
}if(K){AF.fragments[F[0]]=G?J:1
}return{fragment:J,cacheable:K}
}function AZ(F,A){var G={};
AF.each(r.concat.apply([],r.slice(0,A)),function(){G[this]=F
});
return G
}function f(A){return"scrollTo" in A&&A.document?A:A.nodeType===9?A.defaultView||A.parentWindow:false
}var AF=function(F,A){return new AF.fn.init(F,A)
},g=An.jQuery,D=An.$,x=An.document,AQ,A6=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,As=/^.[^:#\[\.,]*$/,AL=/\S/,u=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,h=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,AU=navigator.userAgent,C=false,AS=[],AY,A0=Object.prototype.toString,Au=Object.prototype.hasOwnProperty,AV=Array.prototype.push,AR=Array.prototype.slice,A5=Array.prototype.indexOf;
AF.fn=AF.prototype={init:function(F,A){var J,G;
if(!F){return this
}if(F.nodeType){this.context=this[0]=F;
this.length=1;
return this
}if(F==="body"&&!A){this.context=x;
this[0]=x.body;
this.selector="body";
this.length=1;
return this
}if(typeof F==="string"){if((J=A6.exec(F))&&(J[1]||!A)){if(J[1]){G=A?A.ownerDocument||A:x;
if(F=h.exec(F)){if(AF.isPlainObject(A)){F=[x.createElement(F[1])];
AF.fn.attr.call(F,A,true)
}else{F=[G.createElement(F[1])]
}}else{F=A2([J[1]],[G]);
F=(F.cacheable?F.fragment.cloneNode(true):F.fragment).childNodes
}return AF.merge(this,F)
}else{if(A=x.getElementById(J[2])){if(A.id!==J[2]){return AQ.find(F)
}this.length=1;
this[0]=A
}this.context=x;
this.selector=F;
return this
}}else{if(!A&&/^\w+$/.test(F)){this.selector=F;
this.context=x;
F=x.getElementsByTagName(F);
return AF.merge(this,F)
}else{return !A||A.jquery?(A||AQ).find(F):AF(A).find(F)
}}}else{if(AF.isFunction(F)){return AQ.ready(F)
}}if(F.selector!==v){this.selector=F.selector;
this.context=F.context
}return AF.makeArray(F,this)
},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length
},toArray:function(){return AR.call(this,0)
},get:function(A){return A==null?this.toArray():A<0?this.slice(A)[0]:this[A]
},pushStack:function(F,A,J){var G=AF();
AF.isArray(F)?AV.apply(G,F):AF.merge(G,F);
G.prevObject=this;
G.context=this.context;
if(A==="find"){G.selector=this.selector+(this.selector?" ":"")+J
}else{if(A){G.selector=this.selector+"."+A+"("+J+")"
}}return G
},each:function(F,A){return AF.each(this,F,A)
},ready:function(A){AF.bindReady();
if(AF.isReady){A.call(x,AF)
}else{AS&&AS.push(A)
}return this
},eq:function(A){return A===-1?this.slice(A):this.slice(A,+A+1)
},first:function(){return this.eq(0)
},last:function(){return this.eq(-1)
},slice:function(){return this.pushStack(AR.apply(this,arguments),"slice",AR.call(arguments).join(","))
},map:function(A){return this.pushStack(AF.map(this,function(F,G){return A.call(F,G,F)
}))
},end:function(){return this.prevObject||AF(null)
},push:AV,sort:[].sort,splice:[].splice};
AF.fn.init.prototype=AF.fn;
AF.extend=AF.fn.extend=function(){var F=arguments[0]||{},A=1,O=arguments.length,K=false,L,G,J,N;
if(typeof F==="boolean"){K=F;
F=arguments[1]||{};
A=2
}if(typeof F!=="object"&&!AF.isFunction(F)){F={}
}if(O===A){F=this;
--A
}for(;
A<O;
A++){if((L=arguments[A])!=null){for(G in L){J=F[G];
N=L[G];
if(F!==N){if(K&&N&&(AF.isPlainObject(N)||AF.isArray(N))){J=J&&(AF.isPlainObject(J)||AF.isArray(J))?J:AF.isArray(N)?[]:{};
F[G]=AF.extend(K,J,N)
}else{if(N!==v){F[G]=N
}}}}}}return F
};
AF.extend({noConflict:function(A){An.$=D;
if(A){An.jQuery=g
}return AF
},isReady:false,ready:function(){if(!AF.isReady){if(!x.body){return setTimeout(AF.ready,13)
}AF.isReady=true;
if(AS){for(var F,A=0;
F=AS[A++];
){F.call(x,AF)
}AS=null
}AF.fn.triggerHandler&&AF(x).triggerHandler("ready")
}},bindReady:function(){if(!C){C=true;
if(x.readyState==="complete"){return AF.ready()
}if(x.addEventListener){x.addEventListener("DOMContentLoaded",AY,false);
An.addEventListener("load",AF.ready,false)
}else{if(x.attachEvent){x.attachEvent("onreadystatechange",AY);
An.attachEvent("onload",AF.ready);
var F=false;
try{F=An.frameElement==null
}catch(A){}x.documentElement.doScroll&&F&&Az()
}}}},isFunction:function(A){return A0.call(A)==="[object Function]"
},isArray:function(A){return A0.call(A)==="[object Array]"
},isPlainObject:function(F){if(!F||A0.call(F)!=="[object Object]"||F.nodeType||F.setInterval){return false
}if(F.constructor&&!Au.call(F,"constructor")&&!Au.call(F.constructor.prototype,"isPrototypeOf")){return false
}var A;
for(A in F){}return A===v||Au.call(F,A)
},isEmptyObject:function(F){for(var A in F){return false
}return true
},error:function(A){throw A
},parseJSON:function(A){if(typeof A!=="string"||!A){return null
}A=AF.trim(A);
if(/^[\],:{}\s]*$/.test(A.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return An.JSON&&An.JSON.parse?An.JSON.parse(A):(new Function("return "+A))()
}else{AF.error("Invalid JSON: "+A)
}},noop:function(){},globalEval:function(F){if(F&&AL.test(F)){var A=x.getElementsByTagName("head")[0]||x.documentElement,G=x.createElement("script");
G.type="text/javascript";
if(AF.support.scriptEval){G.appendChild(x.createTextNode(F))
}else{G.text=F
}A.insertBefore(G,A.firstChild);
A.removeChild(G)
}},nodeName:function(F,A){return F.nodeName&&F.nodeName.toUpperCase()===A.toUpperCase()
},each:function(F,A,N){var K,L=0,G=F.length,J=G===v||AF.isFunction(F);
if(N){if(J){for(K in F){if(A.apply(F[K],N)===false){break
}}}else{for(;
L<G;
){if(A.apply(F[L++],N)===false){break
}}}}else{if(J){for(K in F){if(A.call(F[K],K,F[K])===false){break
}}}else{for(N=F[0];
L<G&&A.call(N,L,N)!==false;
N=F[++L]){}}}return F
},trim:function(A){return(A||"").replace(u,"")
},makeArray:function(F,A){A=A||[];
if(F!=null){F.length==null||typeof F==="string"||AF.isFunction(F)||typeof F!=="function"&&F.setInterval?AV.call(A,F):AF.merge(A,F)
}return A
},inArray:function(F,A){if(A.indexOf){return A.indexOf(F)
}for(var J=0,G=A.length;
J<G;
J++){if(A[J]===F){return J
}}return -1
},merge:function(F,A){var K=F.length,G=0;
if(typeof A.length==="number"){for(var J=A.length;
G<J;
G++){F[K++]=A[G]
}}else{for(;
A[G]!==v;
){F[K++]=A[G++]
}}F.length=K;
return F
},grep:function(F,A,L){for(var J=[],K=0,G=F.length;
K<G;
K++){!L!==!A(F[K],K)&&J.push(F[K])
}return J
},map:function(F,A,N){for(var K=[],L,G=0,J=F.length;
G<J;
G++){L=A(F[G],G,N);
if(L!=null){K[K.length]=L
}}return K.concat.apply([],K)
},guid:1,proxy:function(F,A,G){if(arguments.length===2){if(typeof A==="string"){G=F;
F=G[A];
A=v
}else{if(A&&!AF.isFunction(A)){G=A;
A=v
}}}if(!A&&F){A=function(){return F.apply(G||this,arguments)
}
}if(F){A.guid=F.guid=F.guid||A.guid||AF.guid++
}return A
},uaMatch:function(A){A=A.toLowerCase();
A=/(webkit)[ \/]([\w.]+)/.exec(A)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(A)||/(msie) ([\w.]+)/.exec(A)||!/compatible/.test(A)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(A)||[];
return{browser:A[1]||"",version:A[2]||"0"}
},browser:{}});
AU=AF.uaMatch(AU);
if(AU.browser){AF.browser[AU.browser]=true;
AF.browser.version=AU.version
}if(AF.browser.webkit){AF.browser.safari=true
}if(A5){AF.inArray=function(F,A){return A5.call(A,F)
}
}AQ=AF(x);
if(x.addEventListener){AY=function(){x.removeEventListener("DOMContentLoaded",AY,false);
AF.ready()
}
}else{if(x.attachEvent){AY=function(){if(x.readyState==="complete"){x.detachEvent("onreadystatechange",AY);
AF.ready()
}}
}}(function(){AF.support={};
var P=x.documentElement,O=x.createElement("script"),N=x.createElement("div"),K="script"+Ae();
N.style.display="none";
N.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
var L=N.getElementsByTagName("*"),G=N.getElementsByTagName("a")[0];
if(!(!L||!L.length||!G)){AF.support={leadingWhitespace:N.firstChild.nodeType===3,tbody:!N.getElementsByTagName("tbody").length,htmlSerialize:!!N.getElementsByTagName("link").length,style:/red/.test(G.getAttribute("style")),hrefNormalized:G.getAttribute("href")==="/a",opacity:/^0.55$/.test(G.style.opacity),cssFloat:!!G.style.cssFloat,checkOn:N.getElementsByTagName("input")[0].value==="on",optSelected:x.createElement("select").appendChild(x.createElement("option")).selected,parentNode:N.removeChild(N.appendChild(x.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};
O.type="text/javascript";
try{O.appendChild(x.createTextNode("window."+K+"=1;"))
}catch(J){}P.insertBefore(O,P.firstChild);
if(An[K]){AF.support.scriptEval=true;
delete An[K]
}try{delete O.test
}catch(A){AF.support.deleteExpando=false
}P.removeChild(O);
if(N.attachEvent&&N.fireEvent){N.attachEvent("onclick",function F(){AF.support.noCloneEvent=false;
N.detachEvent("onclick",F)
});
N.cloneNode(true).fireEvent("onclick")
}N=x.createElement("div");
N.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";
P=x.createDocumentFragment();
P.appendChild(N.firstChild);
AF.support.checkClone=P.cloneNode(true).cloneNode(true).lastChild.checked;
AF(function(){var Q=x.createElement("div");
Q.style.width=Q.style.paddingLeft="1px";
x.body.appendChild(Q);
AF.boxModel=AF.support.boxModel=Q.offsetWidth===2;
x.body.removeChild(Q).style.display="none"
});
P=function(Q){var T=x.createElement("div");
Q="on"+Q;
var R=Q in T;
if(!R){T.setAttribute(Q,"return;");
R=typeof T[Q]==="function"
}return R
};
AF.support.submitBubbles=P("submit");
AF.support.changeBubbles=P("change");
P=O=N=L=G=null
}})();
AF.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};
var Ag="jQuery"+Ae(),E=0,Ar={};
AF.extend({cache:{},expando:Ag,noData:{embed:true,object:true,applet:true},data:function(F,A,K){if(!(F.nodeName&&AF.noData[F.nodeName.toLowerCase()])){F=F==An?Ar:F;
var G=F[Ag],J=AF.cache;
if(!G&&typeof A==="string"&&K===v){return null
}G||(G=++E);
if(typeof A==="object"){F[Ag]=G;
J[G]=AF.extend(true,{},A)
}else{if(!J[G]){F[Ag]=G;
J[G]={}
}}F=J[G];
if(K!==v){F[A]=K
}return typeof A==="string"?F[A]:F
}},removeData:function(F,A){if(!(F.nodeName&&AF.noData[F.nodeName.toLowerCase()])){F=F==An?Ar:F;
var K=F[Ag],G=AF.cache,J=G[K];
if(A){if(J){delete J[A];
AF.isEmptyObject(J)&&AF.removeData(F)
}}else{if(AF.support.deleteExpando){delete F[AF.expando]
}else{F.removeAttribute&&F.removeAttribute(AF.expando)
}delete G[K]
}}}});
AF.fn.extend({data:function(F,A){if(typeof F==="undefined"&&this.length){return AF.data(this[0])
}else{if(typeof F==="object"){return this.each(function(){AF.data(this,F)
})
}}var J=F.split(".");
J[1]=J[1]?"."+J[1]:"";
if(A===v){var G=this.triggerHandler("getData"+J[1]+"!",[J[0]]);
if(G===v&&this.length){G=AF.data(this[0],F)
}return G===v&&J[1]?this.data(J[0]):G
}else{return this.trigger("setData"+J[1]+"!",[J[0],A]).each(function(){AF.data(this,F,A)
})
}},removeData:function(A){return this.each(function(){AF.removeData(this,A)
})
}});
AF.extend({queue:function(F,A,J){if(F){A=(A||"fx")+"queue";
var G=AF.data(F,A);
if(!J){return G||[]
}if(!G||AF.isArray(J)){G=AF.data(F,A,AF.makeArray(J))
}else{G.push(J)
}return G
}},dequeue:function(F,A){A=A||"fx";
var J=AF.queue(F,A),G=J.shift();
if(G==="inprogress"){G=J.shift()
}if(G){A==="fx"&&J.unshift("inprogress");
G.call(F,function(){AF.dequeue(F,A)
})
}}});
AF.fn.extend({queue:function(F,A){if(typeof F!=="string"){A=F;
F="fx"
}if(A===v){return AF.queue(this[0],F)
}return this.each(function(){var G=AF.queue(this,F,A);
F==="fx"&&G[0]!=="inprogress"&&AF.dequeue(this,F)
})
},dequeue:function(A){return this.each(function(){AF.dequeue(this,A)
})
},delay:function(F,A){F=AF.fx?AF.fx.speeds[F]||F:F;
A=A||"fx";
return this.queue(A,function(){var G=this;
setTimeout(function(){AF.dequeue(G,A)
},F)
})
},clearQueue:function(A){return this.queue(A||"fx",[])
}});
var BB=/[\n\t]/g,z=/\s+/,A7=/\r/g,Al=/href|src|style/,At=/(button|input)/i,AT=/(button|input|object|select|textarea)/i,y=/^(a|area)$/i,Ax=/radio|checkbox/;
AF.fn.extend({attr:function(F,A){return AN(this,F,A,true,AF.attr)
},removeAttr:function(A){return this.each(function(){AF.attr(this,A,"");
this.nodeType===1&&this.removeAttribute(A)
})
},addClass:function(P){if(AF.isFunction(P)){return this.each(function(R){var Q=AF(this);
Q.addClass(P.call(this,R,Q.attr("class")))
})
}if(P&&typeof P==="string"){for(var O=(P||"").split(z),N=0,K=this.length;
N<K;
N++){var L=this[N];
if(L.nodeType===1){if(L.className){for(var G=" "+L.className+" ",J=L.className,A=0,F=O.length;
A<F;
A++){if(G.indexOf(" "+O[A]+" ")<0){J+=" "+O[A]
}}L.className=AF.trim(J)
}else{L.className=P
}}}}return this
},removeClass:function(F){if(AF.isFunction(F)){return this.each(function(P){var Q=AF(this);
Q.removeClass(F.call(this,P,Q.attr("class")))
})
}if(F&&typeof F==="string"||F===v){for(var A=(F||"").split(z),O=0,K=this.length;
O<K;
O++){var L=this[O];
if(L.nodeType===1&&L.className){if(F){for(var G=(" "+L.className+" ").replace(BB," "),J=0,N=A.length;
J<N;
J++){G=G.replace(" "+A[J]+" "," ")
}L.className=AF.trim(G)
}else{L.className=""
}}}}return this
},toggleClass:function(F,A){var J=typeof F,G=typeof A==="boolean";
if(AF.isFunction(F)){return this.each(function(L){var K=AF(this);
K.toggleClass(F.call(this,L,K.attr("class"),A),A)
})
}return this.each(function(){if(J==="string"){for(var O,L=0,N=AF(this),P=A,K=F.split(z);
O=K[L++];
){P=G?P:!N.hasClass(O);
N[P?"addClass":"removeClass"](O)
}}else{if(J==="undefined"||J==="boolean"){this.className&&AF.data(this,"__className__",this.className);
this.className=this.className||F===false?"":AF.data(this,"__className__")||""
}}})
},hasClass:function(F){F=" "+F+" ";
for(var A=0,G=this.length;
A<G;
A++){if((" "+this[A].className+" ").replace(BB," ").indexOf(F)>-1){return true
}}return false
},val:function(F){if(F===v){var A=this[0];
if(A){if(AF.nodeName(A,"option")){return(A.attributes.value||{}).specified?A.value:A.text
}if(AF.nodeName(A,"select")){var O=A.selectedIndex,K=[],L=A.options;
A=A.type==="select-one";
if(O<0){return null
}var G=A?O:0;
for(O=A?O+1:L.length;
G<O;
G++){var J=L[G];
if(J.selected){F=AF(J).val();
if(A){return F
}K.push(F)
}}return K
}if(Ax.test(A.type)&&!AF.support.checkOn){return A.getAttribute("value")===null?"on":A.value
}return(A.value||"").replace(A7,"")
}return v
}var N=AF.isFunction(F);
return this.each(function(P){var T=AF(this),R=F;
if(this.nodeType===1){if(N){R=F.call(this,P,T.val())
}if(typeof R==="number"){R+=""
}if(AF.isArray(R)&&Ax.test(this.type)){this.checked=AF.inArray(T.val(),R)>=0
}else{if(AF.nodeName(this,"select")){var Q=AF.makeArray(R);
AF("option",this).each(function(){this.selected=AF.inArray(AF(this).val(),Q)>=0
});
if(!Q.length){this.selectedIndex=-1
}}else{this.value=R
}}}})
}});
AF.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(F,A,L,J){if(!F||F.nodeType===3||F.nodeType===8){return v
}if(J&&A in AF.attrFn){return AF(F)[A](L)
}J=F.nodeType!==1||!AF.isXMLDoc(F);
var K=L!==v;
A=J&&AF.props[A]||A;
if(F.nodeType===1){var G=Al.test(A);
if(A in F&&J&&!G){if(K){A==="type"&&At.test(F.nodeName)&&F.parentNode&&AF.error("type property can't be changed");
F[A]=L
}if(AF.nodeName(F,"form")&&F.getAttributeNode(A)){return F.getAttributeNode(A).nodeValue
}if(A==="tabIndex"){return(A=F.getAttributeNode("tabIndex"))&&A.specified?A.value:AT.test(F.nodeName)||y.test(F.nodeName)&&F.href?0:v
}return F[A]
}if(!AF.support.style&&J&&A==="style"){if(K){F.style.cssText=""+L
}return F.style.cssText
}K&&F.setAttribute(A,""+L);
F=!AF.support.hrefNormalized&&J&&G?F.getAttribute(A,2):F.getAttribute(A);
return F===null?v:F
}return AF.style(F,A,L)
}});
var AW=/\.(.*)$/,i=function(A){return A.replace(/[^\w\s\.\|`]/g,function(F){return"\\"+F
})
};
AF.event={add:function(T,R,P,N){if(!(T.nodeType===3||T.nodeType===8)){if(T.setInterval&&T!==An&&!T.frameElement){T=An
}var O,K;
if(P.handler){O=P;
P=O.handler
}if(!P.guid){P.guid=AF.guid++
}if(K=AF.data(T)){var L=K.events=K.events||{},F=K.handle;
if(!F){K.handle=F=function(){return typeof AF!=="undefined"&&!AF.event.triggered?AF.event.handle.apply(F.elem,arguments):v
}
}F.elem=T;
R=R.split(" ");
for(var J,G=0,A;
J=R[G++];
){K=O?AF.extend({},O):{handler:P,data:N};
if(J.indexOf(".")>-1){A=J.split(".");
J=A.shift();
K.namespace=A.slice(0).sort().join(".")
}else{A=[];
K.namespace=""
}K.type=J;
K.guid=P.guid;
var V=L[J],Q=AF.event.special[J]||{};
if(!V){V=L[J]=[];
if(!Q.setup||Q.setup.call(T,N,A,F)===false){if(T.addEventListener){T.addEventListener(J,F,false)
}else{T.attachEvent&&T.attachEvent("on"+J,F)
}}}if(Q.add){Q.add.call(T,K);
if(!K.handler.guid){K.handler.guid=P.guid
}}V.push(K);
AF.event.global[J]=true
}T=null
}}},global:{},remove:function(W,V,R,P){if(!(W.nodeType===3||W.nodeType===8)){var Q,N=0,O,J,L,K,A,X,T=AF.data(W),F=T&&T.events;
if(T&&F){if(V&&V.type){R=V.handler;
V=V.type
}if(!V||typeof V==="string"&&V.charAt(0)==="."){V=V||"";
for(Q in F){AF.event.remove(W,Q+V)
}}else{for(V=V.split(" ");
Q=V[N++];
){K=Q;
O=Q.indexOf(".")<0;
J=[];
if(!O){J=Q.split(".");
Q=J.shift();
L=new RegExp("(^|\\.)"+AF.map(J.slice(0).sort(),i).join("\\.(?:.*\\.)?")+"(\\.|$)")
}if(A=F[Q]){if(R){K=AF.event.special[Q]||{};
for(G=P||0;
G<A.length;
G++){X=A[G];
if(R.guid===X.guid){if(O||L.test(X.namespace)){P==null&&A.splice(G--,1);
K.remove&&K.remove.call(W,X)
}if(P!=null){break
}}}if(A.length===0||P!=null&&A.length===1){if(!K.teardown||K.teardown.call(W,J)===false){Af(W,Q,T.handle)
}delete F[Q]
}}else{for(var G=0;
G<A.length;
G++){X=A[G];
if(O||L.test(X.namespace)){AF.event.remove(W,K,X.handler,G);
A.splice(G--,1)
}}}}}if(AF.isEmptyObject(F)){if(V=T.handle){V.elem=null
}delete T.events;
delete T.handle;
AF.isEmptyObject(T)&&AF.removeData(W)
}}}}},trigger:function(Q,P,O,L){var N=Q.type||Q;
if(!L){Q=typeof Q==="object"?Q[Ag]?Q:AF.extend(AF.Event(N),Q):AF.Event(N);
if(N.indexOf("!")>=0){Q.type=N=N.slice(0,-1);
Q.exclusive=true
}if(!O){Q.stopPropagation();
AF.event.global[N]&&AF.each(AF.cache,function(){this.events&&this.events[N]&&AF.event.trigger(Q,P,this.handle.elem)
})
}if(!O||O.nodeType===3||O.nodeType===8){return v
}Q.result=v;
Q.target=O;
P=AF.makeArray(P);
P.unshift(Q)
}Q.currentTarget=O;
(L=AF.data(O,"handle"))&&L.apply(O,P);
L=O.parentNode||O.ownerDocument;
try{if(!(O&&O.nodeName&&AF.noData[O.nodeName.toLowerCase()])){if(O["on"+N]&&O["on"+N].apply(O,P)===false){Q.result=false
}}}catch(J){}if(!Q.isPropagationStopped()&&L){AF.event.trigger(Q,P,L,true)
}else{if(!Q.isDefaultPrevented()){L=Q.target;
var K,A=AF.nodeName(L,"a")&&N==="click",G=AF.event.special[N]||{};
if((!G._default||G._default.call(O,Q)===false)&&!A&&!(L&&L.nodeName&&AF.noData[L.nodeName.toLowerCase()])){try{if(L[N]){if(K=L["on"+N]){L["on"+N]=null
}AF.event.triggered=true;
L[N]()
}}catch(F){}if(K){L["on"+N]=K
}AF.event.triggered=false
}}}},handle:function(F){var A,N,K,L;
F=arguments[0]=AF.event.fix(F||An.event);
F.currentTarget=this;
A=F.type.indexOf(".")<0&&!F.exclusive;
if(!A){N=F.type.split(".");
F.type=N.shift();
K=new RegExp("(^|\\.)"+N.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")
}L=AF.data(this,"events");
N=L[F.type];
if(L&&N){N=N.slice(0);
L=0;
for(var G=N.length;
L<G;
L++){var J=N[L];
if(A||K.test(J.namespace)){F.handler=J.handler;
F.data=J.data;
F.handleObj=J;
J=J.handler.apply(this,arguments);
if(J!==v){F.result=J;
if(J===false){F.preventDefault();
F.stopPropagation()
}}if(F.isImmediatePropagationStopped()){break
}}}}return F.result
},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(F){if(F[Ag]){return F
}var A=F;
F=AF.Event(A);
for(var J=this.props.length,G;
J;
){G=this.props[--J];
F[G]=A[G]
}if(!F.target){F.target=F.srcElement||x
}if(F.target.nodeType===3){F.target=F.target.parentNode
}if(!F.relatedTarget&&F.fromElement){F.relatedTarget=F.fromElement===F.target?F.toElement:F.fromElement
}if(F.pageX==null&&F.clientX!=null){A=x.documentElement;
J=x.body;
F.pageX=F.clientX+(A&&A.scrollLeft||J&&J.scrollLeft||0)-(A&&A.clientLeft||J&&J.clientLeft||0);
F.pageY=F.clientY+(A&&A.scrollTop||J&&J.scrollTop||0)-(A&&A.clientTop||J&&J.clientTop||0)
}if(!F.which&&(F.charCode||F.charCode===0?F.charCode:F.keyCode)){F.which=F.charCode||F.keyCode
}if(!F.metaKey&&F.ctrlKey){F.metaKey=F.ctrlKey
}if(!F.which&&F.button!==v){F.which=F.button&1?1:F.button&2?3:F.button&4?2:0
}return F
},guid:100000000,proxy:AF.proxy,special:{ready:{setup:AF.bindReady,teardown:AF.noop},live:{add:function(A){AF.event.add(this,A.origType,AF.extend({},A,{handler:AE}))
},remove:function(F){var A=true,G=F.origType.replace(AW,"");
AF.each(AF.data(this,"events").live||[],function(){if(G===this.origType.replace(AW,"")){return A=false
}});
A&&AF.event.remove(this,F.origType,AE)
}},beforeunload:{setup:function(F,A,G){if(this.setInterval){this.onbeforeunload=G
}return false
},teardown:function(F,A){if(this.onbeforeunload===A){this.onbeforeunload=null
}}}}};
var Af=x.removeEventListener?function(F,A,G){F.removeEventListener(A,G,false)
}:function(F,A,G){F.detachEvent("on"+A,G)
};
AF.Event=function(A){if(!this.preventDefault){return new AF.Event(A)
}if(A&&A.type){this.originalEvent=A;
this.type=A.type
}else{this.type=A
}this.timeStamp=Ae();
this[Ag]=true
};
AF.Event.prototype={preventDefault:function(){this.isDefaultPrevented=AK;
var A=this.originalEvent;
if(A){A.preventDefault&&A.preventDefault();
A.returnValue=false
}},stopPropagation:function(){this.isPropagationStopped=AK;
var A=this.originalEvent;
if(A){A.stopPropagation&&A.stopPropagation();
A.cancelBubble=true
}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=AK;
this.stopPropagation()
},isDefaultPrevented:AM,isPropagationStopped:AM,isImmediatePropagationStopped:AM};
var AC=function(F){var A=F.relatedTarget;
try{for(;
A&&A!==this;
){A=A.parentNode
}if(A!==this){F.type=F.data;
AF.event.handle.apply(this,arguments)
}}catch(G){}},m=function(A){A.type=A.data;
AF.event.handle.apply(this,arguments)
};
AF.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(F,A){AF.event.special[F]={setup:function(G){AF.event.add(this,A,G&&G.selector?m:AC,F)
},teardown:function(G){AF.event.remove(this,A,G&&G.selector?m:AC)
}}
});
if(!AF.support.submitBubbles){AF.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!=="form"){AF.event.add(this,"click.specialSubmit",function(F){var A=F.target,G=A.type;
if((G==="submit"||G==="image")&&AF(A).closest("form").length){return Aj("submit",this,arguments)
}});
AF.event.add(this,"keypress.specialSubmit",function(F){var A=F.target,G=A.type;
if((G==="text"||G==="password")&&AF(A).closest("form").length&&F.keyCode===13){return Aj("submit",this,arguments)
}})
}else{return false
}},teardown:function(){AF.event.remove(this,".specialSubmit")
}}
}if(!AF.support.changeBubbles){var j=/textarea|input|select/i,I,U=function(F){var A=F.type,G=F.value;
if(A==="radio"||A==="checkbox"){G=F.checked
}else{if(A==="select-multiple"){G=F.selectedIndex>-1?AF.map(F.options,function(J){return J.selected
}).join("-"):""
}else{if(F.nodeName.toLowerCase()==="select"){G=F.selectedIndex
}}}return G
},BA=function(F,A){var K=F.target,G,J;
if(!(!j.test(K.nodeName)||K.readOnly)){G=AF.data(K,"_change_data");
J=U(K);
if(F.type!=="focusout"||K.type!=="radio"){AF.data(K,"_change_data",J)
}if(!(G===v||J===G)){if(G!=null||J){F.type="change";
return AF.event.trigger(F,A,K)
}}}};
AF.event.special.change={filters:{focusout:BA,click:function(F){var A=F.target,G=A.type;
if(G==="radio"||G==="checkbox"||A.nodeName.toLowerCase()==="select"){return BA.call(this,F)
}},keydown:function(F){var A=F.target,G=A.type;
if(F.keyCode===13&&A.nodeName.toLowerCase()!=="textarea"||F.keyCode===32&&(G==="checkbox"||G==="radio")||G==="select-multiple"){return BA.call(this,F)
}},beforeactivate:function(A){A=A.target;
AF.data(A,"_change_data",U(A))
}},setup:function(){if(this.type==="file"){return false
}for(var A in I){AF.event.add(this,A+".specialChange",I[A])
}return j.test(this.nodeName)
},teardown:function(){AF.event.remove(this,".specialChange");
return j.test(this.nodeName)
}};
I=AF.event.special.change.filters
}x.addEventListener&&AF.each({focus:"focusin",blur:"focusout"},function(F,A){function G(J){J=AF.event.fix(J);
J.type=A;
return AF.event.handle.call(this,J)
}AF.event.special[A]={setup:function(){this.addEventListener(F,G,true)
},teardown:function(){this.removeEventListener(F,G,true)
}}
});
AF.each(["bind","one"],function(F,A){AF.fn[A]=function(O,K,L){if(typeof O==="object"){for(var G in O){this[A](G,K,O[G],L)
}return this
}if(AF.isFunction(K)){L=K;
K=v
}var J=A==="one"?AF.proxy(L,function(P){AF(this).unbind(P,J);
return L.apply(this,arguments)
}):L;
if(O==="unload"&&A!=="one"){this.one(O,K,L)
}else{G=0;
for(var N=this.length;
G<N;
G++){AF.event.add(this[G],O,J,K)
}}return this
}
});
AF.fn.extend({unbind:function(F,A){if(typeof F==="object"&&!F.preventDefault){for(var J in F){this.unbind(J,F[J])
}}else{J=0;
for(var G=this.length;
J<G;
J++){AF.event.remove(this[J],F,A)
}}return this
},delegate:function(F,A,J,G){return this.live(A,J,G,F)
},undelegate:function(F,A,G){return arguments.length===0?this.unbind("live"):this.die(A,null,G,F)
},trigger:function(F,A){return this.each(function(){AF.event.trigger(F,A,this)
})
},triggerHandler:function(F,A){if(this[0]){F=AF.Event(F);
F.preventDefault();
F.stopPropagation();
AF.event.trigger(F,A,this[0]);
return F.result
}},toggle:function(F){for(var A=arguments,G=1;
G<A.length;
){AF.proxy(F,A[G++])
}return this.click(AF.proxy(F,function(J){var K=(AF.data(this,"lastToggle"+F.guid)||0)%G;
AF.data(this,"lastToggle"+F.guid,K+1);
J.preventDefault();
return A[K].apply(this,arguments)||false
}))
},hover:function(F,A){return this.mouseenter(F).mouseleave(A||F)
}});
var BE={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};
AF.each(["live","die"],function(F,A){AF.fn[A]=function(R,P,Q,N){var O,J=0,L,K,G=N||this.selector,T=N?this:AF(this.context);
if(AF.isFunction(P)){Q=P;
P=v
}for(R=(R||"").split(" ");
(O=R[J++])!=null;
){N=AW.exec(O);
L="";
if(N){L=N[0];
O=O.replace(AW,"")
}if(O==="hover"){R.push("mouseenter"+L,"mouseleave"+L)
}else{K=O;
if(O==="focus"||O==="blur"){R.push(BE[O]+L);
O+=L
}else{O=(BE[O]||O)+L
}A==="live"?T.each(function(){AF.event.add(this,o(O,G),{data:P,selector:G,handler:Q,origType:O,origHandler:Q,preType:K})
}):T.unbind(o(O,G),Q)
}}return this
}
});
AF.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(F,A){AF.fn[A]=function(G){return G?this.bind(A,G):this.trigger(A)
};
if(AF.attrFn){AF.attrFn[A]=true
}});
An.attachEvent&&!An.addEventListener&&An.attachEvent("onunload",function(){for(var F in AF.cache){if(AF.cache[F].handle){try{AF.event.remove(AF.cache[F].handle.elem)
}catch(A){}}}});
(function(){function Z(Ab){for(var Aa="",w,s=0;
Ab[s];
s++){w=Ab[s];
if(w.nodeType===3||w.nodeType===4){Aa+=w.nodeValue
}else{if(w.nodeType!==8){Aa+=Z(w.childNodes)
}}}return Aa
}function Y(BJ,BI,Ab,Aa,s,w){s=0;
for(var BL=Aa.length;
s<BL;
s++){var BM=Aa[s];
if(BM){BM=BM[BJ];
for(var BK=false;
BM;
){if(BM.sizcache===Ab){BK=Aa[BM.sizset];
break
}if(BM.nodeType===1&&!w){BM.sizcache=Ab;
BM.sizset=s
}if(BM.nodeName.toLowerCase()===BI){BK=BM;
break
}BM=BM[BJ]
}Aa[s]=BK
}}}function X(BJ,BI,Ab,Aa,s,w){s=0;
for(var BL=Aa.length;
s<BL;
s++){var BM=Aa[s];
if(BM){BM=BM[BJ];
for(var BK=false;
BM;
){if(BM.sizcache===Ab){BK=Aa[BM.sizset];
break
}if(BM.nodeType===1){if(!w){BM.sizcache=Ab;
BM.sizset=s
}if(typeof BI!=="string"){if(BM===BI){BK=true;
break
}}else{if(Q.filter(BI,[BM]).length>0){BK=BM;
break
}}}BM=BM[BJ]
}Aa[s]=BK
}}}var V=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,W=0,R=Object.prototype.toString,T=false,O=true;
[0,0].sort(function(){O=false;
return 0
});
var Q=function(BL,BK,BI,Ab){BI=BI||[];
var w=BK=BK||x;
if(BK.nodeType!==1&&BK.nodeType!==9){return[]
}if(!BL||typeof BL!=="string"){return BI
}for(var Aa=[],BQ,BR,BN,BJ,BP=true,BM=F(BK),BO=BL;
(V.exec(""),BQ=V.exec(BO))!==null;
){BO=BQ[3];
Aa.push(BQ[1]);
if(BQ[2]){BJ=BQ[3];
break
}}if(Aa.length>1&&L.exec(BL)){if(Aa.length===2&&P.relative[Aa[0]]){BR=c(Aa[0]+Aa[1],BK)
}else{for(BR=P.relative[Aa[0]]?[BK]:Q(Aa.shift(),BK);
Aa.length;
){BL=Aa.shift();
if(P.relative[BL]){BL+=Aa.shift()
}BR=c(BL,BR)
}}}else{if(!Ab&&Aa.length>1&&BK.nodeType===9&&!BM&&P.match.ID.test(Aa[0])&&!P.match.ID.test(Aa[Aa.length-1])){BQ=Q.find(Aa.shift(),BK,BM);
BK=BQ.expr?Q.filter(BQ.expr,BQ.set)[0]:BQ.set[0]
}if(BK){BQ=Ab?{expr:Aa.pop(),set:A(Ab)}:Q.find(Aa.pop(),Aa.length===1&&(Aa[0]==="~"||Aa[0]==="+")&&BK.parentNode?BK.parentNode:BK,BM);
BR=BQ.expr?Q.filter(BQ.expr,BQ.set):BQ.set;
if(Aa.length>0){BN=A(BR)
}else{BP=false
}for(;
Aa.length;
){var s=Aa.pop();
BQ=s;
if(P.relative[s]){BQ=Aa.pop()
}else{s=""
}if(BQ==null){BQ=BK
}P.relative[s](BN,BQ,BM)
}}else{BN=[]
}}BN||(BN=BR);
BN||Q.error(s||BL);
if(R.call(BN)==="[object Array]"){if(BP){if(BK&&BK.nodeType===1){for(BL=0;
BN[BL]!=null;
BL++){if(BN[BL]&&(BN[BL]===true||BN[BL].nodeType===1&&J(BK,BN[BL]))){BI.push(BR[BL])
}}}else{for(BL=0;
BN[BL]!=null;
BL++){BN[BL]&&BN[BL].nodeType===1&&BI.push(BR[BL])
}}}else{BI.push.apply(BI,BN)
}}else{A(BN,BI)
}if(BJ){Q(BJ,w,BI,Ab);
Q.uniqueSort(BI)
}return BI
};
Q.uniqueSort=function(w){if(N){T=O;
w.sort(N);
if(T){for(var s=1;
s<w.length;
s++){w[s]===w[s-1]&&w.splice(s--,1)
}}}return w
};
Q.matches=function(w,s){return Q(w,null,null,s)
};
Q.find=function(BJ,BI,Ab){var Aa,s;
if(!BJ){return[]
}for(var w=0,BL=P.order.length;
w<BL;
w++){var BM=P.order[w];
if(s=P.leftMatch[BM].exec(BJ)){var BK=s[1];
s.splice(1,1);
if(BK.substr(BK.length-1)!=="\\"){s[1]=(s[1]||"").replace(/\\/g,"");
Aa=P.find[BM](s,BI,Ab);
if(Aa!=null){BJ=BJ.replace(P.match[BM],"");
break
}}}}Aa||(Aa=BI.getElementsByTagName("*"));
return{set:Aa,expr:BJ}
};
Q.filter=function(BM,BL,BJ,Ab){for(var w=BM,Aa=[],BS=BL,BT,BP,BK=BL&&BL[0]&&F(BL[0]);
BM&&BL.length;
){for(var BR in P.filter){if((BT=P.leftMatch[BR].exec(BM))!=null&&BT[2]){var BN=P.filter[BR],BQ,s;
s=BT[1];
BP=false;
BT.splice(1,1);
if(s.substr(s.length-1)!=="\\"){if(BS===Aa){Aa=[]
}if(P.preFilter[BR]){if(BT=P.preFilter[BR](BT,BS,BJ,Aa,Ab,BK)){if(BT===true){continue
}}else{BP=BQ=true
}}if(BT){for(var BI=0;
(s=BS[BI])!=null;
BI++){if(s){BQ=BN(s,BT,BI,BS);
var BO=Ab^!!BQ;
if(BJ&&BQ!=null){if(BO){BP=true
}else{BS[BI]=false
}}else{if(BO){Aa.push(s);
BP=true
}}}}}if(BQ!==v){BJ||(BS=Aa);
BM=BM.replace(P.match[BR],"");
if(!BP){return[]
}break
}}}}if(BM===w){if(BP==null){Q.error(BM)
}else{break
}}w=BM
}return BS
};
Q.error=function(s){throw"Syntax error, unrecognized expression: "+s
};
var P=Q.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(s){return s.getAttribute("href")
}},relative:{"+":function(Ab,Aa){var w=typeof Aa==="string",s=w&&!/\W/.test(Aa);
w=w&&!s;
if(s){Aa=Aa.toLowerCase()
}s=0;
for(var BI=Ab.length,BJ;
s<BI;
s++){if(BJ=Ab[s]){for(;
(BJ=BJ.previousSibling)&&BJ.nodeType!==1;
){}Ab[s]=w||BJ&&BJ.nodeName.toLowerCase()===Aa?BJ||false:BJ===Aa
}}w&&Q.filter(Aa,Ab,true)
},">":function(Ab,Aa){var w=typeof Aa==="string";
if(w&&!/\W/.test(Aa)){Aa=Aa.toLowerCase();
for(var s=0,BI=Ab.length;
s<BI;
s++){var BJ=Ab[s];
if(BJ){w=BJ.parentNode;
Ab[s]=w.nodeName.toLowerCase()===Aa?w:false
}}}else{s=0;
for(BI=Ab.length;
s<BI;
s++){if(BJ=Ab[s]){Ab[s]=w?BJ.parentNode:BJ.parentNode===Aa
}}w&&Q.filter(Aa,Ab,true)
}},"":function(Ab,Aa,w){var s=W++,BI=X;
if(typeof Aa==="string"&&!/\W/.test(Aa)){var BJ=Aa=Aa.toLowerCase();
BI=Y
}BI("parentNode",Aa,s,Ab,BJ,w)
},"~":function(Ab,Aa,w){var s=W++,BI=X;
if(typeof Aa==="string"&&!/\W/.test(Aa)){var BJ=Aa=Aa.toLowerCase();
BI=Y
}BI("previousSibling",Aa,s,Ab,BJ,w)
}},find:{ID:function(Aa,w,s){if(typeof w.getElementById!=="undefined"&&!s){return(Aa=w.getElementById(Aa[1]))?[Aa]:[]
}},NAME:function(Ab,Aa){if(typeof Aa.getElementsByName!=="undefined"){var w=[];
Aa=Aa.getElementsByName(Ab[1]);
for(var s=0,BI=Aa.length;
s<BI;
s++){Aa[s].getAttribute("name")===Ab[1]&&w.push(Aa[s])
}return w.length===0?null:w
}},TAG:function(w,s){return s.getElementsByTagName(w[1])
}},preFilter:{CLASS:function(BI,Ab,w,s,BJ,BK){BI=" "+BI[1].replace(/\\/g,"")+" ";
if(BK){return BI
}BK=0;
for(var Aa;
(Aa=Ab[BK])!=null;
BK++){if(Aa){if(BJ^(Aa.className&&(" "+Aa.className+" ").replace(/[\t\n]/g," ").indexOf(BI)>=0)){w||s.push(Aa)
}else{if(w){Ab[BK]=false
}}}}return false
},ID:function(s){return s[1].replace(/\\/g,"")
},TAG:function(s){return s[1].toLowerCase()
},CHILD:function(w){if(w[1]==="nth"){var s=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(w[2]==="even"&&"2n"||w[2]==="odd"&&"2n+1"||!/\D/.test(w[2])&&"0n+"+w[2]||w[2]);
w[2]=s[1]+(s[2]||1)-0;
w[3]=s[3]-0
}w[0]=W++;
return w
},ATTR:function(Ab,Aa,w,s,BI,BJ){Aa=Ab[1].replace(/\\/g,"");
if(!BJ&&P.attrMap[Aa]){Ab[1]=P.attrMap[Aa]
}if(Ab[2]==="~="){Ab[4]=" "+Ab[4]+" "
}return Ab
},PSEUDO:function(Ab,Aa,w,s,BI){if(Ab[1]==="not"){if((V.exec(Ab[3])||"").length>1||/^\w/.test(Ab[3])){Ab[3]=Q(Ab[3],null,null,Aa)
}else{Ab=Q.filter(Ab[3],Aa,w,true^BI);
w||s.push.apply(s,Ab);
return false
}}else{if(P.match.POS.test(Ab[0])||P.match.CHILD.test(Ab[0])){return true
}}return Ab
},POS:function(s){s.unshift(true);
return s
}},filters:{enabled:function(s){return s.disabled===false&&s.type!=="hidden"
},disabled:function(s){return s.disabled===true
},checked:function(s){return s.checked===true
},selected:function(s){return s.selected===true
},parent:function(s){return !!s.firstChild
},empty:function(s){return !s.firstChild
},has:function(Aa,w,s){return !!Q(s[3],Aa).length
},header:function(s){return/h\d/i.test(s.nodeName)
},text:function(s){return"text"===s.type
},radio:function(s){return"radio"===s.type
},checkbox:function(s){return"checkbox"===s.type
},file:function(s){return"file"===s.type
},password:function(s){return"password"===s.type
},submit:function(s){return"submit"===s.type
},image:function(s){return"image"===s.type
},reset:function(s){return"reset"===s.type
},button:function(s){return"button"===s.type||s.nodeName.toLowerCase()==="button"
},input:function(s){return/input|select|textarea|button/i.test(s.nodeName)
}},setFilters:{first:function(w,s){return s===0
},last:function(Ab,Aa,w,s){return Aa===s.length-1
},even:function(w,s){return s%2===0
},odd:function(w,s){return s%2===1
},lt:function(Aa,w,s){return w<s[3]-0
},gt:function(Aa,w,s){return w>s[3]-0
},nth:function(Aa,w,s){return s[3]-0===w
},eq:function(Aa,w,s){return s[3]-0===w
}},filter:{PSEUDO:function(Ab,Aa,w,s){var BI=Aa[1],BJ=P.filters[BI];
if(BJ){return BJ(Ab,w,Aa,s)
}else{if(BI==="contains"){return(Ab.textContent||Ab.innerText||Z([Ab])||"").indexOf(Aa[3])>=0
}else{if(BI==="not"){Aa=Aa[3];
w=0;
for(s=Aa.length;
w<s;
w++){if(Aa[w]===Ab){return false
}}return true
}else{Q.error("Syntax error, unrecognized expression: "+BI)
}}}},CHILD:function(BI,Ab){var w=Ab[1],s=BI;
switch(w){case"only":case"first":for(;
s=s.previousSibling;
){if(s.nodeType===1){return false
}}if(w==="first"){return true
}s=BI;
case"last":for(;
s=s.nextSibling;
){if(s.nodeType===1){return false
}}return true;
case"nth":w=Ab[2];
var BJ=Ab[3];
if(w===1&&BJ===0){return true
}Ab=Ab[0];
var BK=BI.parentNode;
if(BK&&(BK.sizcache!==Ab||!BI.nodeIndex)){var Aa=0;
for(s=BK.firstChild;
s;
s=s.nextSibling){if(s.nodeType===1){s.nodeIndex=++Aa
}}BK.sizcache=Ab
}BI=BI.nodeIndex-BJ;
return w===0?BI===0:BI%w===0&&BI/w>=0
}},ID:function(w,s){return w.nodeType===1&&w.getAttribute("id")===s
},TAG:function(w,s){return s==="*"&&w.nodeType===1||w.nodeName.toLowerCase()===s
},CLASS:function(w,s){return(" "+(w.className||w.getAttribute("class"))+" ").indexOf(s)>-1
},ATTR:function(Ab,Aa){var w=Aa[1];
Ab=P.attrHandle[w]?P.attrHandle[w](Ab):Ab[w]!=null?Ab[w]:Ab.getAttribute(w);
w=Ab+"";
var s=Aa[2];
Aa=Aa[4];
return Ab==null?s==="!=":s==="="?w===Aa:s==="*="?w.indexOf(Aa)>=0:s==="~="?(" "+w+" ").indexOf(Aa)>=0:!Aa?w&&Ab!==false:s==="!="?w!==Aa:s==="^="?w.indexOf(Aa)===0:s==="$="?w.substr(w.length-Aa.length)===Aa:s==="|="?w===Aa||w.substr(0,Aa.length+1)===Aa+"-":false
},POS:function(Ab,Aa,w,s){var BI=P.setFilters[Aa[2]];
if(BI){return BI(Ab,w,Aa,s)
}}}},L=P.match.POS;
for(var G in P.match){P.match[G]=new RegExp(P.match[G].source+/(?![^\[]*\])(?![^\(]*\))/.source);
P.leftMatch[G]=new RegExp(/(^(?:.|\r|\n)*?)/.source+P.match[G].source.replace(/\\(\d+)/g,function(w,s){return"\\"+(s-0+1)
}))
}var A=function(w,s){w=Array.prototype.slice.call(w,0);
if(s){s.push.apply(s,w);
return s
}return w
};
try{Array.prototype.slice.call(x.documentElement.childNodes,0)
}catch(K){A=function(Ab,Aa){Aa=Aa||[];
if(R.call(Ab)==="[object Array]"){Array.prototype.push.apply(Aa,Ab)
}else{if(typeof Ab.length==="number"){for(var w=0,s=Ab.length;
w<s;
w++){Aa.push(Ab[w])
}}else{for(w=0;
Ab[w];
w++){Aa.push(Ab[w])
}}}return Aa
}
}var N;
if(x.documentElement.compareDocumentPosition){N=function(w,s){if(!w.compareDocumentPosition||!s.compareDocumentPosition){if(w==s){T=true
}return w.compareDocumentPosition?-1:1
}w=w.compareDocumentPosition(s)&4?-1:w===s?0:1;
if(w===0){T=true
}return w
}
}else{if("sourceIndex" in x.documentElement){N=function(w,s){if(!w.sourceIndex||!s.sourceIndex){if(w==s){T=true
}return w.sourceIndex?-1:1
}w=w.sourceIndex-s.sourceIndex;
if(w===0){T=true
}return w
}
}else{if(x.createRange){N=function(Ab,Aa){if(!Ab.ownerDocument||!Aa.ownerDocument){if(Ab==Aa){T=true
}return Ab.ownerDocument?-1:1
}var w=Ab.ownerDocument.createRange(),s=Aa.ownerDocument.createRange();
w.setStart(Ab,0);
w.setEnd(Ab,0);
s.setStart(Aa,0);
s.setEnd(Aa,0);
Ab=w.compareBoundaryPoints(Range.START_TO_END,s);
if(Ab===0){T=true
}return Ab
}
}}}(function(){var Aa=x.createElement("div"),w="script"+(new Date).getTime();
Aa.innerHTML="<a name='"+w+"'/>";
var s=x.documentElement;
s.insertBefore(Aa,s.firstChild);
if(x.getElementById(w)){P.find.ID=function(Ab,BI,BJ){if(typeof BI.getElementById!=="undefined"&&!BJ){return(BI=BI.getElementById(Ab[1]))?BI.id===Ab[1]||typeof BI.getAttributeNode!=="undefined"&&BI.getAttributeNode("id").nodeValue===Ab[1]?[BI]:v:[]
}};
P.filter.ID=function(Ab,BI){var BJ=typeof Ab.getAttributeNode!=="undefined"&&Ab.getAttributeNode("id");
return Ab.nodeType===1&&BJ&&BJ.nodeValue===BI
}
}s.removeChild(Aa);
s=Aa=null
})();
(function(){var s=x.createElement("div");
s.appendChild(x.createComment(""));
if(s.getElementsByTagName("*").length>0){P.find.TAG=function(Ab,Aa){Aa=Aa.getElementsByTagName(Ab[1]);
if(Ab[1]==="*"){Ab=[];
for(var w=0;
Aa[w];
w++){Aa[w].nodeType===1&&Ab.push(Aa[w])
}Aa=Ab
}return Aa
}
}s.innerHTML="<a href='#'></a>";
if(s.firstChild&&typeof s.firstChild.getAttribute!=="undefined"&&s.firstChild.getAttribute("href")!=="#"){P.attrHandle.href=function(w){return w.getAttribute("href",2)
}
}s=null
})();
x.querySelectorAll&&function(){var Aa=Q,w=x.createElement("div");
w.innerHTML="<p class='TEST'></p>";
if(!(w.querySelectorAll&&w.querySelectorAll(".TEST").length===0)){Q=function(Ab,BK,BL,BI){BK=BK||x;
if(!BI&&BK.nodeType===9&&!F(BK)){try{return A(BK.querySelectorAll(Ab),BL)
}catch(BJ){}}return Aa(Ab,BK,BL,BI)
};
for(var s in Aa){Q[s]=Aa[s]
}w=null
}}();
(function(){var s=x.createElement("div");
s.innerHTML="<div class='test e'></div><div class='test'></div>";
if(!(!s.getElementsByClassName||s.getElementsByClassName("e").length===0)){s.lastChild.className="e";
if(s.getElementsByClassName("e").length!==1){P.order.splice(1,0,"CLASS");
P.find.CLASS=function(Ab,Aa,w){if(typeof Aa.getElementsByClassName!=="undefined"&&!w){return Aa.getElementsByClassName(Ab[1])
}};
s=null
}}})();
var J=x.compareDocumentPosition?function(w,s){return !!(w.compareDocumentPosition(s)&16)
}:function(w,s){return w!==s&&(w.contains?w.contains(s):true)
},F=function(s){return(s=(s?s.ownerDocument||s:0).documentElement)?s.nodeName!=="HTML":false
},c=function(Ab,Aa){var w=[],s="",BI;
for(Aa=Aa.nodeType?[Aa]:Aa;
BI=P.match.PSEUDO.exec(Ab);
){s+=BI[0];
Ab=Ab.replace(P.match.PSEUDO,"")
}Ab=P.relative[Ab]?Ab+"*":Ab;
BI=0;
for(var BJ=Aa.length;
BI<BJ;
BI++){Q(Ab,Aa[BI],w)
}return Q.filter(s,w)
};
AF.find=Q;
AF.expr=Q.selectors;
AF.expr[":"]=AF.expr.filters;
AF.unique=Q.uniqueSort;
AF.text=Z;
AF.isXMLDoc=F;
AF.contains=J
})();
var H=/Until$/,A8=/^(?:parents|prevUntil|prevAll)/,Av=/,/;
AR=Array.prototype.slice;
var Ak=function(F,A,J){if(AF.isFunction(A)){return AF.grep(F,function(L,K){return !!A.call(L,K,L)===J
})
}else{if(A.nodeType){return AF.grep(F,function(K){return K===A===J
})
}else{if(typeof A==="string"){var G=AF.grep(F,function(K){return K.nodeType===1
});
if(As.test(A)){return AF.filter(A,G,!J)
}else{A=AF.filter(A,G)
}}}}return AF.grep(F,function(K){return AF.inArray(K,A)>=0===J
})
};
AF.fn.extend({find:function(F){for(var A=this.pushStack("","find",F),N=0,K=0,L=this.length;
K<L;
K++){N=A.length;
AF.find(F,this[K],A);
if(K>0){for(var G=N;
G<A.length;
G++){for(var J=0;
J<N;
J++){if(A[J]===A[G]){A.splice(G--,1);
break
}}}}}return A
},has:function(F){var A=AF(F);
return this.filter(function(){for(var J=0,G=A.length;
J<G;
J++){if(AF.contains(this,A[J])){return true
}}})
},not:function(A){return this.pushStack(Ak(this,A,false),"not",A)
},filter:function(A){return this.pushStack(Ak(this,A,true),"filter",A)
},is:function(A){return !!A&&AF.filter(A,this).length>0
},closest:function(P,O){if(AF.isArray(P)){var N=[],K=this[0],L,G={},J;
if(K&&P.length){L=0;
for(var A=P.length;
L<A;
L++){J=P[L];
G[J]||(G[J]=AF.expr.match.POS.test(J)?AF(J,O||this.context):J)
}for(;
K&&K.ownerDocument&&K!==O;
){for(J in G){L=G[J];
if(L.jquery?L.index(K)>-1:AF(K).is(L)){N.push({selector:J,elem:K});
delete G[J]
}}K=K.parentNode
}}return N
}var F=AF.expr.match.POS.test(P)?AF(P,O||this.context):null;
return this.map(function(R,Q){for(;
Q&&Q.ownerDocument&&Q!==O;
){if(F?F.index(Q)>-1:AF(Q).is(P)){return Q
}Q=Q.parentNode
}return null
})
},index:function(A){if(!A||typeof A==="string"){return AF.inArray(this[0],A?AF(A):this.parent().children())
}return AF.inArray(A.jquery?A[0]:A,this)
},add:function(F,A){F=typeof F==="string"?AF(F,A||this.context):AF.makeArray(F);
A=AF.merge(this.get(),F);
return this.pushStack(b(F[0])||b(A[0])?A:AF.unique(A))
},andSelf:function(){return this.add(this.prevObject)
}});
AF.each({parent:function(A){return(A=A.parentNode)&&A.nodeType!==11?A:null
},parents:function(A){return AF.dir(A,"parentNode")
},parentsUntil:function(F,A,G){return AF.dir(F,"parentNode",G)
},next:function(A){return AF.nth(A,2,"nextSibling")
},prev:function(A){return AF.nth(A,2,"previousSibling")
},nextAll:function(A){return AF.dir(A,"nextSibling")
},prevAll:function(A){return AF.dir(A,"previousSibling")
},nextUntil:function(F,A,G){return AF.dir(F,"nextSibling",G)
},prevUntil:function(F,A,G){return AF.dir(F,"previousSibling",G)
},siblings:function(A){return AF.sibling(A.parentNode.firstChild,A)
},children:function(A){return AF.sibling(A.firstChild)
},contents:function(A){return AF.nodeName(A,"iframe")?A.contentDocument||A.contentWindow.document:AF.makeArray(A.childNodes)
}},function(F,A){AF.fn[F]=function(K,G){var J=AF.map(this,A,K);
H.test(F)||(G=K);
if(G&&typeof G==="string"){J=AF.filter(G,J)
}J=this.length>1?AF.unique(J):J;
if((this.length>1||Av.test(G))&&A8.test(F)){J=J.reverse()
}return this.pushStack(J,F,AR.call(arguments).join(","))
}
});
AF.extend({filter:function(F,A,G){if(G){F=":not("+F+")"
}return AF.find.matches(F,A)
},dir:function(F,A,J){var G=[];
for(F=F[A];
F&&F.nodeType!==9&&(J===v||F.nodeType!==1||!AF(F).is(J));
){F.nodeType===1&&G.push(F);
F=F[A]
}return G
},nth:function(F,A,J){A=A||1;
for(var G=0;
F;
F=F[J]){if(F.nodeType===1&&++G===A){break
}}return F
},sibling:function(F,A){for(var G=[];
F;
F=F.nextSibling){F.nodeType===1&&F!==A&&G.push(F)
}return G
}});
var AG=/ jQuery\d+="(?:\d+|null)"/g,AP=/^\s+/,p=/(<([\w:]+)[^>]*?)\/>/g,Ac=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,d=/<([\w:]+)/,AA=/<tbody/i,k=/<|&#?\w+;/,Ao=/<script|<object|<embed|<option|<style/i,AI=/checked\s*(?:[^=]|=\s*.checked.)/i,BH=function(F,A,G){return Ac.test(G)?F:A+"></"+G+">"
},Ai={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};
Ai.optgroup=Ai.option;
Ai.tbody=Ai.tfoot=Ai.colgroup=Ai.caption=Ai.thead;
Ai.th=Ai.td;
if(!AF.support.htmlSerialize){Ai._default=[1,"div<div>","</div>"]
}AF.fn.extend({text:function(A){if(AF.isFunction(A)){return this.each(function(F){var G=AF(this);
G.text(A.call(this,F,G.text()))
})
}if(typeof A!=="object"&&A!==v){return this.empty().append((this[0]&&this[0].ownerDocument||x).createTextNode(A))
}return AF.text(this)
},wrapAll:function(F){if(AF.isFunction(F)){return this.each(function(G){AF(this).wrapAll(F.call(this,G))
})
}if(this[0]){var A=AF(F,this[0].ownerDocument).eq(0).clone(true);
this[0].parentNode&&A.insertBefore(this[0]);
A.map(function(){for(var G=this;
G.firstChild&&G.firstChild.nodeType===1;
){G=G.firstChild
}return G
}).append(this)
}return this
},wrapInner:function(A){if(AF.isFunction(A)){return this.each(function(F){AF(this).wrapInner(A.call(this,F))
})
}return this.each(function(){var F=AF(this),G=F.contents();
G.length?G.wrapAll(A):F.append(A)
})
},wrap:function(A){return this.each(function(){AF(this).wrapAll(A)
})
},unwrap:function(){return this.parent().each(function(){AF.nodeName(this,"body")||AF(this).replaceWith(this.childNodes)
}).end()
},append:function(){return this.domManip(arguments,true,function(A){this.nodeType===1&&this.appendChild(A)
})
},prepend:function(){return this.domManip(arguments,true,function(A){this.nodeType===1&&this.insertBefore(A,this.firstChild)
})
},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(F){this.parentNode.insertBefore(F,this)
})
}else{if(arguments.length){var A=AF(arguments[0]);
A.push.apply(A,this.toArray());
return this.pushStack(A,"before",arguments)
}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(F){this.parentNode.insertBefore(F,this.nextSibling)
})
}else{if(arguments.length){var A=this.pushStack(this,"after",arguments);
A.push.apply(A,AF(arguments[0]).toArray());
return A
}}},remove:function(F,A){for(var J=0,G;
(G=this[J])!=null;
J++){if(!F||AF.filter(F,[G]).length){if(!A&&G.nodeType===1){AF.cleanData(G.getElementsByTagName("*"));
AF.cleanData([G])
}G.parentNode&&G.parentNode.removeChild(G)
}}return this
},empty:function(){for(var F=0,A;
(A=this[F])!=null;
F++){for(A.nodeType===1&&AF.cleanData(A.getElementsByTagName("*"));
A.firstChild;
){A.removeChild(A.firstChild)
}}return this
},clone:function(F){var A=this.map(function(){if(!AF.support.noCloneEvent&&!AF.isXMLDoc(this)){var J=this.outerHTML,G=this.ownerDocument;
if(!J){J=G.createElement("div");
J.appendChild(this.cloneNode(true));
J=J.innerHTML
}return AF.clean([J.replace(AG,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(AP,"")],G)[0]
}else{return this.cloneNode(true)
}});
if(F===true){BG(this,A);
BG(this.find("*"),A.find("*"))
}return A
},html:function(F){if(F===v){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(AG,""):null
}else{if(typeof F==="string"&&!Ao.test(F)&&(AF.support.leadingWhitespace||!AP.test(F))&&!Ai[(d.exec(F)||["",""])[1].toLowerCase()]){F=F.replace(p,BH);
try{for(var A=0,J=this.length;
A<J;
A++){if(this[A].nodeType===1){AF.cleanData(this[A].getElementsByTagName("*"));
this[A].innerHTML=F
}}}catch(G){this.empty().append(F)
}}else{AF.isFunction(F)?this.each(function(N){var K=AF(this),L=K.html();
K.empty().append(function(){return F.call(this,N,L)
})
}):this.empty().append(F)
}}return this
},replaceWith:function(A){if(this[0]&&this[0].parentNode){if(AF.isFunction(A)){return this.each(function(F){var J=AF(this),G=J.html();
J.replaceWith(A.call(this,F,G))
})
}if(typeof A!=="string"){A=AF(A).detach()
}return this.each(function(){var F=this.nextSibling,G=this.parentNode;
AF(this).remove();
F?AF(F).before(A):AF(G).append(A)
})
}else{return this.pushStack(AF(AF.isFunction(A)?A():A),"replaceWith",A)
}},detach:function(A){return this.remove(A,true)
},domManip:function(R,Q,P){function N(T){return AF.nodeName(T,"table")?T.getElementsByTagName("tbody")[0]||T.appendChild(T.ownerDocument.createElement("tbody")):T
}var O,K,L=R[0],F=[],J;
if(!AF.support.checkClone&&arguments.length===3&&typeof L==="string"&&AI.test(L)){return this.each(function(){AF(this).domManip(R,Q,P,true)
})
}if(AF.isFunction(L)){return this.each(function(T){var V=AF(this);
R[0]=L.call(this,T,Q?V.html():v);
V.domManip(R,Q,P)
})
}if(this[0]){O=L&&L.parentNode;
O=AF.support.parentNode&&O&&O.nodeType===11&&O.childNodes.length===this.length?{fragment:O}:A2(R,this,F);
J=O.fragment;
if(K=J.childNodes.length===1?(J=J.firstChild):J.firstChild){Q=Q&&AF.nodeName(K,"tr");
for(var G=0,A=this.length;
G<A;
G++){P.call(Q?N(this[G],K):this[G],G>0||O.cacheable||this.length>1?J.cloneNode(true):J)
}}F.length&&AF.each(F,t)
}return this
}});
AF.fragments={};
AF.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(F,A){AF.fn[F]=function(N){var K=[];
N=AF(N);
var L=this.length===1&&this[0].parentNode;
if(L&&L.nodeType===11&&L.childNodes.length===1&&N.length===1){N[A](this[0]);
return this
}else{L=0;
for(var G=N.length;
L<G;
L++){var J=(L>0?this.clone(true):this).get();
AF.fn[A].apply(AF(N[L]),J);
K=K.concat(J)
}return this.pushStack(K,F,N.selector)
}}
});
AF.extend({clean:function(R,Q,P,N){Q=Q||x;
if(typeof Q.createElement==="undefined"){Q=Q.ownerDocument||Q[0]&&Q[0].ownerDocument||x
}for(var O=[],K=0,L;
(L=R[K])!=null;
K++){if(typeof L==="number"){L+=""
}if(L){if(typeof L==="string"&&!k.test(L)){L=Q.createTextNode(L)
}else{if(typeof L==="string"){L=L.replace(p,BH);
var F=(d.exec(L)||["",""])[1].toLowerCase(),J=Ai[F]||Ai._default,G=J[0],A=Q.createElement("div");
for(A.innerHTML=J[1]+L+J[2];
G--;
){A=A.lastChild
}if(!AF.support.tbody){G=AA.test(L);
F=F==="table"&&!G?A.firstChild&&A.firstChild.childNodes:J[1]==="<table>"&&!G?A.childNodes:[];
for(J=F.length-1;
J>=0;
--J){AF.nodeName(F[J],"tbody")&&!F[J].childNodes.length&&F[J].parentNode.removeChild(F[J])
}}!AF.support.leadingWhitespace&&AP.test(L)&&A.insertBefore(Q.createTextNode(AP.exec(L)[0]),A.firstChild);
L=A.childNodes
}}if(L.nodeType){O.push(L)
}else{O=AF.merge(O,L)
}}}if(P){for(K=0;
O[K];
K++){if(N&&AF.nodeName(O[K],"script")&&(!O[K].type||O[K].type.toLowerCase()==="text/javascript")){N.push(O[K].parentNode?O[K].parentNode.removeChild(O[K]):O[K])
}else{O[K].nodeType===1&&O.splice.apply(O,[K+1,0].concat(AF.makeArray(O[K].getElementsByTagName("script"))));
P.appendChild(O[K])
}}}return O
},cleanData:function(P){for(var O,N,K=AF.cache,L=AF.event.special,G=AF.support.deleteExpando,J=0,A;
(A=P[J])!=null;
J++){if(N=A[AF.expando]){O=K[N];
if(O.events){for(var F in O.events){L[F]?AF.event.remove(A,F):Af(A,F,O.handle)
}}if(G){delete A[AF.expando]
}else{A.removeAttribute&&A.removeAttribute(AF.expando)
}delete K[N]
}}}});
var M=/z-?index|font-?weight|opacity|zoom|line-?height/i,A3=/alpha\([^)]*\)/,Ap=/opacity=([^)]*)/,Ad=/float/i,AB=/-([a-z])/ig,BC=/([A-Z])/g,Ay=/^-?\d+(?:px)?$/i,Ah=/^-?\d/,AD={position:"absolute",visibility:"hidden",display:"block"},n=["Left","Right"],a=["Top","Bottom"],BF=x.defaultView&&x.defaultView.getComputedStyle,AJ=AF.support.cssFloat?"cssFloat":"styleFloat",l=function(F,A){return A.toUpperCase()
};
AF.fn.css=function(F,A){return AN(this,F,A,true,function(K,G,J){if(J===v){return AF.curCSS(K,G)
}if(typeof J==="number"&&!M.test(G)){J+="px"
}AF.style(K,G,J)
})
};
AF.extend({style:function(F,A,K){if(!F||F.nodeType===3||F.nodeType===8){return v
}if((A==="width"||A==="height")&&parseFloat(K)<0){K=v
}var G=F.style||F,J=K!==v;
if(!AF.support.opacity&&A==="opacity"){if(J){G.zoom=1;
A=parseInt(K,10)+""==="NaN"?"":"alpha(opacity="+K*100+")";
F=G.filter||AF.curCSS(F,"filter")||"";
G.filter=A3.test(F)?F.replace(A3,A):A
}return G.filter&&G.filter.indexOf("opacity=")>=0?parseFloat(Ap.exec(G.filter)[1])/100+"":""
}if(Ad.test(A)){A=AJ
}A=A.replace(AB,l);
if(J){G[A]=K
}return G[A]
},css:function(F,A,N,K){if(A==="width"||A==="height"){var L,G=A==="width"?n:a;
function J(){L=A==="width"?F.offsetWidth:F.offsetHeight;
K!=="border"&&AF.each(G,function(){K||(L-=parseFloat(AF.curCSS(F,"padding"+this,true))||0);
if(K==="margin"){L+=parseFloat(AF.curCSS(F,"margin"+this,true))||0
}else{L-=parseFloat(AF.curCSS(F,"border"+this+"Width",true))||0
}})
}F.offsetWidth!==0?J():AF.swap(F,AD,J);
return Math.max(0,Math.round(L))
}return AF.curCSS(F,A,N)
},curCSS:function(F,A,L){var J,K=F.style;
if(!AF.support.opacity&&A==="opacity"&&F.currentStyle){J=Ap.test(F.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";
return J===""?"1":J
}if(Ad.test(A)){A=AJ
}if(!L&&K&&K[A]){J=K[A]
}else{if(BF){if(Ad.test(A)){A="float"
}A=A.replace(BC,"-$1").toLowerCase();
K=F.ownerDocument.defaultView;
if(!K){return null
}if(F=K.getComputedStyle(F,null)){J=F.getPropertyValue(A)
}if(A==="opacity"&&J===""){J="1"
}}else{if(F.currentStyle){L=A.replace(AB,l);
J=F.currentStyle[A]||F.currentStyle[L];
if(!Ay.test(J)&&Ah.test(J)){A=K.left;
var G=F.runtimeStyle.left;
F.runtimeStyle.left=F.currentStyle.left;
K.left=L==="fontSize"?"1em":J||0;
J=K.pixelLeft+"px";
K.left=A;
F.runtimeStyle.left=G
}}}}return J
},swap:function(F,A,K){var G={};
for(var J in A){G[J]=F.style[J];
F.style[J]=A[J]
}K.call(F);
for(J in A){F.style[J]=G[J]
}}});
if(AF.expr&&AF.expr.filters){AF.expr.filters.hidden=function(F){var A=F.offsetWidth,J=F.offsetHeight,G=F.nodeName.toLowerCase()==="tr";
return A===0&&J===0&&!G?true:A>0&&J>0&&!G?false:AF.curCSS(F,"display")==="none"
};
AF.expr.filters.visible=function(A){return !AF.expr.filters.hidden(A)
}
}var A1=Ae(),Am=/<script(.|\s)*?\/script>/gi,AH=/select|textarea/i,q=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,AX=/=\?(&|$)/,S=/\?/,e=/(\?|&)_=.*?(&|$)/,B=/^(\w+:)?\/\/([^\/?#]+)/,A4=/%20/g,Aq=AF.fn.load;
AF.fn.extend({load:function(F,A,L){if(typeof F!=="string"){return Aq.call(this,F)
}else{if(!this.length){return this
}}var J=F.indexOf(" ");
if(J>=0){var K=F.slice(J,F.length);
F=F.slice(0,J)
}J="GET";
if(A){if(AF.isFunction(A)){L=A;
A=null
}else{if(typeof A==="object"){A=AF.param(A,AF.ajaxSettings.traditional);
J="POST"
}}}var G=this;
AF.ajax({url:F,type:J,dataType:"html",data:A,complete:function(N,O){if(O==="success"||O==="notmodified"){G.html(K?AF("<div />").append(N.responseText.replace(Am,"")).find(K):N.responseText)
}L&&G.each(L,[N.responseText,O,N])
}});
return this
},serialize:function(){return AF.param(this.serializeArray())
},serializeArray:function(){return this.map(function(){return this.elements?AF.makeArray(this.elements):this
}).filter(function(){return this.name&&!this.disabled&&(this.checked||AH.test(this.nodeName)||q.test(this.type))
}).map(function(F,A){F=AF(this).val();
return F==null?null:AF.isArray(F)?AF.map(F,function(G){return{name:A.name,value:G}
}):{name:A.name,value:F}
}).get()
}});
AF.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(F,A){AF.fn[A]=function(G){return this.bind(A,G)
}
});
AF.extend({get:function(F,A,J,G){if(AF.isFunction(A)){G=G||J;
J=A;
A=null
}return AF.ajax({type:"GET",url:F,data:A,success:J,dataType:G})
},getScript:function(F,A){return AF.get(F,null,A,"script")
},getJSON:function(F,A,G){return AF.get(F,A,G,"json")
},post:function(F,A,J,G){if(AF.isFunction(A)){G=G||J;
J=A;
A={}
}return AF.ajax({type:"POST",url:F,data:A,success:J,dataType:G})
},ajaxSetup:function(A){AF.extend(AF.ajaxSettings,A)
},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:An.XMLHttpRequest&&(An.location.protocol!=="file:"||!An.ActiveXObject)?function(){return new An.XMLHttpRequest
}:function(){try{return new An.ActiveXObject("Microsoft.XMLHTTP")
}catch(A){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(Aa){function w(){c.success&&c.success.call(T,O,W,F);
c.global&&Z("ajaxSuccess",[F,c])
}function s(){c.complete&&c.complete.call(T,F,W);
c.global&&Z("ajaxComplete",[F,c]);
c.global&&!--AF.active&&AF.event.trigger("ajaxStop")
}function Z(BI,BJ){(c.context?AF(c.context):AF.event).trigger(BI,BJ)
}var c=AF.extend(true,{},AF.ajaxSettings,Aa),V,W,O,T=Aa&&Aa.context||c,P=c.type.toUpperCase();
if(c.data&&c.processData&&typeof c.data!=="string"){c.data=AF.param(c.data,c.traditional)
}if(c.dataType==="jsonp"){if(P==="GET"){AX.test(c.url)||(c.url+=(S.test(c.url)?"&":"?")+(c.jsonp||"callback")+"=?")
}else{if(!c.data||!AX.test(c.data)){c.data=(c.data?c.data+"&":"")+(c.jsonp||"callback")+"=?"
}}c.dataType="json"
}if(c.dataType==="json"&&(c.data&&AX.test(c.data)||AX.test(c.url))){V=c.jsonpCallback||"jsonp"+A1++;
if(c.data){c.data=(c.data+"").replace(AX,"="+V+"$1")
}c.url=c.url.replace(AX,"="+V+"$1");
c.dataType="script";
An[V]=An[V]||function(BI){O=BI;
w();
s();
An[V]=v;
try{delete An[V]
}catch(BJ){}A&&A.removeChild(K)
}
}if(c.dataType==="script"&&c.cache===null){c.cache=false
}if(c.cache===false&&P==="GET"){var L=Ae(),G=c.url.replace(e,"$1_="+L+"$2");
c.url=G+(G===c.url?(S.test(c.url)?"&":"?")+"_="+L:"")
}if(c.data&&P==="GET"){c.url+=(S.test(c.url)?"&":"?")+c.data
}c.global&&!AF.active++&&AF.event.trigger("ajaxStart");
L=(L=B.exec(c.url))&&(L[1]&&L[1]!==location.protocol||L[2]!==location.host);
if(c.dataType==="script"&&P==="GET"&&L){var A=x.getElementsByTagName("head")[0]||x.documentElement,K=x.createElement("script");
K.src=c.url;
if(c.scriptCharset){K.charset=c.scriptCharset
}if(!V){var N=false;
K.onload=K.onreadystatechange=function(){if(!N&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){N=true;
w();
s();
K.onload=K.onreadystatechange=null;
A&&K.parentNode&&A.removeChild(K)
}}
}A.insertBefore(K,A.firstChild);
return v
}var J=false,F=c.xhr();
if(F){c.username?F.open(P,c.url,c.async,c.username,c.password):F.open(P,c.url,c.async);
try{if(c.data||Aa&&Aa.contentType){F.setRequestHeader("Content-Type",c.contentType)
}if(c.ifModified){AF.lastModified[c.url]&&F.setRequestHeader("If-Modified-Since",AF.lastModified[c.url]);
AF.etag[c.url]&&F.setRequestHeader("If-None-Match",AF.etag[c.url])
}L||F.setRequestHeader("X-Requested-With","XMLHttpRequest");
F.setRequestHeader("Accept",c.dataType&&c.accepts[c.dataType]?c.accepts[c.dataType]+", */*":c.accepts._default)
}catch(Ab){}if(c.beforeSend&&c.beforeSend.call(T,F,c)===false){c.global&&!--AF.active&&AF.event.trigger("ajaxStop");
F.abort();
return false
}c.global&&Z("ajaxSend",[F,c]);
var Y=F.onreadystatechange=function(BJ){if(!F||F.readyState===0||BJ==="abort"){J||s();
J=true;
if(F){F.onreadystatechange=AF.noop
}}else{if(!J&&F&&(F.readyState===4||BJ==="timeout")){J=true;
F.onreadystatechange=AF.noop;
W=BJ==="timeout"?"timeout":!AF.httpSuccess(F)?"error":c.ifModified&&AF.httpNotModified(F,c.url)?"notmodified":"success";
var BK;
if(W==="success"){try{O=AF.httpData(F,c.dataType,c)
}catch(BI){W="parsererror";
BK=BI
}}if(W==="success"||W==="notmodified"){V||w()
}else{AF.handleError(c,F,W,BK)
}s();
BJ==="timeout"&&F.abort();
if(c.async){F=null
}}}};
try{var X=F.abort;
F.abort=function(){F&&X.call(F);
Y("abort")
}
}catch(R){}c.async&&c.timeout>0&&setTimeout(function(){F&&!J&&Y("timeout")
},c.timeout);
try{F.send(P==="POST"||P==="PUT"||P==="DELETE"?c.data:null)
}catch(Q){AF.handleError(c,F,null,Q);
s()
}c.async||Y();
return F
}},handleError:function(F,A,J,G){if(F.error){F.error.call(F.context||F,A,J,G)
}if(F.global){(F.context?AF(F.context):AF.event).trigger("ajaxError",[A,F,G])
}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol==="file:"||F.status>=200&&F.status<300||F.status===304||F.status===1223||F.status===0
}catch(A){}return false
},httpNotModified:function(F,A){var J=F.getResponseHeader("Last-Modified"),G=F.getResponseHeader("Etag");
if(J){AF.lastModified[A]=J
}if(G){AF.etag[A]=G
}return F.status===304||F.status===0
},httpData:function(F,A,K){var G=F.getResponseHeader("content-type")||"",J=A==="xml"||!A&&G.indexOf("xml")>=0;
F=J?F.responseXML:F.responseText;
J&&F.documentElement.nodeName==="parsererror"&&AF.error("parsererror");
if(K&&K.dataFilter){F=K.dataFilter(F,A)
}if(typeof F==="string"){if(A==="json"||!A&&G.indexOf("json")>=0){F=AF.parseJSON(F)
}else{if(A==="script"||!A&&G.indexOf("javascript")>=0){AF.globalEval(F)
}}}return F
},param:function(F,A){function L(N,O){if(AF.isArray(O)){AF.each(O,function(P,Q){A||/\[\]$/.test(N)?J(N,Q):L(N+"["+(typeof Q==="object"||AF.isArray(Q)?P:"")+"]",Q)
})
}else{!A&&O!=null&&typeof O==="object"?AF.each(O,function(P,Q){L(N+"["+P+"]",Q)
}):J(N,O)
}}function J(N,O){O=AF.isFunction(O)?O():O;
K[K.length]=encodeURIComponent(N)+"="+encodeURIComponent(O)
}var K=[];
if(A===v){A=AF.ajaxSettings.traditional
}if(AF.isArray(F)||F.jquery){AF.each(F,function(){J(this.name,this.value)
})
}else{for(var G in F){L(G,F[G])
}}return K.join("&").replace(A4,"+")
}});
var BD={},A9=/toggle|show|hide/,Aw=/^([+-]=)?([\d+-.]+)(.*)$/,AO,r=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];
AF.fn.extend({show:function(F,A){if(F||F===0){return this.animate(AZ("show",3),F,A)
}else{F=0;
for(A=this.length;
F<A;
F++){var K=AF.data(this[F],"olddisplay");
this[F].style.display=K||"";
if(AF.css(this[F],"display")==="none"){K=this[F].nodeName;
var G;
if(BD[K]){G=BD[K]
}else{var J=AF("<"+K+" />").appendTo("body");
G=J.css("display");
if(G==="none"){G="block"
}J.remove();
BD[K]=G
}AF.data(this[F],"olddisplay",G)
}}F=0;
for(A=this.length;
F<A;
F++){this[F].style.display=AF.data(this[F],"olddisplay")||""
}return this
}},hide:function(F,A){if(F||F===0){return this.animate(AZ("hide",3),F,A)
}else{F=0;
for(A=this.length;
F<A;
F++){var G=AF.data(this[F],"olddisplay");
!G&&G!=="none"&&AF.data(this[F],"olddisplay",AF.css(this[F],"display"))
}F=0;
for(A=this.length;
F<A;
F++){this[F].style.display="none"
}return this
}},_toggle:AF.fn.toggle,toggle:function(F,A){var G=typeof F==="boolean";
if(AF.isFunction(F)&&AF.isFunction(A)){this._toggle.apply(this,arguments)
}else{F==null||G?this.each(function(){var J=G?F:AF(this).is(":hidden");
AF(this)[J?"show":"hide"]()
}):this.animate(AZ("toggle",3),F,A)
}return this
},fadeTo:function(F,A,G){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:A},F,G)
},animate:function(F,A,K,G){var J=AF.speed(A,K,G);
if(AF.isEmptyObject(F)){return this.each(J.complete)
}return this[J.queue===false?"each":"queue"](function(){var N=AF.extend({},J),O,P=this.nodeType===1&&AF(this).is(":hidden"),L=this;
for(O in F){var Q=O.replace(AB,l);
if(O!==Q){F[Q]=F[O];
delete F[O];
O=Q
}if(F[O]==="hide"&&P||F[O]==="show"&&!P){return N.complete.call(this)
}if((O==="height"||O==="width")&&this.style){N.display=AF.css(this,"display");
N.overflow=this.style.overflow
}if(AF.isArray(F[O])){(N.specialEasing=N.specialEasing||{})[O]=F[O][1];
F[O]=F[O][0]
}}if(N.overflow!=null){this.style.overflow="hidden"
}N.curAnim=AF.extend({},F);
AF.each(F,function(T,R){var X=new AF.fx(L,N,T);
if(A9.test(R)){X[R==="toggle"?P?"show":"hide":R](F)
}else{var W=Aw.exec(R),Y=X.cur(true)||0;
if(W){R=parseFloat(W[2]);
var V=W[3]||"px";
if(V!=="px"){L.style[T]=(R||1)+V;
Y=(R||1)/X.cur(true)*Y;
L.style[T]=Y+V
}if(W[1]){R=(W[1]==="-="?-1:1)*R+Y
}X.custom(Y,R,V)
}else{X.custom(Y,R,"")
}}});
return true
})
},stop:function(F,A){var G=AF.timers;
F&&this.queue([]);
this.each(function(){for(var J=G.length-1;
J>=0;
J--){if(G[J].elem===this){A&&G[J](true);
G.splice(J,1)
}}});
A||this.dequeue();
return this
}});
AF.each({slideDown:AZ("show",1),slideUp:AZ("hide",1),slideToggle:AZ("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(F,A){AF.fn[F]=function(J,G){return this.animate(A,J,G)
}
});
AF.extend({speed:function(F,A,J){var G=F&&typeof F==="object"?F:{complete:J||!J&&A||AF.isFunction(F)&&F,duration:F,easing:J&&A||A&&!AF.isFunction(A)&&A};
G.duration=AF.fx.off?0:typeof G.duration==="number"?G.duration:AF.fx.speeds[G.duration]||AF.fx.speeds._default;
G.old=G.complete;
G.complete=function(){G.queue!==false&&AF(this).dequeue();
AF.isFunction(G.old)&&G.old.call(this)
};
return G
},easing:{linear:function(F,A,J,G){return J+G*F
},swing:function(F,A,J,G){return(-Math.cos(F*Math.PI)/2+0.5)*G+J
}},timers:[],fx:function(F,A,G){this.options=A;
this.elem=F;
this.prop=G;
if(!A.orig){A.orig={}
}}});
AF.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);
(AF.fx.step[this.prop]||AF.fx.step._default)(this);
if((this.prop==="height"||this.prop==="width")&&this.elem.style){this.elem.style.display="block"
}},cur:function(A){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]
}return(A=parseFloat(AF.css(this.elem,this.prop,A)))&&A>-10000?A:parseFloat(AF.curCSS(this.elem,this.prop))||0
},custom:function(F,A,K){function G(L){return J.step(L)
}this.startTime=Ae();
this.start=F;
this.end=A;
this.unit=K||this.unit||"px";
this.now=this.start;
this.pos=this.state=0;
var J=this;
G.elem=this.elem;
if(G()&&AF.timers.push(G)&&!AO){AO=setInterval(AF.fx.tick,13)
}},show:function(){this.options.orig[this.prop]=AF.style(this.elem,this.prop);
this.options.show=true;
this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());
AF(this.elem).show()
},hide:function(){this.options.orig[this.prop]=AF.style(this.elem,this.prop);
this.options.hide=true;
this.custom(this.cur(),0)
},step:function(F){var A=Ae(),K=true;
if(F||A>=this.options.duration+this.startTime){this.now=this.end;
this.pos=this.state=1;
this.update();
this.options.curAnim[this.prop]=true;
for(var G in this.options.curAnim){if(this.options.curAnim[G]!==true){K=false
}}if(K){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;
F=AF.data(this.elem,"olddisplay");
this.elem.style.display=F?F:this.options.display;
if(AF.css(this.elem,"display")==="none"){this.elem.style.display="block"
}}this.options.hide&&AF(this.elem).hide();
if(this.options.hide||this.options.show){for(var J in this.options.curAnim){AF.style(this.elem,J,this.options.orig[J])
}}this.options.complete.call(this.elem)
}return false
}else{J=A-this.startTime;
this.state=J/this.options.duration;
F=this.options.easing||(AF.easing.swing?"swing":"linear");
this.pos=AF.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||F](this.state,J,0,1,this.options.duration);
this.now=this.start+(this.end-this.start)*this.pos;
this.update()
}return true
}};
AF.extend(AF.fx,{tick:function(){for(var F=AF.timers,A=0;
A<F.length;
A++){F[A]()||F.splice(A--,1)
}F.length||AF.fx.stop()
},stop:function(){clearInterval(AO);
AO=null
},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(A){AF.style(A.elem,"opacity",A.now)
},_default:function(A){if(A.elem.style&&A.elem.style[A.prop]!=null){A.elem.style[A.prop]=(A.prop==="width"||A.prop==="height"?Math.max(0,A.now):A.now)+A.unit
}else{A.elem[A.prop]=A.now
}}}});
if(AF.expr&&AF.expr.filters){AF.expr.filters.animated=function(A){return AF.grep(AF.timers,function(F){return A===F.elem
}).length
}
}AF.fn.offset="getBoundingClientRect" in x.documentElement?function(F){var A=this[0];
if(F){return this.each(function(K){AF.offset.setOffset(this,F,K)
})
}if(!A||!A.ownerDocument){return null
}if(A===A.ownerDocument.body){return AF.offset.bodyOffset(A)
}var J=A.getBoundingClientRect(),G=A.ownerDocument;
A=G.body;
G=G.documentElement;
return{top:J.top+(self.pageYOffset||AF.support.boxModel&&G.scrollTop||A.scrollTop)-(G.clientTop||A.clientTop||0),left:J.left+(self.pageXOffset||AF.support.boxModel&&G.scrollLeft||A.scrollLeft)-(G.clientLeft||A.clientLeft||0)}
}:function(Q){var P=this[0];
if(Q){return this.each(function(R){AF.offset.setOffset(this,Q,R)
})
}if(!P||!P.ownerDocument){return null
}if(P===P.ownerDocument.body){return AF.offset.bodyOffset(P)
}AF.offset.initialize();
var O=P.offsetParent,L=P,N=P.ownerDocument,J,K=N.documentElement,A=N.body;
L=(N=N.defaultView)?N.getComputedStyle(P,null):P.currentStyle;
for(var G=P.offsetTop,F=P.offsetLeft;
(P=P.parentNode)&&P!==A&&P!==K;
){if(AF.offset.supportsFixedPosition&&L.position==="fixed"){break
}J=N?N.getComputedStyle(P,null):P.currentStyle;
G-=P.scrollTop;
F-=P.scrollLeft;
if(P===O){G+=P.offsetTop;
F+=P.offsetLeft;
if(AF.offset.doesNotAddBorder&&!(AF.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(P.nodeName))){G+=parseFloat(J.borderTopWidth)||0;
F+=parseFloat(J.borderLeftWidth)||0
}L=O;
O=P.offsetParent
}if(AF.offset.subtractsBorderForOverflowNotVisible&&J.overflow!=="visible"){G+=parseFloat(J.borderTopWidth)||0;
F+=parseFloat(J.borderLeftWidth)||0
}L=J
}if(L.position==="relative"||L.position==="static"){G+=A.offsetTop;
F+=A.offsetLeft
}if(AF.offset.supportsFixedPosition&&L.position==="fixed"){G+=Math.max(K.scrollTop,A.scrollTop);
F+=Math.max(K.scrollLeft,A.scrollLeft)
}return{top:G,left:F}
};
AF.offset={initialize:function(){var F=x.body,A=x.createElement("div"),L,J,K,G=parseFloat(AF.curCSS(F,"marginTop",true))||0;
AF.extend(A.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});
A.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
F.insertBefore(A,F.firstChild);
L=A.firstChild;
J=L.firstChild;
K=L.nextSibling.firstChild.firstChild;
this.doesNotAddBorder=J.offsetTop!==5;
this.doesAddBorderForTableAndCells=K.offsetTop===5;
J.style.position="fixed";
J.style.top="20px";
this.supportsFixedPosition=J.offsetTop===20||J.offsetTop===15;
J.style.position=J.style.top="";
L.style.overflow="hidden";
L.style.position="relative";
this.subtractsBorderForOverflowNotVisible=J.offsetTop===-5;
this.doesNotIncludeMarginInBodyOffset=F.offsetTop!==G;
F.removeChild(A);
AF.offset.initialize=AF.noop
},bodyOffset:function(F){var A=F.offsetTop,G=F.offsetLeft;
AF.offset.initialize();
if(AF.offset.doesNotIncludeMarginInBodyOffset){A+=parseFloat(AF.curCSS(F,"marginTop",true))||0;
G+=parseFloat(AF.curCSS(F,"marginLeft",true))||0
}return{top:A,left:G}
},setOffset:function(F,A,N){if(/static/.test(AF.curCSS(F,"position"))){F.style.position="relative"
}var K=AF(F),L=K.offset(),G=parseInt(AF.curCSS(F,"top",true),10)||0,J=parseInt(AF.curCSS(F,"left",true),10)||0;
if(AF.isFunction(A)){A=A.call(F,N,L)
}N={top:A.top-L.top+G,left:A.left-L.left+J};
"using" in A?A.using.call(F,N):K.css(N)
}};
AF.fn.extend({position:function(){if(!this[0]){return null
}var F=this[0],A=this.offsetParent(),J=this.offset(),G=/^body|html$/i.test(A[0].nodeName)?{top:0,left:0}:A.offset();
J.top-=parseFloat(AF.curCSS(F,"marginTop",true))||0;
J.left-=parseFloat(AF.curCSS(F,"marginLeft",true))||0;
G.top+=parseFloat(AF.curCSS(A[0],"borderTopWidth",true))||0;
G.left+=parseFloat(AF.curCSS(A[0],"borderLeftWidth",true))||0;
return{top:J.top-G.top,left:J.left-G.left}
},offsetParent:function(){return this.map(function(){for(var A=this.offsetParent||x.body;
A&&!/^body|html$/i.test(A.nodeName)&&AF.css(A,"position")==="static";
){A=A.offsetParent
}return A
})
}});
AF.each(["Left","Top"],function(F,A){var G="scroll"+A;
AF.fn[G]=function(K){var L=this[0],J;
if(!L){return null
}if(K!==v){return this.each(function(){if(J=f(this)){J.scrollTo(!F?K:AF(J).scrollLeft(),F?K:AF(J).scrollTop())
}else{this[G]=K
}})
}else{return(J=f(L))?"pageXOffset" in J?J[F?"pageYOffset":"pageXOffset"]:AF.support.boxModel&&J.document.documentElement[G]||J.document.body[G]:L[G]
}}
});
AF.each(["Height","Width"],function(F,A){var G=A.toLowerCase();
AF.fn["inner"+A]=function(){return this[0]?AF.css(this[0],G,false,"padding"):null
};
AF.fn["outer"+A]=function(J){return this[0]?AF.css(this[0],G,false,J?"margin":"border"):null
};
AF.fn[G]=function(J){var K=this[0];
if(!K){return J==null?null:this
}if(AF.isFunction(J)){return this.each(function(L){var N=AF(this);
N[G](J.call(this,L,N[G]()))
})
}return"scrollTo" in K&&K.document?K.document.compatMode==="CSS1Compat"&&K.document.documentElement["client"+A]||K.document.body["client"+A]:K.nodeType===9?Math.max(K.documentElement["client"+A],K.body["scroll"+A],K.documentElement["scroll"+A],K.body["offset"+A],K.documentElement["offset"+A]):J===v?AF.css(K,G):this.css(G,typeof J==="string"?J:J+"px")
}
});
An.jQuery=An.$=AF
})(window);$.noConflict();(function(D){D.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(F,E){D.fx.step[E]=function(G){if(G.state==0){G.start=C(G.elem,E);
G.end=B(G.end)
}G.elem.style[E]="rgb("+[Math.max(Math.min(parseInt((G.pos*(G.end[0]-G.start[0]))+G.start[0]),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[1]-G.start[1]))+G.start[1]),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[2]-G.start[2]))+G.start[2]),255),0)].join(",")+")"
}
});
function B(F){var E;
if(F&&F.constructor==Array&&F.length==3){return F
}if(E=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return[parseInt(E[1]),parseInt(E[2]),parseInt(E[3])]
}if(E=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return[parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55]
}if(E=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return[parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16)]
}if(E=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return[parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16)]
}return A[D.trim(F).toLowerCase()]
}function C(G,E){var F;
do{F=D.curCSS(G,E);
if(F!=""&&F!="transparent"||D.nodeName(G,"body")){break
}E="backgroundColor"
}while(G=G.parentNode);
return B(F)
}var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}
})(jQuery);if(!jsAddress){var jsAddress="js/"
}if(!INCLUDE_CSS){var INCLUDE_CSS=["css/epg.css","css/grid.css","css/list.css","css/filtering.css","css/search.css","css/bubble.css","css/authentication.css","css/modalDialogue.css","css/skin-sky.css"]
}for(var x=0,j=INCLUDE_CSS.length;
x<j;
x++){document.write('<link type="text/css"  rel="stylesheet" href="'+INCLUDE_CSS[x]+'" />')
};function testBench(){};document.domain=location.host.match(/\w+(\.com|\.co\.uk)/g);
jQuery(function(){try{if(top.location.host!=undefined){epg.init()
}}catch(A){}});
jQuery.browser.chrome=/chrome/.test(navigator.userAgent.toLowerCase());
jQuery.browser.msie9=(/trident\/5.0/.test(navigator.userAgent.toLowerCase()))||/msie 9/.test(navigator.userAgent.toLowerCase());
epg.staticcontent={};
epg.init=function(){if(epg.config.siteId==4&&!epg.tools.supportedBrowser()){jQuery("body").append('<div id="unsupportedBrowser"><p>Sky Player TV Guide is not currently available in this browser. Supported browsers include Internet Explorer 6.0, Firefox 2.0 and Safari 3.0 and more recent versions of each.</p><p><a href="https://skyplayer.sky.com/aboutskyplayer/internet-tv-browser.html" target="_blank">More about technical requirements</a></p>');
return false
}if(epg.config.general.enable_survey){epg.getSurvey()
}epg.data.UserCookie.init();
epg.stateMachine.init();
epg.Authentication.init(function(){epg.ui.init();
epg.filtering.init();
epg.search.init();
epg.data.init();
epg.date.init();
epg.grid.init();
epg.list.init()
});
try{void (document.execCommand("BackgroundImageCache",false,true))
}catch(A){}};
epg.reloadEPG=function(A){epg.data.UserCookie.hardReset();
epg.stateMachine.hardReset();
epg.Authentication.hardReset(function(){epg.ui.hardReset();
epg.filtering.hardReset();
epg.search.hardReset();
epg.data.hardReset();
epg.date.hardReset();
epg.list.hardReset();
epg.grid.clear();
epg.list.clear();
epg.data.init();
epg.data.channelProgramMap=new Array();
epg.data.channelmap=new Array();
if(epg.stateMachine.isAnyGrid()){epg.grid.show();
epg.grid.makeKey()
}else{epg.list.load()
}if(jQuery("#epg_bubble").length>0){intBubbleX=parseInt(jQuery("#epg_bubble").css("left").replace("px",""),10)-epg.bubble.properties.iBubbleXOffset;
intBubbleY=parseInt(jQuery("#epg_bubble").css("top").replace("px",""),10)-epg.bubble.properties.iBubbleYOffset;
var B=epg.data._showid;
var C=epg.data._channelid;
epg.bubble.closeBubble();
setTimeout(function(){epg.data.getProgram(B,C,epg.date.currentDay,epg.config.deepLinking.getProgramStartTime);
if(epg.Authentication.trigger==="reminders"){epg.reminders.openRemindMe()
}epg.Authentication.trigger=""
},1500)
}},A)
};
epg.getSurvey=function(){var B=new Date();
var A=epg.data.UserCookie.getCookie("surveyEPG"+epg.config.cookieSuffix,"plain");
if(A){if(A.substring(0,1)=="W"){datCookie=new Date(A.substring(1,A.length));
datCookie.setDate(datCookie.getDate()+14);
if(datCookie<=B){parent.ecos_ver="";
parent.ecos_i=function(){window.ecos_nc=parent.ecos_nc;
window.ecos_sid=parent.ecos_sid;
window.ecos_altsid=parent.ecos_altsid;
window.ecos_pm=parent.ecos_pm;
window.ecos_ver+=parent.ecos_ver;
window.ecos_go=parent.ecos_go;
window.ecos_i()
};
jQuery.getScript(window.ecos_url);
B.setDate(B.getDate()+76);
epg.data.UserCookie.setCookieRaw("surveyEPG"+epg.config.cookieSuffix,"D","; expires="+B.toGMTString())
}}}else{epg.data.UserCookie.setCookieRaw("surveyEPG"+epg.config.cookieSuffix,"W"+escape(B.toGMTString()))
}};
jQuery(window).unload(function(A){if((epg.config.siteId==4&&epg.tools.supportedBrowser())||(epg.config.siteId!=4)){epg.grid.clear();
epg.grid.unLoad();
jQuery("#"+epg.ui.Dropdowns.providers.element_id).unbind("click",epg.ui.Dropdowns.providers.display);
jQuery("#epg_filter_special").unbind("click",epg.search.ajaxEditorsPickSearch);
jQuery("#epg_filter_main").unbind("click",epg.filtering.quickBrowse);
jQuery("#epg_filter_off").unbind("click",epg.filtering.removeFiltering);
jQuery("#epg_filter_favourites").unbind("click",epg.ui.Toolbars.toolbar3.goToFavourites);
jQuery("#"+epg.ui.Dropdowns.times.element_id).unbind("click",epg.ui.Dropdowns.times.display);
jQuery("#"+epg.config.eInfoCloseDrag).unbind("click",epg.ui.Info.closeDragInfo);
jQuery("#epg_next_day").unbind("click",epg.grid.scrollToNextMorning);
jQuery("#"+epg.ui.Dropdowns.listViewByChannel.element_id).unbind("click",epg.ui.Dropdowns.listViewByChannel.display);
jQuery("#"+epg.ui.Dropdowns.listViewByGenre.element_id).unbind("click",epg.ui.Dropdowns.listViewByGenre.display);
jQuery("#"+epg.list.properties.sRadioTimeId).unbind("click",epg.list.changeView);
jQuery("#"+epg.list.properties.sRadioChannelId).unbind("click",epg.list.changeView);
jQuery(epg.search.search_form).unbind("submit",epg.search.submit);
jQuery(epg.search.search_field).unbind("focus",epg.search.enableSuggestions);
jQuery("#epg_bubble_inner").unbind("mouseover",epg.bubble.setMouseStateOver);
jQuery("#epg_bubble_inner").unbind("mouseout",epg.bubble.setMouseStateOut);
jQuery("#epg_bubble").unbind("mousemove",epg.grid.getShowHover);
jQuery("#epg_bubble").unbind("mouseup",epg.grid.getShowClick);
delete epg
}});if(epg.config.siteId==1){epg.favourites={init:function init(){epg.favourites.__legacyNuke()
},__legacyNuke:function __legacyNuke(){var A=new Date();
A.setTime(A.getTime()+(-1*24*60*60*1000));
document.cookie="epg_favourites=; expires="+A.toGMTString()+"; path=/"
},add:function add(D,B){var A={onSuccess:function(F,E,G){},onError:function(F,E,G){},onUserNotLoggedIn:function(){},resource:epg.config.environment.apiEndpoints.favourites.add,onComplete:function(F,E){}};
B=jQuery.extend(A,B);
if(!epg.Authentication.isAuthenticated()){B.onUserNotLoggedIn();
return false
}B.resource+=D;
var C=jQuery.ajax({cache:false,type:"GET",url:B.resource,dataType:"json",error:function(G,E,F){if(G.status==403){B.onUserNotLoggedIn()
}else{B.onError(F,E,G)
}},success:function(F,E,G){B.onSuccess(F,E,G)
},complete:B.onComplete})
},remove:function remove(D,B){var A={onSuccess:function(F,E,G){},onError:function(F,E,G){},onUserNotLoggedIn:function(){},resource:epg.config.environment.apiEndpoints.favourites.remove,onComplete:function(F,E){}};
B=jQuery.extend(A,B);
if(!epg.Authentication.isAuthenticated()){B.onUserNotLoggedIn();
return false
}B.resource+=D;
var C=jQuery.ajax({cache:false,type:"GET",url:B.resource,dataType:"json",error:function(G,E,F){if(G.status==403){B.onUserNotLoggedIn()
}else{B.onError(F,E,G)
}},success:function(F,E,G){B.onSuccess(F,E,G)
},complete:B.onComplete})
},get:function get(B){var A={onSuccess:function(E,D,F){},onError:function(E,D,F){},onUserNotLoggedIn:function(){},resource:epg.config.environment.apiEndpoints.favourites.get,onComplete:function(E,D){}};
B=jQuery.extend(A,B);
if(!epg.Authentication.isAuthenticated()){B.onUserNotLoggedIn();
return false
}var C=jQuery.ajax({cache:false,type:"GET",url:B.resource,error:function(F,D,E){if(F.status==403){epg.Authentication.logout();
B.onUserNotLoggedIn()
}else{B.onError(E,D,F)
}},success:function(E,D,G){var F=epg.favourites.__filterChannels(E.fav);
B.onSuccess(F,D,G)
},complete:B.onComplete})
},__filterChannels:function __filterChannels(B){var C=new Array();
for(var D=0;
D<B.length;
D++){var E=B[D],A=false;
if(isNaN(E)){A=true
}if(A!==true){C.push(E)
}}return C
},text:{error:[{h4:"Sorry, we couldn't load your favourites"},{p:"Please try a again later"}]}}
};if(_hbPageView===undefined){var _hbPageView=function(){};
var _hbPageView=function(){};
var _hbLink=function(){}
}epg.hitbox={send:function(B,A){switch(B){case"select_day":_hbPageView("select_day"+(A==0?"_today":"_"+A),epg.config.hitbox_root+"/ajax/");
sitecatalyst.trackLink("select_day"+(A==0?"_today":"_"+A));
break;
case"select_time":_hbPageView("select_time_"+A,epg.config.hitbox_root+"/ajax/");
sitecatalyst.trackLink("select_time_"+A);
break;
case"searchresults":_hbPageView("search_results",epg.config.hitbox_root+"/ajax/");
sitecatalyst.trackLink("search_results");
break;
case"maintab_grid":_hbPageView("maintab_grid",epg.config.hitbox_root+"/ajax/");
sitecatalyst.trackLink("maintab_grid");
break;
case"maintab_detailed_grid":_hbPageView("maintab_detailed_grid",epg.config.hitbox_root+"/ajax/");
sitecatalyst.trackLink("maintab_detailed_grid");
break;
case"maintab_list":_hbPageView("maintab_list",epg.config.hitbox_root+"/ajax/");
sitecatalyst.trackLink("maintab_list");
break;
case"listingbubble":_hbPageView("listingbubble",epg.config.hitbox_root+"/ajax/");
sitecatalyst.trackLink("listingbubble");
break;
case"datadrag":_hbPageView("datadrag",epg.config.hitbox_root+"/ajax/");
sitecatalyst.trackLink("datadrag");
break;
case"remoterecord":_hbLink(epg.config.hitbox_root2+"_ajax_remoterecord");
sitecatalyst.trackLink("remoterecord");
break;
case"selectprovider":_hbPageView("selectprovider",epg.config.hitbox_root+"/ajax/");
sitecatalyst.trackLink("selectprovider");
break;
case"searchsuggestion":_hbLink(epg.config.hitbox_root2+"_ajax_searchsuggestion");
sitecatalyst.trackLink("searchsuggestion");
break;
case"getmoreinfo":_hbLink(epg.config.hitbox_root2+"_ajax_getmoreinfo");
sitecatalyst.trackLink("getmoreinfo");
break;
case"favouritechannels":_hbLink(epg.config.hitbox_root2+"_ajax_favouritechannels");
sitecatalyst.trackLink("favouritechannels");
break;
case"applyfilter":_hbPageView("applyfilter",epg.config.hitbox_root+"/ajax/");
sitecatalyst.trackLink("applyfilter");
break;
case"personalfilter":_hbPageView("personalfilter",epg.config.hitbox_root+"/ajax/");
sitecatalyst.trackLink("personalfilter");
break;
case"pre-setfilter":_hbPageView("pre-setfilter",epg.config.hitbox_root+"/ajax/");
sitecatalyst.trackLink("pre-setfilter");
break;
case"seemorefromsky":_hbLink(epg.config.hitbox_root2+"_ajax_seemorefromsky");
sitecatalyst.trackLink("seemorefromsky");
break;
case"skyplayerlivetv":_hbLink(epg.config.hitbox_root2+"_ajax_skyplayerlivetv");
sitecatalyst.trackLink("skyplayerlivetv");
break;
case"skyplayervod":_hbLink(epg.config.hitbox_root2+"_ajax_skyplayervod");
sitecatalyst.trackLink("skyplayervod");
break;
case"epg search":break
}}};epg.tools={init:function(){},arrayify:function(A){if(A.constructor==Array){return A
}return[A]
},cookieToData:function(B){if(!B){B={}
}if(epg.config.general.enableChannelPrefs){var A=epg.data.UserCookie.getCookie("epg_channelPrefs"+epg.config.cookieSuffix);
if(A){if(A.region){B.bouquetId=A.region.split("_")[0];
B.subbouquetId=A.region.split("_")[1]
}}}return B
},supportedBrowser:function(){if(jQuery.browser.safari&&parseInt(jQuery.browser.version,10)<=522){return false
}return true
},isArray:function(A){return A&&A.constructor==Array
},isEmpty:function(A){for(var B in A){return false
}return true
},arrayMapEach:function arrayMapEach(C,B,G){if(typeof G!="function"){var F=typeof G;
throw"Callback must be of type 'function', '"+F+"' supplied"
}if(typeof C!="object"){var F=typeof C;
throw"Arraykeys must be of type 'object', '"+F+"' supplied"
}if(typeof B!="object"){var F=typeof C;
throw"Object must be of type 'object', '"+F+"' supplied"
}for(var E=0;
E<C.length;
E++){var D="",A={};
D=C[E];
A=B[D];
if(A!=undefined){G(D,A)
}}},doAjax:function(A){if(!A){A={}
}if(!A.data){A.data={}
}A.data.siteId=epg.config.siteId;
return jQuery.ajax(A)
},killAjax:function(){Ajax.abortAll()
},popwin:function(A,B){if(B){window.open(A,"newSkyWindow","location=yes,directories=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes,top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight)
}else{window.open(A)
}return false
},createSkyIDURL:function(B,C){B=epg.config.environment.url.skyid+B;
var A=parent.window.location;
var D=A.protocol+"//"+A.host+A.pathname;
if(typeof epg.data._showid!=="undefined"&&typeof epg.data._channelid!=="undefined"){D+="?eventId="+epg.data._showid+"&channelId="+epg.data._channelid
}D=encodeURIComponent(D);
B=B.replace("#SUCCESS_CALLBACK#",D);
B=B.replace("#CANCEL_CALLBACK#",D);
return B
},createSrpUrl:function(C,A){var B="";
var D=top.location.href;
if(C.toLowerCase().substring(0,4)!="http"){if((D.toLowerCase().indexOf("epg-test01")!=-1)||(D.toLowerCase().indexOf(".local.")!=-1)||(D.toLowerCase().indexOf("epg-test02")!=-1)){B="http://chiscvaptest03.test.nm.bskyb.com"
}else{if(D.toLowerCase().indexOf("stage")!=-1){B="https://stage-mysky.sky.com"
}else{B="https://mysky.sky.com"
}}}B+=C+"?source=epg&formaction="+escape(A)+"&srp=";
if(jQuery("#epg_bubble").length>0){if(D.indexOf("?")!=-1){D=D.substr(0,D.indexOf("?"))
}D+="?eventId="+epg.data._showid+"&channelId="+epg.data._channelid
}B+=escape(D);
return B
},sortObject:function(D,B){var C=new Array();
for(E in D){C[C.length]={K:E,V:D[E]}
}if(B){C=C.sort(B)
}else{C=C.sort(function(H,G){return H.V-G.V
})
}var F={};
var A=C.length;
for(var E=0;
E<A;
E++){F[C[E].K]=C[E].V
}delete C;
delete A;
delete E;
delete p;
return F
},cancelBubble:function(B){var A=(B||window.event);
if(!A||A=="undefined"){debug(B);
return 
}A.returnValue=false;
A.cancelBubble=true;
if(A.stopPropagation){A.stopPropagation()
}if(A.preventDefault){A.preventDefault()
}return false
},getTarget:function(D){var A=(D||window.event);
var B=A.srcElement||A.target;
while(B.nodeType!=1){B=B.parentNode
}try{var C=B.parentNode;
while(C.nodeType!=1){C=C.parentNode
}if(C.tagName.toLowerCase()=="a"){B=C
}}catch(D){}return B
},getParentByProperty:function(C,H,G,A){var B=null;
if(typeof G=="string"){if(A){if(A.indexOf("-strict")>-1){var D=new RegExp("(^|\\s)"+G+"(\\s|$)")
}}else{var D=new RegExp(G,"i")
}}else{if(!G){console(1);
clearTimeout(this.stackInt);
return false
}var D=G
}var E;
do{try{E=C[H]||C.getAttribute(H);
E=""+E;
if(D.test(E)){return C
}}catch(F){}C=C.parentNode||C
}while(C.parentNode);
return false
},getPosition:function(D,I){var J,A,G,J,C,K,F,E;
J=T=A=G=C=K=F=E=0;
C=D.offsetWidth;
K=D.offsetHeight;
if(D.offsetParent){J=D.offsetLeft;
T=D.offsetTop;
while(D=D.offsetParent){if(I&&I==D){break
}J+=D.offsetLeft;
T+=D.offsetTop
}}A=T+K;
G=J+C;
F=J+(C/2);
E=T+(K/2);
return{top:T,left:J,right:G,bottom:A,middle:{x:F,y:E},width:C,height:K}
},generateDOM:function(C){var D=document.createElement(C.sNodeType[0]);
if(C.sId){D.id=C.sId
}if(C.sHref){D.href=C.sHref
}if(C.aClasses!==undefined){$(D).className=C.aClasses.join(" ")
}var B=D;
var K=[D];
var A=C.sNodeType.length;
for(var J=1;
J<A;
J++){K[J]=document.createElement(C.sNodeType[J]);
B.appendChild(K[J]);
B=K[J]
}if(C.aAttributes){for(var I=0,G=C.aAttributes.length;
I<G;
I++){if(C.aAttributes[I]!=null){K[C.aAttributes[I].iNodeNo].setAttribute([C.aAttributes[I].sAttribute],C.aAttributes[I].sValue)
}}}if(C.aBehaviours){for(var I=0,G=C.aBehaviours.length;
I<G;
I++){K[C.aBehaviours[I].iNodeNo]["on"+C.aBehaviours[I].sEvent]=C.aBehaviours[I].fCallBack
}}var N=[];
if(!Object.isString(C.oContents)&&C.oContents!=""){var H=C.oContents.length;
for(var J=0;
J<H;
J++){if(Object.isElement(C.oContents[J])){B.appendChild(C.oContents[J])
}else{if((C.oContents[J]) instanceof Object){var L=this.generateDOM(C.oContents[J]);
if(Object.isArray(L)){for(var G=0,F=L.length;
G<F;
G++){B.appendChild(L[G])
}}else{if(C.oContents[J]!=""){B.appendChild(L)
}}}else{if(C.oContents[J]!=""){var E=C.oContents[J];
var M=Object.clone(C);
M.oContents=E;
N[J]=this.generateDOM(M);
N[J].generatedNodeNo=J;
D=N
}}}}}else{if(C.sNodeType[0]!="input"&&C.oContents!=""){B.appendChild(this.createTextNode(C.oContents))
}}return D
},createTextNode:function(A){var B=document.createTextNode(A);
if(Object.isElement(B)){console("yes")
}return B
}};
Element.Methods.positionedFromOffset=function(B,C){var A={top:0,left:0,width:0,height:0};
A.width=B.offsetWidth;
A.height=B.offsetHeight;
if(B.offsetParent){A.left=B.offsetLeft;
A.top=B.offsetTop;
while(B=B.offsetParent){if(C&&C==B){break
}A.left+=B.offsetLeft;
A.top+=B.offsetTop
}}A[0]=A.left;
A[1]=A.top;
return A
};
Element.Methods.epgGetElementsByClassName=function(B,E){if(B.getElementsByClassName){return B.getElementsByClassName(E)
}var A=new Array();
function G(){var K=B.all||B.getElementsByTagName("*");
var J=new RegExp("(^|\\s)"+E+"(\\s|$)");
for(var I=0,L=K.length;
I<L;
I++){if(J.test(K[I].className)){A[A.length]=K[I]
}}}if(document.evaluate){try{var D=".//*[contains(concat(' ', @class, ' '), ' "+E+" ')]";
var H=document.evaluate(D,B,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);
var C=H.iterateNext();
while(C){A[A.length]=C;
C=H.iterateNext()
}}catch(F){G()
}}else{G()
}return A
};
Element.Methods.appendChildrenFromObject=function(B,D){for(var A=0,F=D.length;
A<F;
A++){var E=0;
var C=null;
for(var H in D[A]){if(E++==0){var G=document.createElement(H);
if(typeof D[A][H]=="string"){G.appendChild(document.createTextNode(D[A][H]))
}else{if(D[A][H]){Element.appendChildrenFromObject(G,D[A][H])
}}}else{if(C=H.match(/^on([a-z]+)$/)){Event.observe(G,C[1],D[A][H])
}else{G.setAttribute(H,D[A][H]);
if(H=="class"){G.className=D[A][H]
}}}}B.appendChild(G)
}};
Element.addMethods();
Ajax.Request.abort=function(A){A.transport.onreadystatechange=Prototype.emptyFunction;
A.transport.abort();
$A(Ajax.Responders.responders).each(function(B){if(B.onAbort){B.onAbort(A)
}});
if(!A._complete&&A._complete!="undefined"){Ajax.activeRequestCount--
}Ajax.RequestRegister=Ajax.RequestRegister.without(A)
};
Ajax.abortAll=function(){$A(Ajax.RequestRegister).each(Ajax.Request.abort);
Ajax.RequestRegister=[]
};
Ajax.allRequestsComplete=function(){for(var A in Ajax.RequestRegister){if(Ajax.RequestRegister[A]._complete!=undefined&&Ajax.RequestRegister[A]._complete!==true){return false
}}return true
};
epg.baseAjaxResponders={onCreate:function(A){if(!Ajax.RequestRegister){Ajax.RequestRegister=[]
}Ajax.RequestRegister[Ajax.RequestRegister.length]=A
},onException:function(B,A){if(B.transport){Ajax.Request.abort(B)
}else{Ajax.abortAll()
}}};
Ajax.Responders.register(epg.baseAjaxResponders);
Ajax.Responders.register({onCreate:function(A){epg.ui.infoPane.displayLoader()
},onComplete:function(A){if(Ajax.allRequestsComplete()){epg.ui.infoPane.hideLoader()
}},onException:function(B,A){if(Ajax.allRequestsComplete()){epg.ui.infoPane.hideLoader()
}},onAbort:function(A){if(Ajax.allRequestsComplete()){epg.ui.infoPane.hideLoader()
}}});
Ajax.Responders.register({onException:function(B,A){},on500:function(B,A){}});
Number.prototype.pad=String.prototype.pad=function(C,B){var A=this.toString(B||10);
while(A.length<C){A="0"+A
}return A
};
String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"")
};
String.prototype.toWord=function(){return this.replace(/\s+([a-z]{1})/ig,function(A){return A.toUpperCase()
}).replace(/\s+/g,"")
};
String.prototype.createDOMElement=function(){var J=this;
var I;
var K;
var E;
var H=new Array();
var G;
while(J.charAt(0)!="<"){J=J.substr(1)
}while(J.length){var F=J.match(/^<([a-z0-9]+)/);
var D=J.match(/^([a-z]+)="([^"]+)"/i);
var C=J.match(/^(>)/);
var B=J.match(/^<\/([a-z0-9]+)/);
var A=J.match(/^\/>/);
var L=J.match(/^([^<]+)/);
if(F){E=document.createElement(F[1]);
if(!I){I=E
}else{K.appendChild(E)
}K=E;
J=J.replace("<"+F[1],"")
}else{if(D){E.setAttribute(D[1],D[2]);
if(D[1]=="class"){E.className=D[2]
}J=J.replace(D[1]+'="'+D[2]+'"',"")
}else{if(C){J=J.replace(C[1],"")
}else{if(B){if(K.parentNode){K=K.parentNode
}J=J.replace("</"+B[1]+">","")
}else{if(A){if(K.parentNode){K=K.parentNode
}J=J.replace("/>","")
}else{if(L){K.appendChild(document.createTextNode(L[1]));
J=J.replace(L[1],"")
}}}}}}J=J.replace(/^\s+|\s+$/,"")
}return I
};epg.date={dServerTime:0,currentDay:0,dLocalTime:0,iLocalTimeOffset:0,init:function(){if(epg.stateMachine.storedCurrentTime===false){epg.date.setCurrentTime((new Date()).setDate((new Date()).getDate()+epg.config.api.toolbar.dates.initial));
traceCurrentTime(0)
}else{epg.date.setCurrentTime(epg.stateMachine.storedCurrentTime);
traceCurrentTime(1)
}for(var A=0;
A<20;
A++){var B;
B=new Date();
B.setDate(B.getDate()+A);
B=epg.date.dateToMidnight(B);
epg.date.aEpgDate[A]=B;
epg.date.aHoursInDay[A]=epg.date.hoursInDay(B);
delete B
}},aEpgDate:[],aHoursInDay:[],hardReset:function(){epg.date.init()
},dateToURL:function(F,A){F.setHours((F.getHours()));
var B=F.getMinutes();
while(B%15!=0){B++
}if(B!=0){}F.setMinutes(B);
if(A){return""+F.getTime()
}var H=F.getFullYear().toString();
var E=(F.getMonth()+1).toPaddedString(2);
var C=F.getDate().toPaddedString(2);
var I=F.getHours().toPaddedString(2);
var D=F.getMinutes().toPaddedString(2);
var G=H+E+C+I+D;
return G
},dateToMidnight:function(A){return new Date(A.getFullYear(),A.getMonth(),A.getDate())
},nixToEpg:function(C){var B=epg.date.nixToMidnight(C);
var A;
for(iDay=0,j=epg.config.constants.maxDays;
iDay<j;
iDay++){A=epg.date.epgDateNix(iDay);
if(B===A){return iDay
}}return false
},nixToMidnight:function(B){var A=new Date;
A.setTime(B);
A=epg.date.dateToMidnight(A);
return epg.date.dateToNix(A)
},nixToDate:function(B){var A=new Date;
A.setTime(B);
return A
},dateToNix:function(A){if(A){return A.getTime()
}},epgDate:function(A){return epg.date.aEpgDate[A]
},epgHoursInDay:function(A){return epg.date.aHoursInDay[A]
},epgDateNix:function(A){return epg.date.dateToNix(epg.date.epgDate(A))
},dateToString:function(G){var H=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
var F=new Date;
F.setTime(G);
var E=F.getHours();
var B=F.getMinutes().toPaddedString(2);
var A=F.getDate();
var D=H[F.getDay()];
var C=E<12?"am":"pm";
E=(E<12?E:E-12);
E=E==0?12:E;
E=(E+":"+B+""+C);
E=E.replace(/:00/,"");
A+=(A==1||A==21||A==31)?"st":(A==2||A==22)?"nd":(A==3||A==23)?"rd":"th";
return D+", "+A+", "+E
},dateToStringList:function(D){var E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var B=["January","February","March","April","May","June","July","August","September","October","November","December"];
var C=new Date;
C.setTime(D);
var A=C.getDate();
A+=(A==1||A==21||A==31)?"st":(A==2||A==22)?"nd":(A==3||A==23)?"rd":"th";
return E[C.getDay()]+", "+B[C.getMonth()]+" "+A
},timeSTR:function(E){var D=new Date;
D.setTime(E);
var C=D.getHours();
var A=D.getMinutes().toPaddedString(2);
var B=C<12?"am":"pm";
C=(C<12?C:C-12);
C=C==0?12:C;
C=(C+":"+A+""+B);
if(!epg.config.grid.showFullTimeBarTime){C=C.replace(/:00/,"")
}return C
},timeFromOffairStr:function(A){return epg.date.timeFromString(A,true)
},timeFromString:function(C,B){if(isNaN(C)){var F=/[^0-9]*([0-9]{1,2})[\.\s]*([0-9]*)\s*([pa]m).*/i;
if(!F.test(C)){return false
}var D=parseInt(C.replace(F,"$1"),10);
var G=C.replace(F,"$3")||"";
if(G.toLowerCase()=="pm"&&D<12){D+=12
}if(G.toLowerCase()=="am"&&D==12){D=0
}var A=C.replace(F,"$2");
A=typeof A=="string"&&A!=""?parseInt(A,10):0
}else{var D=parseInt(C,10);
var A=0
}var E=new Date();
if(D<epg.date.currentTime.getHours()&&B){E.setMonth(epg.date.currentTime.getMonth(),epg.date.currentTime.getDate()+1)
}else{E.setMonth(epg.date.currentTime.getMonth(),epg.date.currentTime.getDate())
}E.setHours(D);
E.setMinutes(A);
return E
},now:new Date(),currentTime:new Date(),setCurrentTime:function(C){var D=C;
if(C.setTime){D=C.getTime()
}epg.stateMachine.storedCurrentTime=D;
epg.date.currentTime.setTime(parseInt(D,10));
epg.ui.Toolbars.toolbar2.setDay(epg.date.currentTime.getDate());
epg.date.timeOfDayDate=epg.date.getTimeOfDay();
if(!epg.ui.Dropdowns.times.all_day&&arguments[1]!==undefined){epg.ui.Dropdowns.times.update(D)
}var B=new Date();
B.setHours(0);
B.setMinutes(0);
B.setSeconds(0);
B=B.getTime();
var E=new Date();
E.setTime(epg.date.currentTime.getTime());
E.setHours(0);
E.setMinutes(0);
E.setSeconds(0);
E=E.getTime();
var A=Math.round((E-B)/(24*60*60*1000));
if(epg.date.currentDay!==A){epg.bubble.closeBubble()
}epg.date.currentDay=A
},selectedDayIsToday:function(){var A=new Date();
time=A.getTime();
return epg.date.nixToMidnight(epg.stateMachine.storedCurrentTime)==epg.date.nixToMidnight(time)
},getTimeOfDay:function(G){var H=epg.date.timeOfDay();
var C=epg.date.currentTime.getHours();
var B=new Date();
B.setTime(epg.date.currentTime.getTime());
var A;
var F;
for(F=0,j=H.length;
F<j;
F++){var E=H[(F+1)]?H[(F+1)].hour:24-H[0].hour;
if(C>=H[F].hour){if(C<E){B.setHours(H[F].hour);
break
}}B.setMinutes(0,0,0)
}if(G){var D={startval:B,textval:epg.date.timeOfDay()[F].text,duration:epg.date.timeOfDay()[F].duration};
return D
}return B
},timeOfDayDate:new Date(),timeOfDay:function(){return epg.config.general.timeOfDay_format
},hoursInDay:function(C){var A=[new Date(2011,9,30),new Date(2012,9,28),new Date(2013,9,27),new Date(2014,9,26),new Date(2015,9,25)];
var B=[new Date(2012,2,25),new Date(2013,2,31),new Date(2014,2,30),new Date(2015,2,29)];
for(var D=0;
D<A.length;
D++){if(C.getFullYear()==A[D].getFullYear()&&C.getMonth()==A[D].getMonth()&&C.getDate()==A[D].getDate()){return 25
}}for(var D=0;
D<B.length;
D++){if(C.getFullYear()==B[D].getFullYear()&&C.getMonth()==B[D].getMonth()&&C.getDate()==B[D].getDate()){return 23
}}return 24
}};epg.list={init:function(){var A=epg.data.UserCookie.getCookie("epg_listsorttype"+epg.config.cookieSuffix)||epg.config.api.list.sort_type.initial;
if((A===0&&!epg.config.api.list.sort_type.enabled.channel)||(A==1&&!epg.config.api.list.sort_type.enabled.time)){A=epg.config.api.list.sort_type.initial
}epg.list.tracking.sortType=A;
Event.observe($(epg.list.properties.sRadioTimeId),"click",epg.list.changeView);
Event.observe($(epg.list.properties.sRadioChannelId),"click",epg.list.changeView)
},properties:{sRadioTimeId:"epg_listTime",sRadioChannelId:"epg_listChannel",sNextChannelView:"Next channels",sPrevChannelView:"Previous channels",sNextTimeView:"Later",sPrevTimeView:"Earlier",sEmptyList:"epg_emptyList"},filters:"",listViewScrollerTop:0,listViewScrollerHeight:0,iCurrentDur:null,iCurrentStart:null,aChannels:[],aListFilterCurrent:[],bListFilterEnabled:false,bIsFavourites:false,oEventJump:null,lastViewedTime:false,tracking:{currentBlock:0,sortType:0,getCurrentCallDuration:function(){var B;
if(epg.list.tracking.sortType===0){if(!epg.ui.Dropdowns.times.all_day){var C=epg.date.getTimeOfDay(true);
B=C.duration-1
}else{B=1680
}}if(epg.list.tracking.sortType===1){var A=40;
B=(A/epg.list.aChannels.length);
B=Math.ceil(B);
B=B>6?6:B;
B*=60;
B-=1
}return B
}},changeView:function(C){epg.tools.killAjax();
epg.list.makeEmpty();
if(typeof C!="string"&&typeof C!="number"){var F=epg.tools.getTarget(C);
var E=F.id.toString();
var A=(E==epg.list.properties.sRadioChannelId)?0:1;
if(E==epg.list.properties.sRadioChannelId){$(E).checked=true;
$(epg.list.properties.sRadioTimeId).checked=false
}else{$(E).checked=true;
$(epg.list.properties.sRadioChannelId).checked=false
}epg.list.tracking.sortType=A
}else{C=C.toString();
epg.list.tracking.sortType=C
}if(epg.list.tracking.sortType===1&&epg.ui.Dropdowns.times.all_day===true){epg.ui.Dropdowns.times.all_day=false;
var B=new Date();
epg.date.setCurrentTime(B.valueOf());
traceCurrentTime(15)
}var G;
var D;
if(epg.list.tracking.sortType===0){G=new Date();
G.setTime(epg.date.timeOfDayDate.getTime());
G.setMinutes(0);
G.setSeconds(0);
G.setMilliseconds(0);
D=G.getTime()
}else{G=new Date();
G.setTime(epg.date.currentTime.getTime());
G.setMinutes(0);
G.setSeconds(0);
G.setMilliseconds(0);
D=G.getTime()
}epg.data.UserData.saveData("epg_listsorttype",epg.list.tracking.sortType);
epg.list.load(D)
},load:function(H){var D=epg.config.deepLinking.checkDeepLink(true);
if(D){epg.data.getProgram(D[0],D[1],epg.date.currentDay,epg.config.deepLinking.getProgramStartTime);
return 
}epg.list.makeEmpty();
epg.list.show();
$(epg.config.eListMain).style.height=epg.list.listViewScrollerHeight+"px";
if(H){epg.date.setCurrentTime(H);
traceCurrentTime(14)
}epg.list.aProgStore=[];
epg.list.oProgHash={};
var K=[];
if(epg.stateMachine.isFilter()){K=epg.filtering.filters[epg.filtering.current_filter].channels||[]
}if(epg.stateMachine.isTvListing()){if(epg.list.bListFilterEnabled){K=epg.list.aListFilterCurrent
}else{K=epg.data.current
}}epg.list.aChannels=K;
var G=(epg.list.tracking.currentBlock)*epg.config.iMaxChannelsLists;
if(epg.stateMachine.isFilter()&&epg.list.lastViewedTime===false&&epg.list.tracking.sortType!==1){epg.list.lastViewedTime=epg.date.currentTime.getTime();
var P=epg.date.timeFromString("12am");
epg.date.setCurrentTime(P.valueOf());
traceCurrentTime(13);
document.getElementById(epg.ui.Dropdowns.times.value_id).innerHTML="All day";
epg.ui.Dropdowns.times.all_day=true
}var I=epg.date.currentDay;
var O=epg.list.receiveData;
var L=epg.list.tracking.getCurrentCallDuration();
var B=(epg.list.tracking.sortType===0)?epg.date.timeOfDayDate:epg.date.currentTime;
if(epg.ui.Dropdowns.times.all_day){epg.list.iCurrentDur=L;
var C=new Date();
C.setTime(B.getTime());
C.setHours(0);
C.setMinutes(0);
epg.list.iCurrentStart=C.getTime()
}else{epg.list.iCurrentDur=L;
epg.list.iCurrentStart=B.getTime()
}var M=G+(epg.config.iMaxChannelsLists-1);
var F;
if(epg.list.tracking.sortType===0){epg.data.requestType=0;
K=K.sortBy(function(Q){return epg.data.channels[(Q)].channelno
});
F=[];
var J=K.length;
for(var E=0;
E<J;
E++){if(E>=G&&E<=M){F[F.length]=K[E]
}}epg.list.fetchTotal=F.length
}if(epg.list.tracking.sortType==1){epg.data.requestType=1;
F=K;
var N=new Date();
N.setTime(epg.date.currentTime.getTime());
N.setMinutes(0);
epg.date.setCurrentTime(N);
traceCurrentTime(12);
var A=epg.date.dateToURL(epg.date.currentTime);
epg.list.fetchTotal=F.length
}epg.list.aChannels=F.slice();
if(!epg.stateMachine.isFilter()&&epg.list.aChannels.length===0&&!epg.stateMachine.isSearch()){epg.filtering.removeFiltering();
return 
}if(epg.stateMachine.isFilter()&&epg.list.aChannels.length===0&&!epg.stateMachine.isSearch()){if(!$(epg.config.eAlert)){epg.list.displayNoChannelsMessage()
}}else{if(epg.list.tracking.sortType==1&&epg.list.aChannels.length>0&&!epg.stateMachine.isSearch()){if($(epg.config.eAlert)){epg.ui.Alerts.alert.close()
}epg.data.getList(F,I,O,L,A)
}else{if(epg.list.tracking.sortType==0&&epg.list.aChannels.length>0&&!epg.stateMachine.isSearch()){if($(epg.config.eAlert)){epg.ui.Alerts.alert.close()
}epg.data.getList(F,I,O)
}}}},show:function(){if(epg.list.bIsFavourites){epg.list.updateFilteredFavourites()
}Element.removeClassName($(epg.config.eList),"view_off");
if(!epg.stateMachine.isSearch()){$(epg.config.eListBar).style.display="";
$(epg.config.eListMain).style.display=""
}var A=epg.tools.getPosition($(epg.config.eList));
var B=epg.tools.getPosition($(epg.config.constants.listViewBarId));
epg.list.listViewScrollerHeight=(A.bottom-B.bottom)-2
},hide:function(){Element.addClassName($(epg.config.eList),"view_off")
},makeEmpty:function(){jQuery("#"+epg.config.eListMain).addClass(epg.list.properties.sEmptyList);
jQuery("#"+epg.config.eListScroller).remove()
},clear:function(){epg.tools.killAjax();
epg.data.requestType=0;
Element.addClassName($("epg_list"),"view_off");
var A=$(epg.config.constants.listwrapperId);
A.innerHTML=""
},aProgStore:[],oProgHash:{},iChannelsReceived:0,receiveData:function(D,F,H){var B;
var A=epg.list.iCurrentStart;
var M=epg.list.iCurrentStart+(epg.list.iCurrentDur*60*1000);
var I=new Date();
I.setTime(M);
if(I.getDate()!=epg.date.currentTime.getDate()){I.setDate(epg.date.currentTime.getDate());
I.setHours(23);
I.setMinutes(59);
M=I.getTime();
M=M+(1000*60*60*4)
}var E=epg.list.aProgStore;
var K,C;
var J=0;
var G=0;
if(epg.stateMachine.isFilter()){for(kProg in D){if(epg.list.oProgHash[kProg]===undefined&&D[kProg].filtermatch===""){K=D[kProg].start;
C=parseInt(K,10)+parseInt(D[kProg].dur*1000,10);
if(K<M&&K>=A){J++;
E[E.length]=D[kProg];
epg.list.oProgHash[kProg]=true
}if((K<A&&C>M)&&epg.list.tracking.sortType===0){J++;
E[E.length]=D[kProg];
epg.list.oProgHash[kProg]=true
}B=D[kProg].channelid
}}}else{for(kProg in D){if(epg.list.oProgHash[kProg]===undefined&&epg.list.oProgHash[kProg]===undefined){K=D[kProg].start;
C=parseInt(K,10)+parseInt(D[kProg].dur*1000,10);
if(K<M&&K>=A){J++;
E[E.length]=D[kProg];
epg.list.oProgHash[kProg]=true
}if((K<A&&C>M)&&epg.list.tracking.sortType===0){J++;
E[E.length]=D[kProg];
epg.list.oProgHash[kProg]=true
}B=D[kProg].channelid
}}}var L;
if(J===0&&epg.list.tracking.sortType===0){if(epg.data.channels[B]){L=E[E.length]=epg.data.channels[B].valueOf();
L.noData=true
}}if(E.length===0&&epg.list.tracking.sortType===1&&F>=(epg.list.aChannels.length-1)){if(epg.data.channels[B]){L=E[E.length]=epg.data.channels[B].valueOf();
L.noData=true
}}epg.list.iChannelsReceived++;
if(epg.list.fetchTotal===(F+1)&&epg.list.fetchTotal!==undefined&&epg.list.fetchTotal!==0){if(epg.list.tracking.sortType===0){epg.list.writeByChannel(epg.list.aProgStore)
}else{epg.list.writeByTime(epg.list.aProgStore)
}delete epg.list.fetchTotal
}},xhtml:{scroller:'<div id="epg_listViewScroller" class="epg_listViewScroller epg_stdList" style="height:XXXheightXXXpx;top:XXXtopXXXpx">XXXcontentsXXX</div>',channels:{std:'<div class="epg_listRow_header" id="epg_listViewChannel_XXXchannelIDXXX"><div class="epg_channelNumber epg_type_2">XXXchannelnoXXX</div><div class="epg_channelName epg_type_1">XXXchannelnameXXX</div>  XXXfavouriteXXX  </div><br style="clear:both;" />',time:'<div class="epg_listRow_header epg_timeView"><div class="epg_channelTime epg_type_11">XXXtimeXXX</div></div>'},program:{std:'<div id="epg_event_XXXchannelidXXX_XXXeventidXXX" class="epg_listRow XXXdontmissXXX XXXoffairXXX"><div class="epg_time_order epg_type_1">XXXprogtimeXXX</div><div class="epg_programme">XXXgenreXXX<div class="epg_programmeTitle epg_type_5">XXXprogtitleXXX</div></div>XXXbubblelinkXXX</div>',time:'<div id="epg_event_XXXchannelidXXX_XXXeventidXXX" class="epg_listRow XXXdontmissXXX XXXoffairXXX"><div class="epg_time_order epg_type_1">XXXprogtimeXXX</div><div class="epg_programme">XXXgenreXXX<div class="epg_programmeTitle epg_type_5">XXXprogtitleXXX</div></div> <div class="epg_timeListDetails"> XXXfavouriteXXX <div class="epg_channelNumber epg_type_2">XXXchannelnoXXX</div> <div class="epg_channelName epg_type_1">XXXchannelnameXXX</div> </div> XXXbubblelinkXXX</div>',genre:'<div class="epg_listGenre epg_type_12">XXXgenretxtXXX</div>',bubblelink:'<div class="epg_expand_show"><a href="#" class="epg_link_A">Expand</a></div>'},promo:'<div class="epg_promoRow" id="epg_list_promo_XXXchannelidXXX" style="background:transparent url(XXXimageurlXXX) repeat-x bottom left;"><div class="epg_promoImage"></div><div class="epg_promoHide"><a href="#"><span>Hide promo</span></a></div></div>',bubble:'<div style="clear:all;" class="epg_bubbleRow epg_emptyBubble epg_hidden_bubble"><div class="epg_bubbleTip"><img src="images/skin/assets/gif/bubble_L.gif" alt=" " /></div><div id="XXXbubbleidXXX" class="epg_bubbleRowWrapper"></div></div><br style="clear:both;" />',favourite:'<div class="epg_addChannel"><a href="#" class="epg_XXXfavimageXXX" id="epg_favChannel_XXXfavIDXXX">&nbsp;</a></div>',favtxt:["add","remove"],nextprev:{wrapper:'<div class="epg_nextPrevious">XXXlinksXXX</div>',prevLink:'<a id="epg_list_previous" href="#" class="epg_link_J">XXXpreviousTEXTXXX</a>',nextLink:'<a id="epg_list_next" href="#" class="epg_link_J">XXXnextTEXTXXX</a>',prevLinkTop:'<a id="epg_list_previous_top" href="#" class="epg_link_J">XXXpreviousTEXTXXX</a>',nextLinkTop:'<a id="epg_list_next_top" href="#" class="epg_link_J">XXXnextTEXTXXX</a>'},nodata:'<div class="epg_listRow"><div class="epg_programme"><div class="epg_programmeTitle epg_type_5">Sorry. no programme information available</div></div></div>'},_writeProgram:function(E,G,C){var F,D,N="",J="",I="",K="";
chItem=epg.data.channels[G];
var H=epg.data.genre[E.genre];
H=H.display?H.name:false;
if(H){J='<div class="epg_listGenre epg_type_12">'+H+"</div>"
}var B=(E.edschoice=="true"?" "+epg.config.p_dontmiss:"");
var L=(E.offair?" "+epg.config.p_offair:"");
if(epg.list.tracking.sortType===0){if(E.start>epg.date.epgDateNix(epg.date.currentDay+1)){var A=" epg_listRowFiltered";
var M=epg.date.dateToStringList(E.start)
}else{var M="";
var A=""
}N='<div id="epg_event_'+E.channelid+"_"+E.eventid+'" class="epg_listRow'+B+L+A+'"><div class="epg_time_order epg_type_1">'+epg.date.timeSTR(E.start)+'</div><div class="epg_programme">'+J+'<div class="epg_programmeTitle epg_type_5">'+E.title+'</div><span class="epg_channelListFilterDay">'+M+"</span></div>"+(epg.config.api.bubble.enabled?epg.list.xhtml.program.bubblelink:"")+"</div>"
}if(epg.list.tracking.sortType==1){N='<div id="epg_event_'+E.channelid+"_"+E.eventid+'" class="epg_listRow'+B+L+'"><div class="epg_time_order epg_type_1">'+epg.date.timeSTR(E.start)+'</div><div class="epg_programme">'+J+'<div class="epg_programmeTitle epg_type_5">'+E.title+'</div></div><div class="epg_timeListDetails">'+epg.list._writeFavourite(chItem)+'<div class="epg_channelNumber epg_type_2">'+C+'</div><div class="epg_channelName epg_type_1">'+(chItem.title||"")+"</div></div>"+(epg.config.api.bubble.enabled?epg.list.xhtml.program.bubblelink:"")+"</div>"
}if(G==E.channelid){if(!E.offair&&epg.config.api.bubble.enabled){N+=epg.list.writeBubble(E)
}}return N
},_writeFavourite:function(A){if(epg.config.api.favourites.enabled){return'<div class="epg_addChannel"><a href="#" class="epg_'+(epg.data.favourites[A.channelid]?"fav_1":"fav_0")+'" id="epg_favChannel_'+A.channelid+'">&nbsp;</a></div>'
}else{return""
}},writeByChannel:function(D){var K=epg.config.iMaxTimeShows;
var N=[];
var I=true;
var A;
var G=null;
epg.grid.currentChannel=epg.list.aChannels[0];
var E=epg.list.tracking.currentBlock===0;
var F;
if(epg.stateMachine.isFilter()){F=(((epg.list.tracking.currentBlock+1)*epg.config.iMaxChannelsLists)<epg.filtering.filters[epg.filtering.current_filter].channels.length?false:true)
}else{F=(epg.list.tracking.currentBlock+1)*epg.config.iMaxChannelsLists>(epg.list.aListFilterCurrent.length>0?epg.list.aListFilterCurrent.length:epg.data.current.length)
}if(!document.getElementById(epg.config.eListScroller)){A=0;
epg.list.aListTimeLabels=[];
epg.list.iListPosition=0;
epg.list.iListPosition+=K;
N[N.length]='<div id="'+epg.config.eListScroller+'" class="epg_listViewScroller epg_stdList" style="height:'+epg.list.listViewScrollerHeight+"px;top:"+epg.list.listViewScrollerTop+'px">';
I=true
}else{A=epg.list.iListPosition;
epg.list.iListPosition+=K;
I=false
}if(I===true){if(E&&!F){N[N.length]='<div class="epg_nextPrevious"><a id="epg_list_next_top" href="#" class="epg_link_J">'+epg.list.properties.sNextChannelView+"</a></div>"
}else{if(!E&&!F){N[N.length]='<div class="epg_nextPrevious"><a id="epg_list_previous_top" href="#" class="epg_link_J">'+epg.list.properties.sPrevChannelView+'</a><a id="epg_list_next_top" href="#" class="epg_link_J">'+epg.list.properties.sNextChannelView+"</a></div>"
}else{if(!E&&F){N[N.length]='<div class="epg_nextPrevious"><a id="epg_list_previous_top" href="#" class="epg_link_J">'+epg.list.properties.sPrevChannelView+"</a></div>"
}}}}D=D.sortBy(function(O){if(epg.data.channels[O.channelid]){return epg.data.channels[O.channelid].channelno+O.start
}});
var B,G,J;
var C=epg.data.channels;
var H=0;
for(var M=0,L=D.length;
M<L;
M++){B=D[M];
if(G===null||G!=B.channelid){G=B.channelid;
N[N.length]='<div class="epg_listRow_header" id="epg_listViewChannel_'+(B.channelid||"")+'"><div class="epg_channelNumber epg_type_2">'+(C[B.channelid].channelno||"")+'</div><div class="epg_channelName epg_type_1">'+(epg.data.channels[B.channelid].title||"")+"</div>"+(epg.list._writeFavourite(B))+'</div><br style="clear:both;" />';
N[N.length]=epg.list._writePromo(B.channelid)
}if(B.noData===true){N[N.length]='<div class="epg_listRow"><div class="epg_programme"><div class="epg_programmeTitle epg_type_5" style="width:auto;">Sorry, there are no programmes matching your filter criteria at this time</div></div></div>';
continue
}if(!B.noData){N[N.length]=epg.list._writeProgram(B,B.channelid,C[B.channelid].channelno);
H++
}}if(I===true){if(E&&!F){N[N.length]='<div class="epg_nextPrevious"><a id="epg_list_next" href="#" class="epg_link_J">'+epg.list.properties.sNextChannelView+"</a></div>"
}else{if(!E&&!F){N[N.length]='<div class="epg_nextPrevious"><a id="epg_list_previous" href="#" class="epg_link_J">'+epg.list.properties.sPrevChannelView+'</a><a id="epg_list_next" href="#" class="epg_link_J">'+epg.list.properties.sNextChannelView+"</a></div>"
}else{if(!E&&F){N[N.length]='<div class="epg_nextPrevious"><a id="epg_list_previous" href="#" class="epg_link_J">'+epg.list.properties.sPrevChannelView+"</a></div>"
}}}N[N.length]="</div>";
$(epg.config.eListMain).insert(N.join(""))
}else{$(epg.config.eListScroller).insert(N.join(""),{position:"after"});
$(epg.config.eListScroller).appendChild($("showMeMore"));
$(epg.config.eListScroller).appendChild($("epg_nextPrevious"))
}epg.list.bindHeaderMethods();
epg.list.bindEventMethods(D,0,D.length);
epg.list.bindMethods(D,0,D.length);
$(epg.config.eListScroller).style.visibility="visible";
Element.removeClassName($(epg.config.eListMain),epg.list.properties.sEmptyList)
},iListPosition:0,aListTimeLabels:{},writeByTime:function(F){if(epg.list.tracking.sortType==1){var M=epg.config.iMaxTimeShows;
var P=[];
var K=true;
var A;
var G=epg.list.tracking.currentBlock===0;
var H=(epg.list.tracking.currentBlock+1)*epg.config.iMaxChannelsLists>(epg.list.aListFilterCurrent.length>0?epg.list.aListFilterCurrent.length:epg.data.current.length);
if(F===undefined){F=epg.list.aProgStore
}if(!document.getElementById(epg.config.eListScroller)){A=0;
epg.list.aListTimeLabels=[];
epg.list.iListPosition=0;
epg.list.iListPosition+=M;
P[P.length]='<div id="'+epg.config.eListScroller+'" class="epg_listViewScroller epg_stdList" style="height:'+epg.list.listViewScrollerHeight+"px;top:"+epg.list.listViewScrollerTop+'px">';
K=true
}else{A=epg.list.iListPosition;
epg.list.iListPosition+=M;
K=false
}if(K===true){P[P.length]='<div class="epg_nextPrevious"><a id="epg_list_previous_top" href="#" class="epg_link_J">'+epg.list.properties.sPrevTimeView+'</a><a id="epg_list_next_top" href="#" class="epg_link_J">'+epg.list.properties.sNextTimeView+"</a></div>"
}var C;
var L=new Date();
var B;
var D=epg.data.channels;
var N=A;
function E(Q){return Math.round(Q/(60*1000))*(60*1000)
}F=F.sortBy(function(Q){return parseInt(E(Q.start)+""+epg.data.channels[Q.channelid].channelno,10)
});
var J=F.length;
while(N<(A+M)&&N>=A){if(F[N]){C=F[N];
L.setTime(C.start||epg.date.currentTime.getTime());
if(B!=L.getHours()){var O=new Date();
O.setHours(L.getHours());
O.setMinutes(0);
B=O.getHours();
if(epg.list.aListTimeLabels[B]===undefined){epg.list.aListTimeLabels[B]=true;
P[P.length]='<div class="epg_listRow_header epg_timeView"><div class="epg_channelTime epg_type_11">'+epg.date.timeSTR(O.getTime())+"</div></div>"
}}if(!C.noData){P[P.length]=epg.list._writeProgram(C,C.channelid,D[C.channelid].channelno);
P[P.length]=epg.list._writePromo(C.channelid);
epg.list.sLastId="epg_event_"+C.channelid+"_"+C.eventid
}else{P[P.length]=epg.list.xhtml.nodata;
N++;
continue
}}N++;
if(N>=F.length&&$("showMeMore")){$("showMeMore").hide()
}}if(K===true){var I="epg.list.writeByTime();";
if(J>M&&epg.list.iListPosition<J){P[P.length]='<div id="showMeMore" href="#"><a class="epg_type_5 epg_time_order" onClick="'+I+'return false;">Display '+(J-(epg.list.iListPosition+M)<0?(J-epg.list.iListPosition):M)+" more programmes..</a><br/><br/></div>"
}P[P.length]='<div class="epg_nextPrevious" id="epg_nextPrevious"><a id="epg_list_previous" href="#" class="epg_link_J">'+epg.list.properties.sPrevTimeView+'</a><a id="epg_list_next" href="#" class="epg_link_J">'+epg.list.properties.sNextTimeView+"</a></div>";
P[P.length]="</div>";
$(epg.config.eListMain).insert(P.join(""))
}else{$(epg.config.eListScroller).insert(P.join(""),{position:"after"});
$(epg.config.eListScroller).appendChild($("showMeMore"));
$(epg.config.eListScroller).appendChild($("epg_nextPrevious"))
}setTimeout(function(){epg.list.bindEventMethods(F,A,M)
},0);
if(K===true){setTimeout(function(){epg.list.bindHeaderMethods()
},0)
}setTimeout(function(){epg.list.bindMethods(F,A,M)
},0);
$(epg.config.eListScroller).style.visibility="visible";
Element.removeClassName($(epg.config.eListMain),epg.list.properties.sEmptyList)
}},_writePromo:function(A){if(epg.data.promos!=null&&epg.data.promos[epg.date.currentDay][A]!=null){var B=epg.data.promos[epg.date.currentDay][A]||false;
if(!B||B.hidden===true||!epg.config.api.promos.enabled){return""
}else{return'<div class="epg_promoRow" id="epg_list_promo_'+A+'" style="background:transparent url('+B.promo+') repeat-x bottom left;"><div class="epg_promoImage"></div><div class="epg_promoHide" id="epg_list_promo_hide_'+A+'"><a href="#"><span>Hide promo</span></a></div></div>'
}}else{return""
}},writeBubble:function(A){return'<div style="clear:all;" class="epg_bubbleRow epg_emptyBubble epg_hidden_bubble"><div class="epg_bubbleTip"><img src="images/skin/assets/gif/bubble_L.gif" alt=" " /></div><div id="bubble_event_'+A.channelid+"_"+A.eventid+'" class="epg_bubbleRowWrapper"></div></div><br style="clear:both;" />'
},bindHeaderMethods:function(){var A=$("epg_list_next");
if(A){A.onclick=epg.list.next
}var C=$("epg_list_previous");
if(C){C.onclick=epg.list.previous
}var B=$("epg_list_next_top");
if(B){B.onclick=epg.list.next
}var D=$("epg_list_previous_top");
if(D){D.onclick=epg.list.previous
}},bindMethods:function(G,H,D){var F=$$("#"+epg.config.constants.listwrapperId+" ."+epg.config.p_offair.strip());
var E=F.length;
n=0;
while(n<E){$$("#"+F[n].id+" .epg_programmeTitle")[0].onclick=epg.list.offairJump;
n++
}var B=H;
var C=epg.data.promos;
var A=epg.date.currentDay;
while(B<(H+D)&&B>=H){if(G[B]){if(G[B]&&!G[B].noData&&C[A]&&C[A][G[B].channelid]!==undefined){$("epg_list_promo_"+G[B].channelid).onclick=function(I){epg.promo.action(I,true)
};
$("epg_list_promo_hide_"+G[B].channelid).onclick=epg.promo.hide
}else{B++;
continue
}}B++
}},bindEventMethods:function(E,F,C){var A=F;
if(epg.config.api.bubble.enabled){var D=new RegExp(epg.config.p_offair.strip(),"i");
while(A<(F+C)&&A>=F){if(E[A]){if(!E[A].noData){var B=document.getElementById("epg_event_"+E[A].channelid+"_"+E[A].eventid);
if(B&&!D.test(B.id.toString())){B.onclick=epg.list.showHideBubble
}if(document.getElementById("epg_favChannel_"+E[A].channelid)){document.getElementById("epg_favChannel_"+E[A].channelid).onclick=epg.list.addRemoveFavourites
}}else{A++;
continue
}}A++
}}else{while(A<(F+C)&&A>=F){if(E[A]){if(!E[A].noData){document.getElementById("epg_favChannel_"+E[A].channelid).onclick=epg.list.addRemoveFavourites
}else{A++;
continue
}}A++
}}},next:function(D){var C;
epg.tools.cancelBubble(D);
if(epg.list.tracking.sortType===0){epg.list.tracking.currentBlock++;
C=epg.date.timeOfDayDate.getTime()
}if(epg.list.tracking.sortType===1){C=epg.date.currentTime.getTime();
var A=(epg.list.iCurrentDur+1)*60*1000;
C+=A
}epg.list.updateFilteredFavourites();
var B=new Date();
epg.list.gotoTime(C)
},previous:function(D){var C;
epg.tools.cancelBubble(D);
if(epg.list.tracking.sortType===0){epg.list.tracking.currentBlock--;
C=epg.date.timeOfDayDate.getTime()
}if(epg.list.tracking.sortType===1){C=epg.date.currentTime.getTime();
var A=((epg.list.iCurrentDur+1)*60*1000);
var B=epg.date.dateToNix(epg.date.epgDate(0));
if((C-A)<B){C=B
}else{C-=A
}}epg.list.updateFilteredFavourites();
epg.list.gotoTime(C)
},showHideBubble:function(H,D,K,L){var G;
if(D===undefined){G=this;
epg.tools.cancelBubble(H)
}else{G=$("epg_event_"+K+"_"+L)
}var C=/[^0-9]+([0-9]+)_([0-9]+)/;
var I=G.id.replace(C,"$1_$2");
var M=$(G).getElementsByClassName(epg.config.listCollapse)[0]||G.getElementsByClassName(epg.config.listExpand)[0];
var A=Element.cleanWhitespace(M).getElementsByTagName("a")[0];
var E="bubble_event_"+I;
var J=$(E);
J=epg.tools.getParentByProperty(J,"className",epg.config.listBubbleRow,"-strict");
if(G.getElementsByClassName(epg.config.listCollapse)[0]){if(D){return 
}J.focus()
}else{G.focus()
}var F=new RegExp(epg.config.listHiddenBubble,"g");
if(F.test(J.className)){var B=function(){jQuery(J).removeClass(epg.config.listHiddenBubble);
jQuery(M).removeClass(epg.config.listExpand).addClass(epg.config.listCollapse);
jQuery(A).html("Collapse");
M.blur();
var N=G.id.split("_");
epg.data.getProgram(N[3],N[2],epg.date.currentDay,epg.bubble.processProgramData_list)
};
if(jQuery("#epg_bubble").length>0){jQuery("#epg_bubble").fadeTo("fast",0,function(){jQuery("#epg_bubble").slideUp(function(){jQuery("#epg_bubble").remove();
jQuery(".epg_bubbleRow").not(J).addClass("epg_hidden_bubble").prev().find(".epg_expand_hide").addClass(epg.config.listExpand).removeClass(epg.config.listCollapse).find("a").html("Expand");
B()
})
})
}else{B()
}}else{epg.list.removeBubble(J);
jQuery(M).addClass(epg.config.listExpand).removeClass(epg.config.listCollapse);
jQuery(A).html("Expand");
M.blur()
}},removeBubble:function(A){jQuery("#epg_bubble").fadeTo("fast",0,function(){jQuery("#epg_bubble").slideUp(function(){jQuery("#epg_bubble").remove();
jQuery(A).addClass(epg.config.listHiddenBubble)
})
})
},gotoTime:function(D){var C=epg.date.nixToEpg(D);
epg.date.setCurrentTime(D);
traceCurrentTime(11);
if(epg.date.currentDay!==C){epg.date.currentDay=C;
var A=epg.date.nixToDate(D);
epg.ui.Toolbars.toolbar2.setDay(A.getDate())
}var B=(epg.list.tracking.sortType===0)?epg.date.timeOfDayDate:epg.date.currentTime;
D=B.getTime();
epg.list.load(D)
},gotoDay:function(A){if(epg.stateMachine.isFilter()){epg.filtering.removeFiltering()
}epg.list.gotoTime(A)
},checkForEventJump:function(){var A=epg.list.oEventJump;
if(A){epg.list.gotoEvent(A.eventid,A.channelid,A.iStart,A.bShowBubble)
}epg.list.oEventJump=null
},gotoEvent:function(G,E,A,J){var B=$("epg_event_"+E+"_"+G);
var F=$("bubble_event_"+E+"_"+G);
if(B){var C=$(epg.config.eListScroller);
var I=(Element.positionedOffset(B).top);
var D=1;
jQuery("#"+C).animate({scrollTop:I},(D*1000),"swing");
if(J){epg.list.showHideBubble(B,true,E,G)
}return 
}epg.list.resetFilters();
epg.views.gotoTime(A);
epg.list.lastViewedTime=epg.date.currentTime.getTime();
var H=epg.date.timeFromString("12am");
epg.date.setCurrentTime(H.valueOf());
traceCurrentTime(10);
document.getElementById(epg.ui.Dropdowns.times.value_id).innerHTML="All day";
epg.ui.Dropdowns.times.all_day=true;
epg.list.filterByChannel(parseInt(E,10));
setTimeout(function(){if($("epg_event_"+E+"_"+G)){epg.list.showHideBubble($("epg_event_"+E+"_"+G),true,E,G);
var K=$(epg.config.eListScroller);
var L=(Element.positionedOffset($("epg_event_"+E+"_"+G)).top);
var M=1000;
jQuery("#"+K).animate({scrollTop:L},M,"swing")
}},1000)
},offairJump:function(E){var D=epg.tools.getTarget(E);
if(D.childNodes&&D.childNodes[0]){var C=Element.cleanWhitespace(D).childNodes[0].nodeValue;
var B=new Date();
var A=epg.date.timeFromOffairStr(C);
if(A.getTime){epg.list.gotoTime(A.getTime())
}}},programInfo:function(F){var E;
var C=/[^0-9]*([0-9]+)_([0-9]+).*/;
E=epg.tools.getTarget(F);
if(!C.test(E.id.toString())){E=epg.tools.getParentByProperty(E,"id",C)
}var B=E.id.toString();
var A=B.replace(C,"$1");
var D=B.replace(C,"$2");
epg.ui.infoPane.displayInfo((epg.data.list[epg.date.currentDay][A][D].shortDesc).truncate(90,"..."))
},addRemoveFavourites:function(B){epg.tools.cancelBubble(B);
var C=this.id;
C=C.split("_");
var A=C[2];
if(epg.data.favourites[A]){if($(this).removeClassName("epg_fav_1")){$(this).removeClassName("epg_fav_1")
}$(this).addClassName("epg_fav_0");
epg.data.removeFavourite(A)
}else{if($(this).removeClassName("epg_fav_0")){$(this).removeClassName("epg_fav_0")
}$(this).addClassName("epg_fav_1");
epg.data.addFavourite(A)
}},displayNoChannelsMessage:function(){epg.ui.Alerts.alert.display(epg.filtering.text.error)
},filterByChannel:function(B){if(typeof B==="number"){B=epg.data.channels[B].title
}epg.tools.killAjax();
if(epg.stateMachine.isFilter()){epg.filtering.resetFilteringParameters()
}epg.list.tracking.currentBlock=0;
epg.stateMachine.set(2);
epg.list.bListFilterEnabled=(B!=epg.ui.Dropdowns.listViewByChannel.content[0]);
epg.ui.Dropdowns.listViewByChannel.bIsDefault=(B==epg.ui.Dropdowns.listViewByChannel.content[0]);
for(var A in epg.data.channels){if(epg.data.channels[A].title==B){epg.list.aListFilterCurrent=[A];
break
}}if(epg.ui.Dropdowns.listViewByChannel.bIsDefault){epg.ui.Dropdowns.listViewByGenre.reset()
}epg.list.load(epg.date.currentTime.getTime())
},filterByGenre:function(B){epg.tools.killAjax();
if(epg.stateMachine.isFilter()){epg.filtering.resetFilteringParameters()
}epg.list.tracking.currentBlock=0;
epg.ui.Dropdowns.listViewByChannel.reset();
epg.stateMachine.set(2);
epg.list.bListFilterEnabled=(B!=epg.ui.Dropdowns.listViewByGenre.content[0]);
epg.ui.Dropdowns.listViewByGenre.bIsDefault=(B==epg.ui.Dropdowns.listViewByGenre.content[0]);
var D=null;
var C=false;
B=B.unescapeHTML();
var A;
for(i in epg.data.epggenre){A=epg.data.epggenre[i].name.unescapeHTML();
if(A==B){D=epg.data.epggenre[i].genreid;
epg.list.bIsFavourites=(i=="fave");
break
}}epg.list.aListFilterCurrent=[];
epg.list.aListGenreCurrent=[];
if(epg.list.bIsFavourites){epg.list.updateFilteredFavourites()
}else{for(i in epg.data.channels){if(epg.data.channels[i].epggenre==D){epg.list.aListFilterCurrent[epg.list.aListFilterCurrent.length]=epg.data.channels[i].channelid
}}epg.list.aListGenreCurrent=epg.list.aListFilterCurrent.slice()
}epg.list.load(epg.date.currentTime.getTime())
},resetFilters:function(){epg.ui.Dropdowns.listViewByChannel.reset();
epg.ui.Dropdowns.listViewByGenre.reset();
epg.list.bListFilterEnabled=false;
epg.list.bIsFavourites=false;
epg.list.aListFilterCurrent=[];
epg.list.aListGenreCurrent=[]
},updateFilteredFavourites:function(){if(epg.list.bIsFavourites){var B=epg.data.favourites;
epg.list.aListFilterCurrent=[];
for(var A in B){epg.list.aListFilterCurrent[epg.list.aListFilterCurrent.length]=A.toString()
}epg.list.aListGenreCurrent=epg.list.aListFilterCurrent.slice()
}},hardReset:function(){$$("#epg_list_filters .epg_dropDown_container").each(Element.remove);
epg.list.resetFilters();
epg.list.tracking.currentBlock=0;
epg.list.aProgStore=[];
epg.list.bIsFavourites=false
}};epg.xml={init:function(){},parseEPGInit:function(R){if(R===""||R.error){epg.ui.Alerts.mainError.display();
return 
}var Y;
var A=epg.data.channels;
var G=epg.data.favourites;
var P=epg.data.current;
var N=epg.data.channelnoMap;
var C=epg.data.genre;
var L=epg.data.epggenre;
var E=epg.data.promos;
var X=epg.date.nixToEpg;
var B;
var D=epg.data.channelmap;
var U=epg.data.genremap;
epg.data.userPreferences=R.userPreferences;
epg.Authentication.checkAuthenticated();
if(epg.search.reloadSearch){epg.search.reloadSearchTerm()
}if(epg.config.general.enable_favourites){L.fave={name:"Favourites",genreid:"fave"};
U.push("fave")
}L.all={name:"All channels",genreid:"all"};
U.push("all");
if(epg.config.general.enable_favourites){A.special={channelno:false,epggenre:"fave",title:epg.config.sFaveHTML,height:31};
D.push("special")
}var Z=R.channels;
var J=R.genre;
var W=R.epggenre;
var I=R.filters;
var T=epg.data.grid;
var O=epg.data.list;
for(var F=0,S=epg.config.constants.maxDays;
F<S;
F++){if(!T[F]){T[F]={};
O[F]={}
}}for(var Q=0,S=epg.config.constants.maxDays;
Q<S;
Q++){if(!E[Q]){E[Q]={}
}}epg.staticcontent=R.staticcontent;
epg.Authentication.properties.sPasswordLink=epg.config.urlForgottenPassword;
epg.Authentication.properties.sUserNameLink=epg.config.urlForgottenUsername;
if(Z&&Z.length){for(var M=0,K=Z.length;
M<K;
M++){D.push(Z[M]["channelid"]);
A[Z[M]["channelid"]]=Z[M];
P[P.length]=Z[M]["channelid"];
N[Z[M]["channelno"]]=Z[M]["channelid"];
if(Z[M]["promo__program"]&&!Z[M]["promo__program"].length){B=X(Z[M]["promo__program"]["start"]);
if(!E[B]){E[B]={}
}E[B][Z[M]["channelid"]]=Z[M]["promo__program"];
delete A[Z[M]["channelid"]]["promo__program"]
}else{if(Z[M]["promo__program"]){for(var H=0,V=H<Z[M]["promo__program"].length;
H<V;
H++){B=X(Z[M]["promo__program"][H]["start"]);
if(!E[B]){E[B]={}
}E[B][Z[M]["channelid"]]=Z[M]["promo__program"][H]
}delete A[Z[M]["channelid"]]["promo__program"]
}}}}if(J&&J.length){for(var M=0,K=J.length;
M<K;
M++){Y=J[M]["genreid"];
C[Y]=J[M];
if(Y==6){C[Y].name="Film";
C[Y]["display"]=true
}if(Y==7){C[Y]["display"]=true
}}}if(W.length===undefined){W=[W]
}if(W&&W.length){for(var M=0,K=W.length;
M<K;
M++){L[W[M]["genreid"]]=W[M];
U.push(W[M]["genreid"])
}}if(I&&I.length){for(var M=0,K=I.length;
M<K;
M++){epg.filtering.filters[I[M].k.toString().toWord()]={name:I[M].k,genres:I[M].v.split(","),channels:null}
}}epg.Authentication.checkAuthenticated();
epg.ui.Toolbars.toolbar1.setup();
if(epg.stateMachine.isHDChannels===true){epg.data.selectedRegion="HD Channels"
}else{if(R.selectedRegion&&R.selectedRegion.shortName!==undefined){epg.data.selectedRegion=R.selectedRegion.shortName
}}if(epg.ui.Dropdowns.providers.currentRegion===null){epg.ui.Dropdowns.providers.currentRegion=R.selectedRegion.shortName
}},parseProgram:function(B,D,C){if(B===""||B.error){return 
}var A=epg.data.events;
if(!A[C]){A[C]={}
}if(!A[C][D]){A[C][D]={}
}A[C][D]=B.all__details
},parseChannel:function(D,E){var I=D;
if(D===""||D.error){return 
}var A=epg.data.grid;
if(!A[E]){A[E]={}
}var F=epg.data.channelProgramMap;
if(!F[E]){F[E]={}
}if(D.channels.constructor==Object){D.channels=[D.channels]
}if(D.channels&&typeof D.channels.length==="number"){for(var J=0,H=D.channels.length;
J<H;
J++){var G=D.channels[J]["program"];
var C=D.channels[J]["channelid"];
if(!A[E][C]){A[E][C]={}
}if(!F[E][C]){F[E][C]=new Array()
}var B={};
for(iProgram=0,max=G.length;
iProgram<max;
iProgram++){A[E][C][G[iProgram]["eventid"]]=G[iProgram];
F[E][C].push(G[iProgram]["eventid"])
}}}},parseList:function(C,D){var H=C;
if(C===""||C.error){return 
}var E=epg.data.list;
if(!E[D]){E[D]={}
}if(C.channels.constructor==Object){C.channels=[C.channels]
}if(C.channels&&typeof C.channels.length==="number"){for(var I=0,G=C.channels.length;
I<G;
I++){var F=C.channels[I]["program"];
var B=C.channels[I]["channelid"];
if(!E[D][B]){E[D][B]={}
}var A={};
for(iProgram=0,max=F.length;
iProgram<max;
iProgram++){E[D][B][F[iProgram]["eventid"]]=F[iProgram]
}}}},parseFilterGenres:function(A){if(A&&A.category){epg.filtering.filter_genres=A.category
}else{epg.ui.Alerts.mainError.display()
}},parseFilterChannels:function(B,C){if(B){if(B.channels&&B.channels.length){var A=B.channels.split(",");
for(i=0;
i<A.length;
i++){if(epg.data.channels[A[i]]===undefined){delete A[i]
}}A=A.uniq();
A=A.compact();
epg.filtering.filters[C].channels=A
}else{epg.filtering.filters[C].channels=[]
}if($("epg_filterCloud")){setTimeout("epg.views.reloadCurrentView()",500)
}else{epg.views.reloadCurrentView()
}}else{epg.ui.Alerts.mainError.display()
}}};epg.promo={_findPromo:function(C){try{var B=/[^0-9]+_([0-9]+)$/;
var E=epg.tools.getParentByProperty(C,"id",B);
var A=E.id.toString().replace(B,"$1");
var F=epg.data.promos[epg.date.currentDay][A];
return F
}catch(D){return false
}},action:function(D,G,F){var C=epg.tools.getTarget(D);
F=F||epg.promo._findPromo(C);
var A;
if(G===true){var E;
if(F.promolink!==undefined){var B=epg.date.timeSTR(F.start);
B+=" on ";
B+=epg.data.channels[F.channelid].title;
epg.ui.Alerts.modalDialogue.open.promo(F.title,B,F.promolink,"_blank")
}else{var B=epg.date.timeSTR(F.start);
B+=" on ";
B+=epg.data.channels[F.channelid].title;
epg.ui.Alerts.modalDialogue.open.promo(F.title,B,epg.config.urlFindOutAboutGettingSky,"_parent")
}}else{epg.promo.finalAction(F)
}},finalAction:function(A){if(A.promolink!==undefined){document.location=A.promolink
}else{epg.views.gotoEvent(A.eventid,A.channelid,A.start,true)
}},hide:function(D){var B=this;
if(epg.stateMachine.isAnyGrid()){}if(epg.stateMachine.isList()){var A=/[^0-9]+_([0-9]+)$/;
var E=epg.tools.getParentByProperty(B,"id",A);
epg.tools.cancelBubble(D);
var F=epg.promo._findPromo(B);
F.hidden=true;
var C=E.id;
E=$(C);
while(E){Element.remove(E);
E=$(C)||false
}}}};epg.data={init:function(){traceData("epg.data.init");
if(!epg.stateMachine.isFilter()){if(epg.stateMachine.isAnyGrid()){epg.data.getInit(epg.grid.makeKey)
}else{if(epg.stateMachine.isList()){epg.data.getInit(epg.list.load)
}}}else{epg.data.getInit(function(){epg.data.getFilterChannels(epg.filtering.current_filter,epg.date.dateToURL(epg.date.currentTime))
})
}},hardReset:function(){traceData("epg.data.hardReset");
epg.data.channels={};
epg.data.current=[];
epg.data.channelnoMap={};
epg.data.genre={};
epg.data.epggenre={};
epg.data.grid={};
epg.data.events={};
epg.data.favourites={};
epg.data.promos={};
epg.data.filtered={};
epg.data.userPreferences={};
epg.data.requestType=0;
epg.data.channelProgramMap=new Array();
epg.data.channelmap=new Array()
},channels:{},current:[],channelnoMap:{},channelmap:[],genremap:[],channelProgramMap:{},genre:{},epggenre:{},grid:{},list:{},events:{},favourites:{},promos:{},filtered:{},requestType:0,addFavourite:function(A){if(sitecatalyst&&sitecatalyst.site==="sky/tvlistings"){traceData("epg.data.addFavourite");
jQuery(epg.data.channels[A].channelKey).addClass("working");
epg.favourites.add(A,{onComplete:function(){jQuery(epg.data.channels[A].channelKey).removeClass("working")
},onSuccess:function(){jQuery(epg.data.channels[A].channelKey).attr("title","Remove channel from favourites");
epg.data.favourites[A]=Object.clone(epg.data.channels[A]);
epg.data.favourites[A].epggenre="fave";
epg.grid.stripChannel(epg.data.favourites[A]);
epg.data.favourites[A].promo=undefined;
epg.data.favourites[A].promoKey=undefined;
if(epg.data.channels.special){epg.grid.removeChannel(epg.data.channels.special);
delete epg.data.channels.special;
var C=true
}if(epg.stateMachine.isAnyGrid()){var B;
if(epg.stateMachine.isextendedGrid()){B=epg.config.iExtendedHeight
}else{if(!epg.stateMachine.isextendedGrid()){B=epg.config.iGridHeight
}}epg.grid.addFavourite(A);
epg.grid.setChannelHeight();
epg.grid.getUpdate();
if(C){epg.grid.jumpTo($(epg.config.eSchedule).scrollLeft,$(epg.config.eSchedule).scrollTop+B-epg.config.iGridHeight)
}else{epg.grid.jumpTo($(epg.config.eSchedule).scrollLeft,$(epg.config.eSchedule).scrollTop+B)
}}},onError:function(){epg.ui.Alerts.modalDialogue.open.error('Could not remove "'+epg.data.channels[A].title+'" from favourites, please try again.')
},onUserNotLoggedIn:function(){epg.Authentication.display("loginOnly");
jQuery(epg.data.channels[A].channelKey).removeClass("working")
}});
epg.hitbox.send("favouritechannels")
}},removeFavourite:function(A){if(sitecatalyst&&sitecatalyst.site==="sky/tvlistings"){traceData("epg.data.removeFavourite");
jQuery(epg.data.favourites[A].channelKey).addClass("working");
jQuery(epg.data.channels[A].channelKey).addClass("working");
epg.favourites.remove(A,{onUserNotLoggedIn:function(){jQuery(epg.data.channels[A].channelKey).removeClass("working");
epg.Authentication.display("loginOnly")
},onComplete:function(){jQuery(epg.data.channels[A].channelKey).removeClass("working")
},onError:function(){epg.ui.Alerts.modalDialogue.open.error('Could not remove "'+epg.data.channels[A].title+'" from favourites, please try again.')
},onSuccess:function(){jQuery(epg.data.channels[A].channelKey).attr("title","Add channel to favourites");
if(epg.data.favourites[A].status===true){epg.grid.removeChannel(epg.data.favourites[A])
}delete epg.data.favourites[A];
if(!epg.data.channels.special&&Object.keys(epg.data.favourites).length===0){epg.data.channels.special={channelno:false,epggenre:"fave",title:epg.config.sFaveHTML,height:31};
var C=true
}if(epg.stateMachine.isAnyGrid()){epg.grid.removeFavourite(A);
var B;
if(epg.stateMachine.isextendedGrid()){B=epg.config.iExtendedHeight
}else{if(!epg.stateMachine.isextendedGrid()){B=epg.config.iGridHeight
}}epg.grid.setChannelHeight();
epg.grid.getUpdate();
if(C){epg.grid.jumpTo($(epg.config.eSchedule).scrollLeft,$(epg.config.eSchedule).scrollTop-B+epg.config.iGridHeight)
}else{epg.grid.jumpTo($(epg.config.eSchedule).scrollLeft,$(epg.config.eSchedule).scrollTop-B)
}}epg.hitbox.send("favouritechannels")
}})
}},isFavourite:function(A){traceData("epg.data.isFavourite");
if(epg.data.favourites[A]){return true
}else{return false
}},getInit:function(B){traceData("epg.data.getInit");
var A=epg.tools.cookieToData();
epg.tools.doAjax({url:epg.config.fileInit,data:A,dataType:"json",type:"get",success:function(D){function C(){var E=epg.tools.doAjax({url:epg.config.ajaxGetTime,type:"get",success:function(){epg.Authentication.checkAuthenticated();
epg.date.dServerTime=new Date(E.getResponseHeader("Date"));
epg.date.dLocalTime=new Date();
if(isNaN(epg.date.dServerTime)){epg.date.dServerTime=epg.date.dLocalTime
}epg.date.iLocalTimeOffset=Date.parse(epg.date.dServerTime)-Date.parse(epg.date.dLocalTime);
if(epg.stateMachine.haveServerTime===false){epg.date.setCurrentTime(epg.date.dServerTime);
traceCurrentTime(2);
epg.stateMachine.haveServerTime=true;
epg.ui.Toolbars.toolbar2.setup()
}else{epg.date.setCurrentTime(epg.stateMachine.storedCurrentTime);
traceCurrentTime("2b")
}epg.xml.parseEPGInit(D);
epg.regions.setRefreshRegion();
var F=function F(){epg.ui.Toolbars.toolbar3.populate();
epg.ui.Toolbars.listFilterBar.setup();
if(typeof (B)==="function"){traceData(B);
B()
}};
if(sitecatalyst&&sitecatalyst.site==="sky/tvlistings"){epg.favourites.get({onSuccess:function(I){var G=epg.data.channels;
for(var H=0;
H<I.length;
H++){epg.data.favourites[I[H]]=Object.clone(G[I[H]]);
epg.data.favourites[I[H]].epggenre="fave"
}if(I.length>0){delete G.special
}F()
},onError:function(){epg.ui.Alerts.modalDialogue.open.error("Could not load favourites, please try again later.");
F()
},onUserNotLoggedIn:function(){F()
}})
}else{F()
}}})
}if(epg.config.siteId!=4&&epg.data.UserCookie.getCookie("skySSO","plain")&&epg.data.UserCookie.getCookie("skySSO","plain")!='""'){epg.tools.doAjax({url:epg.config.fileInitUser,data:A,dataType:"json",type:"get",success:function(E){if(E.result&&E.result.status!="error"){D.userPreferences=E.result.content;
epg.data.userPreferences=D.userPreferences
}C()
}})
}else{C()
}}})
},getProgram:function(F,C,B,E){if((C==0)&&epg.data._channelid){epg.data._channelid=0
}else{epg.data._channelid=C
}if((F==0)&&epg.data._showid){epg.data._showid=0
}else{epg.data._showid=F
}traceData("epg.data.getProgram");
if(!epg.data.events[C]||!epg.data.events[C][F]){var D={channelId:C,eventId:F};
D=epg.tools.cookieToData(D);
var A=function(){epg.tools.doAjax({url:epg.config.fileProgram,type:"get",data:D,dataType:"json",timeout:epg.config.ajaxTimeout,success:function(H){if(jQuery("#ajaxtimeoutdelaymodal").length>0||jQuery("#ajaxtimeoutfailuremodal").length>0){epg.ui.Alerts.modalDialogue.closeRawDialogue()
}function G(){epg.xml.parseProgram(H,F,C);
var K=getURLParam("epgSearchQuery");
if(!epg.data.events[C][F]){epg.bubble.closeBubble();
epg.ui.Alerts.modalDialogue.open.alreadyBroadcast();
return 
}var J=parseInt(epg.data.events[C][F].program.start,10)+(parseInt(epg.data.events[C][F].program.dur,10)*1000);
if(K&&epg.date.nixToEpg(J)===false){var I=false;
if(getURLParam("epgMethod")=="searchExact"){I=true
}epg.reloadEPG();
epg.search.ajaxSearch(K,I);
return 
}if(typeof (E)==="function"){traceData(E);
E(epg.data.events[C][F])
}}G()
},error:function(I,J,H){if(J=="timeout"){if(!this.tryCount){this.tryCount=0
}if(this.tryCount<epg.config.ajaxTimeoutRetryLimit){this.tryCount++;
if(jQuery("#ajaxtimeoutdelaymodal").length==0){epg.ui.Alerts.modalDialogue.open.ajaxTimeoutDelay()
}this.url=epg.config.fileProgram;
epg.tools.doAjax(this);
return 
}if(this.tryCount==epg.config.ajaxTimeoutRetryLimit){if(jQuery("#ajaxtimeoutdelaymodal").length>0||jQuery("#ajaxtimeoutfailuremodal").length>0){epg.ui.Alerts.modalDialogue.closeRawDialogue()
}var G=this;
G.url=epg.config.fileProgram;
epg.ui.Alerts.modalDialogue.open.ajaxTimeoutFailure(function(){epg.tools.doAjax(G)
})
}return 
}if(I.status==500){if(getURLParam("epgSearchQuery")===null){epg.bubble.closeBubble();
epg.ui.Alerts.modalDialogue.open.alreadyBroadcast();
return 
}}epg.bubble.properties.iShow=F;
epg.bubble.properties.iChannel=C;
if(getURLParam("epgSearchQuery")!==null){epg.search.ajaxSearch(getURLParam("epgSearchQuery"),true)
}else{epg.bubble.closeBubble();
epg.ui.Alerts.modalDialogue.open.alreadyBroadcast()
}}})
};
setTimeout(A,200)
}else{if(typeof (E)==="function"){traceData(E);
E(epg.data.events[C][F])
}}},getGrid:function(I,E,L){traceData("epg.data.getGrid");
var B=epg.data.grid;
var G=epg.data.channels;
var J=[];
var C=[];
if(epg.stateMachine.isFilter()){var H=epg.filtering.filters[epg.filtering.current_filter].genres.join(",");
for(var A=0,F=I.length;
A<F;
A++){if(G[I[A]]!==undefined){if(G[I[A]].filterGenre===H&&G[I[A]].filterDay===epg.date.currentDay){C[C.length]=I[A]
}else{G[I[A]].filterDay=epg.date.currentDay;
J[J.length]=I[A];
G[I[A]].filterGenre=H
}}}}else{for(var A=0,F=I.length;
A<F;
A++){if(B[E]&&!B[E][I[A]]){J[J.length]=I[A]
}else{C[C.length]=I[A]
}}}if(J.length>0){J=J.compact();
var D={channels:I.join(","),time:epg.date.dateToURL(epg.date.epgDate(E)),dur:1680,detail:2};
if(epg.stateMachine.isFilter()){D.genres=epg.filtering.filters[epg.filtering.current_filter].genres.join(",")
}epg.tools.doAjax({url:epg.config.fileGrid,data:D,type:"get",dataType:"json",success:function(O){epg.xml.parseChannel(O,E);
if(typeof (L)==="function"){for(var N=0,M=J.length;
N<M;
N++){traceData(L);
L(B[E][J[N]],J[N])
}}}})
}if(typeof (L)==="function"){for(var K=0,F=C.length;
K<F;
K++){traceData(L);
if(B[E]){L(B[E][C[K]],C[K])
}}}},getList:function(I,E,L,K,C){traceData("epg.data.getList");
if(isNaN(E)||E>7||E<0){E=0
}var H=epg.data.list;
var G=epg.data.channels;
var J=[];
var B=[];
for(var A=0,F=I.length;
A<F;
A++){if(epg.data.requestType==1||!H[E]||!H[E][I[A]]){J[J.length]=I[A]
}else{B[B.length]=I[A]
}}J=B.concat(J);
if(J.length>0){var D={channels:J.join(","),time:C||epg.date.dateToURL(epg.date.epgDate(E)),dur:K||1560,detail:K?1:2};
if(epg.stateMachine.isFilter()){D.genres=epg.filtering.filters[epg.filtering.current_filter].genres.join(",")
}epg.tools.doAjax({url:epg.config.fileGrid,type:epg.config.sRPCMethod,data:D,dataType:"json",success:function(N){epg.xml.parseList(N,E);
var P=epg.data.list;
if(typeof (L)==="function"){for(var O=0,M=I.length;
O<M;
O++){traceData(L);
L(P[E][I[O]],O,I.length,I[O])
}}}})
}},getFilterGenres:function(A){traceData("epg.data.getFilterGenres");
epg.tools.doAjax({url:epg.config.fileFilterGenres,type:epg.config.sRPCMethod,data:{},dataType:"json",type:"get",success:function(B){epg.xml.parseFilterGenres(B);
if(A){traceData(A);
A()
}}})
},getFilterChannels:function(B,C){traceData("epg.data.getFilterChannels");
var A=function(){var D={genres:epg.filtering.filters[B].genres.join(","),time:C};
D=epg.tools.cookieToData(D);
epg.tools.doAjax({url:epg.config.fileFilterChannels,type:epg.config.sRPCMethod,data:D,dataType:"json",type:"get",success:function(E){epg.xml.parseFilterChannels(E,B)
}})
};
if(epg.stateMachine.isAnyGrid()){epg.grid.addLoader(A)
}else{A()
}},getPlayState:function(F,C,E,B){var D="";
F=epg.date.nixToDate(F);
var A=new Date(F);
A.setTime(A.getTime()+(parseInt(C,10)*1000));
now=new Date();
now=new Date(Date.parse(now)+epg.date.iLocalTimeOffset);
if(now>=F&&now<=A){D="PLAYING_NOW"
}if(A<now){D="FINISHED"
}if(F>now){D="NOT_STARTED"
}if(this.grid&&this.grid[0]&&this.grid[0][E]&&this.grid[0][E][B]&&this.grid[0][E][B].blackout=="true"){D="BLACKOUT"
}return D
}};epg.grid={aLoadCache:[],currentChannel:false,currentGridItem:null,gridWithBubbleOffsetX:epg.config.grid.gridWithBubbleOffsetX,gridWithBubbleOffsetY:epg.config.grid.gridWithBubbleOffsetY,dragging:false,scrolling:false,bFoundFilterShow:false,bIsFirstFilterGridView:true,aFirstFilterShow:[],init:function(){traceGrid("init",arguments);
Event.observe($(epg.config.eSchedule),"mousedown",epg.grid.startScheduleDrag);
Event.observe($(epg.config.eChannels),"mousedown",epg.grid.startChannelDrag);
Event.observe($(epg.config.eTimeline),"mousedown",epg.grid.startScheduleDrag);
Event.observe(document,"mouseup",epg.grid.docMouseUp);
epg.grid.addLoader(function(){epg.grid.makeTimeBar(0)
});
Event.observe($("epg_scrollE"),"mousedown",epg.grid.scrollEast);
Event.observe($("epg_scrollE"),"mousedown",epg.grid.beginScroll);
Event.observe($("epg_scrollW"),"mousedown",epg.grid.scrollWest);
Event.observe($("epg_scrollW"),"mousedown",epg.grid.beginScroll);
Event.observe($("epg_scrollN"),"mousedown",epg.grid.scrollNorth);
Event.observe($("epg_scrollN"),"mousedown",epg.grid.beginScroll);
Event.observe($("epg_scrollS"),"mousedown",epg.grid.scrollSouth);
Event.observe($("epg_scrollS"),"mousedown",epg.grid.beginScroll);
Event.observe($("epg_scrollE"),"mouseout",epg.grid.cancelScroll);
Event.observe($("epg_scrollW"),"mouseout",epg.grid.cancelScroll);
Event.observe($("epg_scrollN"),"mouseout",epg.grid.cancelScroll);
Event.observe($("epg_scrollS"),"mouseout",epg.grid.cancelScroll);
Event.observe($("epg_scrollE"),"mouseup",epg.grid.cancelScroll);
Event.observe($("epg_scrollW"),"mouseup",epg.grid.cancelScroll);
Event.observe($("epg_scrollN"),"mouseup",epg.grid.cancelScroll);
Event.observe($("epg_scrollS"),"mouseup",epg.grid.cancelScroll);
epg.grid.initLoaded=true;
if(!epg.config.api.channels.categories.enabled){epg.config.iTabHeight=0
}Event.observe($(epg.config.eTimeline),"mousemove",epg.grid.getShowHover);
Event.observe($(epg.config.eTimeline),"mouseup",epg.grid.getShowClick);
Event.observe($(epg.config.eChannels),"mouseover",epg.grid.channelAction);
Event.observe($(epg.config.eChannels),"mouseup",epg.grid.getChannelClick);
Event.observe($(epg.config.eWrapper),"mouseover",epg.grid.showAction);
Event.observe($(epg.config.eWrapper),"mousedown",epg.grid.showAction);
Event.observe($(epg.config.eWrapper),"mouseup",epg.grid.getShowClick);
jQuery("#"+epg.config.eWrapper).css("cursor","url(images/common/cur/grab.cur), -moz-grab")
},channelAction:function(B){traceGrid("channelAction",arguments);
if(epg.grid.dragging!==true&&epg.grid.scrolling!==true){var A=Event.element(B);
var C;
if(A.id){C=A.id.match(/channel_([0-9]{1,})/,"$1");
if(C&&C[1]){epg.grid.iChannelHoverId=parseInt(C[1],10)
}}else{if(A.parentNode.id){C=A.parentNode.id.match(/channel_([0-9]{1,})/,"$1");
if(C&&C[1]){epg.grid.iChannelHoverId=parseInt(C[1],10)
}}else{epg.grid.iChannelHoverId=undefined
}}}},getChannelClick:function(A){traceGrid("getChannelClick",arguments);
if(epg.grid.aLoaderStatus===false){epg.grid.addLoader(function(){if(epg.grid.dragging!==true&&epg.grid.scrolling!==true&&epg.grid.iChannelHoverId!==undefined){epg.grid.adding=true;
if(epg.config.general.enable_favourites){if(epg.data.favourites[epg.grid.iChannelHoverId]){epg.data.removeFavourite(epg.grid.iChannelHoverId)
}else{epg.data.addFavourite(epg.grid.iChannelHoverId)
}}epg.bubble.closeBubble()
}})
}},docMouseUp:function(A){traceGrid("docMouseUp",arguments);
epg.grid.stopDrag();
jQuery("#"+epg.config.eWrapper).css("cursor","url(images/common/cur/grab.cur), -moz-grab");
Event.stopObserving(document,"mousemove",epg.grid.trackChannelDrag);
Event.stopObserving(document,"mousemove",epg.grid.trackScheduleDrag);
Event.stopObserving(document,"mousemove",epg.grid.trackTimelineDrag);
document.onselectstart=null
},showAction:function(F,E){traceGrid("showAction",arguments);
if(epg.grid.dragging!==true&&epg.grid.scrolling!==true){var B=Event.element(F);
var A=B.tagName;
if(A!=="DIV"){B=B.parentNode;
if(B.tagName!=="DIV"){B=B.parentNode
}}if(epg.grid.oldHoverElement){epg.grid.oldHoverElement.removeClass("hover");
epg.grid.oldHoverElement=null
}var D=B.className.match(/nextDay/);
if(B&&B.id&&B!=document&&!D){var H=B.id.match(/([a-z]{1,})_([0-9]{1,})_([0-9]{1,})/,"$1");
if(H!==null&&epg.grid.iShowHoverId===undefined){epg.grid.iShowHoverId=[H[1],H[2],H[3]]
}if(H!==null&&document.getElementById(H[1]+"_"+H[2]+"_"+H[3])){jQuery(B).addClass("hover");
epg.grid.oldHoverElement=jQuery(B);
if(epg.data.grid[epg.date.currentDay]&&epg.data.grid[epg.date.currentDay][H[2]]){var G=epg.data.grid[epg.date.currentDay][H[2]][H[3]];
var C=(G.dur/60);
if(epg.config.general.infoPane_trigger==0||E){epg.ui.infoPane.displayInfo(G.title,epg.date.timeSTR(G.start),Math.round(C)+"min",G.shortDesc,epg.data.channels[G.channelid].title,true,G)
}epg.grid.iShowHoverId=[H[1],H[2],H[3]]
}}}else{if(B&&!B.id&&epg.grid.iShowHoverId!==undefined){jQuery("#"+epg.grid.iShowHoverId[0]+"_"+epg.grid.iShowHoverId[1]+"_"+epg.grid.iShowHoverId[2]).removeClass("hover");
epg.grid.iShowHoverId=undefined
}else{if(D&&B.hasNextDay===undefined){if(epg.config.general.infoPane_trigger==0){Event.observe($(B),"mousemove",epg.grid.getShowHover)
}B.hasNextDay=true
}}}}},getShowClick:function(A){traceGrid("getShowClick",arguments);
if(epg.grid.dragging!==true&&epg.grid.scrolling!==true&&epg.config.api.bubble.enabled&&epg.grid.iShowHoverId&&document.getElementById(epg.grid.iShowHoverId[0]+"_"+epg.grid.iShowHoverId[1]+"_"+epg.grid.iShowHoverId[2])&&!epg.bubble.properties.bubbleOver){jQuery("#epg_info_text img.rating").fadeOut();
if(epg.data.grid[epg.date.currentDay]&&epg.data.grid[epg.date.currentDay][epg.grid.iShowHoverId[1]][epg.grid.iShowHoverId[2]]){var I=epg.data.grid[epg.date.currentDay][epg.grid.iShowHoverId[1]][epg.grid.iShowHoverId[2]];
if(I.title.substring(0,2)===".."){var N=epg.data.grid[epg.date.currentDay][epg.grid.iShowHoverId[1]];
var E=0;
var B;
for(kShow in N){if(N[kShow].start>epg.data.grid[epg.date.currentDay][epg.grid.iShowHoverId[1]][epg.grid.iShowHoverId[2]].start){if(N[kShow].start<E||E===0){if(N[kShow].title.substring(0,2)!==".."){B=N[kShow];
E=N[kShow].start;
break
}}}}if(E===0){var D=I.title.match(/am$/)?true:false;
var C=I.title.match(/([0-9]{1,2})\.([0-9]{2})[apm]{2}$/);
var O=0;
if(D===true){O=epg.date.dateToNix(epg.date.epgDate(epg.date.currentDay+1))+(C[1]*60*60*1000)+(C[2]*60*1000)
}else{O=epg.date.dateToNix(epg.date.epgDate(epg.date.currentDay+1))+((C[1]+12)*60*60*1000)+(C[2]*60*1000)
}epg.data.getGrid([epg.grid.iShowHoverId[1]],epg.date.nixToEpg(O),function(S,P){var R=0;
for(kShow in S){if(S[kShow].start<R||R===0){if(S[kShow].title.substring(0,2)!==".."){var Q=S[kShow].eventid;
break
}}}epg.grid.gotoEvent(Q,P,O,true)
})
}else{epg.grid.gotoEvent(B.eventid,B.channelid,E,true)
}}else{var G=document.getElementById(epg.grid.iShowHoverId[0]+"_"+epg.grid.iShowHoverId[1]+"_"+epg.grid.iShowHoverId[2]);
var K=document.getElementById("channel_"+epg.grid.iShowHoverId[1]);
var J=epg.date.epgDateNix(epg.date.currentDay);
var L=epg.date.epgDateNix(epg.date.currentDay+1);
var H=G.offsetLeft;
var F=G.parentNode.offsetTop+G.parentNode.parentNode.offsetTop;
var M=epg.grid.transBubblePosition([H,F]);
jQuery("#gridSchedule .channel .highlighted").parent().removeClass("selected");
jQuery("#gridSchedule .channel .highlighted").removeClass("highlighted");
jQuery(G).addClass("highlighted");
jQuery("#epg_key .channel.selected").removeClass("selected");
jQuery(K).addClass("selected");
jQuery(G).parent().addClass("selected");
epg.grid.scrollTo(M[0]+epg.grid.gridWithBubbleOffsetX,M[1]-$(epg.config.eTimeline).clientHeight+epg.grid.gridWithBubbleOffsetY,1);
epg.bubble.closeBubble();
epg.bubble.newBubble(M,"vertical",epg.grid.iShowHoverId[2],epg.grid.iShowHoverId[1])
}}}},hoverTimeout:null,getShowHover:function(R){traceGrid("getShowHover",arguments);
if(epg.grid.dragging!==true&&epg.grid.scrolling!==true&&epg.grid.hoverTimeout===null&&!jQuery(R.target).closest("div#epg_bubble")[0]){function N(X,V,U){var W=X?X:0;
if(V&&(!W||(W>V))){W=V
}return U&&(!W||(W>U))?U:W
}function L(){return N(window.pageXOffset?window.pageXOffset:0,document.documentElement?document.documentElement.scrollLeft:0,document.body?document.body.scrollLeft:0)
}function J(){return N(window.pageYOffset?window.pageYOffset:0,document.documentElement?document.documentElement.scrollTop:0,document.body?document.body.scrollTop:0)
}epg.grid.hoverTimeout=true;
var T=epg.data.epggenre;
var H;
var Q=epg.data.grid;
var G=epg.date.currentDay;
var M;
var C;
var B;
var P=false;
var K=$(epg.config.eSchedule).scrollLeft;
var F=$(epg.config.eSchedule).scrollTop;
var D=$(epg.config.eSchedule).scrollLeft+$(epg.config.eSchedule).clientWidth;
if(epg.stateMachine.isextendedGrid()){iItemHeight=epg.config.iExtendedHeight
}else{if(!epg.stateMachine.isextendedGrid()){iItemHeight=epg.config.iGridHeight
}}var I=Event.pointerY(R);
var E=Event.pointerX(R);
var A=$(epg.config.eSchedule).viewportOffset();
A[0]=E-A[0]-L();
A[1]=I-A[1]-J();
for(keyGenre in T){if(P===false&&T[keyGenre].epgTop<=A[1]&&(T[keyGenre].epgTop+$("genreKey"+keyGenre).clientHeight)>=A[1]){if(keyGenre==="fave"){H=epg.data.favourites;
B="favourite"
}else{if(keyGenre==="all"){H=epg.data.filtered;
B="filter"
}else{H=epg.data.channels;
B="grid"
}}for(iChannel in H){if(P===false&&H[iChannel].epggenre===T[keyGenre].genreid&&A[1]>=(T[keyGenre].epgTop+H[iChannel].epgTop)&&A[1]<=((T[keyGenre].epgTop+H[iChannel].epgTop)+iItemHeight)){M=Q[G][iChannel];
for(iGridShow in M){if(A[0]<=(M[iGridShow].epgLeft+M[iGridShow].epgWidth)&&A[0]>=M[iGridShow].epgLeft){if(epg.grid.iShowHoverId===undefined){epg.grid.iShowHoverId=[B,iChannel,iGridShow]
}if(document.getElementById(B+"_"+iChannel+"_"+iGridShow)&&(epg.grid.iShowHoverId[0]!==B||epg.grid.iShowHoverId[1]!==iChannel||epg.grid.iShowHoverId[2]!==iGridShow)){if(epg.grid.iShowHoverId&&document.getElementById(epg.grid.iShowHoverId[0]+"_"+epg.grid.iShowHoverId[1]+"_"+epg.grid.iShowHoverId[2])){$(document.getElementById(epg.grid.iShowHoverId[0]+"_"+epg.grid.iShowHoverId[1]+"_"+epg.grid.iShowHoverId[2])).removeClassName("hover")
}$(B+"_"+iChannel+"_"+iGridShow).addClassName("hover");
var S=epg.data.grid[epg.date.currentDay][iChannel][iGridShow];
var O=(S.dur/60);
if(epg.config.general.infoPane_trigger==0){epg.ui.infoPane.displayInfo(S.title,epg.date.timeSTR(S.start),Math.round(O)+"min",S.shortDesc,false,S)
}epg.grid.iShowHoverId=[B,iChannel,iGridShow]
}P=true
}}}}}}}else{if(epg.grid.hoverTimeout===true){epg.grid.hoverTimeout=false;
setTimeout(function(){epg.grid.hoverTimeout=null
},50)
}}},startScheduleDrag:function(A){traceGrid("startScheduleDrag",arguments);
jQuery(epg.config.eTimeline).stop();
jQuery(epg.config.eSchedule).stop();
jQuery(epg.config.eChannels).stop();
jQuery("#"+epg.config.eWrapper).css("cursor","url(images/common/cur/grabbing.cur), -moz-grabbing");
if(epg.bubble.properties.bubbleOver!=1){var B=$(epg.config.eSchedule);
document.onselectstart=epg.grid.cancelSelect;
B.iStartX=Event.pointerX(A);
B.iStartY=Event.pointerY(A);
B.iStartScrollX=B.scrollLeft;
B.iStartScrollY=B.scrollTop;
Event.observe(document,"mousemove",epg.grid.trackScheduleDrag)
}},startChannelDrag:function(A){traceGrid("startChannelDrag",arguments);
jQuery(epg.config.eTimeline).stop();
jQuery(epg.config.eSchedule).stop();
jQuery(epg.config.eChannels).stop();
var B=$(epg.config.eSchedule);
document.onselectstart=epg.grid.cancelSelect;
B.iStartY=Event.pointerY(A);
B.iStartScrollY=B.scrollTop;
Event.observe(document,"mousemove",epg.grid.trackChannelDrag)
},trackScheduleDrag:function(C){traceGrid("trackScheduleDrag",arguments);
var D=document.getElementById(epg.config.eSchedule);
if(D.iStartX==Event.pointerX(C)&&D.iStartY==Event.pointerY(C)){return false
}var A=D.iStartScrollX+(D.iStartX-Event.pointerX(C));
var B=D.iStartScrollY+(D.iStartY-Event.pointerY(C));
epg.grid.dragging=true;
D.scrollLeft=A;
D.scrollTop=B;
document.getElementById(epg.config.eTimeline).scrollLeft=A;
document.getElementById(epg.config.eChannels).scrollTop=B
},stopDrag:function(B){traceGrid("stopDrag",arguments);
if(epg.grid.dragging===true){epg.grid.setGridMicroTime();
var A=epg.grid.gridMicroTime();
epg.date.setCurrentTime(epg.date.nixToDate(epg.date.epgDateNix(epg.date.currentDay)+A),"stopDrag");
traceCurrentTime(9);
Event.stopObserving($(epg.config.eSchedule),"mousemove",epg.grid.trackScheduleDrag);
Event.stopObserving($(epg.config.eChannels),"mousemove",epg.grid.trackChannelDrag);
Event.stopObserving($(epg.config.eTimeline),"mousemove",epg.grid.trackTimelineDrag);
epg.grid.triggerNextDay(A);
epg.grid.dragging=false;
epg.grid.hitboxPageChangeTest()
}},currentPage:0,pageWidth:300,hitboxPageChangeTest:function(){if(epg.stateMachine.isAnyGrid()){epg.grid.getUpdate();
var B=$(epg.config.eSchedule);
var A=Math.round(Math.abs(B.scrollLeft)/epg.grid.pageWidth)+Math.round(Math.abs(B.scrollTop)/epg.grid.pageWidth);
if(A!==epg.grid.currentPage){epg.hitbox.send("datadrag")
}epg.grid.currentPage=A
}},cancelScroll:function(){traceGrid("cancelScroll",arguments);
jQuery(".epg_scrollButton").css("opacity",1);
epg.grid.scrollDistance=1;
epg.grid.setGridMicroTime();
clearTimeout(epg.grid.timerScroll);
if(epg.grid.scrolling===true){var A=epg.grid.gridMicroTime();
epg.date.setCurrentTime(epg.date.nixToDate(epg.date.epgDateNix(epg.date.currentDay)+A),"cancel");
traceCurrentTime(8);
epg.grid.triggerNextDay(A);
epg.grid.scrolling=false;
epg.grid.getUpdate();
epg.grid.hitboxPageChangeTest()
}return false
},timerScroll:null,scrollDistance:1,beginScroll:function(){epg.grid.scrolling=true
},scrollNorth:function(){traceGrid("scrollNorth",arguments);
$(epg.config.eSchedule).scrollTop+=epg.grid.scrollDistance;
$(epg.config.eChannels).scrollTop+=epg.grid.scrollDistance;
clearTimeout(epg.grid.timerScroll);
epg.grid.timerScroll=setTimeout(epg.grid.scrollNorth,1000/epg.config.animation_frameRate);
if(epg.grid.scrollDistance<40){jQuery("#epg_scrollN").css("opacity",0.5);
epg.grid.scrollDistance=epg.grid.scrollDistance+1
}return false
},scrollSouth:function(){traceGrid("scrollSouth",arguments);
$(epg.config.eSchedule).scrollTop-=epg.grid.scrollDistance;
$(epg.config.eChannels).scrollTop-=epg.grid.scrollDistance;
clearTimeout(epg.grid.timerScroll);
epg.grid.timerScroll=setTimeout(epg.grid.scrollSouth,1000/epg.config.animation_frameRate);
if(epg.grid.scrollDistance<40){jQuery("#epg_scrollS").css("opacity",0.5);
epg.grid.scrollDistance=epg.grid.scrollDistance+1
}return false
},scrollEast:function(){traceGrid("scrollEast",arguments);
$(epg.config.eSchedule).scrollLeft-=epg.grid.scrollDistance;
$(epg.config.eTimeline).scrollLeft-=epg.grid.scrollDistance;
clearTimeout(epg.grid.timerScroll);
epg.grid.timerScroll=setTimeout(epg.grid.scrollEast,1000/epg.config.animation_frameRate);
if(epg.grid.scrollDistance<40){jQuery("#epg_scrollE").css("opacity",0.5);
epg.grid.scrollDistance=epg.grid.scrollDistance+1
}return false
},scrollWest:function(){traceGrid("scrollWest",arguments);
$(epg.config.eSchedule).scrollLeft+=epg.grid.scrollDistance;
$(epg.config.eTimeline).scrollLeft+=epg.grid.scrollDistance;
clearTimeout(epg.grid.timerScroll);
epg.grid.timerScroll=setTimeout(epg.grid.scrollWest,1000/epg.config.animation_frameRate);
if(epg.grid.scrollDistance<40){jQuery("#epg_scrollW").css("opacity",0.5);
epg.grid.scrollDistance=epg.grid.scrollDistance+1
}return false
},trackChannelDrag:function(B){traceGrid("trackChannelDrag",arguments);
var A=$(epg.config.eSchedule).iStartScrollY+($(epg.config.eSchedule).iStartY-Event.pointerY(B));
epg.grid.dragging=true;
$(epg.config.eSchedule).scrollTop=A;
$(epg.config.eChannels).scrollTop=A
},startTimelineDrag:function(A){traceGrid("startTimelineDrag",arguments);
var B=$(epg.config.eSchedule);
document.onselectstart=epg.grid.cancelSelect;
B.iStartX=Event.pointerX(A);
B.iStartScrollX=B.scrollLeft;
Event.observe(document,"mousemove",epg.grid.trackTimelineDrag)
},trackTimelineDrag:function(B){traceGrid("trackTimelineDrag",arguments);
var A=$(epg.config.eSchedule).iStartScrollX+($(epg.config.eSchedule).iStartX-Event.pointerX(B));
epg.grid.dragging=true;
$(epg.config.eSchedule).scrollLeft=A;
$(epg.config.eTimeline).scrollLeft=A
},cancelSelect:function(A){return false
},gotoDay:function(A){traceGrid("gotoDay",arguments);
epg.grid.gotoTime(epg.date.epgDateNix(epg.date.nixToEpg(A))+epg.grid.gridMicroTime())
},gotoTime:function(G){traceGrid("gotoTime",arguments);
var E=epg.date.nixToEpg(G);
var D;
if(epg.date.currentDay!==E){var B=epg.data.channels;
var F=epg.data.promos;
var C=epg.date.currentDay;
epg.date.currentDay=E;
D=(-(((epg.date.epgDateNix(E)+epg.grid.gridMicroTime())-G)*(epg.config.iChannelWidth/(24*60*60*1000))));
epg.grid.scrollTo($(epg.config.eSchedule).scrollLeft+D,false,2);
var A=epg.date.nixToDate(G);
epg.date.setCurrentTime(A.getTime(),"gotoTime");
traceCurrentTime(7);
epg.bubble.closeBubble();
epg.grid.makeTimeBar(epg.date.currentDay);
return D
}else{D=(-(((epg.date.epgDateNix(E)+epg.grid.gridMicroTime())-G)*(epg.config.iChannelWidth/(24*60*60*1000))));
epg.grid.scrollTo($(epg.config.eSchedule).scrollLeft+D,false,2);
return D
}},gridMicroTime:function(){traceGrid("gridMicroTime",arguments);
if(epg.grid.microTime===0){return epg.grid.setGridMicroTime()
}else{return epg.grid.microTime||epg.grid.setGridMicroTime()
}},setGridMicroTime:function(){traceGrid("setGridMicroTime",arguments);
epg.grid.iScrollLeft=$(epg.config.eSchedule).scrollLeft;
epg.grid.iScrollRight=epg.grid.iScrollLeft+$(epg.config.eSchedule).clientWidth;
var A=(epg.grid.iScrollLeft/epg.config.iChannelWidth)*(24*60*60*1000);
if(A>=(24*60*60*1000)){A=(24*60*59*1000)
}epg.grid.microTime=A;
return A
},microToPixel:function(A){traceGrid("microToPixel",arguments);
return(epg.config.iChannelWidth/(24*60*60*1000))*A
},gotoChannel:function(A){traceGrid("gotoChannel",arguments);
epg.grid.scrollTo(false,epg.grid.channelPosition(A)-40,2)
},gotoEvent:function(I,H,C,L){traceGrid("gotoEvent",arguments);
var E=epg.date.nixToEpg(C);
var A=$(epg.config.eSchedule).clientWidth;
if(epg.date.currentDay!==E){epg.date.currentDay=E;
epg.grid.setChannelHeight();
var K=epg.date.nixToDate(C);
epg.date.setCurrentTime(K.getTime(),"gotoEvent");
traceCurrentTime(6)
}epg.grid.currGridItem="#grid_"+H+"_"+I;
var B="#grid_"+H+"_"+I;
var F=document.getElementById("channel_"+H);
var D=epg.grid.eventPosition(I,H,C);
var G=epg.grid.transBubblePosition(D);
var J=0;
if(L){epg.grid.scrollTo(G[0]+epg.grid.gridWithBubbleOffsetX,G[1]-$(epg.config.eTimeline).clientHeight+epg.grid.gridWithBubbleOffsetY,2,null,function(){});
epg.bubble.newBubble(G,"vertical",I,H)
}else{epg.grid.scrollTo(G[0],G[1]-$(epg.config.eTimeline).clientHeight-10,2,null,function(){})
}jQuery("#gridSchedule .channel .highlighted").parent().removeClass("selected");
jQuery("#gridSchedule .channel .highlighted").removeClass("highlighted");
jQuery(B).addClass("highlighted");
jQuery("#epg_key .channel.selected").removeClass("selected");
jQuery(F).addClass("selected");
jQuery(B).parent().addClass("selected")
},eventPosition:function(D,B,E){traceGrid("eventPosition",arguments);
var C=epg.date.nixToEpg(E);
var A=epg.grid.microToPixel(E-epg.date.epgDateNix(C));
return[A,epg.grid.channelPosition(B)]
},transBubblePosition:function(A){traceGrid("transBubblePosition",arguments);
iBubbleXOffset=epg.config.bubble.iBubbleXOffset===undefined?-230:epg.config.bubble.iBubbleXOffset;
iBubbleYOffset=epg.config.bubble.iBubbleYOffset===undefined?-35:epg.config.bubble.iBubbleYOffset;
var B=0;
if(epg.stateMachine.isSearch()){B=30
}if((A[0]-B)<iBubbleXOffset){A[0]=iBubbleXOffset
}else{A[0]=A[0]-B
}if(epg.config.grid.timelineInsideGrid){if(A[1]<($(epg.config.eTimeline).clientHeight)){A[1]=$(epg.config.eTimeline).clientHeight
}}return A
},channelPosition:function(A){traceGrid("channelPosition",arguments);
if(epg.stateMachine.isFilter()){if(epg.config.general.enable_favourites&&epg.data.favourites[A]!==undefined){return epg.data.favourites[A].epgTop+epg.data.epggenre.fave.epgTop
}else{if(epg.data.filtered[A]){return epg.data.filtered[A].epgTop+epg.data.epggenre[epg.data.filtered[A].epggenre].epgTop
}}}else{if(epg.data.channels[A]){if(epg.config.general.enable_favourites&&epg.data.favourites[A]!==undefined){return epg.data.favourites[A].epgTop+epg.data.epggenre.fave.epgTop
}else{return epg.data.channels[A].epgTop+epg.data.epggenre[epg.data.channels[A].epggenre].epgTop
}}else{return 0
}}},scrollTo:function(G,E,H,J,D){traceGrid("scrollTo",arguments);
var F=$(epg.config.eSchedule).scrollLeft;
var I=$(epg.config.eSchedule).scrollTop;
var A=$(epg.config.eSchedule).clientWidth;
var B=epg.config.iChannelWidth+(epg.config.iChannelWidth/24*4);
if(G>(B-A)){G=(B-A)
}else{if(G<0){G=0
}}if(E===false&&G!==false&&F===G){epg.grid.scrolling=false;
epg.grid.setChannelHeight();
epg.grid.getUpdate()
}else{if((E!==false&&I===E)&&((G==0)||(G!==false&&F===G))){epg.grid.scrolling=false;
epg.grid.setChannelHeight();
epg.grid.getUpdate()
}else{var C={};
if(G!==false&&F!==G){C.scrollLeft=G
}if(E!==false&&I!==E){C.scrollTop=E
}jQuery("#"+epg.config.eSchedule+", #"+epg.config.eTimeline+", #"+epg.config.eChannels).animate(C,(H*1000),"swing",function(K){epg.grid.setGridMicroTime();
epg.grid.scrolling=false;
epg.grid.setChannelHeight();
epg.grid.getUpdate();
epg.date.setCurrentTime(epg.date.nixToDate(epg.date.epgDateNix(epg.date.currentDay)+epg.grid.gridMicroTime()),"scrollTo");
traceCurrentTime(5);
epg.grid.triggerNextDay();
epg.search.lockGotoEvent=false
});
epg.grid.scrolling=true
}}},jumpTo:function(C,B,D,A){traceGrid("jumpTo",arguments);
if(C){$(epg.config.eSchedule).scrollLeft=C;
$(epg.config.eTimeline).scrollLeft=C;
epg.grid.setGridMicroTime();
epg.date.setCurrentTime(epg.date.nixToDate(epg.date.epgDateNix(epg.date.currentDay)+epg.grid.gridMicroTime()),"jumpTo");
traceCurrentTime(4)
}if(B||B==0){$(epg.config.eSchedule).scrollTop=B;
$(epg.config.eChannels).scrollTop=B
}if(D===undefined||D===null){epg.grid.getUpdate(A)
}},jumpToTime:function(H,B){traceGrid("jumpToTime",arguments);
var F=epg.date.nixToEpg(H);
var E;
if(epg.date.currentDay!==F){var C=epg.data.channels;
var G=epg.data.promos;
var D=epg.date.currentDay;
epg.date.currentDay=F;
E=(-(((epg.date.epgDateNix(F)+epg.grid.gridMicroTime())-H)*(epg.config.iChannelWidth/(24*60*60*1000))));
epg.grid.setChannelHeight();
epg.grid.jumpTo($(epg.config.eSchedule).scrollLeft+E,null,null,false);
if(E===0){epg.grid.getUpdate(B)
}var A=epg.date.nixToDate(H);
epg.date.setCurrentTime(A.getTime(),"jumpToTime");
traceCurrentTime(3);
epg.bubble.closeBubble();
return E
}else{E=(-(((epg.date.epgDateNix(F)+epg.grid.gridMicroTime())-H)*(epg.config.iChannelWidth/(24*60*60*1000))));
epg.grid.jumpTo($(epg.config.eSchedule).scrollLeft+E,false,null,B);
return E
}},makeTimeBar:function(B){traceGrid("makeTimeBar",arguments);
var A='<div class="epg_listRowTime_header"style="position:absolute;left:XXXleftXXX;width:XXXwidthXXX"><div class="epg_channelTime"><span>XXXtimeXXX</span></div></div>';
var D=(epg.config.iChannelWidth/24);
var G,F="";
var E=new Date(epg.date.epgDate(B));
for(var C=0;
C<28;
C++){G=(D*C)+(D/2)+26+"px";
F+=(A.replace(/XXXtimeXXX/,epg.date.timeSTR(E.getTime())).replace(/XXXleftXXX/,G).replace(/XXXwidthXXX/,(D-20)+"px"));
E.setTime(E.getTime()+(60*60*1000))
}$(epg.config.eTimeline).innerHTML=F;
$(epg.config.eTimeline).scrollLeft=$(epg.config.eSchedule).scrollLeft
},setGridClass:function(){traceGrid("setGridClass",arguments);
if(epg.stateMachine.isextendedGrid()){Element.addClassName($(epg.config.eWrapper),epg.config.extendedGrid);
Element.addClassName($(epg.config.eChannels),epg.config.sExtendedGridChannelsCSS)
}else{if(!epg.stateMachine.isextendedGrid()){Element.removeClassName($(epg.config.eWrapper),epg.config.extendedGrid);
Element.removeClassName($(epg.config.eChannels),epg.config.sExtendedGridChannelsCSS)
}}},makeGenres:function(){traceGrid("makeGenres",arguments);
var D=epg.data.epggenre;
var C=epg.config.iTabHeight;
var F=epg.grid.modifiedChannelWidth()+(epg.config.iChannelWidth/24*4);
var A;
var B="";
var E="";
if(C-1<0){A=0
}else{A=C-1
}if(jQuery.browser.chrome||jQuery.browser.msie9){if(epg.stateMachine.isFilter()){epg.tools.arrayMapEach(epg.data.genremap,D,function(H,G){B+='<div class="genre" id="genreKey'+H+'"><div class="showHide" style="height:'+A+'px;"><span class="label">'+D[H].name+"</span></div></div>";
E+='<div class="genre" id="genre'+H+'" style="width:'+F+'px;"><div class="showHide" style="width:'+F+"px;height:"+A+'px;"></div></div>'
})
}else{epg.tools.arrayMapEach(epg.data.genremap,D,function(H,G){B+='<div class="genre" id="genreKey'+H+'"><div class="showHide" onmouseup="epg.grid.genreAccordion(\''+H+'\',this);" style="height:'+A+'px;"><span class="label">'+D[H].name+"</span></div></div>";
E+='<div class="genre" id="genre'+H+'" style="width:'+F+'px;"><div class="showHide" style="width:'+F+"px;height:"+A+'px;"></div></div>'
})
}}else{if(epg.stateMachine.isFilter()){for(kEpggenre in D){B+='<div class="genre" id="genreKey'+kEpggenre+'"><div class="showHide" style="height:'+A+'px;"><span class="label">'+D[kEpggenre].name+"</span></div></div>";
E+='<div class="genre" id="genre'+kEpggenre+'" style="width:'+F+'px;"><div class="showHide" style="width:'+F+"px;height:"+A+'px;"></div></div>'
}}else{for(kEpggenre in D){B+='<div class="genre" id="genreKey'+kEpggenre+'"><div class="showHide" onmouseup="epg.grid.genreAccordion(\''+kEpggenre+'\',this);" style="height:'+A+'px;"><span class="label">'+D[kEpggenre].name+"</span></div></div>";
E+='<div class="genre" id="genre'+kEpggenre+'" style="width:'+F+'px;"><div class="showHide" style="width:'+F+"px;height:"+A+'px;"></div></div>'
}}}paddingBottom=epg.config.grid.paddingBottom;
if(jQuery.browser.msie){paddingBottom+=15
}$(epg.config.eChannels).innerHTML=B+'<div style="height: '+paddingBottom+'px;">&nbsp;</div>';
$(epg.config.eWrapper).innerHTML=E+'<div style="height: '+paddingBottom+'px;">&nbsp;</div>';
for(kEpggenre in D){D[kEpggenre].genreKey=$("genreKey"+kEpggenre);
D[kEpggenre].genre=$("genre"+kEpggenre)
}},setupFiltering:function(){traceGrid("setupFiltering",arguments);
var A=epg.data.channels;
var D=epg.data.filtered;
if(epg.stateMachine.isFilter()){if(epg.filtering.filters[epg.filtering.current_filter].genres.length>0){$(epg.config.eSchedule).addClassName("filtered")
}else{$(epg.config.eSchedule).removeClassName("filtered")
}epg.grid.currentChannel=false;
delete epg.data.filtered;
epg.data.filtered={};
var B=epg.filtering.filters[epg.filtering.current_filter].channels;
try{B=B.sortBy(function(E){return parseInt(epg.data.channels[E].channelno,10)
})
}catch(C){}if(B&&B.length){for(kFilter=0;
kFilter<B.length;
kFilter++){if(A[B[kFilter]]){epg.data.filtered[B[kFilter]]=Object.clone(A[B[kFilter]]);
epg.data.filtered[B[kFilter]].epggenre="all";
epg.grid.stripChannel(epg.data.filtered[B[kFilter]])
}}}}else{$(epg.config.eSchedule).removeClassName("filtered");
for(kFilter in D){epg.grid.removeChannel(D[kFilter]);
delete D[kFilter]
}}},setInitView:function(){traceGrid("setInitView",arguments);
var A=epg.config.deepLinking.checkDeepLink(true);
var B;
if(A===false){if(epg.stateMachine.bubble===1){if(epg.data.grid[epg.date.currentDay]&&epg.data.grid[epg.date.currentDay][epg.bubble.properties.iChannel]){B=epg.grid.channelPosition(epg.bubble.properties.iChannel);
epg.grid.jumpTo(false,B-$(epg.config.eTimeline).clientHeight-10,null,true);
epg.grid.jumpToTime(epg.date.dateToNix(epg.date.currentTime),true)
}else{epg.grid.jumpToTime(epg.date.dateToNix(epg.date.currentTime),true)
}}else{if(epg.grid.currentChannel!==false&&epg.data.channelnoMap[epg.grid.currentChannel]){B=epg.grid.channelPosition(epg.data.channelnoMap[epg.grid.currentChannel]);
epg.grid.jumpTo(false,B,null,true);
epg.grid.jumpToTime(epg.date.dateToNix(epg.date.currentTime),true)
}else{$(epg.config.eSchedule).scrollTop=0;
$(epg.config.eChannels).scrollTop=0;
epg.grid.jumpToTime(epg.date.dateToNix(epg.date.currentTime),true)
}}}else{epg.data.getProgram(A[0],A[1],epg.date.currentDay,epg.config.deepLinking.getProgramStartTime)
}},makeKey:function(){traceGrid("makeKey",arguments);
epg.grid.setGridClass();
epg.grid.makeGenres();
epg.grid.setupFiltering();
epg.grid.setChannelHeight();
if(epg.stateMachine.bubble===1){$("epg_bubble").style.top=epg.grid.channelPosition(epg.bubble.properties.iChannel)+epg.bubble.properties.iBubbleYOffset+"px"
}epg.grid.setInitView();
epg.grid.getUpdate()
},genreAccordion:function(C,A){traceGrid("genreAccordion",arguments);
if(epg.grid.dragging!==true&&epg.grid.scrolling!==true){var D=epg.data.epggenre;
var B=epg.config.iTabHeight;
$("genre"+C).genreId=C;
epg.bubble.closeBubble();
if(D[C].hidden===undefined||D[C].hidden===false){D[C].epgHeight=$(A.parentNode).getHeight();
$(A.parentNode.childNodes[0]).addClassName("showHideOpen");
jQuery("#genre"+C+", #genreKey"+C).animate({height:B},500,"swing",function(){epg.data.epggenre[C].hidden=true;
epg.grid.scrolling=false;
epg.grid.setChannelHeight();
epg.grid.getUpdate()
});
D[C].hidden=true
}else{if(D[C].hidden===true){$(A.parentNode.childNodes[0]).removeClassName("showHideOpen");
epg.grid.scrolling=true;
jQuery("#genre"+C+", #genreKey"+C).animate({height:D[C].epgHeight},500,"swing");
jQuery("#"+epg.config.eSchedule+", #"+epg.config.eChannels).animate({scrollTop:D[C].genre.offsetTop},1000,"swing",function(){epg.data.epggenre[C].hidden=false;
epg.grid.scrolling=false;
epg.grid.setChannelHeight();
epg.grid.getUpdate()
})
}}}},createChannelKeyPromo:function(F,A,E){traceGrid("createChannelKeyPromo",arguments);
var D=document.createElement("DIV");
D.className="promo";
D.style.top=E+"px";
var C=document.createElement("SPAN");
C.innerHTML='<span class="hide">Hide Promo <img src="'+epg.config.constants.editableIMGurl+'/skin/icons/gif/close.gif" style="width:12px;height:12px;" /></span>';
C.className="label hide";
C.channelID=F.channelid;
var B=document.createElement("SPAN");
B.className=" label";
B.innerHTML="<br/>"+F.title+", "+epg.date.timeSTR(F.start)+" on "+epg.data.channels[F.channelid].title;
B.channelID=F.channelid;
B.eventID=F.eventid;
B.eventStart=F.start;
Event.observe(B,"mouseup",function(G){if(!epg.grid.dragging){epg.promo.action(G,true,F)
}});
Event.observe(C,"mouseup",function(G){if(!epg.grid.dragging){epg.data.promos[epg.date.currentDay][this.channelID].hidden=true;
try{$(epg.data.channels[this.channelID].promo).hide();
$(epg.data.channels[this.channelID].promoKey).hide()
}catch(H){$(epg.data.filtered[this.channelID].promo).hide();
$(epg.data.filtered[this.channelID].promoKey).hide()
}epg.grid.setChannelHeight();
epg.grid.getUpdate()
}});
D.appendChild(C);
D.appendChild(B);
A.appendChild(D);
return D
},createChannelPromo:function(E,B,D){traceGrid("createChannelPromo",arguments);
var C=epg.grid.modifiedChannelWidth()+(epg.config.iChannelWidth/24*4);
var A=document.createElement("DIV");
A.className="promo";
A.style.width=C+"px";
A.style.backgroundImage="url("+E.promo+")";
A.style.top=D+"px";
A.channelID=E.channelid;
A.eventID=E.eventid;
A.eventStart=E.start;
Event.observe(A,"mouseup",epg.grid.promoMouseUp);
if(B&&A){B.appendChild(A);
return A
}},promoMouseUp:function(B){traceGrid("promoMouseUp",arguments);
if(epg.grid.dragging!==true){if(epg.grid.iShowHoverId&&document.getElementById(epg.grid.iShowHoverId[0]+"_"+epg.grid.iShowHoverId[1]+"_"+epg.grid.iShowHoverId[2])){$(document.getElementById(epg.grid.iShowHoverId[0]+"_"+epg.grid.iShowHoverId[1]+"_"+epg.grid.iShowHoverId[2])).removeClassName("hover")
}epg.grid.iShowHoverId=undefined;
var A=Event.element(B);
if(A.channelID){epg.promo.action(B,true,epg.data.promos[epg.date.currentDay][A.channelID])
}}},createChannelKey:function(F,C,H){traceGrid("createChannelKey",arguments);
var J=epg.data.epggenre;
var M=$(epg.config.eChannels);
var L=$(epg.config.eWrapper);
var G=epg.date.nixToEpg;
var I=epg.data.favourites;
var K;
if(epg.stateMachine.isextendedGrid()){K=epg.config.iExtendedHeight
}else{if(!epg.stateMachine.isextendedGrid()){K=epg.config.iGridHeight
}}var D=epg.config.iTabHeight;
var E=epg.grid.modifiedChannelWidth()+(epg.config.iChannelWidth/24*4);
var B=document.createElement("DIV");
if(epg.data.favourites[F.channelid]!==undefined&&F.channelno){B.className="channel";
if(epg.config.general.enable_favourites){B.className+=" fav";
B.title="Remove channel from favourites"
}else{B.className+=" channelNoFav"
}}else{if(F.channelno){if(epg.config.general.enable_favourites){B.className="channel";
B.title="Add channel to favourites"
}else{B.className="channel channelNoFav"
}}else{B.className="special channel"
}}if(F&&F.channelid){B.channelID=F.channelid
}if(H){B.style.top=H+"px"
}else{B.style.top="0px"
}B.id="channel_"+F.channelid;
var A=document.createElement("SPAN");
if(F.channelno){A.innerHTML="<span>"+F.channelno+"</span> "+(epg.stateMachine.isextendedGrid()&&!epg.config.grid.enable_detailed_grid_channel_titles?"":F.title)
}else{A.innerHTML="<span></span> "+(epg.stateMachine.isextendedGrid()&&!epg.config.grid.enable_detailed_grid_channel_titles?"":F.title)
}A.className="label";
if(epg.stateMachine.isextendedGrid()&&F.channelno){if(I[F.channelid]||epg.config.general.enable_colour_icons_by_default){A.style.backgroundImage="url("+epg.config.constants.colourLogoPath+"/channel_"+F.channelid+".gif)"
}else{A.style.backgroundImage="url("+epg.config.constants.monoLogoPath+"/channel_"+F.channelid+".gif)"
}}if(epg.config.grid.enableChannelClick){$channelKey=jQuery(B);
$channelKey.attr("title","Watch now").addClass("hoverable");
$channelKey.hover(function(){jQuery(this).addClass("hover")
},function(){jQuery(this).removeClass("hover")
});
$channelKey.click(function(){parent.ChangeChannel(null,F.channelid)
})
}B.appendChild(A);
if(B&&C){C.appendChild(B);
return B
}},addRemoveFaveMouseUp:function(){traceGrid("addRemoveFaveMouseUp",arguments);
if(epg.grid.dragging!==true&&epg.grid.scrolling!==true){if(epg.data.favourites[this.channelID]){epg.data.removeFavourite(this.channelID)
}else{epg.data.addFavourite(this.channelID)
}epg.bubble.closeBubble()
}},createChannel:function(C,A,D,E){traceGrid("createChannel",arguments);
var F=epg.data.epggenre;
var I=$(epg.config.eChannels);
var G=$(epg.config.eWrapper);
var J=epg.config.iBannerHeight;
var B=epg.grid.modifiedChannelWidth()+(epg.config.iChannelWidth/24*4);
var H=document.createElement("DIV");
H.className="channel";
if(E){H.className+=" odd"
}H.style.width=B+"px";
if(D){H.style.top=D+"px"
}else{H.style.top="0px"
}if(H&&A){A.appendChild(H);
return H
}},setChannelHeight:function(){traceGrid("setChannelHeight",arguments);
if(epg.stateMachine.isAnyGrid()){var P=epg.data.channels;
var B=epg.data.epggenre;
var D=0;
var T=epg.data.promos;
var S=epg.date.nixToEpg;
var L=epg.date.currentDay;
var U=epg.config.iBannerHeight;
var A;
var F={};
var O=epg.config.iTabHeight;
var Q;
var R;
if(epg.stateMachine.isextendedGrid()){R=epg.config.iExtendedHeight
}else{if(!epg.stateMachine.isextendedGrid()){R=epg.config.iGridHeight
}}for(kGenre in B){F[kGenre]=O
}if(!epg.stateMachine.isFilter()){if(jQuery.browser.chrome||jQuery.browser.msie9){var J=null;
epg.tools.arrayMapEach(epg.data.channelmap,P,function(W,V){J=W;
if(T[L]!==undefined&&T[L][W]!==undefined&&epg.config.api.promos.enabled){A=S(T[L][W].start);
if(A===L&&T[L][W].hidden!==true){epg.data.promos[L][W].epgTop=F[P[W].epggenre];
F[P[W].epggenre]+=U
}}P[W].epgTop=F[P[W].epggenre];
if(!P[W].height){F[P[W].epggenre]+=R
}else{F[P[W].epggenre]+=P[W].height
}});
var N=J
}else{for(N in P){if(T[L]!==undefined&&T[L][N]!==undefined&&epg.config.api.promos.enabled){A=S(T[L][N].start);
if(A===L&&T[L][N].hidden!==true){epg.data.promos[L][N].epgTop=F[P[N].epggenre];
F[P[N].epggenre]+=U
}}P[N].epgTop=F[P[N].epggenre];
if(!P[N].height){F[P[N].epggenre]+=R
}else{F[P[N].epggenre]+=P[N].height
}}}}var I=0;
var C=[];
var H=epg.data.favourites;
for(kFavourite in H){if(epg.data.channels[kFavourite]!==undefined){C[C.length]=epg.data.channels[kFavourite].channelno;
I++
}}C=C.sortBy(function(V){return V
});
var K;
if(epg.stateMachine.isFilter()){var E=epg.filtering.filters[epg.filtering.current_filter].channels;
for(iChannel=0;
iChannel<C.length;
iChannel++){K=epg.data.channelnoMap[C[iChannel]];
if(E.indexOf(K)>-1){H[K].epgTop=F[H[K].epggenre];
if(!P[N]){F[H[K].epggenre]+=R
}else{if(!P[N].height){F[H[K].epggenre]+=R
}else{F[H[K].epggenre]+=P[N].height
}}}}}else{for(iChannel=0;
iChannel<C.length;
iChannel++){K=epg.data.channelnoMap[C[iChannel]];
if(H[K]){H[K].epgTop=F[H[K].epggenre];
if(!N){F[H[K].epggenre]+=R
}if(!P[N].height){F[H[K].epggenre]+=R
}else{F[H[K].epggenre]+=P[N].height
}}}}var G=epg.data.filtered;
if(jQuery.browser.chrome||jQuery.browser.msie9){epg.tools.arrayMapEach(epg.data.channelmap,G,function(W,V){if(T[L]&&T[L][W]!==undefined&&epg.config.api.promos.enabled){A=S(T[L][W].start);
if(A===L&&T[L][W]&&T[L][W].hidden!==true){epg.data.promos[L][W].epgTop=F[G[W].epggenre];
F[G[W].epggenre]+=U
}}G[W].epgTop=F[G[W].epggenre];
if(!P[N]){F[G[W].epggenre]+=R
}else{if(!P[N].height){F[G[W].epggenre]+=R
}else{F[G[W].epggenre]+=P[N].height
}}})
}else{for(kFilter in G){if(T[L]&&T[L][kFilter]!==undefined&&epg.config.api.promos.enabled){A=S(T[L][kFilter].start);
if(A===L&&T[L][kFilter]&&T[L][kFilter].hidden!==true){epg.data.promos[L][kFilter].epgTop=F[G[kFilter].epggenre];
F[G[kFilter].epggenre]+=U
}}G[kFilter].epgTop=F[G[kFilter].epggenre];
if(!P[N]){F[G[kFilter].epggenre]+=R
}else{if(!P[N].height){F[G[kFilter].epggenre]+=R
}else{F[G[kFilter].epggenre]+=P[N].height
}}}}if(!epg.stateMachine.isFilter()){for(kEpggenre in B){if(kEpggenre==="all"){$("genre"+kEpggenre).style.height="0px";
$("genreKey"+kEpggenre).style.height="0px"
}else{if(B[kEpggenre].hidden===undefined){$("genre"+kEpggenre).style.height=F[kEpggenre]+"px";
$("genreKey"+kEpggenre).style.height=F[kEpggenre]+"px"
}}}}else{for(kEpggenre in B){if(kEpggenre==="fave"||kEpggenre==="all"&&B[kEpggenre].hidden===undefined){$("genre"+kEpggenre).style.height=F[kEpggenre]+"px";
$("genreKey"+kEpggenre).style.height=F[kEpggenre]+"px"
}else{if(B[kEpggenre].hidden===true){$("genre"+kEpggenre).style.height=O+"px";
$("genreKey"+kEpggenre).style.height=O+"px"
}else{$("genre"+kEpggenre).style.height="0px";
$("genreKey"+kEpggenre).style.height="0px"
}}}}var M=$(epg.config.eChannels);
for(kEpggenre in B){B[kEpggenre].epgTop=$("genreKey"+kEpggenre).viewportOffset()[1]-M.viewportOffset()[1]
}}},removeFavourite:function(A){traceGrid("removeFavourite",arguments);
if(epg.stateMachine.isextendedGrid()){if(epg.data.channels[A]&&epg.data.channels[A].channelKey){$(epg.data.channels[A].channelKey).removeClassName("fav");
if($(epg.data.channels[A].channelKey).firstChild){$(epg.data.channels[A].channelKey).firstChild.style.backgroundImage="url("+epg.config.constants.monoLogoPath+"/channel_"+A+".gif)"
}}if(epg.data.favourites[A]&&epg.data.favourites[A].channelKey){$(epg.data.favourites[A].channelKey).removeClassName("fav");
if($(epg.data.favourites[A].channelKey).firstChild){$(epg.data.favourites[A].channelKey).firstChild.style.backgroundImage="url("+epg.config.constants.monoLogoPath+"/channel_"+A+".gif)"
}delete epg.data.favourites[A]
}if(epg.data.filtered[A]&&epg.data.filtered[A].channelKey){$(epg.data.filtered[A].channelKey).removeClassName("fav");
if($(epg.data.filtered[A].channelKey).firstChild){$(epg.data.filtered[A].channelKey).firstChild.style.backgroundImage="url("+epg.config.constants.monoLogoPath+"/channel_"+A+".gif)"
}}}else{if(epg.data.channels[A]&&epg.data.channels[A].channelKey){$(epg.data.channels[A].channelKey).removeClassName("fav")
}if(epg.data.favourites[A]&&epg.data.favourites[A].channelKey){$(epg.data.favourites[A].channelKey).removeClassName("fav");
delete epg.data.favourites[A]
}if(epg.data.filtered[A]&&epg.data.filtered[A].channelKey){$(epg.data.filtered[A].channelKey).removeClassName("fav")
}}},addFavourite:function(A){traceGrid("addFavourite",arguments);
if(epg.stateMachine.isextendedGrid()){if(epg.data.channels[A]&&epg.data.channels[A].channelKey){$(epg.data.channels[A].channelKey).addClassName("fav");
$(epg.data.channels[A].channelKey).firstChild.style.backgroundImage="url("+epg.config.constants.colourLogoPath+"/channel_"+A+".gif)"
}if(epg.data.favourites[A]&&epg.data.favourites[A].channelKey){$(epg.data.favourites[A].channelKey).addClassName("fav");
$(epg.data.favourites[A].channelKey).firstChild.style.backgroundImage="url("+epg.config.constants.colourLogoPath+"/channel_"+A+".gif)"
}if(epg.data.filtered[A]&&epg.data.filtered[A].channelKey){$(epg.data.filtered[A].channelKey).addClassName("fav");
$(epg.data.filtered[A].channelKey).firstChild.style.backgroundImage="url("+epg.config.constants.colourLogoPath+"/channel_"+A+".gif)"
}}else{if(epg.data.channels[A]&&epg.data.channels[A].channelKey){$(epg.data.channels[A].channelKey).addClassName("fav")
}if(epg.data.favourites[A]&&epg.data.favourites[A].channelKey){$(epg.data.favourites[A].channelKey).addClassName("fav")
}if(epg.data.filtered[A]&&epg.data.filtered[A].channelKey){$(epg.data.filtered[A].channelKey).addClassName("fav")
}}},isFilterShowOnScreen:function(D,B,E,A,C){traceGrid("isFilterShowOnScreen",arguments);
if(D>epg.grid.iScrollLeft&&D<epg.grid.iScrollRight){epg.grid.bFoundFilterShow=true
}else{if(epg.grid.aFirstFilterShow.length===0||Math.abs(epg.grid.iScrollRight-D)<Math.abs(epg.grid.iScrollRight-epg.grid.aFirstFilterShow[3])){if(D<epg.grid.modifiedChannelWidth()){epg.grid.aFirstFilterShow=[E,A,C,D]
}}}},renderShow:function(K,G){traceGrid("renderShow",arguments);
var L=[];
var C=epg.data.genre;
var N=((epg.config.iChannelWidth/(60*60*24))*K.dur);
var D=(epg.config.iChannelWidth/(60*60*24*1000))*(K.start-Date.parse(epg.date.epgDate(epg.date.currentDay)));
if((D)>(epg.grid.iLastPosition+epg.grid.iLastWidth+20)){var P=Math.round(D-epg.grid.iLastPosition);
var Q="Programme information unavailable";
L[L.length]='<div class="offair" style="left: '+Math.round(epg.grid.iLastPosition+epg.grid.iLastWidth)+"px; width: "+P+'px"><span class="label">'+Q.truncate((P-8)/6,"..")+"</span></div>"
}epg.grid.iLastWidth=N;
epg.grid.iLastPosition=D;
if(N>=8){if(D+N>(epg.grid.modifiedChannelWidth()+(epg.config.iChannelWidth/24*4))){N=(epg.grid.modifiedChannelWidth()+(epg.config.iChannelWidth/24*4))-D-8
}else{N=(N-8)
}}else{N=0
}var M="";
var R=0;
var J=C[K.genre].name;
if(J==="Film"||J==="Sports"){if(epg.config.grid.enable_genre_labels){var I=0;
M='<span class="genre">'+J+"</span>";
I=J.length;
R=(I*5)+15
}}var H=K.title;
var O=K.title.length;
var A=K.shortDesc;
var F="";
if(K.offair){F="offair";
H=K.title.replace(/^\.\.programmes start/,"Programmes will start")
}else{F="show";
if(K.edschoice==="true"){F+=" edsChoice"
}if(K.filtermatch!==undefined){epg.grid.isFilterShowOnScreen(D,N,K.eventid,K.channelid,K.start);
F+=" filterMatch"
}if(K.blackout==="true"){F+=" blackout"
}}if(N<35){H="&nbsp;";
F+=" infoIcon";
A=""
}else{H=((N-R-15)<15)?"":H.truncate(((N-R)/5),"..")
}if(epg.stateMachine.isextendedGrid()&&!K.offair){var B="";
var E=function(S){return'<a onmouseover="epg.grid.showRecordMouseOver(this);" onclick="epg.bubble.closeBubble();" onmouseout="epg.grid.showRecordMouseOut(this);" class="SkyWidget:Open button" href="'+epg.config.environment.url.tvwidgethost+"/tvlistings-proxy/tvwidget/remoterecord/confirm.do?siteId="+epg.config.siteId+"&amp;channelId="+K.channelid+"&amp;eventId="+K.eventid+'">'+S+"</a>"
};
if(N>=180){dur=(K.dur/60);
B=epg.date.timeSTR(K.start)+", "+Math.round(dur)+"min &nbsp;"+((epg.config.api.authentication.enabled&&epg.config.api.remote_record.enabled)?E("Remote record"):"")
}else{if(N<=180&&N>150){B=epg.date.timeSTR(K.start)+((epg.config.api.authentication.enabled&&epg.config.api.remote_record.enabled)?" &nbsp; "+E("Remote record"):"")
}else{if(N<=150&&N>100){B=(epg.config.api.authentication.enabled&&epg.config.api.remote_record.enabled)?E("Remote record"):""
}else{if(N<=100&&N>65){B=(epg.config.api.authentication.enabled&&epg.config.api.remote_record.enabled)?E("Record"):""
}else{B=(epg.config.api.authentication.enabled&&epg.config.api.remote_record.enabled)?E("&nbsp;"):""
}}}}L[L.length]='<div class="'+F+'" style="width: '+N+"px; left: "+D+'px;" id="'+G+"_"+K.channelid+"_"+K.eventid+'"><span class="label">'+H+"</span><p>"+A+'</p><p class="record">'+B+"</p></div>"
}else{L[L.length]='<div class="'+F+'" style="width: '+N+"px; left: "+D+'px;" id="'+G+"_"+K.channelid+"_"+K.eventid+'">'+M+H+"</div>"
}K.epgLeft=D;
K.epgWidth=N;
return L.join("")
},iLastPosition:0,iLastWidth:0,renderChannel:function(C,D,F,E){traceGrid("renderChannel",arguments);
if(E){if(epg.grid.dragging!==true&&epg.grid.scrolling!==true&&epg.stateMachine.isAnyGrid()){var H;
var A=epg.grid.modifiedChannelWidth();
if(epg.stateMachine.isextendedGrid()){H=epg.config.iExtendedHeight
}else{H=epg.config.iGridHeight
}var G=[];
var K=Date.parse(epg.date.epgDate(epg.date.currentDay));
var I=epg.bubble.properties.iBubbleYOffset;
if(jQuery.browser.chrome||jQuery.browser.msie9){var J=null;
epg.tools.arrayMapEach(epg.data.channelProgramMap[epg.date.currentDay][D],C,function(M,L){J=M;
G[G.length]=epg.grid.renderShow(C[J],F);
if(epg.search.resultHash[D+"_"+J]!==undefined){G[G.length]='<div class="epg_searchOrder" id="search_'+D+"_"+J+'" style="left: '+((A/(60*60*epg.date.epgHoursInDay(epg.date.currentDay)*1000))*(C[J].start-K)-epg.date.epgHoursInDay(epg.date.currentDay)+1)+'px;">'+(epg.search.resultHash[D+"_"+J]+1)+"</div>"
}})
}else{for(J in C){G[G.length]=epg.grid.renderShow(C[J],F);
if(epg.search.resultHash[D+"_"+J]!==undefined){G[G.length]='<div class="epg_searchOrder" id="search_'+D+"_"+J+'" style="left: '+((A/(60*60*epg.date.epgHoursInDay(epg.date.currentDay)*1000))*(C[J].start-K)-epg.date.epgHoursInDay(epg.date.currentDay)+1)+'px;">'+(epg.search.resultHash[D+"_"+J]+1)+"</div>"
}}}if(epg.config.grid.enableNextDayOverlay){G[G.length]='<div class="nextDay" style="height:'+H+"px;left:"+epg.grid.modifiedChannelWidth()+"px;width:"+(epg.config.iChannelWidth/24*4)+'px"></div>'
}E.innerHTML=G.join("");
if(epg.stateMachine.isextendedGrid()){H=epg.config.iExtendedHeight
}else{H=epg.config.iGridHeight
}epg.grid.iLastPosition=0;
epg.grid.iLastWidth=0;
if(epg.grid.lastRenderChannel===D){if(epg.stateMachine.isFilter()&&epg.grid.bFoundFilterShow===false&&epg.grid.bIsFirstFilterGridView===true&&epg.grid.aFirstFilterShow.length>0){epg.grid.gotoEvent(epg.grid.aFirstFilterShow[0],epg.grid.aFirstFilterShow[1],epg.grid.aFirstFilterShow[2],false);
epg.grid.bIsFirstFilterGridView=false
}}}else{if(epg.stateMachine.isAnyGrid()){epg.grid.addLoader(function(){epg.grid.renderChannel(C,D,F,E)
})
}}}if(epg.grid.currGridItem!==undefined){var B=epg.grid.currGridItem.split("_");
if(D==B[1]){jQuery("#gridSchedule .channel .highlighted").parent().removeClass("selected");
jQuery("#gridSchedule .channel .show").removeClass("highlighted");
jQuery("#epg_key .channel.selected").removeClass("selected");
jQuery(epg.grid.currGridItem).parent().addClass("selected");
jQuery(epg.grid.currGridItem).addClass("highlighted");
jQuery("#epg_key #channel_"+B[1]).addClass("selected")
}}},showRecord:function(B,A){traceGrid("showRecord",arguments)
},showRecordMouseOver:function(A){traceGrid("showRecordMouseOver",arguments);
if(epg.grid.dragging!==true&&epg.grid.scrolling!==true){$(A).addClassName("hover")
}},showRecordMouseOut:function(A){traceGrid("showRecordMouseOut",arguments);
if(epg.grid.dragging!==true&&epg.grid.scrolling!==true){$(A).removeClassName("hover")
}},aLoader:[],iLoaderKey:0,aLoaderStatus:false,addLoader:function(A){traceGrid("addLoader",arguments);
epg.grid.aLoader[epg.grid.aLoader.length]=A;
if(epg.grid.aLoaderStatus===false){epg.grid.playLoader()
}},playLoader:function(){traceGrid("playLoader",arguments);
if(epg.grid.aLoader[epg.grid.iLoaderKey]){epg.grid.aLoaderStatus=true;
epg.grid.aLoader[epg.grid.iLoaderKey]();
delete epg.grid.aLoader[epg.grid.iLoaderKey];
epg.grid.iLoaderKey++;
setTimeout(epg.grid.playLoader,1)
}else{epg.grid.aLoaderStatus=false
}},garbageCollector:function(A){traceGrid("garbageCollector",arguments);
if(A){jQuery(A).remove()
}},removeChannel:function(B){traceGrid("removeChannel",arguments);
var A=epg.grid.garbageCollector;
if(B.channel){A(B.channel)
}if(B.channelKey){B.channelKey.onmouseup=null;
A(B.channelKey)
}if(B.promo){A(B.promo)
}if(B.promoKey){A(B.promoKey)
}B.status=false;
delete B.channel;
delete B.channelKey;
delete B.promo;
delete B.promoKey;
delete B.currentDay;
delete B.visible
},hideChannel:function(A){traceGrid("hideChannel",arguments);
if(epg.grid.dragging!==true&&epg.grid.scrolling!==true){if(A.channel){$(A.channel).hide()
}if(A.channelKey){$(A.channelKey).hide()
}if(A.promo){$(A.promo).hide()
}if(A.promoKey){$(A.promoKey).hide()
}A.hidden=true
}else{setTimeout(function(){epg.grid.hideChannel(A)
},25)
}},showChannel:function(A){traceGrid("showChannel",arguments);
if(epg.grid.dragging!==true&&epg.grid.scrolling!==true){if(A.channel){$(A.channel).show()
}if(A.channelKey){$(A.channelKey).show()
}if(epg.data.promos[epg.date.currentDay][A.channelid]&&epg.data.promos[epg.date.currentDay][A.channelid].hidden!==true){if(A.promo){$(A.promo).show()
}if(A.promoKey){$(A.promoKey).show()
}}A.hidden=false
}else{setTimeout(function(){epg.grid.showChannel(A)
},25)
}},stripChannel:function(A){traceGrid("stripChannel",arguments);
delete A.status;
delete A.visible;
delete A.hidden;
delete A.currentDay
},checkVisibility:function(){traceGrid("checkVisibility",arguments);
var D=$(epg.config.eChannels).scrollTop;
var E=$(epg.config.eChannels).getHeight();
var C=D+E+epg.config.iGridHeight;
var B=(epg.stateMachine.isextendedGrid()?(D-epg.config.iExtendedHeight):(D-epg.config.iGridHeight));
var A=epg.date.currentDay;
epg.grid.currentChannel=false;
epg.grid.groupVisibility(epg.data.channels,B,C,A);
epg.grid.groupVisibility(epg.data.favourites,B,C,A,"fave");
epg.grid.groupVisibility(epg.data.filtered,B,C,A)
},groupVisibility:function(C,B,E,I,A){traceGrid("groupVisibility",arguments);
var H=epg.grid.removeChannel;
var F=epg.grid.stripChannel;
var D=epg.data.epggenre;
for(kChannel in C){if(D[C[kChannel].epggenre]){var G=C[kChannel].epgTop+D[C[kChannel].epggenre].epgTop;
if(G>B&&G<E){if(D[C[kChannel].epggenre].hidden===true){H(C[kChannel]);
F(C[kChannel])
}else{if(epg.stateMachine.isFilter()&&A==="fave"&&epg.data.filtered[kChannel]===undefined){H(epg.data.favourites[kChannel]);
F(epg.data.favourites[kChannel])
}else{if(C[kChannel].status===true){if(C[kChannel].currentDay!==I){H(C[kChannel]);
F(C[kChannel])
}else{if(C[kChannel].epgTop!=C[kChannel].channel.style.top.replace(/px/,"")){C[kChannel].channel.style.top=C[kChannel].epgTop+"px";
C[kChannel].channelKey.style.top=C[kChannel].epgTop+"px";
if(C[kChannel].promo&&epg.config.api.promos.enabled!=C[kChannel].promo.style.top.replace(/px/,"")){C[kChannel].promo.style.top=epg.data.promos[I][kChannel].epgTop+"px";
C[kChannel].promoKey.style.top=epg.data.promos[I][kChannel].epgTop+"px"
}}}}if(epg.grid.currentChannel===false){epg.grid.currentChannel=C[kChannel].channelno
}C[kChannel].currentDay=I;
C[kChannel].visible=true;
epg.grid.lastRenderChannel=kChannel
}}}else{if(C[kChannel].status===true){H(C[kChannel]);
F(C[kChannel])
}else{delete C[kChannel].visible
}}}}},renderGrid:function(A){traceGrid("renderGrid",arguments);
if(epg.config.general.enable_favourites){epg.grid.renderGroup(epg.data.favourites,false,A)
}if(epg.stateMachine.isFilter()){if(!epg.tools.isEmpty(epg.data.filtered)){epg.grid.renderGroup(epg.data.filtered,true,A)
}}else{if(!epg.tools.isEmpty(epg.data.channels)){epg.grid.renderGroup(epg.data.channels,true,A)
}}},renderGroup:function(C,A,B){traceGrid("renderGroup",arguments);
var F=0;
var H=0;
var K=epg.config.iMaxChannels;
if(B){K=epg.config.iFirstRequestChannels
}var G=epg.data.promos;
var I=epg.date.currentDay;
var M=true;
var J=new Array();
var L=0;
if(jQuery.browser.chrome||jQuery.browser.msie9){epg.tools.arrayMapEach(epg.data.channelmap,C,function(N,O){J.push(N);
L++;
if(L>=K){return false
}})
}else{for(kChannel in C){J.push(kChannel);
L++;
if(L>=K){break
}}}if(K>J.length){K=J.length
}L=0;
if(B==true){for(var E=0;
E<K;
E++){kChannel=J[E];
if(G[I]&&G[I][kChannel]!==undefined&&A&&G[I][kChannel].hidden!==true&&epg.config.api.promos.enabled){var D=epg.date.nixToEpg(G[I][kChannel].start);
if(D===I){C[kChannel].promoKey=epg.grid.createChannelKeyPromo(G[D][[kChannel]],$("genreKey"+C[kChannel].epggenre),C[kChannel].epgTop-epg.config.iBannerHeight);
C[kChannel].promo=epg.grid.createChannelPromo(G[D][[kChannel]],$("genre"+C[kChannel].epggenre),C[kChannel].epgTop-epg.config.iBannerHeight);
C[kChannel].promo.currentDay=I
}}C[kChannel].channelKey=epg.grid.createChannelKey(C[kChannel],$("genreKey"+C[kChannel].epggenre),C[kChannel].epgTop);
C[kChannel].channel=epg.grid.createChannel(C[kChannel],$("genre"+C[kChannel].epggenre),C[kChannel].epgTop,M);
if(kChannel!=="special"){epg.grid.aLoadCache[epg.grid.aLoadCache.length]=kChannel
}C[kChannel].status=true;
M=!M
}epg.data.getGrid(epg.grid.aLoadCache,I,epg.grid.forkGridCallback);
epg.grid.aLoadCache=[]
}else{if(C){if(jQuery.browser.chrome||jQuery.browser.msie9){epg.tools.arrayMapEach(epg.data.channelmap,C,function(O,P){if(C[O].visible===true&&C[O].status===undefined){if(G[I]&&G[I][O]!==undefined&&A&&G[I][O].hidden!==true&&epg.config.api.promos.enabled){var N=epg.date.nixToEpg(G[I][O].start);
if(N===I){C[O].promoKey=epg.grid.createChannelKeyPromo(G[N][[O]],$("genreKey"+C[O].epggenre),C[O].epgTop-epg.config.iBannerHeight);
C[O].promo=epg.grid.createChannelPromo(G[N][[O]],$("genre"+C[O].epggenre),C[O].epgTop-epg.config.iBannerHeight);
C[O].promo.currentDay=I
}}C[O].channelKey=epg.grid.createChannelKey(C[O],$("genreKey"+C[O].epggenre),C[O].epgTop);
C[O].channel=epg.grid.createChannel(C[O],$("genre"+C[O].epggenre),C[O].epgTop,M);
if(O!=="special"){epg.grid.aLoadCache[epg.grid.aLoadCache.length]=O
}C[O].status=true
}if(epg.grid.aLoadCache.length===K){epg.data.getGrid(epg.grid.aLoadCache,I,epg.grid.forkGridCallback);
epg.grid.aLoadCache=[]
}M=!M
})
}else{for(kChannel in C){if(C[kChannel].visible===true&&C[kChannel].status===undefined){if(G[I]&&G[I][kChannel]!==undefined&&A&&G[I][kChannel].hidden!==true&&epg.config.api.promos.enabled){var D=epg.date.nixToEpg(G[I][kChannel].start);
if(D===I){C[kChannel].promoKey=epg.grid.createChannelKeyPromo(G[D][[kChannel]],$("genreKey"+C[kChannel].epggenre),C[kChannel].epgTop-epg.config.iBannerHeight);
C[kChannel].promo=epg.grid.createChannelPromo(G[D][[kChannel]],$("genre"+C[kChannel].epggenre),C[kChannel].epgTop-epg.config.iBannerHeight);
C[kChannel].promo.currentDay=I
}}C[kChannel].channelKey=epg.grid.createChannelKey(C[kChannel],$("genreKey"+C[kChannel].epggenre),C[kChannel].epgTop);
C[kChannel].channel=epg.grid.createChannel(C[kChannel],$("genre"+C[kChannel].epggenre),C[kChannel].epgTop,M);
if(kChannel!=="special"){epg.grid.aLoadCache[epg.grid.aLoadCache.length]=kChannel
}C[kChannel].status=true
}if(epg.grid.aLoadCache.length===K){epg.data.getGrid(epg.grid.aLoadCache,I,epg.grid.forkGridCallback);
epg.grid.aLoadCache=[]
}M=!M
}}}}},forkGridCallback:function(B,A){if(epg.data.channels[A]!==undefined&&epg.data.channels[A].status===true){epg.grid.addLoader(function(){if(epg.data.channels[A]!==undefined){epg.grid.renderChannel(B,A,"grid",epg.data.channels[A].channel)
}})
}if(epg.data.favourites[A]!==undefined&&epg.data.favourites[A].status===true){epg.grid.addLoader(function(){if(epg.data.favourites[A]!==undefined){epg.grid.renderChannel(B,A,"favourite",epg.data.favourites[A].channel)
}})
}if(epg.data.filtered[A]&&epg.data.filtered[A]!==undefined&&epg.data.filtered[A].status===true){epg.grid.renderChannel(B,A,"filter",epg.data.filtered[A].channel)
}},getUpdate:function(A){traceGrid("forkGridCallback",arguments);
if(epg.grid.dragging!==true&&epg.grid.scrolling!==true&&epg.stateMachine.isAnyGrid()){epg.grid.setGridMicroTime();
if(epg.stateMachine.isFilter()&&epg.filtering.filters[epg.filtering.current_filter].channels&&epg.filtering.filters[epg.filtering.current_filter].channels.length===0&&epg.filtering.cloudBurstActive===false){epg.ui.Alerts.alert.display(epg.filtering.text.error)
}else{epg.grid.checkVisibility();
epg.grid.renderGrid(A);
if(epg.grid.aLoadCache.length>0){epg.data.getGrid(epg.grid.aLoadCache,epg.date.currentDay,epg.grid.forkGridCallback);
epg.grid.aLoadCache=[]
}}}},show:function(){traceGrid("show",arguments);
Element.removeClassName($(epg.config.eGrid),"view_off")
},hide:function(){traceGrid("hide",arguments);
Element.addClassName($(epg.config.eGrid),"view_off")
},clear:function(){traceGrid("clear",arguments);
var C=epg.data.channels;
var E=epg.data.epggenre;
var A=epg.data.favourites;
var B=epg.grid.removeChannel;
var D=epg.grid.stripChannel;
Element.addClassName($(epg.config.eGrid),"view_off");
for(kGenre in E){delete E[kGenre].hidden
}for(kChannel in C){D(C[kChannel])
}for(kFavourite in A){D(A[kFavourite])
}var F=epg.data.filtered;
for(kFilter in F){D(F[kFilter])
}jQuery("#"+epg.config.eChannels).html("");
jQuery("#"+epg.config.eWrapper).html("")
},unLoad:function(){traceGrid("unLoad",arguments);
Event.stopObserving($(epg.config.eSchedule),"mousedown",epg.grid.startScheduleDrag);
Event.stopObserving($(epg.config.eChannels),"mousedown",epg.grid.startChannelDrag);
Event.stopObserving($(epg.config.eTimeline),"mousedown",epg.grid.startScheduleDrag);
Event.stopObserving(document,"mouseup",epg.grid.docMouseUp);
Event.stopObserving($("epg_scrollE"),"mousedown",epg.grid.scrollEast);
Event.stopObserving($("epg_scrollE"),"mousedown",epg.grid.beginScroll);
Event.stopObserving($("epg_scrollW"),"mousedown",epg.grid.scrollWest);
Event.stopObserving($("epg_scrollW"),"mousedown",epg.grid.beginScroll);
Event.stopObserving($("epg_scrollN"),"mousedown",epg.grid.scrollNorth);
Event.stopObserving($("epg_scrollN"),"mousedown",epg.grid.beginScroll);
Event.stopObserving($("epg_scrollS"),"mousedown",epg.grid.scrollSouth);
Event.stopObserving($("epg_scrollS"),"mousedown",epg.grid.beginScroll);
Event.stopObserving($("epg_scrollE"),"mouseout",epg.grid.cancelScroll);
Event.stopObserving($("epg_scrollW"),"mouseout",epg.grid.cancelScroll);
Event.stopObserving($("epg_scrollN"),"mouseout",epg.grid.cancelScroll);
Event.stopObserving($("epg_scrollS"),"mouseout",epg.grid.cancelScroll);
Event.stopObserving($("epg_scrollE"),"mouseup",epg.grid.cancelScroll);
Event.stopObserving($("epg_scrollW"),"mouseup",epg.grid.cancelScroll);
Event.stopObserving($("epg_scrollN"),"mouseup",epg.grid.cancelScroll);
Event.stopObserving($("epg_scrollS"),"mouseup",epg.grid.cancelScroll);
Event.stopObserving($(epg.config.eTimeline),"mousemove",epg.grid.getShowHover);
Event.stopObserving($(epg.config.eTimeline),"mouseup",epg.grid.getShowClick);
Event.stopObserving($(epg.config.eChannels),"mouseover",epg.grid.channelAction);
Event.stopObserving($(epg.config.eChannels),"mouseup",epg.grid.getChannelClick);
Event.stopObserving($(epg.config.eWrapper),"mouseover",epg.grid.showAction);
Event.stopObserving($(epg.config.eWrapper),"mousedown",epg.grid.showAction);
Event.stopObserving($(epg.config.eWrapper),"mouseup",epg.grid.getShowClick)
},triggerNextDay:function(A){traceGrid("triggerNextDay",arguments);
var B=epg.date.currentTime.getHours();
if(B>21){epg.ui.nextDay.display()
}else{epg.ui.nextDay.hide()
}},scrollToNextMorning:function(){traceGrid("scrollToNextMorning",arguments);
var A=new Date();
A.setTime(epg.date.currentTime.getTime());
A.setDate(A.getDate()+1);
A.setHours(1);
A.setMinutes(1);
A.setSeconds(1);
epg.grid.jumpToTime(A.valueOf());
epg.ui.nextDay.hide()
},modifiedChannelWidth:function(){return epg.config.iChannelWidth/24*epg.date.epgHoursInDay(epg.date.currentDay)
}};epg.filtering={init:function(){traceFiltering("epg.filtering.init",arguments);
var B=epg.data.UserCookie.getCookie("epg_filters"+epg.config.cookieSuffix);
if(B){for(var A in B){if(!epg.filtering.filters[A]){epg.filtering.filters[A]={name:A,hashmap:{},user:true}
}epg.filtering.filters[A].genres=B[A];
for(var D=0,C=B[A].length;
D<C;
D++){epg.filtering.filters[A].hashmap[B[A][D]]=true
}}}if(epg.config.api.filters.initial!==null&&epg.config.api.filters.initial.genres instanceof Array&&epg.config.api.filters.initial.genres.length&&epg.config.api.filters.initial.name){epg.filtering.current_filter=epg.config.api.filters.initial.name;
epg.filtering.filters[epg.config.api.filters.initial.name]=epg.config.api.filters.initial;
epg.filtering.applyFiltering();
epg.filtering.filters[epg.filtering.current_filter].day=epg.date.currentTime.getDate();
epg.ui.Toolbars.toolbar3.appendTag(epg.config.api.filters.initial.name)
}},hardReset:function(){traceFiltering("epg.filtering.hardReset",arguments);
epg.filtering.filter_genres=null;
epg.filtering.current=null;
epg.filtering.previous=null;
epg.filtering.init();
for(var A in epg.filtering.filters){epg.filtering.filters[A].channels=null
}},main_filter:"quickbrowse",tag_filter:"tag",filter_genres:null,current:null,previous:null,filters:{quickbrowse:{name:"quickbrowse",channels:null,genres:[],day:null,hashmap:{},user:true}},undoStore:{filters:null,activeTags:null},text:{error:[{h4:"Sorry, we couldn't find any programmes to match your search."},{p:"Please try a different search:"},{ul:[{li:"Select a different day"},{li:"Try using different Categories"}]},{a:"back","class":"epg_actionButton epg_positiveButton",onclick:function(A){epg.ui.Alerts.alert.close();
epg.filtering.editFilter()
}}],more:"More...",less:"Less..."},applyFiltering:function(){traceFiltering("epg.filtering.applyFiltering",arguments);
epg.list.resetFilters();
if(epg.stateMachine.isAnyGrid()){jQuery("#"+epg.config.eTimeline).stop();
jQuery("#"+epg.config.eSchedule).stop();
jQuery("#"+epg.config.eChannels).stop();
epg.grid.bIsFirstFilterGridView=true;
epg.grid.bFoundFilterShow=false;
epg.grid.aFirstFilterShow=[];
epg.bubble.closeBubble()
}if(epg.stateMachine.isSearch()){epg.search.close()
}if(epg.stateMachine.isextendedGrid()){epg.stateMachine.set(7)
}else{if(epg.stateMachine.isAnyGrid()){epg.stateMachine.set(6)
}else{epg.stateMachine.set(8)
}}},resetFilteringParameters:function(){traceFiltering("epg.filtering.resetFilteringParameters",arguments);
if(document.getElementById("epg_filter_off").className.indexOf("epg_block_g3")===-1){if(epg.stateMachine.isextendedGrid()){epg.stateMachine.set(1)
}else{if(epg.stateMachine.isGrid()){epg.stateMachine.set(0)
}else{epg.stateMachine.set(2)
}}if(epg.filtering.current_filter==epg.filtering.tag_filter){epg.ui.Toolbars.toolbar3.removeTag()
}epg.filtering.current_filter=null;
epg.ui.Toolbars.toolbar3.select(document.getElementById("epg_filter_off"));
epg.list.resetFilters()
}},removeFiltering:function(A){traceFiltering("epg.filtering.removeFiltering",arguments);
if(epg.stateMachine.isList()&&epg.stateMachine.isSearch()){epg.search.close()
}jQuery(epg.config.eTimeline).stop();
jQuery(epg.config.eSchedule).stop();
jQuery(epg.config.eChannels).stop();
epg.grid.bIsFirstFilterGridView=true;
epg.grid.bFoundFilterShow=false;
epg.grid.aFirstFilterShow=[];
epg.grid.currentChannel=false;
epg.bubble.closeBubble();
epg.filtering.resetFilteringParameters();
epg.list.resetFilters();
epg.views.reloadCurrentView();
if(A){A.stopPropagation()
}},createFilter:function(){traceFiltering("epg.filtering.createFilter",arguments);
var A;
epg.filtering.filters.quickbrowse.genres=A;
epg.filtering.filters.quickbrowse.channels=epg.data.getFilterChannels(filter_name,epg.date.dateToURL(epg.date.currentTime))
},createSkyFilter:function(A){traceFiltering("epg.filtering.createSkyFilter",arguments);
if(!epg.filtering.filters[A.name.toWord()]){epg.filtering.filters[A.name.toWord()]=A.genres
}},selectFilter:function(B){traceFiltering("epg.filtering.selectFilter",arguments);
var A=this;
while(!A.id||!A.getAttribute("id").toString().match(/epg_filter_(.+)/)){A=A.parentNode
}var C=A.getAttribute("id").toString().match(/epg_filter_(.+)/)[1];
if(epg.filtering.current_filter==epg.filtering.tag_filter){epg.ui.Toolbars.toolbar3.removeTag()
}epg.ui.Toolbars.toolbar3.select(A);
if(!epg.filtering.current_filter||epg.filtering.current_filter!=C){epg.filtering.current_filter=C;
epg.filtering.applyFiltering();
epg.list.tracking.currentBlock=0;
if(!epg.filtering.filters[C].day||epg.filtering.filters[C].day!=epg.date.currentTime.getDate()){epg.filtering.filters[C].day=epg.date.currentTime.getDate();
if(epg.filtering.filters[C].genres.length>0){epg.data.getFilterChannels(C,epg.date.dateToURL(epg.date.currentTime))
}else{epg.views.reloadCurrentView()
}}else{epg.views.reloadCurrentView()
}}epg.hitbox.send("pre-setfilter");
if(B){B.stopPropagation()
}return false
},changeDay:function(){traceFiltering("epg.filtering.changeDay",arguments);
epg.filtering.filters[epg.filtering.current_filter].day=epg.date.currentTime.getDate();
epg.data.getFilterChannels(epg.filtering.current_filter,epg.date.dateToURL(epg.date.currentTime))
},quickBrowse:function(A){traceFiltering("epg.filtering.quickBrowse",arguments);
epg.filtering.previous=Element.epgGetElementsByClassName(document.getElementById("epg_toolFilters"),epg.ui.Toolbars.toolbar3.filter_classes.on)[0];
epg.ui.Toolbars.toolbar3.select(document.getElementById("epg_filter_main"));
if(epg.filtering.filters[epg.filtering.main_filter]&&epg.filtering.filters[epg.filtering.main_filter].genres.length){epg.filtering.applyFiltering();
epg.filtering.current_filter=epg.filtering.main_filter;
if(epg.filtering.filters[epg.filtering.main_filter].channels&&epg.filtering.filters[epg.filtering.main_filter].day==epg.date.currentTime.getDate()){if(!$("epg.config.eFilterCloud")){epg.views.reloadCurrentView()
}}else{epg.filtering.filters[epg.filtering.main_filter].day=epg.date.currentTime.getDate();
epg.data.getFilterChannels(epg.filtering.main_filter,epg.date.dateToURL(epg.date.currentTime))
}}else{epg.filtering.Cloud.open(epg.filtering.main_filter)
}if(A){A.stopPropagation()
}return false
},loadTag:function(A,B){traceFiltering("epg.filtering.loadTag",arguments);
filter_name=epg.filtering.tag_filter;
epg.filtering.filters.tag={name:epg.filtering.tag_filter,channels:null,genres:[A],day:null};
epg.filtering.current_filter=filter_name;
epg.filtering.applyFiltering();
epg.filtering.filters[filter_name].day=epg.date.currentTime.getDate();
epg.data.getFilterChannels(filter_name,epg.date.dateToURL(epg.date.currentTime));
epg.ui.Toolbars.toolbar3.appendTag(B)
},editFilter:function(B){traceFiltering("epg.filtering.editFilter",arguments);
var A=epg.filtering.main_filter;
epg.filtering.previous=Element.epgGetElementsByClassName(document.getElementById("epg_toolFilters"),epg.ui.Toolbars.toolbar3.filter_classes.on)[0];
epg.ui.Toolbars.toolbar3.select(document.getElementById("epg_filter_main"));
epg.filtering.Cloud.edit_mode=true;
epg.filtering.Cloud.open(A);
if(B){Event.stop(B)
}},html:{cloud_header:'<div id="epg_filterCloudHeader"><div class="epg_col1">Select</div><div class="epg_col2">Select sub categories</div><a href="#" class="epg_close" title="close">Close</a><div class="clear"></div></div>',cloud_body:'<div id="epg_filterCloudBody"><ul class="epg_filterCloudList"></ul></div>',cloud_footer:'<div id="epg_filterCloudFooter"><div id="epg_filterCloudFooterWrapper"><div class="epg_actionButton epg_negativeButton"><span><span><a>Clear All</a></span></span></div><div class="epg_actionButton epg_negativeButton"><span><span><a>Cancel</a></span></span></div><div class="epg_actionButton epg_positiveButton"><span><span><a>Apply</a></span></span></div><div class="clear"</div></div></div>',cloud_genre:"<span><span><span>XXXnameXXX</span></span></span>",cloud_more:'<li class="epg_on"><a href="#" class="epg_link_J">More...</a></li>',clear:'<div class="clear"></div>'},Cloud:{filter:null,edit_mode:false,collapsed_genres:4,activeTags:{},open:function(C){traceFiltering("epg.filtering.Cloud.open",arguments);
epg.tools.killAjax();
epg.filtering.undoStore.filters=jQuery.extend(true,{},epg.filtering.filters);
epg.filtering.undoStore.activeTags=jQuery.extend(true,{},epg.filtering.Cloud.activeTags);
epg.ui.Toolbars.disable();
epg.filtering.Cloud.filter=C;
var B=document.createElement("div");
B.setAttribute("id",epg.config.eFilterCloud);
if(epg.stateMachine.isAnyGrid()){document.getElementById(epg.config.eGrid).appendChild(B)
}else{document.getElementById(epg.config.eList).appendChild(B)
}$(B).addClassName("epg_loading");
var A=B.offsetHeight;
epg.grid.dragging=true;
jQuery(B).animate({top:0},300,"swing",function(){if(!epg.filtering.filter_genres){epg.data.getFilterGenres(epg.filtering.Cloud.write)
}else{setTimeout(epg.filtering.Cloud.write,100)
}epg.grid.dragging=false
})
},write:function(){traceFiltering("epg.filtering.Cloud.write",arguments);
var A=epg.filtering.filters[epg.filtering.Cloud.filter];
var N=epg.filtering.filter_genres;
var C=document.getElementById(epg.config.eFilterCloud);
epg.filtering.cloudBurstActive=true;
$(C).removeClassName("epg_loading");
var B="";
var E="";
var M;
var I="";
var D=0;
var P="";
var G="";
var Q="";
var F=[];
var K=['<div id="epg_filterCloudHeader"><div class="epg_col1">Select:</div><div class="epg_col2">Select sub categories:</div><a href="#" class="epg_close" id="filter_epg_close" title="close">Close</a><div class="clear"></div></div><div id="epg_filterCloudBody" style="height:384px"><ul class="epg_filterCloudList">'];
for(var L=0,H=N.length;
L<H;
L++){if(N[L].k=="7"){P="epg_separate_genre"
}else{P=""
}if(A.hashmap[N[L].k]){P+=" epg_on";
Q="epg_block_g3"
}else{Q="epg_block_g4"
}if(N[L].subcategories&&N[L].subcategories.category&&N[L].subcategories.category.length){M=N[L].subcategories.category;
D=0;
F=[];
for(var J=0,O=M.length;
J<O;
J++){I="";
G="";
if(A.hashmap[M[J].k]){G="epg_block_g3"
}else{G="epg_block_g4"
}if(A.hashmap[M[J].k]){I="epg_on";
D++
}else{if(J>=epg.filtering.Cloud.collapsed_genres){I="epg_hidden"
}}F[F.length]='<li id="epg_cloud_subgenre_'+L+"_"+J+'" class="'+I+'"><a href="#" class="epg_level_3 '+G+'" onclick="epg.filtering.Cloud.selectSubgenre(this,'+L+","+J+');return false;"><span><span><span>'+M[J].v+"</span></span></span></a></li>";
if(A.hashmap[M[J].k]){epg.filtering.Cloud.activeTags["epg_cloud_subgenre_"+L+"_"+J]=true
}}if(M.length>epg.filtering.Cloud.collapsed_genres&&D<M.length){F[F.length]='<li class="epg_on"><a href="#" class="epg_link_J epg_filter_more" onclick="epg.filtering.Cloud.expandGenre(this,'+L+'); return false;">More...</a></li>'
}K[K.length]='<li id="epg_cloud_genre_'+L+'" class="'+P+'"><h4><a href="#" class="epg_level_x '+Q+'" id="filter_epg_genre_'+J+'" onclick="epg.filtering.Cloud.selectGenre(this,'+L+'); return false;"><span><span><span>'+N[L].v+"</span></span></span></a></h4><ul>"+F.join("")+'</ul><div class="clear"></div></li>';
if(A.hashmap[N[L].k]){epg.filtering.Cloud.activeTags["epg_cloud_genre_"+L]=true
}}}K[K.length]='</ul></div><div id="epg_filterCloudFooter"><div id="epg_filterCloudFooterWrapper"><div class="epg_actionButton epg_negativeButton"><span><span><a>Clear All</a></span></span></div><div class="epg_actionButton epg_negativeButton"><span><span><a>Cancel</a></span></span></div><div class="epg_actionButton epg_positiveButton"><span><span><a>Apply</a></span></span></div><div class="clear"</div></div></div>';
C.innerHTML=K.join("");
jQuery("#filter_epg_close").click(function(){epg.filtering.Cloud.close();
return false
});
jQuery(jQuery("#epg_filterCloudFooterWrapper a").get(0)).bind("click",epg.filtering.Cloud.clear);
jQuery(jQuery("#epg_filterCloudFooterWrapper a").get(1)).bind("click",epg.filtering.Cloud.cancel);
jQuery(jQuery("#epg_filterCloudFooterWrapper a").get(2)).bind("click",epg.filtering.Cloud.apply);
epg.hitbox.send("personalfilter")
},cancel:function(){epg.filtering.filters=jQuery.extend(true,{},epg.filtering.undoStore.filters);
epg.filtering.Cloud.activeTags=jQuery.extend(true,{},epg.filtering.undoStore.activeTags);
epg.filtering.Cloud.close()
},close:function(){traceFiltering("epg.filtering.Cloud.close",arguments);
var B=document.getElementById(epg.config.eFilterCloud);
var A=B.offsetHeight;
epg.filtering.cloudBurstActive=false;
B.innerHTML="";
epg.filtering.Cloud.filter=null;
epg.filtering.Cloud.edit_mode=false;
if(!epg.filtering.previous){epg.ui.Toolbars.toolbar3.select(document.getElementById("epg_filter_off"))
}else{if(epg.filtering.previous!=document.getElementById("epg_filter_main")&&epg.filtering.current_filter!=epg.filtering.main_filter){epg.ui.Toolbars.toolbar3.select(epg.filtering.previous)
}}epg.grid.dragging=true;
jQuery(B).animate({top:0-A},300,"swing",function(){epg.grid.dragging=false;
epg.filtering.Cloud.kill()
})
},kill:function(){traceFiltering("epg.filtering.Cloud.kill",arguments);
jQuery("#"+epg.config.eFilterCloud).remove();
epg.ui.Toolbars.enable()
},autoSetHeight:function(){traceFiltering("epg.filtering.Cloud.autoSetHeight",arguments);
var B=document.getElementById(epg.config.eFilterCloud);
var D=document.getElementById("epg_filterCloudHeader");
var E=document.getElementById("epg_filterCloudBody");
var C=document.getElementById("epg_filterCloudFooter");
var A=B.parentNode.offsetHeight-D.offsetHeight-C.offsetHeight;
E.style.height=A+"px"
},apply:function(D){traceFiltering("epg.filtering.Cloud.apply",arguments);
var B=epg.filtering.filters[epg.filtering.main_filter].hashmap;
var C=Event.element(D);
epg.filtering.Cloud.close(D);
epg.filtering.current_filter=epg.filtering.Cloud.filter;
delete epg.filtering.filters[epg.filtering.main_filter].genres;
epg.filtering.filters[epg.filtering.main_filter].genres=[];
for(var A in B){epg.filtering.filters[epg.filtering.main_filter].genres.push(A.toString())
}if(epg.filtering.filters[epg.filtering.main_filter].genres.length===0){epg.data.UserData.saveData("epg_filters",epg.filtering.createCookieObject());
epg.filtering.Cloud.close();
setTimeout(function(){epg.reloadEPG()
},500);
Event.stop(D);
return 
}epg.data.UserData.saveData("epg_filters",epg.filtering.createCookieObject());
if(epg.filtering.filters[epg.filtering.main_filter].genres.length){if(jQuery("#epg_toolFilters .epg_edit").length==0){epg.ui.Toolbars.toolbar3.appendAction(document.getElementById("epg_filter_main"),"edit",epg.filtering.editFilter)
}epg.filtering.applyFiltering();
epg.filtering.filters[epg.filtering.main_filter].day=epg.date.currentTime.getDate();
epg.data.getFilterChannels(epg.filtering.main_filter,epg.date.dateToURL(epg.date.currentTime));
epg.filtering.quickBrowse()
}else{var E=(document.getElementById("epg_filter_"+epg.filtering.current_filter))?document.getElementById("epg_filter_"+epg.filtering.current_filter):document.getElementById("epg_filter_main");
epg.ui.Toolbars.toolbar3.removeAction(E);
epg.filtering.removeFiltering()
}epg.hitbox.send("applyfilter");
Event.stop(D)
},clear:function(F){traceFiltering("epg.filtering.Cloud.clear",arguments);
epg.data.UserData.saveData("epg_filters","");
var D=Event.element(F);
var C=epg.filtering.filters[epg.filtering.main_filter].hashmap;
for(var A in C){delete C[A]
}var E=Element.epgGetElementsByClassName(document.getElementById("epg_filterCloud"),"epg_on");
for(kTag in epg.filtering.Cloud.activeTags){if(kTag){var B=$(kTag);
var G=B.className;
if(B.id.match(/epg_cloud_subgenre_/)){B.firstChild.className="epg_level_3 epg_block_g4"
}else{B.firstChild.firstChild.className="epg_level_x epg_block_g4";
if(G==="epg_separate_genre epg_on"){B.className="epg_separate_genre"
}}if(G==="epg_on"){B.className=""
}}}},selectGenre:function(C,B){traceFiltering("epg.filtering.Cloud.selectGenre",arguments);
if(typeof C==="object"){C=jQuery(C);
var F=C.parents("[id^=epg_cloud_genre_]");
var D=F.find("a")[0];
var E=F.is(".epg_on");
var A=epg.filtering.filter_genres[B];
if(E){if(epg.filtering.filters[epg.filtering.main_filter].hashmap[A.k]){delete epg.filtering.filters[epg.filtering.main_filter].hashmap[A.k]
}if(A.subcategories&&A.subcategories.category&&A.subcategories.category.length){for(x=0,y=A.subcategories.category.length;
x<y;
x++){if(epg.filtering.filters[epg.filtering.main_filter].hashmap[A.subcategories.category[x].k]){delete epg.filtering.filters[epg.filtering.main_filter].hashmap[A.subcategories.category[x].k]
}}}epg.ui.Button.unselect(D);
F.find("ul:first li a").each(function(){$this=jQuery(this);
if(!$this.is(".epg_link_J")){$this.parent().removeClass("epg_on");
epg.ui.Button.unselect($this[0]);
delete epg.filtering.Cloud.activeTags[$this.attr("id")]
}});
F.removeClass("epg_on")
}else{if(!epg.filtering.filters[epg.filtering.main_filter].hashmap[A.k]){epg.filtering.filters[epg.filtering.main_filter].hashmap[A.k]=true;
if(A.subcategories&&A.subcategories.category&&A.subcategories.category.length){for(x=0,y=A.subcategories.category.length;
x<y;
x++){if(!epg.filtering.filters[epg.filtering.main_filter].hashmap[A.subcategories.category[x].k]){epg.filtering.filters[epg.filtering.main_filter].hashmap[A.subcategories.category[x].k]=true
}}}}epg.ui.Button.select(D);
F.find("ul:first li a").each(function(){$this=jQuery(this);
if(!$this.is(".epg_link_J")){$this.parent().addClass("epg_on");
epg.ui.Button.select($this[0]);
epg.filtering.Cloud.activeTags[$this.attr("id")]=true
}});
F.addClass("epg_on")
}}},selectSubgenre:function(D,C,E){traceFiltering("epg.filtering.Cloud.selectSubgenre",arguments);
D=jQuery(D);
var G=D.parents("[id^=epg_cloud_genre_]");
var A=D.parents("[id^=epg_cloud_subgenre_]");
var F=A.is(".epg_on");
var B=epg.filtering.filter_genres[C];
if(F){delete epg.filtering.filters[epg.filtering.main_filter].hashmap[epg.filtering.filter_genres[C].subcategories.category[E].k];
delete epg.filtering.filters[epg.filtering.main_filter].hashmap[B.k];
epg.ui.Button.unselect(A.find("a")[0]);
A.removeClass("epg_on");
delete epg.filtering.Cloud.activeTags[A.attr("id")];
epg.ui.Button.unselect(G.find("a")[0]);
G.removeClass("epg_on")
}else{epg.filtering.filters[epg.filtering.main_filter].hashmap[epg.filtering.filter_genres[C].subcategories.category[E].k]=true;
epg.ui.Button.select(A.find("a")[0]);
A.addClass("epg_on");
epg.filtering.Cloud.activeTags[A.attr("id")]=true;
if(G.find("li").not(".epg_on").length==0){epg.filtering.filters[epg.filtering.main_filter].hashmap[B.k]=true;
epg.ui.Button.select(G.find("a")[0])
}}},expandGenre:function(D,B){traceFiltering("epg.filtering.Cloud.expandGenre",arguments);
if(typeof D==="object"){var E=D.parentNode;
while(!E.getAttribute("id")||!E.getAttribute("id").match(/epg_cloud_genre_/)){E=E.parentNode
}var A=E.getElementsByTagName("ul")[0];
var F=B;
var C=epg.filtering.filter_genres[F].subcategories.category;
var G=D.parentNode.parentNode.getElementsByTagName("LI");
for(iKey=0,j=G.length;
iKey<j;
iKey++){if(G[iKey].className.match(/epg_hidden/)){$(G[iKey]).removeClassName("epg_hidden")
}}D.parentNode.parentNode.removeChild(D.parentNode)
}},collapseGenre:function(E,C){traceFiltering("epg.filtering.Cloud.collapseGenre",arguments);
$(E);
var F=E.parentNode;
while(!F.getAttribute("id")||!F.getAttribute("id").match(/epg_cloud_genre_/)){F=F.parentNode
}var B=F.getElementsByTagName("ul")[0];
var G=parseInt(F.getAttribute("id").match(/epg_cloud_genre_([0-9]+)/)[1],10);
var D=epg.filtering.filter_genres[G].subcategories.category;
for(var A=epg.filtering.Cloud.collapsed_genres,H=D.length;
A<H;
A++){$(B.getElementsByTagName("li")[A]).addClassName("epg_hidden")
}E.onclick=function(){epg.filtering.Cloud.expandGenre(E,C)
};
E.innerHTML=epg.filtering.text.more
}},createCookieObject:function(){traceFiltering("epg.filtering.Cloud.createCookieObject",arguments);
var C=epg.filtering.filters;
var B={};
for(var A in C){if(C[A].user){B[A]=C[A].genres
}}return B
}};epg.search={suggestion_delay:400,max_suggestions:10,no_suggestion_text:"No suggestions...",pane_innerhtml:'<div class="epg_searchResults"><div class="epg_searchResultsHeader"><div class="epg_searchResultsTitle"><a href="#" onclick="return epg.search.close()" class="epg_close" title="close"></a><h3 class="epg_searchResultsAmount">XXXresultsXXX for &#39;XXXqueryXXX&#39;</h3><div class="clear"></div></div><div class="epg_searchResultsSort"><h4>We\'ve found results with these tags</h4><ul>XXXgenresXXX</ul><br clear="all" /></div></div><div class="epg_searchResultsLister">XXXsearchresultsXXXXXXfilteredsearchtextXXX</div></div></div>',pane_empty_innerhtml:'<div class="epg_searchResults"><div class="epg_searchResultsHeader"><div class="epg_searchResultsTitle"><a href="#" onclick="return epg.search.close()" class="epg_close" title="close"></a><h3 class="epg_searchResultsAmount">0 results for &#39;XXXqueryXXX&#39;</h3><div class="clear"></div></div></div><div class="epg_searchEmptyResults"><p>Sorry but there are no results for &#39;XXXqueryXXX&#39;. Please try a different search:</p><ul><li>Use different keywords</li><li>Try more general keywords</li></ul>XXXfilteredsearchtextXXX</div></div></div>',pane_loading_innerhtml:'<div class="epg_searchResults"><div class="epg_searchResultsHeader"><div class="epg_searchResultsTitle"><h3 class="epg_searchResultsAmount">Loading Search Results...</h3><div class="clear"></div></div><div class="epg_searchLoading"></div></div>',genre_innerhtml:'<li><a class="XXXgenreclassXXX" href="#" onclick="epg.search.ajaxSearch(XXXgenresearchXXX);return false"><span><span><span><span>XXXgenreXXX</span></span></span></span></a></li> ',result_innerhtml:'<div id="XXXeventfullidXXX" class="epg_listRow"><div class="epg_searchOrder">XXXresultXXX</div><div class="epg_programme"><div class="epg_programmeGenre">XXXgenreXXX</div><a href="#" class="epg_programmeTitle" onclick="XXXclickresultXXX">XXXtitleXXX</a></div><a href="#" class="epg_schedule" onclick="XXXclickresultXXX">XXXdatetimeXXX</a><a href="#" class="epg_addChannel XXXclassfavouriteXXX" onclick="XXXclickfavouriteXXX" title="Click to add this epg_programme to your favourites"></a><a href="#" class="epg_channelNumber" onclick="XXXclickresultXXX">XXXchannelidXXX</a><a href="#" class="epg_channelName" onclick="XXXclickresultXXX">XXXchannelnameXXX</a><a href="#" class="epg_viewAirings epg_link_J" onclick="XXXviewairingsXXX">All Airings</a><a href="#" class="epg_expand epg_expand_show" onclick="XXXclickexpandXXX">Expand</a></div>',result_id_innerhtml:'<div class="epg_searchOrder">XXXresultXXX</div>',genre_classes:["epg_block_g3 epg_level_2","epg_block_g4 epg_level_2","epg_block_g3 epg_level_1","epg_block_g4 epg_level_1"],filtered_search_html:'<div class="epg_filteredSearchText"><p>These result are based on your current channel setup:<br />"XXXchannelSetupXXX"</p><p>Across all channels, there are <a href="#" id="aUnfilteredSearch">XXXunfilteredsearchresultsXXX results</a> for \'XXXqueryXXX\'</p></div>',search_field:null,search_form:null,search_pane:null,suggestion_list:null,search_field_value:"",query:"",last_suggestion:null,not_searched:true,search_genre:"all",full_results:[],collapsed_results:null,search_genres:[],sky_results:0,suggest_timeout:null,maxresults:10,reloadSearch:null,init:function(){},hardReset:function(){traceSearch("hardReset",arguments);
epg.search.full_results=[];
epg.search.last_suggestion=null;
epg.search.search_pane=null;
epg.search.search_field_value="";
if(document.getElementById(epg.config.eSearchPane)){document.getElementById(epg.config.eSearchPane).parentNode.removeChild(document.getElementById(epg.config.eSearchPane))
}if(Element.epgGetElementsByClassName(document.getElementById(epg.config.eList),"epg_searchResults").length){document.getElementById(epg.config.eList).removeChild(Element.epgGetElementsByClassName(document.getElementById(epg.config.eList),"epg_searchResults")[0])
}document.getElementById("epg_controls").style.right="110px";
if(document.getElementById(epg.config.eInfoDrag)){document.getElementById(epg.config.eInfoDrag).style.right=20
}if(epg.search.search_form!=null){if(epg.search.search_form.getElementsByTagName("input")[1]){Event.observe(epg.search.search_form.getElementsByTagName("input")[1],"click",epg.search.submit)
}}},submit:function(C){traceSearch("submit",arguments);
var D=epg.search.search_field.value;
if(D.match(/^([0-9]+)$|^([0-9]+)\s\-\s/)){var B=D.match(/^([0-9]+)$/);
if(B){B=B[1]
}else{B=D.match(/^([0-9]+)\s\-\s/)[1]
}var A=epg.data.channelnoMap[B];
if(A){if(epg.stateMachine.isAnyGrid()){epg.grid.gotoChannel(parseInt(A,10))
}else{if(epg.stateMachine.isList()){epg.list.filterByChannel(parseInt(A,10))
}}}else{epg.search.ajaxSearch(escape(D),false)
}}else{if(D==epg.search.last_suggestion){epg.search.ajaxSearch(escape(D),true);
epg.hitbox.send("searchsuggestion")
}else{epg.search.ajaxSearch(escape(D),false)
}}Event.stop(C)
},searchFromSuggestion:function(B){traceSearch("searchFromSuggestion",arguments);
var A=(window.event)?window.event.srcElement:this;
var C=this.innerHTML;
epg.search.search_field.value=C.replace(/&amp;/,"&");
epg.search.ajaxSearch(escape(C.replace(/&amp;/,"&")),true);
epg.hitbox.send("searchsuggestion");
Event.stop(B)
},ajaxEditorsPickSearch:function(B){traceSearch("ajaxEditorsPickSearch",arguments);
epg.search.query="Top Picks";
if(epg.stateMachine.isFilter()){epg.filtering.removeFiltering()
}if(epg.stateMachine.isextendedGrid()){epg.stateMachine.set(4)
}else{if(epg.stateMachine.isAnyGrid()){epg.stateMachine.set(3)
}else{epg.stateMachine.set(5)
}}if(epg.stateMachine.isAnyGrid()&&!epg.search.search_pane){epg.search.createPane();
var A=0-epg.search.search_pane.offsetWidth;
jQuery(epg.search.search_pane).css("right",A).animate({right:0},400,"swing");
jQuery("#epg_controls").css("right",110).animate({right:100-A},400,"swing");
jQuery("#"+epg.config.eInfoDrag).css("right",30).animate({right:10-A},400,"swing");
epg.hitbox.send("pre-setfilter")
}else{if(epg.stateMachine.isAnyGrid()){epg.search.search_pane.innerHTML=epg.search.pane_loading_innerhtml
}}Element.addClassName(epg.search.search_pane,"epg_loading");
if(epg.stateMachine.isAnyGrid()&&epg.search.full_results){epg.search.removeResultIDs()
}var C={editorPicks:"true",time:epg.date.dateToURL(epg.date.currentTime)};
C=epg.tools.cookieToData(C);
epg.tools.doAjax({url:epg.config.fileSearch,data:C,dataType:"json",type:"get",success:function(D){epg.search.ajaxSearchResults(D,null,C)
}});
if(B){B.stopPropagation()
}},ajaxSearch:function(G,D,B){if(G!==""){traceSearch("ajaxSearch",arguments);
epg.search.query=unescape(G);
var C=epg.tools.isArray(B)?B.join(","):"";
var A=(D)?"true":"false";
if(epg.stateMachine.isFilter()){epg.filtering.removeFiltering()
}if(epg.stateMachine.isextendedGrid()){epg.stateMachine.set(4)
}else{if(epg.stateMachine.isAnyGrid()){epg.stateMachine.set(3)
}else{epg.stateMachine.set(5)
}}if(epg.stateMachine.isAnyGrid()&&!epg.search.search_pane){epg.search.createPane();
var E=0-epg.search.search_pane.offsetWidth;
jQuery(epg.search.search_pane).css("right",E).animate({right:0},400,"swing");
jQuery("#epg_controls").animate({right:100-E},400,"swing");
jQuery("#"+epg.config.eInfoDrag).animate({right:10-E},400,"swing")
}else{if(epg.stateMachine.isAnyGrid()){epg.search.search_pane.innerHTML=epg.search.pane_loading_innerhtml
}}Element.addClassName(epg.search.search_pane,"epg_loading");
if(epg.stateMachine.isAnyGrid()&&epg.search.full_results){epg.search.removeResultIDs()
}epg.search.not_searched=false;
var F={query:epg.search.query,fromSuggestion:A,genres:C};
F=epg.tools.cookieToData(F);
epg.tools.doAjax({url:epg.config.fileSearch,data:F,dataType:"json",type:"get",success:function(H){epg.search.ajaxSearchResults(H,null,F)
}});
epg.hitbox.send("searchresults")
}},resultHash:{},lockGotoEvent:false,ajaxSearchResults:function(B,A,C){setTimeout(function(){traceSearch("ajaxSearchResults",arguments);
epg.search.results=B.results;
if(B.results&&B.results.result){B.results.result=epg.tools.arrayify(B.results.result);
var S=B.results.result;
if(epg.search.full_results){delete (epg.search.full_results)
}epg.search.full_results=[];
if(B.results.fromsuggestion&&B.results.fromsuggestion=="true"){epg.search.collapsed_results=false
}else{epg.search.collapsed_results=true
}var F={},T;
var R=S.length;
for(var K=0,I=S.length;
K<I;
K++){if(S[K].screenings&&S[K].screenings.screening){S[K].screenings.screening=epg.tools.arrayify(S[K].screenings.screening)
}var H={title:(S[K].program.title?S[K].program.title:S[K].program),start:S[K].program.start,channelid:S[K].program.channelid,eventid:S[K].program.eventid,genre:(epg.data.genre[S[K].program.genre]&&epg.data.genre[S[K].program.genre].display)?epg.data.genre[S[K].program.genre].name:false,airings:(epg.search.collapsed_results&&(S[K].screenings&&S[K].screenings.screening.length))?true:false,vodonskyplayer:S[K].vodonskyplayer};
epg.search.full_results.push(H);
if(S[K].screenings&&S[K].screenings.screening){S[K].screenings.screening=epg.tools.arrayify(S[K].screenings.screening)
}if(S[K].screenings){if(!epg.search.collapsed_results){if(S[K].screenings){for(var J=0,L=S[K].screenings.screening.length;
J<L;
J++){T=S[K].screenings.screening[J];
F={};
F.title=H.title;
F.genre=H.genre;
F.eventid=T.eventid;
F.channelid=T.channelid;
F.start=T.start;
epg.search.full_results.push(F)
}}}}}if(!B.results.searchcategories.category&&epg.search.search_genres){delete (epg.search.search_genres);
epg.search.search_genres=[];
if(B.results.related&&B.results.related.category.length){var G=B.results.related.category;
for(K=0,J=G.length;
K<J;
K++){var E={};
E.key=G[K].k;
E.value=G[K].v;
epg.search.search_genres.push(E)
}}}epg.search.search_genre="all";
if(B.results.searchcategories.category){epg.search.search_genre=B.results.searchcategories.category.k
}}else{epg.search.full_results=null
}if(B.results){if(B.results.skyresults){epg.search.sky_results=B.results.skyresults
}else{epg.search.sky_results=0
}}var Q;
if(epg.search.full_results){epg.search.resultHash={};
for(var K=0,J=epg.search.full_results.length;
K<J;
K++){if(epg.search.full_results[K].channelid&&epg.search.full_results[K].eventid){epg.search.resultHash[epg.search.full_results[K].channelid+"_"+epg.search.full_results[K].eventid]=K
}else{if(epg.search.full_results[K].vodonskyplayer){epg.search.resultHash["vodonskyplayer_"+epg.search.full_results[K].vodonskyplayer]=K
}}}Q=epg.search.pane_innerhtml;
if(epg.search.collapsed_results){var V=epg.search.full_results.length;
if(V==1){Q=Q.replace(/XXXresultsXXX/g,"1 result")
}else{Q=Q.replace(/XXXresultsXXX/g,V+" results")
}}else{var V=0;
for(var K=0,J=epg.search.full_results.length;
K<J;
K++){if(epg.search.full_results[K].start){V++
}}if(V==0){Q=Q.replace(/XXXresultsXXX/g,"Results")
}else{if(V==1){Q=Q.replace(/XXXresultsXXX/g,"1 result")
}else{Q=Q.replace(/XXXresultsXXX/g,V+" results")
}}}if(epg.config.api.search.upsell_message.enabled&&epg.Authentication.channelPrefs.properties.iCurrentProvider!==0&&parseInt(epg.search.sky_results,10)){Q=Q.replace(/XXXskyresultsXXX/,epg.search.sky_results)
}else{Q=Q.replace(/<div class="epg_searchResultsFooter">.*?<\/div>/,"")
}Q=Q.replace(/XXXqueryXXX/g,epg.search.query);
var D="";
if(epg.search.collapsed_results){var N=epg.search.genre_innerhtml.replace(/XXXgenreXXX/g,"All");
N=N.replace(/XXXgenresearchXXX/,"'"+epg.search.query+"', false");
if(epg.search.search_genre=="all"){N=N.replace(/XXXgenreclassXXX/g,epg.search.genre_classes[0])
}else{N=N.replace(/XXXgenreclassXXX/g,epg.search.genre_classes[1])
}D+=N;
for(K=0,J=epg.search.search_genres.length;
K<J;
K++){if(!epg.search.search_genres[K].key.match(/^[0-9]+_[0-9]+_|^[0-9]+$/)){N=epg.search.genre_innerhtml.replace(/XXXgenreXXX/,epg.search.search_genres[K].value);
N=N.replace(/XXXgenresearchXXX/,"'"+epg.search.query+"',false,['"+epg.search.search_genres[K].key+"']");
if(epg.search.search_genre==epg.search.search_genres[K].key){N=N.replace(/XXXgenreclassXXX/,epg.search.genre_classes[0])
}else{N=N.replace(/XXXgenreclassXXX/,epg.search.genre_classes[1])
}D+=N
}}Q=Q.replace(/XXXgenresXXX/,D)
}else{Q=Q.replace(/<div class="epg_searchResultsSort">.*?<\/div>/,"")
}var P=[];
var O="";
if(!epg.search.collapsed_results){if(epg.search.full_results[0].vodonskyplayer){epg.search.full_results[0].vodonskyplayer=[epg.search.full_results[0].vodonskyplayer]
}else{epg.search.full_results[0].vodonskyplayer=[]
}for(K=1,J=epg.search.full_results.length;
K<J;
K++){if(epg.search.full_results[K].vodonskyplayer){epg.search.full_results[0].vodonskyplayer.push(epg.search.full_results[K].vodonskyplayer)
}}if(epg.search.full_results[0].vodonskyplayer.length>0){epg.search.full_results.splice(2,0,"vodonskyplayer")
}else{delete (epg.search.full_results[0].vodonskyplayer)
}}for(K=0,J=epg.search.full_results.length;
K<J;
K++){if(epg.data.channels[epg.search.full_results[K].channelid]&&epg.search.full_results[K]!="vodonskyplayer"){P[P.length]='<div id="epg_searchresult_'+epg.search.full_results[K].channelid+"_"+epg.search.full_results[K].eventid+'" class="epg_listRow"><div class="epg_searchOrder">'+((!epg.search.collapsed_results&&epg.search.full_results[0].vodonskyplayer&&K>2)?(K):(K+1))+'</div><div class="epg_programme"><div class="epg_programmeGenre">'+(epg.search.full_results[K].genre?epg.search.full_results[K].genre:"")+'</div><a href="#" class="epg_programmeTitle" onclick="epg.search.resultAction('+K+', this);return false">'+epg.search.full_results[K].title+'</a></div><a href="#" class="epg_schedule" onclick="epg.search.resultAction('+K+', this);return false">'+epg.date.dateToString(epg.search.full_results[K].start)+'</a><a href="#" class="epg_addChannel '+(epg.data.isFavourite(epg.search.full_results[K].channelid)?"epg_on":"")+'" onclick="epg.search.toggleFavourite('+epg.search.full_results[K].channelid+');return false" title="Click to add this epg_programme to your favourites"></a><a href="#" class="epg_channelNumber" onclick="epg.search.resultAction('+K+', this);return false">'+epg.data.channels[epg.search.full_results[K].channelid].channelno+'</a><a href="#" class="epg_channelName" onclick="epg.search.resultAction('+K+', this);return false">'+epg.data.channels[epg.search.full_results[K].channelid].title+"</a>"+(epg.search.full_results[K].airings?'<a href="#" class="epg_viewAirings epg_link_J" onclick="epg.search.ajaxSearch(\''+epg.search.full_results[K].title.replace("'","\\'")+"', true ); return false\">All Airings</a>":"")+(epg.search.full_results[K].vodonskyplayer&&epg.search.collapsed_results?epg.config.search.vodHtml.replace("##VODURL##",epg.search.full_results[K].vodonskyplayer):"")+(epg.config.api.bubble.enabled?'<a href="#" class="epg_expand epg_expand_show" onclick="epg.search.listBubble(this,'+K+');return false">Expand</a>':"")+"</div>"
}if(epg.search.collapsed_results&&epg.search.full_results[K].vodonskyplayer&&!epg.search.full_results[K].channelid){P[P.length]='<div id="epg_searchresult_vod_'+epg.search.full_results[K].vodonskyplayer+'" class="epg_listRow"><div class="epg_searchOrder">'+((!epg.search.collapsed_results&&epg.search.full_results[0].vodonskyplayer&&K>2)?(K):(K+1))+'</div><div class="epg_programme"><div class="epg_programmeGenre">'+(epg.search.full_results[K].genre?epg.search.full_results[K].genre:"")+'</div><span class="epg_programmeTitle">'+epg.search.full_results[K].title+"</span></div>"+(epg.search.full_results[K].airings?'<a href="#" class="epg_viewAirings epg_link_J" onclick="epg.search.ajaxSearch(\''+epg.search.full_results[K].title.replace("'","\\'")+"', true ); return false\">All Airings</a>":"")+(epg.search.full_results[K].vodonskyplayer&&epg.search.collapsed_results?epg.config.search.vodHtml.replace("##VODURL##",epg.search.full_results[K].vodonskyplayer):"")+(epg.config.api.bubble.enabled?'<a href="#" class="epg_expand epg_expand_show" onclick="epg.search.listBubble(this,'+K+');return false">Expand</a>':"")+"</div>"
}if(epg.search.full_results[K]=="vodonskyplayer"){for(var U=0,M=epg.search.full_results[0].vodonskyplayer.length;
U<M;
U++){P[P.length]=epg.config.search.airings_vodHtml.replace("##TITLE##",epg.search.full_results[0].title).replace("##VODURL##",epg.search.full_results[0].vodonskyplayer[U])
}}}Q=Q.replace(/XXXsearchresultsXXX/,P.join(""));
epg.hitbox.send("epg search")
}else{Q=epg.search.pane_empty_innerhtml;
if(epg.config.api.search.upsell_message.enabled&&epg.Authentication.channelPrefs.properties.iCurrentProvider!==0&&parseInt(epg.search.sky_results,10)){Q=Q.replace(/XXXskyresultsXXX/,epg.search.sky_results)
}else{Q=Q.replace(/<div class="epg_searchResultsFooter">.*?<\/div>/,"")
}Q=Q.replace(/XXXqueryXXX/g,epg.search.query)
}Q=Q.replace(/XXXfilteredsearchtextXXX/g,"");
Element.removeClassName(epg.search.search_pane,"epg_loading");
if(epg.stateMachine.isAnyGrid()){epg.search.renderPane(Q);
if(epg.search.full_results&&epg.search.lockGotoEvent===false&&epg.search.full_results[0].eventid){epg.grid.gotoEvent(epg.search.full_results[0].eventid,epg.search.full_results[0].channelid,epg.search.full_results[0].start,true)
}}else{epg.search.renderList(Q)
}jQuery("#epg_searchPane a.vod").click(function(){epg.hitbox.send("skyplayervod")
});
jQuery("#aUnfilteredSearch").click(function(){jQuery("#"+epg.ui.Dropdowns.providers.value_id).html(jQuery("#epg_dropdown_epg_provider_options").html());
epg.hitbox.send("selectprovider");
epg.Authentication.channelPrefs.saveSingleCP(0);
epg.search.ajaxSearch(C.query,C.fromSuggestion,C.genres);
return false
})
},200)
},renderPane:function(A){traceSearch("renderPane",arguments);
epg.search.search_pane.innerHTML=A;
epg.search.autoSetHeight()
},renderList:function(A){traceSearch("renderList",arguments);
document.getElementById(epg.config.eListBar).style.display="none";
document.getElementById(epg.config.eListMain).style.display="none";
var B=Element.epgGetElementsByClassName(document.getElementById(epg.config.eList),"epg_searchResults");
if(B.length){B[0].parentNode.removeChild(B[0])
}$(epg.config.eList).insert(A);
epg.search.autoSetHeight()
},createPane:function(){traceSearch("createPane",arguments);
epg.search.search_pane=document.createElement("div");
epg.search.search_pane.setAttribute("id",epg.config.eSearchPane);
epg.search.search_pane.style.height=document.getElementById(epg.config.eGrid).offsetHeight-1+"px";
epg.search.search_pane.onMouseDown=function(){e.stopPropagation()
};
epg.search.search_pane.innerHTML=epg.search.pane_loading_innerhtml;
document.getElementById(epg.config.eGrid).appendChild(epg.search.search_pane)
},autoSetHeight:function(){traceSearch("autoSetHeight",arguments);
var A=document.getElementById(epg.config.eEPG);
var B=Element.epgGetElementsByClassName(A,"epg_searchResults")[0];
var D=Element.epgGetElementsByClassName(B,"epg_searchResultsHeader")[0];
var G=(epg.search.full_results)?Element.epgGetElementsByClassName(B,"epg_searchResultsLister")[0]:Element.epgGetElementsByClassName(B,"epg_searchEmptyResults")[0];
var C=Element.epgGetElementsByClassName(B,"epg_searchResultsFooter");
var F=parseInt(Element.getStyle(B,"paddingTop"),10)*2+parseInt(Element.getStyle(B,"paddingBottom"),10)*2+parseInt(Element.getStyle(G,"paddingTop"),10)+parseInt(Element.getStyle(G,"paddingBottom"),10);
var E=B.parentNode.offsetHeight-D.offsetHeight-F;
if(C.length){E=E-C[0].offsetHeight
}G.style.height=E+"px"
},refresh:function(){traceSearch("refresh",arguments);
if((epg.stateMachine.last!=3&&epg.stateMachine.last!=4)&&epg.stateMachine.isAnyGrid()){epg.search.createPane();
epg.search.search_pane.innerHTML="";
epg.search.search_pane.style.right=0;
document.getElementById(epg.config.eListBar).style.display="";
document.getElementById(epg.config.eListMain).style.display="";
document.getElementById("epg_controls").style.right=110+epg.search.search_pane.offsetWidth+"px";
if(document.getElementById(epg.config.eInfoDrag)){document.getElementById(epg.config.eInfoDrag).style.right=20+epg.search.search_pane.offsetWidth+"px"
}document.getElementById(epg.config.eSearchPane).appendChild(Element.epgGetElementsByClassName(document.getElementById(epg.config.eList),"epg_searchResults")[0]);
if(epg.search.full_results[0].eventid){epg.grid.gotoEvent(epg.search.full_results[0].eventid,epg.search.full_results[0].channelid,epg.search.full_results[0].start,true)
}}else{if((epg.stateMachine.last==3||epg.stateMachine.last==4)&&!epg.stateMachine.isAnyGrid()){document.getElementById(epg.config.eListBar).style.display="none";
document.getElementById(epg.config.eListMain).style.display="none";
document.getElementById(epg.config.eList).appendChild(Element.epgGetElementsByClassName(document.getElementById(epg.config.eGrid),"epg_searchResults")[0]);
epg.search.killPane()
}}setTimeout(epg.search.autoSetHeight,1)
},close:function(B){traceSearch("close",arguments);
epg.stateMachine.set(epg.stateMachine.current-3);
if(epg.stateMachine.isAnyGrid()){var A=0-epg.search.search_pane.offsetWidth;
jQuery(epg.search.search_pane).animate({right:A},200,"swing",function(){epg.search.killPane()
});
jQuery("#epg_controls").animate({right:110},200,"swing");
jQuery("#"+epg.config.eInfoDrag).animate({right:20},200,"swing");
epg.search.search_pane.innerHTML="";
epg.search.removeResultIDs()
}else{if(Element.epgGetElementsByClassName(document.getElementById(epg.config.eList),"epg_searchResults").length){document.getElementById(epg.config.eList).removeChild(Element.epgGetElementsByClassName(document.getElementById(epg.config.eList),"epg_searchResults")[0])
}document.getElementById(epg.config.eListBar).style.display="";
document.getElementById(epg.config.eListMain).style.display="";
epg.list.load(epg.date.currentTime.getTime());
document.getElementById("epg_controls").style.right="110px";
if(document.getElementById(epg.config.eInfoDrag)){document.getElementById(epg.config.eInfoDrag).style.right="20px"
}}return false
},killPane:function(){traceSearch("killPane",arguments);
if(epg.search.search_pane){epg.search.search_pane.parentNode.removeChild(epg.search.search_pane)
}epg.search.search_pane=null
},resultAction:function(D,A){if(epg.search.lockGotoEvent!==false){return 
}traceSearch("resultAction",arguments);
if(epg.stateMachine.isAnyGrid()){epg.grid.gotoEvent(epg.search.full_results[D].eventid,epg.search.full_results[D].channelid,epg.search.full_results[D].start,true)
}else{if(epg.config.api.bubble.enabled){var B=A.parentNode;
while(!Element.hasClassName(B,"epg_listRow")){B=B.parentNode
}var C=Element.epgGetElementsByClassName(B,"epg_expand")[0];
epg.search.listBubble(C,D)
}}},listBubble:function(A,H){traceSearch("listBubble",arguments);
var C=epg.search.full_results[H].channelid;
var G=epg.search.full_results[H].eventid;
var D=(new Date(parseInt(epg.search.full_results[H].start,10))).getDate();
var F=A.parentNode;
while(!F.className.toString().match(/epg_listRow/)){F=F.parentNode
}var B=document.getElementById("bubble_event_"+C+"_"+G);
if(!B){B='<div id="bubble_event_'+C+"_"+G+'" class="epg_listBubble epg_emptyBubble epg_hidden_bubble"></div>';
jQuery(F).after(B)
}B=jQuery("#bubble_event_"+C+"_"+G);
if(B.hasClass(epg.config.listHiddenBubble)){var E=function(){jQuery(B).removeClass(epg.config.listHiddenBubble);
jQuery(A).removeClass(epg.config.listExpand).addClass(epg.config.listCollapse);
jQuery(A).html("Collapse");
epg.data.getProgram(G,C,D,epg.bubble.processProgramData_list)
};
if(jQuery("#epg_bubble").length>0){jQuery("#epg_bubble").fadeTo("fast",0,function(){jQuery("#epg_bubble").slideUp(function(){jQuery("#epg_bubble").parent().prev().find("a.epg_expand").addClass(epg.config.listExpand).removeClass(epg.config.listCollapse).text("Expand");
jQuery("#epg_bubble").parent(".epg_listBubble").remove();
jQuery("#epg_bubble").remove();
E()
})
})
}else{E()
}}else{epg.list.removeBubble(B);
jQuery(A).addClass(epg.config.listExpand).removeClass(epg.config.listCollapse);
jQuery(A).html("Expand")
}return false
},toggleFavourite:function(D){traceSearch("toggleFavourite",arguments);
var C=Element.epgGetElementsByClassName(Element.epgGetElementsByClassName(document.getElementById(epg.config.eEPG),"epg_searchResultsLister")[0],"epg_listRow");
var E=false;
if(!epg.data.isFavourite(D)){epg.data.addFavourite(D);
E=true
}else{epg.data.removeFavourite(D)
}for(var A=0,G=C.length;
A<G;
A++){var B=C[A].id.toString().match(/^epg_searchresult_([0-9]+)/);
if(B&&B[1]==D){var F=Element.epgGetElementsByClassName(C[A],"epg_addChannel")[0];
if(E){Element.addClassName(F,"epg_on")
}else{Element.removeClassName(F,"epg_on")
}}}},populateResultIDs:function(){traceSearch("populateResultIDs",arguments);
if(epg.search.full_results){var D;
var C;
for(var A=0,F=epg.search.full_results.length;
A<F;
A++){if(!document.getElementById("search_"+epg.search.full_results[A].channelid+"_"+epg.search.full_results[A].eventid)){var B=document.getElementById("grid_"+epg.search.full_results[A].channelid+"_"+epg.search.full_results[A].eventid);
if(B){C=B.parentNode;
if(!document.getElementById("search_"+epg.search.full_results[A].channelid+"_"+epg.search.full_results[A].eventid)){D=epg.search.result_id_innerhtml.replace(/XXXresultXXX/,A+1);
D=D.createDOMElement();
D.className="epg_searchOrder";
D.setAttribute("id","search_"+epg.search.full_results[A].channelid+"_"+epg.search.full_results[A].eventid);
C.appendChild(D);
D.style.left=Element.positionedFromOffset(B,C).left-D.offsetWidth+"px"
}}var E=document.getElementById("favourite_"+epg.search.full_results[A].channelid+"_"+epg.search.full_results[A].eventid);
if(E){C=E.parentNode;
if(!document.getElementById("search_"+epg.search.full_results[A].channelid+"_"+epg.search.full_results[A].eventid+"_f")){D=epg.search.result_id_innerhtml.replace(/XXXresultXXX/,A+1);
D=D.createDOMElement();
D.className="epg_searchOrder";
D.setAttribute("id","search_"+epg.search.full_results[A].channelid+"_"+epg.search.full_results[A].eventid+"_f");
C.appendChild(D);
D.style.left=Element.positionedFromOffset(E,C).left-D.offsetWidth+"px"
}}}}}},removeResultIDs:function(){traceSearch("removeResultIDs",arguments);
if(epg.search.full_results){var B;
for(var A=0,C=epg.search.full_results.length;
A<C;
A++){B=document.getElementById("search_"+epg.search.full_results[A].channelid+"_"+epg.search.full_results[A].eventid);
if(B){B.parentNode.removeChild(B)
}B=document.getElementById("search_"+epg.search.full_results[A].channelid+"_"+epg.search.full_results[A].eventid+"_f");
if(B){B.parentNode.removeChild(B)
}}}},enableSuggestions:function(){traceSearch("enableSuggestions",arguments);
Event.observe(epg.search.search_field,"keydown",epg.search.captureSuggestionsEvent);
Event.observe(epg.search.search_field,"blur",epg.search.disableSuggestions)
},disableSuggestions:function(){traceSearch("disableSuggestions",arguments);
clearTimeout(epg.search.suggest_timeout);
Event.stopObserving(epg.search.search_field,"keydown",epg.search.captureSuggestionsEvent);
Event.stopObserving(epg.search.search_field,"blur",epg.search.disableSuggestions);
setTimeout(epg.search.removeSuggestions,200)
},captureSuggestionsEvent:function(B){traceSearch("captureSuggestionsEvent",arguments);
clearTimeout(epg.search.suggest_timeout);
epg.search.not_searched=true;
var A=(window.event)?window.event.keyCode:(B.keyCode)?B.keyCode:(B.which)?B.which:null;
var C=epg.search.search_field.value.strip();
if(A==40&&epg.search.suggestion_list){epg.search.downSuggestionList()
}else{if(A==38&&epg.search.suggestion_list){epg.search.upSuggestionList()
}else{if(A!=13&&C.length>1){epg.search.suggest_timeout=setTimeout(epg.search.ajaxSuggest,epg.search.suggestion_delay)
}else{epg.search.removeSuggestions()
}}}},ajaxSuggest:function(C){traceSearch("ajaxSuggest",arguments);
var A=epg.search.search_field.value;
if(A!=epg.search.search_field_value&&A.toString().length>2){var B={prefix:A};
B=epg.tools.cookieToData(B);
epg.tools.doAjax({url:epg.config.fileSuggestion,data:B,dataType:"json",type:"get",success:function(D){epg.search.ajaxSuggestionResults(D)
}});
epg.search.search_field_value=A
}else{if(A.toString().length<3){epg.search.removeSuggestions()
}}},ajaxSuggestionResults:function(L){traceSearch("ajaxSuggestionResults",arguments);
if(epg.search.not_searched){var B=false;
if(!epg.search.suggestion_list){epg.search.createSuggestionList()
}else{while(epg.search.suggestion_list.childNodes.length){epg.search.suggestion_list.removeChild(epg.search.suggestion_list.firstChild)
}}var C=Element.positionedFromOffset(epg.search.search_field,document.getElementById(epg.config.eEPG));
epg.search.suggestion_list.style.top=C.top+C.height+"px";
epg.search.suggestion_list.style.left=C.left+"px";
epg.search.suggestion_list.style.width=C.width-1+"px";
var K;
var H;
if(L.suggestion){L.suggestion=epg.tools.arrayify(L.suggestion)
}if(L.suggestion&&L.suggestion.length){var D=L.suggestion;
var F=(D.length<epg.search.max_suggestions)?D.length:epg.search.max_suggestions;
for(var I=0;
I<F;
I++){if(D[I].type=="P"||D[I].type=="A"||D[I].type=="S"){K=document.createElement("li");
H=document.createElement("a");
H.className="epg_link_G";
Event.observe(H,"click",epg.search.searchFromSuggestion);
Event.observe(H,"mouseover",epg.search.highlightSuggestion);
Event.observe(H,"mouseout",epg.search.unhighlightSuggestion);
H.appendChild(document.createTextNode(D[I].value));
K.appendChild(H);
epg.search.suggestion_list.appendChild(K)
}else{if(D[I].type=="C"){var E=D[I].value;
if(epg.data.channels[E]){var G=epg.data.channels[E].channelno+" - "+epg.data.channels[E].title;
K=document.createElement("li");
H=document.createElement("a");
H.className="epg_link_G";
H.channel_id=E;
var A=function(){if(epg.stateMachine.isAnyGrid()){epg.search.suggestion_list.blur();
epg.grid.gotoChannel(this.channel_id)
}else{epg.search.suggestion_list.blur();
epg.list.filterByChannel(parseInt(this.channel_id,10))
}};
Event.observe(H,"click",A);
Event.observe(H,"mouseover",epg.search.highlightSuggestion);
Event.observe(H,"mouseout",epg.search.unhighlightSuggestion);
H.appendChild(document.createTextNode(G));
K.appendChild(H);
epg.search.suggestion_list.insertBefore(K,epg.search.suggestion_list.firstChild)
}}}}}else{K=document.createElement("li");
var J=document.createElement("span");
J.appendChild(document.createTextNode(epg.search.no_suggestion_text));
K.appendChild(J);
epg.search.suggestion_list.appendChild(K)
}}else{if(epg.search.suggestion_list){epg.search.removeSuggestions()
}}},createSuggestionList:function(){traceSearch("createSuggestionList",arguments);
epg.search.suggestion_list=document.createElement("ul");
epg.search.suggestion_list.setAttribute("id","epg_suggestions");
document.getElementById(epg.config.eEPG).appendChild(epg.search.suggestion_list)
},removeSuggestions:function(){traceSearch("removeSuggestions",arguments);
epg.search.search_field_value="";
if(epg.search.suggestion_list){document.getElementById(epg.config.eEPG).removeChild(epg.search.suggestion_list)
}epg.search.suggestion_list=null
},downSuggestionList:function(){traceSearch("downSuggestionList",arguments);
var C=-1;
if(epg.search.suggestion_list&&Element.epgGetElementsByClassName(epg.search.suggestion_list,"selected").length){var D=Element.epgGetElementsByClassName(epg.search.suggestion_list,"selected")[0];
Element.removeClassName(D,"selected");
var B=epg.search.suggestion_list.getElementsByTagName("a");
for(var A=0,E=B.length;
A<E;
A++){if(B[A]==D){C=A;
break
}}}C+=1;
if(!epg.search.suggestion_list.getElementsByTagName("a")[C]){C=0
}if(C<epg.search.suggestion_list.getElementsByTagName("a").length){Element.addClassName(epg.search.suggestion_list.getElementsByTagName("a")[C],"selected");
epg.search.search_field.value=epg.search.suggestion_list.getElementsByTagName("a")[C].firstChild.nodeValue;
epg.search.last_suggestion=epg.search.suggestion_list.getElementsByTagName("a")[C].firstChild.nodeValue
}},upSuggestionList:function(){traceSearch("upSuggestionList",arguments);
var C=-1;
if(epg.search.suggestion_list&&Element.epgGetElementsByClassName(epg.search.suggestion_list,"selected").length){var D=Element.epgGetElementsByClassName(epg.search.suggestion_list,"selected")[0];
Element.removeClassName(D,"selected");
var B=epg.search.suggestion_list.getElementsByTagName("a");
for(var A=0,E=B.length;
A<E;
A++){if(B[A]==D){C=A;
break
}}}C-=1;
if(C<0){C=epg.search.suggestion_list.getElementsByTagName("a").length-1
}if(C>-1){Element.addClassName(epg.search.suggestion_list.getElementsByTagName("a")[C],"selected");
epg.search.search_field.value=epg.search.suggestion_list.getElementsByTagName("a")[C].firstChild.nodeValue;
epg.search.last_suggestion=epg.search.suggestion_list.getElementsByTagName("a")[C].firstChild.nodeValue
}},highlightSuggestion:function(){traceSearch("highlightSuggestion",arguments);
var A=(window.event)?window.event.srcElement:this;
Element.addClassName(A,"selected")
},unhighlightSuggestion:function(){traceSearch("unhighlightSuggestion",arguments);
var A=(window.event)?window.event.srcElement:this;
Element.removeClassName(A,"selected")
},swapProvider:function(){traceSearch("swapProvider",arguments);
epg.hitbox.send("seemorefromsky");
epg.search.reloadSearch=epg.search.search_field.value;
epg.Authentication.channelPrefs.saveSingleCP(0)
},reloadSearchTerm:function(){traceSearch("reloadSearchTerm",arguments);
epg.search.search_field.value=epg.search.reloadSearch;
if(epg.search.results&&epg.search.results.fromsuggestion==="true"){epg.search.ajaxSearch(epg.search.reloadSearch,true)
}else{epg.search.ajaxSearch(epg.search.reloadSearch,false)
}epg.search.reloadSearch=null
}};epg.views={init:function(){},tabStates:function(A){traceViews("epg.views.tabStates",arguments);
switch(A){case 0:epg.hitbox.send("maintab_grid");
break;
case 1:epg.hitbox.send("maintab_detailed_grid");
break;
case 2:epg.hitbox.send("maintab_list");
break
}epg.stateMachine.set(epg.stateMachine.getDisplayState(A));
epg.data.UserData.saveData("epg_viewstate",epg.stateMachine.getTabState());
if(epg.stateMachine.current==epg.stateMachine.last){return 
}epg.tools.killAjax();
if(epg.stateMachine.isAnyGrid()&&epg.ui.Dropdowns.times.all_day===true){epg.ui.Dropdowns.times.all_day=false
}epg.ui.infoPane.hideInfo();
if(epg.list.lastViewedTime!==false){epg.date.setCurrentTime(epg.list.lastViewedTime);
traceCurrentTime(19);
epg.ui.Dropdowns.times.update(epg.list.lastViewedTime);
epg.list.lastViewedTime=false
}if(epg.stateMachine.isextendedGrid()){epg.list.clear();
epg.grid.clear();
epg.grid.show();
epg.grid.makeKey()
}if(epg.stateMachine.isGrid()){epg.list.clear();
epg.grid.clear();
epg.grid.show();
epg.grid.makeKey()
}if(epg.stateMachine.isSearch()){epg.search.refresh()
}if(epg.stateMachine.isList()){epg.grid.clear();
epg.list.clear();
epg.list.show();
if(!epg.stateMachine.isSearch()){epg.list.load(epg.date.getTimeOfDay())
}}jQuery("#epg_tab_row .epg_tab").each(function(){$this=jQuery(this);
if($this.attr("id")=="epg_stateChanger_"+A){$this.removeClass("epg_tab_off")
}else{$this.addClass("epg_tab_off")
}})
},reloadCurrentView:function(){traceViews("epg.views.reloadCurrentView",arguments);
if(epg.stateMachine.isAnyGrid()){epg.list.clear();
epg.grid.clear();
epg.grid.show();
epg.grid.makeKey()
}else{epg.grid.clear();
epg.list.clear();
epg.list.tracking.currentBlock=0;
epg.list.load()
}},gotoDay:function(A){traceViews("epg.views.gotoDay",arguments);
if(epg.stateMachine.isList()){epg.stateMachine.set(2)
}if(epg.stateMachine.isSearch()){epg.search.close()
}if(epg.stateMachine.isFilter()){epg.date.setCurrentTime(epg.date.nixToDate(A))
}else{epg.date.setCurrentTime(epg.stateMachine.storedCurrentTime)
}traceCurrentTime(18);
if(!epg.stateMachine.isFilter()){if(epg.stateMachine.isAnyGrid()){epg.grid.gotoDay(A.valueOf())
}if(epg.stateMachine.isList()&&!epg.stateMachine.isSearch()){epg.list.gotoDay(A.valueOf())
}}else{epg.filtering.changeDay()
}epg.hitbox.send("select_day",epg.date.currentDay)
},gotoTime:function(A){traceViews("epg.views.gotoTime",arguments);
if(epg.stateMachine.isSearch()){epg.search.close()
}epg.date.setCurrentTime(A);
traceCurrentTime(17);
A+=epg.date.iLocalTimeOffset;
if(epg.stateMachine.isAnyGrid()){epg.grid.gotoTime(A.valueOf())
}if(epg.stateMachine.isList()&&!epg.stateMachine.isSearch()){epg.list.gotoTime(A.valueOf())
}},gotoEvent:function(C,B,D,A){traceViews("epg.views.gotoEvent",arguments);
if(epg.stateMachine.isAnyGrid()){epg.grid.gotoEvent(C,B,D,true)
}if(epg.stateMachine.isList()){if(epg.stateMachine.isSearch()){epg.search.close()
}epg.list.gotoEvent(C,B,D,true)
}}};
epg.stateMachine={bubble:0,current:0,last:0,storedCurrentTime:false,haveServerTime:false,lastClickedDropDown:false,isHDChannels:false,init:function(B){var A;
if(getURLParam("view")!==null){var A=parseInt(getURLParam("view"),10)
}else{var A=epg.data.UserCookie.getCookie("epg_viewstate"+epg.config.cookieSuffix)||epg.config.general.default_view
}if((A===0&&!epg.config.api.view.enabled.grid)||(A===1&&!epg.config.api.view.enabled.detailed)||(A===2&&!epg.config.api.view.enabled.list)){A=epg.config.general.default_view
}if(getURLParam("channelId")){A=0
}epg.stateMachine.last=A;
epg.stateMachine.set(A)
},hardReset:function(){epg.stateMachine.init(true)
},getTabState:function(){if(epg.stateMachine.isGrid()){return 0
}else{if(epg.stateMachine.isextendedGrid()){return 1
}else{return 2
}}},getDisplayState:function(A){var B=epg.stateMachine.current;
if(A===0){if(epg.stateMachine.isTvListing()){return 0
}if(epg.stateMachine.isSearch()){return 3
}if(epg.stateMachine.isFilter()){return 6
}}if(A===1){if(epg.stateMachine.isTvListing()){return 1
}if(epg.stateMachine.isSearch()){return 4
}if(epg.stateMachine.isFilter()){return 7
}}if(A===2){if(epg.stateMachine.isTvListing()){return 2
}if(epg.stateMachine.isSearch()){return 5
}if(epg.stateMachine.isFilter()){return 8
}}},isTvListing:function(){if(epg.stateMachine.current===0||epg.stateMachine.current===1||epg.stateMachine.current===2){return true
}return false
},isSearch:function(){if(epg.stateMachine.current===3||epg.stateMachine.current===4||epg.stateMachine.current===5){return true
}return false
},isFilter:function(){if(epg.stateMachine.current===6||epg.stateMachine.current===7||epg.stateMachine.current===8){return true
}return false
},isAnyGrid:function(){return(epg.stateMachine.isextendedGrid()||epg.stateMachine.isGrid())
},isList:function(){if(epg.stateMachine.current===2||epg.stateMachine.current===5||epg.stateMachine.current===8){return true
}return false
},setBubbleState:function(A){epg.stateMachine.bubble=A
},isGrid:function(){if(epg.stateMachine.current===0||epg.stateMachine.current===3||epg.stateMachine.current===6){return true
}return false
},isextendedGrid:function(){if(epg.stateMachine.current===1||epg.stateMachine.current===4||epg.stateMachine.current===7){return true
}else{return false
}},isGrid_last:function(){return(/0|3|6/).test(epg.stateMachine.last)
},isextendedGrid_last:function(){return(/1|4|7/).test(epg.stateMachine.last)
},getCurrentZoom:function(){return epg.stateMachine.isGrid()?0:1
},set:function(B){epg.stateMachine.last=epg.stateMachine.current;
epg.stateMachine.current=B;
var A=jQuery("#skyEPG");
if(epg.stateMachine.isAnyGrid()){if(epg.stateMachine.isGrid()){A.removeClass(epg.config.extendedGrid);
if(epg.stateMachine.isSearch()){}}else{A.addClass(epg.config.extendedGrid)
}}else{A.removeClass(epg.config.extendedGrid)
}}};epg.ui={init:function(){traceUi("init",arguments);
epg.ui.writeUI();
epg.ui.setupViews();
epg.ui.Toolbars.init();
epg.ui.setupGrid();
epg.ui.setupList();
epg.ui.infoPane.init();
if(epg.config.siteId!=4){epg.ui.preloadImages()
}},preloadImages:function(){var B="images/skin-sky/bubble/";
var A=[B+"bl.gif",B+"bm.gif",B+"br.gif",B+"l.gif",B+"r.gif",B+"tl.gif",B+"tm.gif",B+"tr.gif"];
var D=[];
for(var E=0,C=A.length;
E<C;
E++){D[E]=new Image;
D[E].src=A[E]
}},doFade:function(B,A,C,D){jQuery("#"+B).addClass("epg_hidden").fadeOut(A,C)
},hardReset:function(){traceUi("init",arguments);
epg.ui.Toolbars.hardReset();
epg.ui.infoPane.hardReset();
epg.ui.modalPane.kill()
},writeUI:function(){traceUi("writeUI",arguments);
var C=[{div:[{div:null,"class":"epg_toolbar1"},{div:null,"class":"epg_toolbar2"},{div:null,"class":"epg_toolbar3"}],"class":"epg_header",id:"epg_header"}];
var A=[{div:[{div:null,id:"epg_timeline","class":"epg_timeline"},{div:null,id:"epg_key","class":"epg_key"},{div:[{SPAN:null,id:"gridWrapper","class":"gridWrapper"}],id:"gridSchedule","class":"gridSchedule notScrolling"},{div:null,"class":"clear"},{div:[{div:null,"class":"epg_scrollButton",id:"epg_scrollS"},{div:null,"class":"epg_scrollButton",id:"epg_scrollE"},{div:null,"class":"epg_scrollButton",id:"epg_scrollW"},{div:null,"class":"epg_scrollButton",id:"epg_scrollN"}],"class":"epg_controls",id:"epg_controls"}],id:"epg_grid","class":"view_off"}];
var B=[{div:[{div:[{div:null,id:"epg_list_filters"},{div:[{form:[{div:"Sort by:","class":"epg_type_1"},{input:null,type:"radio",value:"time",id:"epg_listTime",name:"sort"},{label:"Time","for":"epg_listTime","class":"epg_type_8"},{input:null,type:"radio",value:"channel",id:"epg_listChannel",name:"sort"},{label:"Channel","for":"epg_listChannel","class":"epg_type_8"}]}],"class":"epg_ListViewChoice"}],id:"listViewBar"},{div:null,id:"epg_listViewArea"}],id:"epg_list","class":"view_off"}];
info_pane='<div id="epg_info_outer"><div id="epg_info"></div><div class="epg_info_spacer"></div><div id="epg_info_otherairings"></div></div>';
if(epg.config.general.infoPane_position==1){jQuery("#"+epg.config.eEPG).append(info_pane)
}Element.appendChildrenFromObject(document.getElementById(epg.config.eEPG),C);
Element.appendChildrenFromObject(document.getElementById(epg.config.eEPG),A);
Element.appendChildrenFromObject(document.getElementById(epg.config.eEPG),B);
if(epg.config.general.infoPane_position==0){jQuery("#"+epg.config.eEPG).append(info_pane)
}},setupViews:function(){traceUi("setupViews",arguments);
if(epg.stateMachine.getTabState()===0||epg.stateMachine.getTabState()===1){epg.grid.show()
}else{epg.list.show()
}},setupGrid:function(){traceUi("setupGrid",arguments);
var A=epg.data.UserCookie.getCookie("epg_draginfo"+epg.config.cookieSuffix);
if(!A){epg.ui.Info.createDragInfo()
}epg.ui.nextDay.setup()
},setupList:function(){},Toolbars:{enabled:true,init:function(){this.toolbar1.setup();
this.toolbar2.setup();
this.toolbar3.setup()
},enable:function(){traceUi("Toolbars.enable",arguments);
if(!epg.ui.Toolbars.enabled){if(epg.ui.Toolbars.toolbar1.enabled&&Element.epgGetElementsByClassName(epg.ui.Toolbars.toolbar1.element,"epg_overlay").length){epg.ui.Toolbars.toolbar1.element.removeChild(Element.epgGetElementsByClassName(epg.ui.Toolbars.toolbar1.element,"epg_overlay")[0])
}if(epg.ui.Toolbars.toolbar2.enabled&&Element.epgGetElementsByClassName(epg.ui.Toolbars.toolbar2.element,"epg_overlay").length){epg.ui.Toolbars.toolbar2.element.removeChild(Element.epgGetElementsByClassName(epg.ui.Toolbars.toolbar2.element,"epg_overlay")[0])
}if(epg.ui.Toolbars.toolbar3.enabled&&Element.epgGetElementsByClassName(epg.ui.Toolbars.toolbar3.element,"epg_overlay").length){epg.ui.Toolbars.toolbar3.element.removeChild(Element.epgGetElementsByClassName(epg.ui.Toolbars.toolbar3.element,"epg_overlay")[0])
}epg.ui.Toolbars.enabled=true
}},disable:function(){traceUi("Toolbars.disable",arguments);
if(epg.ui.Toolbars.enabled){var B,A;
if(epg.ui.Toolbars.toolbar1.enabled){B=epg.ui.Toolbars.toolbar1.element;
A=document.createElement("div");
A.className="epg_overlay";
A.style.top=B.offsetTop+"px";
A.style.height=B.offsetHeight+"px";
A.style.width=B.offsetWidth+"px";
B.insertBefore(A,B.firstChild)
}if(epg.ui.Toolbars.toolbar2.enabled){B=epg.ui.Toolbars.toolbar2.element;
A=document.createElement("div");
A.className="epg_overlay";
A.style.top=B.offsetTop+"px";
A.style.height=B.offsetHeight+"px";
A.style.width=B.offsetWidth+"px";
B.insertBefore(A,B.firstChild)
}if(epg.ui.Toolbars.toolbar3.enabled){B=epg.ui.Toolbars.toolbar3.element;
A=document.createElement("div");
A.className="epg_overlay";
A.style.top=B.offsetTop+"px";
A.style.height=B.offsetHeight+"px";
A.style.width=B.offsetWidth+"px";
B.insertBefore(A,B.firstChild)
}epg.ui.Toolbars.enabled=false
}},hardReset:function(){traceUi("Toolbars.hardReset",arguments);
if(document.getElementById("epg_toolFilters")){document.getElementById("epg_toolFilters").parentNode.removeChild(document.getElementById("epg_toolFilters"))
}epg.ui.Toolbars.toolbar3.setup()
},toolbar1:{enabled:false,element:null,setup:function(){if(!jQuery("#epg_header .epg_toolbar1").length){return false
}traceUi("Toolbars.toolbar1.setup",arguments);
var E;
E=epg.ui.Toolbars.toolbar1.element=Element.epgGetElementsByClassName(document.getElementById("epg_header"),"epg_toolbar1")[0];
var B={tabs_start:'<div class="epg_viewTabs" id="epg_tab_row">',tab:'<div id="epg_stateChanger_XXXstateXXX" class="epg_tab epg_tab_off" onclick="epg.views.tabStates(XXXstateXXX)"><div class="epg_tabL">XXXtitleXXX</div><div class="epg_tabR"></div></div>',tabs_end:(epg.config.general.enable_saotv===true?'<div class="epg_tab epg_tab_off" onclick="location.href=\'/saotv/saotv.html?returnPath=XXXreturnPathXXX\'"><div class="epg_tabL">Sky Anytime</div><div class="epg_tabR"></div></div>':"")+"</div>",authentication_start:'<div class="epg_authentication">',authentication_login:'<a href="#" id="epg_login" onclick="epg.Authentication.trigger = \'\';epg.Authentication.display(\'loginOnly\');return false;"><strong>Sign in</strong></a>',authentication_loggedin:'<span>Hi XXXuserXXX | </span> <a href="#" id="epg_login" onclick="epg.Authentication.logout();return false;">Log out</a>',authentication_region:'<span> | Region: <a id="epg_region_selector" href="#" onclick="epg.regions.displayRegions(); return false;">London</a></span>',authentication_end:"</div>",clear:'<div class="clear"></div>'};
var A="";
var C={on:"epg_tab",off:"epg_tab_off"};
if(epg.config.api.view.enabled.grid||epg.config.api.view.enabled.detailed||epg.config.api.view.enabled.list){A+=B.tabs_start;
var D;
if(epg.config.api.view.enabled.grid){D=B.tab.replace(/XXXstateXXX/g,0);
if(epg.stateMachine.getTabState()===0){D=D.replace(C.off,"")
}A+=D.replace(/XXXtitleXXX/,"grid view")
}if(epg.config.api.view.enabled.detailed){D=B.tab.replace(/XXXstateXXX/g,1);
if(epg.stateMachine.getTabState()===1){D=D.replace(C.off,"")
}A+=D.replace(/XXXtitleXXX/,"detailed grid")
}if(epg.config.api.view.enabled.list){D=B.tab.replace(/XXXstateXXX/g,2);
if(epg.stateMachine.getTabState()===2){D=D.replace(C.off,"")
}A+=D.replace(/XXXtitleXXX/,"list")
}A+=B.tabs_end.replace(/XXXreturnPathXXX/,location.pathname)
}if(epg.config.api.authentication.enabled){A+=B.authentication_start;
if(epg.Authentication.isAuthenticated()){A+=B.authentication_loggedin.replace(/XXXuserXXX/,epg.Authentication.properties.sUserName)
}else{A+=B.authentication_login
}A+=B.authentication_region+B.authentication_end
}A+=B.clear;
if(A!=B.clear){E.innerHTML=A;
epg.ui.Toolbars.toolbar1.enabled=true
}else{E.parentNode.removeChild(E)
}},updateAuthentication:function(){traceUi("Toolbars.toolbar1.updateAuthentication",arguments);
var A={tabs_start:'<div class="epg_viewTabs" id="epg_tab_row">',tab:'<div id="epg_stateChanger_XXXstateXXX" class="epg_tab epg_tab_off" onclick="epg.views.tabStates(XXXstateXXX)"><div class="epg_tabL">XXXtitleXXX</div><div class="epg_tabR"></div></div>',tabs_end:"</div>",authentication_start:'<div class="epg_authentication">',authentication_login:'<a href="#" id="epg_login" onclick="epg.Authentication.trigger = \'\';epg.Authentication.display(\'loginOnly\');return false;"><strong>Log in</strong> or <strong>Register</strong> to save your preferences!</a>',authentication_loggedin:'<span>Hi XXXuserXXX | </span> <a href="#" id="epg_login" onclick="epg.Authentication.logout();return false;">Log out</a>',authentication_end:"</div>",clear:'<div class="clear"></div>'}
}},toolbar2:{enabled:false,setup:function(){traceUi("Toolbars.toolbar2.setup",arguments);
var M;
M=epg.ui.Toolbars.toolbar2.element=Element.epgGetElementsByClassName(document.getElementById("epg_header"),"epg_toolbar2")[0];
var F={dates:function(){var P='<div id="epg_date_links"><div class="epg_tools_day">';
if(epg.config.toolbar.enable_now&&epg.config.toolbar.nowPos=="left"){P+='<a class="epg_block_g4 epg_level_2 epg_now" onclick="XXXclicknowXXX"><span><span><span><span>Now</span></span></span></span></a>'
}P+='<a id="epg_ui_day_XXXdayXXX" class="XXXclassXXX epg_level_2" href="#" onclick="XXXclicktodayXXX"><span><span><span><span>Today</span></span></span></span></a>';
if(epg.config.toolbar.enable_now&&epg.config.toolbar.nowPos=="right"){P+='<a class="epg_block_g4 epg_level_2 epg_now" onclick="XXXclicknowXXX"><span><span><span><span>Now</span></span></span></span></a>'
}P+='</div><div class="epg_tools_week epg_vertical_line">XXXdaysXXX</div></div>';
return P
},date_links:'<a id="epg_ui_day_XXXdayXXX" class="XXXclassXXX epg_level_0" href="#" onclick="XXXclickXXX"><span><span><span><span class="epg_week_day">XXXweekdayXXX</span><span class="epg_date">XXXdayXXX</span></span></span></span></a>',search:'<div class="epg_searchBoxHolder" id="epg_search"><form action="#" id="epg_search_form"><div class="epg_filters_text">SEARCH: <span>Prog, Actor or Channel</span></div><input name="login_field" type="text" value="" class="epg_searchField" autocomplete="off" /><input class="epg_searchButton" name="Search" type="submit" value="" alt="Search" onMousedown="epg.hitbox.send(\'search_go_button\')" /></form></div>',dropdown_start:'<div class="epg_dropDownHolder">',dropdown_end:"</div>",clear:'<div class="clear"></div>'};
var G="";
var B=["epg_block_g3","epg_block_g4"];
var O=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
if(epg.config.api.toolbar.dates.enabled){var D=(epg.config.api.toolbar.dates.initial===0)?B[0]:B[1];
var E=new Date();
E.setTime(epg.date.currentTime.getTime());
var N=F.dates().replace(/XXXclassXXX/,D);
N=N.replace(/XXXdayXXX/,E.getDate());
N=N.replace(/XXXclicktodayXXX/,"epg.views.gotoDay("+E.valueOf()+");epg.ui.Button.toggle(this,document.getElementById('epg_date_links'));return false");
N=N.replace(/XXXclicknowXXX/,"epg.views.gotoTime((new Date).valueOf());epg.ui.Button.toggle(this.previousSibling,document.getElementById('epg_date_links'));return false");
var A="";
for(var L=0,K=epg.config.api.toolbar.dates.days-1;
L<K;
L++){E.setDate(E.getDate()+1);
var J=E.getDate();
var I=O[E.getDay()];
var C=F.date_links.replace(/XXXweekdayXXX/,I);
var H=(epg.config.api.toolbar.dates.initial==L+1)?B[0]:B[1];
C=C.replace(/XXXdayXXX/g,J);
C=C.replace(/XXXclickXXX/,"epg.views.gotoDay("+E.valueOf()+");epg.ui.Button.toggle(this,document.getElementById('epg_date_links'));return false");
C=C.replace(/XXXclassXXX/,H);
A+=C
}N=N.replace(/XXXdaysXXX/,A);
G+=N
}if(epg.config.api.toolbar.time_of_day.enabled||epg.config.api.toolbar.provider.enabled){G+=F.dropdown_start
}if(epg.config.api.toolbar.time_of_day.enabled){G+=epg.ui.Dropdowns.createDropdown("time","Time of Day","epg_block_g3",true,"")
}if(epg.config.api.toolbar.provider.enabled){G+=epg.ui.Dropdowns.createDropdown("provider","Channel Filters &amp; Setup","epg_block_g3",true,"epg_vertical_line")
}if(epg.config.api.toolbar.time_of_day.enabled||epg.config.api.toolbar.provider.enabled){G+=F.dropdown_end
}if(epg.config.api.search.enabled){G+=F.search
}G+=F.clear;
if(G!=F.clear){M.innerHTML=G;
epg.ui.Toolbars.toolbar2.enabled=true
}else{M.parentNode.removeChild(M)
}if(epg.config.api.toolbar.time_of_day.enabled){epg.ui.Dropdowns.times.setup()
}if(epg.config.api.toolbar.provider.enabled){epg.ui.Dropdowns.providers.setup()
}if(epg.config.general.enable_search){epg.search.search_field=document.getElementById("epg_search").getElementsByTagName("input")[0];
epg.search.search_form=document.getElementById("epg_search").getElementsByTagName("form")[0];
Event.observe(epg.search.search_form,"submit",epg.search.submit);
Event.observe(epg.search.search_field,"focus",epg.search.enableSuggestions)
}if(!epg.config.toolbar.enable_provider){jQuery("#providerDropDownContainer").css("display","none")
}if(!epg.config.toolbar.enable_time_of_day){jQuery("#timeDropDownContainer").css("display","none")
}},setDay:function(C){traceUi("Toolbars.toolbar2.setDay",arguments);
if(epg.config.api.toolbar.dates.enabled){jQuery("#epg_date_links .epg_block_g3").removeClass("epg_block_g3").addClass("epg_block_g4");
for(var A=0,D=epg.config.api.toolbar.dates.days+1;
A<D;
A++){var B=new Date((new Date()).setDate((new Date()).getDate()+A)).getDate();
if(C==B){jQuery("#epg_ui_day_"+B).removeClass("epg_block_g4").addClass("epg_block_g3")
}}}}},toolbar3:{enabled:false,container:null,toolbar_html:{filter:"<span><span><span><span>XXXnameXXX</span></span></span></span>",filter_separator:'<div class="epg_vertical_separator">|</div>',clear:'<div class="clear"></div>'},filter_classes:{on:"epg_block_g3",off:"epg_block_g4",special:"epg_block_4b"},setup:function(){traceUi("Toolbars.toolbar3.setup",arguments);
epg.ui.Toolbars.toolbar3.container=epg.ui.Toolbars.toolbar3.element=Element.epgGetElementsByClassName(document.getElementById("epg_header"),"epg_toolbar3")[0];
if(epg.config.api.filters.enabled){epg.ui.Toolbars.toolbar3.enabled=true
}else{if(epg.ui.Toolbars.toolbar3.container){epg.ui.Toolbars.toolbar3.container.parentNode.removeChild(epg.ui.Toolbars.toolbar3.container)
}}if(epg.config.api.filters.enabled){jQuery(epg.ui.Toolbars.toolbar3.container).append('<div id="epg_toolFilters"></div>');
var A=jQuery("#epg_toolFilters");
A.append('<a href="#" id="epg_filter_off" class="epg_filter epg_level_2 '+epg.ui.Toolbars.toolbar3.filter_classes.on+'">'+epg.ui.Toolbars.toolbar3.toolbar_html.filter.replace(/XXXnameXXX/,"All Programmes")+"</a>").find("a:last").click(function(){epg.filtering.removeFiltering();
return false
});
if(epg.config.api.filters.quickbrowse.enabled){A.append('<a href="#" id="epg_filter_main" class="epg_filter epg_level_2 '+epg.ui.Toolbars.toolbar3.filter_classes.off+'">'+epg.ui.Toolbars.toolbar3.toolbar_html.filter.replace(/XXXnameXXX/,"Browse By Tags")+"</a>").find("a:last").click(function(){epg.filtering.quickBrowse();
return false
})
}if(epg.filtering.filters||epg.config.api.filters.special){A.append(epg.ui.Toolbars.toolbar3.toolbar_html.filter_separator)
}if(epg.config.api.filters.special){A.append('<a href="#" id="epg_filter_special" class="epg_filter epg_level_2 '+epg.ui.Toolbars.toolbar3.filter_classes.special+'">'+epg.ui.Toolbars.toolbar3.toolbar_html.filter.replace(/XXXnameXXX/,"Top picks")+"</a>").find("a:last").click(function(){epg.search.ajaxEditorsPickSearch();
return false
})
}if(epg.config.general.enable_favourites){A.append('<a href="#" id="epg_filter_favourites" class="epg_filter epg_level_2 '+epg.ui.Toolbars.toolbar3.filter_classes.off+'">'+epg.ui.Toolbars.toolbar3.toolbar_html.filter.replace(/XXXnameXXX/,"Favourites")+"</a>").find("a:last").click(function(){epg.ui.Toolbars.toolbar3.goToFavourites();
return false
})
}}},goToFavourites:function(C){traceUi("Toolbars.toolbar3.goToFavourites",arguments);
if(epg.stateMachine.isAnyGrid()){epg.grid.scrollTo(false,0,2)
}else{if(epg.stateMachine.isList()){var A=epg.data.favourites;
var B=0;
for(kFavourite in A){B++
}if(B>0){epg.list.filterByGenre("Favourites")
}}}if(C){C.preventDefault();
C.stopPropagation()
}},populate:function(){traceUi("Toolbars.toolbar3.populate",arguments);
if(epg.config.api.filters.enabled){var D=document.getElementById("epg_toolFilters");
if(epg.config.api.filters.allhd){epg.filtering.filters.AllHD={};
epg.filtering.filters.AllHD.name="All HD";
epg.filtering.filters.AllHD.channels=[];
epg.filtering.filters.AllHD.genres=[];
for(var C in epg.data.channels){if(epg.data.channels[C]["channeltype"]==134){epg.filtering.filters.AllHD.channels.push(C)
}}}if(epg.filtering.filters){for(var A in epg.filtering.filters){if(A!=epg.filtering.main_filter&&(!A!=epg.config.api.filters.initial||(A!=epg.config.api.filters.initial&&A!=epg.config.api.filters.initial.name))&&jQuery("#epg_filter_"+epg.filtering.filters[A].name.toWord()).length==0){var B=document.createElement("a");
B.setAttribute("href","#");
B.setAttribute("id","epg_filter_"+epg.filtering.filters[A].name.toWord());
B.className="epg_filter epg_level_2";
Element.addClassName(B,epg.ui.Toolbars.toolbar3.filter_classes.off);
B.onclick=epg.filtering.selectFilter;
B.appendChild(epg.ui.Toolbars.toolbar3.toolbar_html.filter.replace(/XXXnameXXX/,epg.filtering.filters[A].name).createDOMElement());
D.appendChild(B)
}}}D.appendChild(epg.ui.Toolbars.toolbar3.toolbar_html.clear.createDOMElement());
if(epg.filtering.filters[epg.filtering.main_filter].genres.length){if(jQuery("#epg_toolFilters .epg_edit").length==0){epg.ui.Toolbars.toolbar3.appendAction(document.getElementById("epg_filter_main"),"edit",epg.filtering.editFilter)
}}}},select:function(A){traceUi("Toolbars.toolbar3.select",arguments);
jQuery("#epg_toolFilters ."+epg.ui.Toolbars.toolbar3.filter_classes.on).removeClass(epg.ui.Toolbars.toolbar3.filter_classes.on).addClass(epg.ui.Toolbars.toolbar3.filter_classes.off);
jQuery(A).removeClass(epg.ui.Toolbars.toolbar3.filter_classes.off).addClass(epg.ui.Toolbars.toolbar3.filter_classes.on)
},appendAction:function(A,D,C){traceUi("Toolbars.toolbar3.appendAction",arguments);
var B=document.createElement("a");
B.setAttribute("href","#");
B.className="epg_filter epg_level_2";
Element.addClassName(B,"epg_block_g2 epg_"+D);
Event.observe(B,"click",C);
B.appendChild(epg.ui.Toolbars.toolbar3.toolbar_html.filter.replace(/XXXnameXXX/,D).createDOMElement());
if(A.nextSibling){A.parentNode.insertBefore(B,A.nextSibling)
}else{A.parentNode.appendChild(B)
}},removeAction:function(A){traceUi("Toolbars.toolbar3.removeAction",arguments);
A.parentNode.removeChild(A.nextSibling)
},appendTag:function(C){traceUi("Toolbars.toolbar3.appendTag",arguments);
if(document.getElementById("epg_filter_tag")){epg.ui.Toolbars.toolbar3.removeTag()
}jQuery("#epg_toolFilters ."+epg.ui.Toolbars.toolbar3.filter_classes.on).removeClass(epg.ui.Toolbars.toolbar3.filter_classes.on).addClass(epg.ui.Toolbars.toolbar3.filter_classes.off);
var A=document.createElement("a");
A.setAttribute("href","#");
A.setAttribute("id","epg_filter_tag");
A.className="epg_filter epg_level_2";
Element.addClassName(A,"epg_block_g3");
Event.observe(A,"click",function(D){Event.stop(D)
});
A.appendChild(epg.ui.Toolbars.toolbar3.toolbar_html.filter.replace(/XXXnameXXX/,C).createDOMElement());
var B=Element.epgGetElementsByClassName(epg.ui.Toolbars.toolbar3.container,"epg_vertical_separator");
if(B.length){B[0].parentNode.insertBefore(A,B[0])
}else{epg.ui.Toolbars.toolbar3.container.appendChild(A)
}},removeTag:function(){traceUi("Toolbars.toolbar3.removeTag",arguments);
document.getElementById("epg_filter_tag").parentNode.removeChild(document.getElementById("epg_filter_tag"))
}},listFilterBar:{setup:function(){traceUi("Toolbars.listFilterBar.setup",arguments);
if(epg.config.api.list.dropdowns.enabled.genre){jQuery("#"+epg.config.eListBarFilterWrapper).append(epg.ui.Dropdowns.createDropdown("view_by_genre","by genre","epg_block_g1",true,""));
epg.ui.Dropdowns.listViewByGenre.setup()
}if(epg.config.api.list.dropdowns.enabled.channel){jQuery("#"+epg.config.eListBarFilterWrapper).append(epg.ui.Dropdowns.createDropdown("view_by_channel","by channel","epg_block_g1",true,""));
epg.ui.Dropdowns.listViewByChannel.setup()
}if(epg.config.api.list.sort_type.enabled.channel&&epg.config.api.list.sort_type.enabled.time){var B=epg.config.api.list.sort_type.initial;
var A=jQuery(epg.config.eListBarSortChannel).parents("form")[0];
jQuery("#"+epg.config.eListBarSortChannel)[0].checked=(epg.list.tracking.sortType===0)?true:false;
jQuery("#"+epg.config.eListBarSortTime)[0].checked=(epg.list.tracking.sortType===1)?true:false
}else{jQuery("#"+epg.config.eListBarSortOptions).remove()
}if(!epg.config.api.list.dropdowns.enabled.genre&&!epg.config.api.list.dropdowns.enabled.channel&&!epg.config.api.list.sort_type.enabled.time&&!epg.config.api.list.sort_type.enabled.channel){jQuery("#"+epg.config.eListBar).hide()
}}}},nextDay:{setup:function(){traceUi("Toolbars.nextDay.setup",arguments);
var B='<span id="epg_next_day">Go to next day</span>';
var A=B.createDOMElement();
document.getElementById(epg.config.eGrid).appendChild(A);
Event.observe(document.getElementById("epg_next_day"),"click",epg.grid.scrollToNextMorning)
},display:function(){traceUi("Toolbars.nextDay.display",arguments);
jQuery("#epg_next_day").fadeIn(200)
},hide:function(){traceUi("Toolbars.nextDay.hide",arguments);
jQuery("#epg_next_day").css("display","")
}},Info:{createDragInfo:function(){traceUi("Toolbars.Info.createDragInfo",arguments);
var B='<div id="epg_info_drag">TIP<br />You can also drag the programme guide with your mouse cursor<div id="epg_close_info_drag">close</div></div>';
var A=B.createDOMElement();
document.getElementById(epg.config.eGrid).appendChild(A);
Event.observe(document.getElementById(epg.config.eInfoCloseDrag),"click",epg.ui.Info.closeDragInfo)
},closeDragInfo:function(){traceUi("Toolbars.Info.closeDragInfo",arguments);
epg.data.UserData.saveData("epg_draginfo",{visible:true});
Event.stopObserving(document.getElementById(epg.config.eInfoCloseDrag,"click",epg.ui.Info.closeDragInfo));
jQuery("#"+epg.config.eInfoDrag).fadeOut(500,function(){epg.ui.Info.killDragInfo
})
},killDragInfo:function(){traceUi("Toolbars.Info.killDragInfo",arguments);
document.getElementById(epg.config.eGrid).removeChild(document.getElementById(epg.config.eInfoDrag))
}},Dropdowns:{container_id:"skyEPG",dropdown_id:"epg_dropdown",css_class:"epg_dropdown",current_dropdown:null,html:{dropdown:'<div class="epg_dropDown_container XXXcontainerClassXXX" id="XXXcontainerIdXXXDropDownContainer"><div class="epg_filters_text">XXXlabelXXX:</div><div id="epg_XXXnameXXX_options"><a class="XXXclassXXX epg_level_1" href="#"><span><span><span><span id="epg_XXXnameXXX_chosen"></span></span></span></span></a><a href="#" class="epg_dropdown_arrow">Click to choose an option</a></div></div>'},times:{content:null,element_id:"epg_time_options",value_id:"epg_time_chosen",all_day:false,setup:function(){traceUi("epg.ui.Dropdowns.setup",arguments);
epg.ui.Dropdowns.times.content=epg.ui.Dropdowns.times.parseEPGTimeTracking();
if(document.getElementById(epg.ui.Dropdowns.times.value_id).innerHTML===""||(epg.list.tracking.sortType===1&&document.getElementById(epg.ui.Dropdowns.times.value_id).innerHTML=="All day")){document.getElementById(epg.ui.Dropdowns.times.value_id).innerHTML=epg.ui.Dropdowns.times.content[0]
}Event.observe(document.getElementById(epg.ui.Dropdowns.times.element_id),"click",epg.ui.Dropdowns.times.display)
},action:function(G){traceUi("epg.ui.Dropdowns.action",arguments);
epg.stateMachine.lastClickedDropDown=epg.ui.Dropdowns.times.element_id;
var A;
var E=(window.event)?window.event.srcElement:this;
var F=E.firstChild.nodeValue||E.firstChild.innerHTML;
for(var C=0,B=epg.date.timeOfDay().length;
C<B;
C++){if(epg.date.timeOfDay()[C].text==F){A=epg.date.timeOfDay()[C].hour;
break
}}if(A==null){A="All day"
}if(A==="All day"){A=0;
F="12am";
epg.ui.Dropdowns.times.all_day=true;
document.getElementById(epg.ui.Dropdowns.times.value_id).innerHTML="All day";
if(epg.stateMachine.isList()){epg.list.lastViewedTime=epg.date.currentTime.getTime()
}}else{epg.ui.Dropdowns.times.all_day=false;
document.getElementById(epg.ui.Dropdowns.times.value_id).innerHTML=F
}if(isNaN(A)){var D=epg.date.timeFromString(F)
}else{var D=epg.date.timeFromString(A)
}epg.date.setCurrentTime(D.valueOf());
traceCurrentTime(16);
epg.views.gotoTime(D.valueOf());
epg.hitbox.send("select_time",jQuery("#epg_time_chosen").html());
try{G.preventDefault()
}catch(G){}return false
},parseEPGTimeTracking:function(){traceUi("epg.ui.Dropdowns.parseEPGTimeTracking",arguments);
var B=[];
for(var A in epg.date.timeOfDay()){if(epg.date.timeOfDay()[A].hour!==undefined){B[B.length]=epg.date.timeOfDay()[A].text
}}return B
},display:function(A){traceUi("epg.ui.Dropdowns.display",arguments);
var B=epg.ui.Dropdowns.times.content;
if(epg.stateMachine.isList()&&epg.list.tracking.sortType===0){B.push("All day")
}epg.ui.Dropdowns.createDropdownList(epg.ui.Dropdowns.times.element_id);
epg.ui.Dropdowns.populateDropdown(B,epg.ui.Dropdowns.times.action);
epg.ui.Dropdowns.setupEvents();
Event.stopObserving(document.getElementById(epg.ui.Dropdowns.times.element_id),"click",epg.ui.Dropdowns.times.display);
A.preventDefault();
A.stopPropagation();
return false
},update:function(F){traceUi("epg.ui.Dropdowns.update",arguments);
var A=new Date(F);
var B=A.getHours();
var J=[];
var G=0;
for(var I=0,H=epg.ui.Dropdowns.times.content.length;
I<H;
I++){var C;
for(var E=0,D=epg.date.timeOfDay().length;
E<D;
E++){if(epg.date.timeOfDay()[E].text==epg.ui.Dropdowns.times.content[I]){C=epg.date.timeOfDay()[E].hour;
break
}}J[J.length]=C;
if(B>=C){G=I
}}document.getElementById(epg.ui.Dropdowns.times.value_id).innerHTML=epg.ui.Dropdowns.times.content[G]
}},rollOver:function(A){traceUi("epg.ui.Dropdowns.rollOver",arguments);
if(!A.innerHTML){A=A.target
}if(A.tagName!=="A"){return 
}A.style.backgroundColor="#009BD4"
},rollOut:function(A){traceUi("epg.ui.Dropdowns.rollOut",arguments);
if(!A.innerHTML){A=A.target
}if(A.tagName!=="A"){return 
}A.style.backgroundColor="#ffffff"
},providers:{content:[],currentRegion:null,element_id:"epg_provider_options",value_id:"epg_provider_chosen",setup:function(){traceUi("epg.ui.Dropdowns.providers.setup",arguments);
epg.ui.Dropdowns.providers.createContent();
if(document.getElementById(epg.ui.Dropdowns.providers.value_id)){var B=epg.Authentication.channelPrefs.properties.iCurrentProvider;
var A="All Channels (London)";
switch(B){case (epg.Authentication.channelPrefs.properties.oArrayProviderMap.virgin):A="Virgin";
break;
case (epg.Authentication.channelPrefs.properties.oArrayProviderMap.freeview):A="freeview";
break;
default:if(epg.data.selectedRegion!==undefined){A="My Channels ("+epg.data.selectedRegion+")"
}}if(epg.stateMachine.isHDChannels===true){A="HD Channels"
}if(document.getElementById(epg.ui.Dropdowns.providers.value_id).innerHTML===""){document.getElementById(epg.ui.Dropdowns.providers.value_id).innerHTML=A
}}jQuery("#"+epg.ui.Dropdowns.providers.element_id).click(epg.ui.Dropdowns.providers.display)
},createContent:function(){traceUi("epg.ui.Dropdowns.providers.createContent",arguments);
var E=(epg.ui.Dropdowns.providers.currentRegion)?epg.ui.Dropdowns.providers.currentRegion:"London";
var C='<a href="#" class="epg_link_G providerDDItem" onclick="epg.Authentication.channelPrefs.saveSingleCP(0);" onMouseOver="epg.ui.Dropdowns.rollOver(this);return false;" onMouseOut="epg.ui.Dropdowns.rollOut(this);return false;">All Channels (London)</a>';
var B='<a href="#" class="epg_link_G" onclick="epg.Authentication.channelPrefs.saveSingleCP(1);" onMouseOver="epg.ui.Dropdowns.rollOver(this);return false;" onMouseOut="epg.ui.Dropdowns.rollOut(this);return false;">Virgin</a>';
var A='<a href="#" class="epg_link_G" onclick="epg.Authentication.channelPrefs.saveSingleCP(2);" onMouseOver="epg.ui.Dropdowns.rollOver(this);return false;" onMouseOut="epg.ui.Dropdowns.rollOut(this);return false;">freeview</a>';
var D='<a href="#" class="epg_link_J" onclick="epg.Authentication.trigger = \'\';epg.Authentication.display(\'channelSetup\');" >My Channels ('+E+")</a>";
var F='<a href="#edit" class="epg_link_J" onclick="epg.Authentication.trigger = \'\';epg.Authentication.display(\'channelSetupEdit\');">(Edit My Channels)</a>';
epg.ui.Dropdowns.providers.content=[C,D,F]
},display:function(A){traceUi("epg.ui.Dropdowns.providers.display",arguments);
epg.ui.Dropdowns.providers.setup();
epg.ui.Dropdowns.createDropdownList(epg.ui.Dropdowns.providers.element_id);
epg.ui.Dropdowns.populateDropdown(epg.ui.Dropdowns.providers.content,epg.ui.Dropdowns.providers.action);
epg.ui.Dropdowns.setupEvents();
Event.stopObserving(document.getElementById(epg.ui.Dropdowns.providers.element_id),"click",epg.ui.Dropdowns.providers.display);
A.preventDefault();
A.stopPropagation();
return false
},action:function(B){traceUi("epg.ui.Dropdowns.providers.action",arguments);
epg.stateMachine.lastClickedDropDown=epg.ui.Dropdowns.providers.element_id;
var A=(window.event)?window.event.srcElement:this;
var C=A.firstChild.nodeValue||A.firstChild.innerHTML;
if(A.getAttribute("href")!=="#edit"){document.getElementById(epg.ui.Dropdowns.providers.value_id).innerHTML=C
}epg.hitbox.send("selectprovider");
try{B.preventDefault()
}catch(B){}return false
},reset:function reset(){traceUi("epg.ui.Dropdowns.providers.reset",arguments);
var A=epg.data.UserCookie.getCookie("epg_channelPrefs"+epg.config.cookieSuffix);
if(A!==null&&A.region!==undefined){jQuery("#"+epg.ui.Dropdowns.providers.value_id).html("My Channels ("+epg.data.selectedRegion+")")
}else{jQuery("#"+epg.ui.Dropdowns.providers.value_id).html("All Channels (London)")
}}},listViewByChannel:{content:["All Channels"],element_id:"epg_view_by_channel_options",value_id:"epg_view_by_channel_chosen",all_day:false,bIsDefault:true,setup:function(){traceUi("epg.ui.Dropdowns.listViewByChannel.setup",arguments);
epg.ui.Dropdowns.listViewByChannel.content=["All Channels"];
var A=epg.data.current;
if(!epg.ui.Dropdowns.listViewByGenre.bIsDefault){A=epg.list.aListGenreCurrent
}$A(A).each(function(B){epg.ui.Dropdowns.listViewByChannel.content[epg.ui.Dropdowns.listViewByChannel.content.length]=epg.data.channels[B].title
});
if(jQuery("#"+epg.ui.Dropdowns.listViewByChannel.value_id).html()===""){jQuery("#"+epg.ui.Dropdowns.listViewByChannel.value_id).html(epg.ui.Dropdowns.listViewByChannel.content[0])
}jQuery("#epg_view_by_channel_options").click(epg.ui.Dropdowns.listViewByChannel.display)
},action:function(B){traceUi("epg.ui.Dropdowns.listViewByChannel.action",arguments);
epg.stateMachine.lastClickedDropDown=epg.ui.Dropdowns.listViewByChannel.element_id;
var A=epg.tools.getTarget(B);
var C=A.firstChild.nodeValue||A.firstChild.innerHTML;
if(epg.stateMachine.lastClickedDropDown=="epg_view_by_channel_options"){epg.ui.Dropdowns.listViewByChannel.storeChannelDropHistory(C)
}jQuery("#"+epg.ui.Dropdowns.listViewByChannel.value_id).html(C);
epg.list.filterByChannel(A.innerHTML)
},channelDropHistory:[],storeChannelDropHistory:function(A){traceUi("epg.ui.Dropdowns.listViewByChannel.storeChannelDropHistory",arguments);
var D=false;
if(epg.ui.Dropdowns.listViewByChannel.channelDropHistory.length>0){for(var C=0,B=epg.ui.Dropdowns.listViewByChannel.channelDropHistory.length;
C<B;
C++){if(A===epg.ui.Dropdowns.listViewByChannel.channelDropHistory[C]){D=true
}}}if(!D&&A!="All Channels"){epg.ui.Dropdowns.listViewByChannel.channelDropHistory.push(A)
}},display:function(A){traceUi("epg.ui.Dropdowns.listViewByChannel.display",arguments);
epg.ui.Dropdowns.createDropdownList(epg.ui.Dropdowns.listViewByChannel.element_id);
epg.ui.Dropdowns.populateDropdown(epg.ui.Dropdowns.listViewByChannel.content,epg.ui.Dropdowns.listViewByChannel.action);
epg.ui.Dropdowns.setupEvents();
jQuery("#"+epg.ui.Dropdowns.listViewByChannel.element_id).unbind("click",epg.ui.Dropdowns.listViewByChannel.display);
epg.tools.cancelBubble(A)
},reset:function(A){traceUi("epg.ui.Dropdowns.listViewByChannel.reset",arguments);
if(jQuery("#"+epg.ui.Dropdowns.listViewByChannel.value_id).length>0){jQuery("#"+epg.ui.Dropdowns.listViewByChannel.value_id).html(epg.ui.Dropdowns.listViewByChannel.content[0]);
epg.ui.Dropdowns.listViewByChannel.bIsDefault=true
}}},listViewByGenre:{content:["Channel Categories"],omitFromContent:((epg.config.api.favourites.enabled===true)?["all"]:["all","fave"]),element_id:"epg_view_by_genre_options",value_id:"epg_view_by_genre_chosen",all_day:false,bIsDefault:true,setup:function(){traceUi("epg.ui.Dropdowns.listViewByGenre.setup",arguments);
epg.ui.Dropdowns.listViewByGenre.content=["Channel Categories"];
for(var A in epg.data.epggenre){if(!$A(epg.ui.Dropdowns.listViewByGenre.omitFromContent).include(A)){epg.ui.Dropdowns.listViewByGenre.content[epg.ui.Dropdowns.listViewByGenre.content.length]=epg.data.epggenre[A].name
}}if($(epg.ui.Dropdowns.listViewByGenre.value_id)){if($(epg.ui.Dropdowns.listViewByGenre.value_id).innerHTML===""){$(epg.ui.Dropdowns.listViewByGenre.value_id).innerHTML=epg.ui.Dropdowns.listViewByGenre.content[0]
}Event.observe($(epg.ui.Dropdowns.listViewByGenre.element_id),"click",epg.ui.Dropdowns.listViewByGenre.display)
}},action:function(B){traceUi("epg.ui.Dropdowns.listViewByGenre.action",arguments);
epg.stateMachine.lastClickedDropDown=epg.ui.Dropdowns.listViewByGenre.element_id;
var A=epg.tools.getTarget(B);
var C=A.firstChild.nodeValue||A.firstChild.innerHTML;
$(epg.ui.Dropdowns.listViewByGenre.value_id).innerHTML=C;
epg.list.filterByGenre(A.innerHTML)
},display:function(A){traceUi("epg.ui.Dropdowns.listViewByGenre.display",arguments);
$(epg.ui.Dropdowns.listViewByGenre.display).innerHTML="";
epg.ui.Dropdowns.createDropdownList(epg.ui.Dropdowns.listViewByGenre.element_id);
epg.ui.Dropdowns.populateDropdown(epg.ui.Dropdowns.listViewByGenre.content,epg.ui.Dropdowns.listViewByGenre.action);
epg.ui.Dropdowns.setupEvents();
Event.stopObserving($(epg.ui.Dropdowns.listViewByGenre.element_id),"click",epg.ui.Dropdowns.listViewByGenre.display);
epg.tools.cancelBubble(A)
},reset:function(B){traceUi("epg.ui.Dropdowns.listViewByGenre.reset",arguments);
var A=$(epg.ui.Dropdowns.listViewByGenre.value_id);
if(!A){return 
}A.innerHTML=epg.ui.Dropdowns.listViewByGenre.content[0];
epg.ui.Dropdowns.listViewByGenre.bIsDefault=true
}},setupEvents:function(){traceUi("epg.ui.Dropdowns.listViewByGenre.setupEvents",arguments);
Event.observe(document.body,"click",epg.ui.Dropdowns.closeDropdown)
},createDropdown:function(C,B,E,D,A){traceUi("epg.ui.Dropdowns.listViewByGenre.createDropdown",arguments);
var F=epg.ui.Dropdowns.html.dropdown.replace(/XXXnameXXX/g,C);
F=F.replace(/XXXlabelXXX/g,B);
F=F.replace(/XXXclassXXX/g,E);
F=F.replace(/XXXcontainerClassXXX/g,A);
F=F.replace(/XXXcontainerIdXXX/g,C);
return D?F:F.createDOMElement()
},createDropdownList:function(C){traceUi("epg.ui.Dropdowns.listViewByGenre.createDropdownList",arguments);
var A=document.getElementById(C);
if(epg.ui.Dropdowns.current_dropdown){epg.ui.Dropdowns.current_dropdown.innerHTML=""
}else{epg.ui.Dropdowns.current_dropdown=document.createElement("ul");
epg.ui.Dropdowns.current_dropdown.setAttribute("id",epg.ui.Dropdowns.dropdown_id+"_"+C);
epg.ui.Dropdowns.current_dropdown.className=epg.ui.Dropdowns.css_class;
document.getElementById(epg.ui.Dropdowns.container_id).appendChild(epg.ui.Dropdowns.current_dropdown)
}var B=Element.positionedFromOffset(A.getElementsByTagName("a")[0],document.getElementById(epg.ui.Dropdowns.container_id));
epg.ui.Dropdowns.current_dropdown.style.top=B.top+B.height+"px";
epg.ui.Dropdowns.current_dropdown.style.left=B.left+"px"
},populateDropdown:function(C,K){traceUi("epg.ui.Dropdowns.listViewByGenre.populateDropdown",arguments);
var H=[];
var I=0;
if(epg.ui.Dropdowns.listViewByChannel.channelDropHistory.length>0&&C[0]=="All Channels"){for(var D=0,A=epg.ui.Dropdowns.listViewByChannel.channelDropHistory.length;
D<A;
D++){H[I]='<li><a class="epg_link_G">'+epg.ui.Dropdowns.listViewByChannel.channelDropHistory[D]+"</a></li>";
I++
}H[I]='<li class="epg_dd_separator2"></li>';
I++;
H[I]='<li><a class="epg_link_G">All Channels</a></li>';
I++
}var E=C.length;
for(var J=I;
J<E;
J++){if(C[J].match(/^<.+>$/)){H[J]="<li>"+C[J]+"</li>"
}else{if(C[J]!="-"){H[J]='<li><a class="epg_link_G">'+C[J]+"</a></li>"
}else{H[J]='<li class="epg_dd_separator"></li>'
}}}var F=H.join("");
epg.ui.Dropdowns.current_dropdown.innerHTML=F;
Event.observe(epg.ui.Dropdowns.current_dropdown,"mouseover",epg.ui.Dropdowns.rollOver);
var G=epg.ui.Dropdowns.current_dropdown.childNodes;
var B=G.length;
for(D=0;
D<B;
D++){G[D].onclick=K
}Event.observe(epg.ui.Dropdowns.current_dropdown,"mouseout",epg.ui.Dropdowns.rollOut)
},closeDropdown:function(A){traceUi("epg.ui.Dropdowns.listViewByGenre.closeDropdown",arguments);
if(epg.ui.Dropdowns.current_dropdown){epg.ui.Dropdowns.current_dropdown.parentNode.removeChild(epg.ui.Dropdowns.current_dropdown);
epg.ui.Dropdowns.current_dropdown=null
}Event.stopObserving(document,"mouseup",epg.ui.Dropdowns.closeDropdown);
if(epg.config.api.toolbar.time_of_day.enabled){epg.ui.Dropdowns.times.setup()
}if(epg.config.api.toolbar.provider.enabled){epg.ui.Dropdowns.providers.setup()
}if(epg.config.api.list.dropdowns.enabled.genre){epg.ui.Dropdowns.listViewByGenre.setup()
}if(epg.config.api.list.dropdowns.enabled.channel){epg.ui.Dropdowns.listViewByChannel.setup()
}}},Button:{select:function(A){traceUi("Toolbars.Button.select",arguments);
jQuery(A).removeClass("epg_block_g4").addClass("epg_block_g3")
},unselect:function(A){traceUi("Toolbars.Button.unselect",arguments);
jQuery(A).removeClass("epg_block_g3").addClass("epg_block_g4")
},toggle:function(B,A){traceUi("Toolbars.Button.toggle",arguments);
B=jQuery(B);
jQuery(".epg_block_g3",A).removeClass("epg_block_g3").addClass("epg_block_g4");
B.removeClass("epg_block_g4").addClass("epg_block_g3")
}},Alerts:{html:{alert_pane:'<div class="epg_alert_pane_content"></div>'},alert:{display:function(E){traceUi("Toolbars.Alerts.alert.display",arguments);
var C="";
var G=epg.ui.Alerts.html.alert_pane.createDOMElement();
if(!$(epg.config.eAlert)){var F=document.createElement("div");
F.setAttribute("id",epg.config.eAlert);
if(epg.stateMachine.isAnyGrid()){document.getElementById(epg.config.eGrid).appendChild(F)
}else{document.getElementById(epg.config.eList).appendChild(F)
}}else{F=$(epg.config.eAlert);
F.innerHTML=""
}Element.appendChildrenFromObject(G,E);
F.appendChild(G);
var B=document.getElementById(epg.config.eToolbar).getElementsByTagName("a");
for(var A=0,H=B.length;
A<H;
A++){if(!B[A].parentNode.parentNode.className.match(/epg_dropDown_container/)){Event.observe(B[A],"click",epg.ui.Alerts.alert.close)
}}Event.observe(document.getElementById(epg.config.eSearch).getElementsByTagName("form")[0],"submit",epg.ui.Alerts.alert.close);
var D=F.offsetHeight;
jQuery(F).animate({top:0},300)
},close:function(D){traceUi("Toolbars.Alerts.alert.close",arguments);
var E=document.getElementById(epg.config.eAlert);
var C=E.offsetHeight;
var B=document.getElementById(epg.config.eToolbar).getElementsByTagName("a");
for(var A=0,F=B.length;
A<F;
A++){Event.stopObserving(B[A],"click",epg.ui.Alerts.alert.close)
}Event.stopObserving(document.getElementById(epg.config.eSearch).getElementsByTagName("form")[0],"submit",epg.ui.Alerts.alert.close);
jQuery(E).animate({top:0-C},300,function(){epg.ui.Alerts.alert.kill()
});
if(D){Event.stop(D)
}},kill:function(){traceUi("Toolbars.Alerts.alert.kill",arguments);
document.getElementById(epg.config.eAlert).parentNode.removeChild(document.getElementById(epg.config.eAlert))
}},mainError:{display:function(){traceUi("Toolbars.Alerts.mainError.display",arguments);
epg.ui.modalPane.display(epg.ui.Alerts.mainError.write,false,false)
},write:function(A){traceUi("Toolbars.Alerts.mainError.write",arguments);
Element.addClassName(A,"epg_errorPane");
Element.appendChildrenFromObject(A,[{div:[{h2:"Sorry! Something went wrong."},{p:"Unfortunately we are unable to deal with your request at the moment. Please try later."},{p:[{a:"Restart EPG",href:"#","class":"epg_link_J",onclick:function(B){Event.stop(B);
epg.reloadEPG()
}}]}],"class":"epg_errorPane_contents"}])
},close:function(A){traceUi("Toolbars.Alerts.mainError.close",arguments);
epg.ui.modalPane.close(A)
}}},modalPane:{ePane:null,aCurrentPaneArgs:null,display:function(C,E,B){if(parent.window.location.host){traceUi("Toolbars.modalPane.display",arguments)
}epg.ui.modalPane.kill();
epg.ui.modalPane.aCurrentPaneArgs=arguments;
epg.ui.Toolbars.disable();
var D;
D=epg.ui.modalPane.ePane=document.createElement("div");
D.setAttribute("id",epg.config.eModalPane);
if(B||arguments.length<3){Element.appendChildrenFromObject(D,[{a:"Close",href:"#","class":"epg_close",title:"close",onclick:epg.ui.modalPane.close}])
}if(epg.stateMachine.isAnyGrid()){document.getElementById(epg.config.eGrid).appendChild(D)
}else{document.getElementById(epg.config.eList).appendChild(D)
}if(E){Element.addClassName(D,"epg_loading")
}var A=D.offsetHeight;
jQuery("#"+epg.config.eModalPane).css("top",0-A);
jQuery("#"+epg.config.eModalPane).animate({top:0},300,function(){C(D)
})
},displaySuper:function(C,E,B){if(parent.window.location.host){traceUi("Toolbars.modalPane.display",arguments)
}epg.ui.modalPane.kill();
epg.ui.modalPane.aCurrentPaneArgs=arguments;
epg.ui.Toolbars.disable();
var D;
D=epg.ui.modalPane.ePane=document.createElement("div");
D.setAttribute("id",epg.config.eModalPane);
if(B||arguments.length<3){Element.appendChildrenFromObject(D,[{a:"Close",href:"#","class":"epg_close",title:"close",onclick:epg.ui.modalPane.close}])
}document.getElementById("skyEPG").appendChild(D);
if(E){Element.addClassName(D,"epg_loading")
}var A=D.offsetHeight;
jQuery("#"+epg.config.eModalPane).css("top",0-A);
jQuery("#"+epg.config.eModalPane).animate({top:0},300,function(){C(D)
})
},close:function(B){traceUi("Toolbars.modalPane.close",arguments);
var C=epg.ui.modalPane.ePane;
if(C){var A=C.offsetHeight;
C.innerHTML="";
jQuery(C).animate({top:0-A},300,function(){epg.ui.modalPane.kill()
});
if(arguments.length){Event.stop(B)
}}},kill:function(){traceUi("Toolbars.modalPane.kill",arguments);
if(!$(epg.ui.modalPane.ePane)){return 
}Element.remove($(epg.ui.modalPane.ePane));
delete epg.ui.modalPane.ePane;
epg.ui.Toolbars.enable()
},cancelLoadAnimation:function(){traceUi("Toolbars.modalPane.cancelLoadAnimation",arguments);
jQuery(epg.ui.modalPane.ePane).removeClass("epg_loading")
}}};epg.bubble={init:function(){},properties:{eBubble:null,eBubbleTitle:null,eBubbleInner:null,eBubbleContent:null,oCurrentBubbleData:{iBubbleCurrentShow:null,iBubbleCurrentChannel:null,iBubbleCurrentStartTime:null,oFullProgrammeData:null},iBubbleXOffset:epg.config.bubble.iBubbleXOffset,iBubbleYOffset:epg.config.bubble.iBubbleYOffset,iInverseBubbleYOffset:epg.config.bubble.iInverseBubbleYOffset,iChannel:0,iShow:0,ageRating:["","u","pg","12","15","18"],sLoadingText:"Loading...",sCloseButtonText:"Close me",sRemoteRecordText:"Remote Record",sWatchNowText:"Watch now",sRemindMeText:"Remind Me",sRemindMeTextEdit:"Update Reminder",sDeepLink:"Link",sDeepLinkTextInfo:"Paste link in email or IM",sSendToFriendText:"Share",bubbleOver:0,promoPos:["bottom right","bottom left"],sTimeAfter:["Started ","mins ago"],sTimeBefore:["Starts in ","mins"],bIsGrown:false},newBubble:function(D,H,A,G){traceBubble("newBubble",arguments);
epg.bubble.properties.iChannel=G;
epg.bubble.properties.iShow=A;
epg.stateMachine.setBubbleState(1);
var F="UNKNOWN";
if(epg.data.grid[epg.date.currentDay]&&epg.data.grid[epg.date.currentDay][G]&&epg.data.grid[epg.date.currentDay][G][A]){F=epg.data.getPlayState(epg.data.grid[epg.date.currentDay][G][A].start,epg.data.grid[epg.date.currentDay][G][A].dur,G,A)
}if(epg.date.currentDay>0){F="NOT_STARTED"
}if(epg.config.bubble.requiresRequest===false&&F=="FINISHED"){epg.bubble.closeBubble();
return 
}if(!epg.bubble.properties.eBubble){if(jQuery("#epg_bubble").length==0){jQuery("#"+epg.config.eSchedule).append(epg.bubble.newGridBubble())
}epg.bubble.properties.eBubble=jQuery("#epg_bubble");
if(epg.config.bubble.closeButton){this.newCloseButton(jQuery("#epg_bubble_inner"))
}if(epg.config.bubble.bubbleTitle){this.newBubbleTitle(jQuery("#epg_bubble_inner"))
}this.newBubbleContent(jQuery("#epg_bubble_inner"));
Event.observe($("epg_bubble_inner"),"mouseover",epg.bubble.setMouseStateOver);
Event.observe($("epg_bubble_inner"),"mouseout",epg.bubble.setMouseStateOut);
jQuery("#epg_bubble").bind("mousemove",epg.grid.getShowHover);
jQuery("#epg_bubble").bind("mouseup",epg.grid.getShowClick)
}else{this.bubbleReset()
}if(epg.config.bubble.large&&D[0]<220){D[0]=220
}jQuery("#epg_bubble").css("left",(D[0]+epg.bubble.properties.iBubbleXOffset)+"px");
if(epg.config.bubble&&((D[1]+epg.bubble.properties.iBubbleYOffset)<=epg.config.bubble.iMinBubbleY)){jQuery("#epg_bubble").addClass("inverse");
jQuery("#epg_bubble").css("top",(D[1]+epg.bubble.properties.iInverseBubbleYOffset)+"px")
}else{jQuery("#epg_bubble").removeClass("inverse");
jQuery("#epg_bubble").css("top",(D[1]+epg.bubble.properties.iBubbleYOffset)+"px")
}if(epg.config.bubble.requiresRequest===false){epg.bubble.properties.eBubbleContent.removeClass("epg_bubble_loading");
var E=epg.bubble.properties.eBubbleContent;
this.setBubbleInfo({program:{eventid:A,channelid:G}});
bubbleContent=[];
bubbleEvents=[];
if((epg.config.general.enable_watch_now)&&(epg.config.bubble.watchNowTarget=="bubble")){if(F=="PLAYING_NOW"){bubbleContent.push(this.createWatchNow());
bubbleEvents.push(function(){jQuery("a#aWatchNow").click(function(I){parent.ChangeChannel(null,epg.bubble.properties.iChannel);
I.preventDefault()
})
})
}}if(epg.config.bubble.remoteRecordTarget=="bubble"){if(epg.config.api.remote_record.enabled&&epg.config.api.authentication.enabled){if(F=="NOT_STARTED"){oBubbleData={program:{remoteRecordable:"true"}};
bubbleContent.push(this.createRemoteRecord(oBubbleData));
bubbleEvents.push(function(){jQuery("p.epg_remoteRecord a").click(epg.bubble.remoteRecordClick)
})
}}}if(bubbleContent.length>0){for(var C=0,B=bubbleContent.length;
C<B;
C++){if(bubbleContent[C]!=null){epg.bubble.properties.eBubbleContent.append(bubbleContent[C])
}}if(jQuery.browser.msie){jQuery("#epg_bubble").each(function(){jQuery(this).width(jQuery(this).find(".m").width()+1)
})
}if(epg.config.bubble.clearingDiv){epg.bubble.properties.eBubbleContent.append('<div class="clear"></div>')
}for(var C=0,B=bubbleEvents.length;
C<B;
C++){if(bubbleEvents[C]!=null){bubbleEvents[C]()
}}}else{epg.bubble.closeBubble()
}}epg.data.getProgram(A,G,epg.date.currentDay,epg.bubble.processProgramData);
epg.hitbox.send("listingbubble")
},newGridBubble:function(){traceBubble("newGridBubble",arguments);
var A=epg.config.bubble.html;
return A
},newBubbleContent:function(A){traceBubble("newBubbleContent",arguments);
var B='<div class="epg_bubble_content epg_bubble_loading"></div>';
A.append(B);
this.properties.eBubbleContent=jQuery(".epg_bubble_content")
},newBubbleTitle:function(A){traceBubble("newBubbleTitle",arguments);
var B='<h6 id="epg_bubble_title">'+this.properties.sLoadingText+"</h6>";
A.append(B);
this.properties.eBubbleTitle=jQuery("h6#epg_bubble_title")
},setTitle:function(C){traceBubble("setTitle",arguments);
if(this.properties.eBubbleTitle){var B=jQuery("#epg_bubble");
var A=24;
this.properties.eBubbleTitle.html(C);
if(this.properties.eBubbleTitle[0].scrollHeight>A){B.addClass("grown")
}else{B.removeClass("grown")
}}},bubbleReset:function(){traceBubble("bubbleReset",arguments);
this.properties.eBubble.removeClass("grown");
this.properties.eBubble.attr("style","");
this.setTitle(this.properties.sLoadingText);
this.properties.eBubbleContent.html("");
this.properties.eBubbleContent.addClass("epg_bubble_loading")
},setMouseStateOver:function(){epg.bubble.properties.bubbleOver=1
},setMouseStateOut:function(){epg.bubble.properties.bubbleOver=0
},newCloseButton:function(B){traceBubble("newCloseButton",arguments);
var A='<div class="epg_bubbleClose"><a id="aBubbleClose">'+this.properties.sCloseButtonText+"</a></div>";
B.append(A).find(".epg_bubbleClose").click(epg.bubble.closeBubbleClick)
},closeBubbleClick:function(A){traceBubble("closeBubbleClick",arguments);
epg.bubble.closeBubble();
if(A){A.stopPropagation()
}},closeBubble:function(B){traceBubble("closeBubble",arguments);
var A=$("epg_bubble");
if(A){if($("epg_bubble_inner")){jQuery("#epg_bubble_inner").unbind("mouseover",epg.bubble.setMouseStateOver);
jQuery("#epg_bubble_inner").unbind("mouseout",epg.bubble.setMouseStateOut)
}jQuery("#epg_bubble").unbind("mousemove",epg.grid.grid);
jQuery("#epg_bubble").unbind("mouseup",epg.grid.getShowClick);
A.parentNode.removeChild(A);
epg.stateMachine.setBubbleState(1);
epg.bubble.setMouseStateOut();
epg.bubble.properties.eBubble=null;
epg.stateMachine.setBubbleState(0)
}return false
},processProgramDataTimer:null,processProgramData:function(A){if(epg.stateMachine.isAnyGrid()){if(epg.grid.scrolling!==true&&epg.grid.dragging!==true){if(A){epg.bubble.triggerProcessProgramData(A)
}}else{epg.grid.addLoader(function(){epg.bubble.processProgramData(A)
})
}}else{if(A){epg.bubble.triggerProcessProgramData(A)
}}},triggerProcessProgramData:function(B){traceBubble("triggerProcessProgramData",arguments);
if(B.program.hd){jQuery("#epg_bubble").addClass("epg_bubble_hd")
}else{jQuery("#epg_bubble").removeClass("epg_bubble_hd")
}var A=epg.bubble.properties.eBubbleContent;
this.setTitle(B.program.title);
this.setBubbleInfo(B);
epg.bubble.properties.eBubbleContent=this.createBubbleContent(epg.bubble.properties.eBubbleContent,B);
epg.bubble.properties.eBubbleContent.removeClass("epg_bubble_loading");
if(getURLParam("reminder")==1&&!epg.config.deepLinking.bReminderActionComplete){epg.reminders.openRemindMe();
epg.config.deepLinking.bReminderActionComplete=true
}if(getURLParam("share")==1&&!epg.config.deepLinking.bShareActionComplete){epg.emailToFriend.open();
epg.config.deepLinking.bShareActionComplete=true
}},setBubbleInfo:function(A){traceBubble("setBubbleInfo",arguments);
epg.bubble.properties.oCurrentBubbleData.iBubbleCurrentShow=A.program.eventid;
epg.bubble.properties.oCurrentBubbleData.iBubbleCurrentChannel=A.program.channelid;
epg.bubble.properties.oCurrentBubbleData.iBubbleCurrentStartTime=A.program.start;
epg.bubble.properties.oCurrentBubbleData.oFullProgrammeData=A.program
},createBubbleContent:function(E,F){traceBubble("createBubbleContent",arguments);
var D=[];
var C=[];
jQuery("#epg_info").addClass("overShow");
if(epg.config.bubble.programInfoTarget=="bubble"){D.push(this.createProgramInfo(F))
}else{if(epg.config.bubble.programInfoTarget=="infopanel"){jQuery("#epg_info_text ul.init").remove();
jQuery("#epg_info_text .header").show();
if(jQuery("#epg_info_text span.start").length==0){jQuery("#epg_info_text").prepend('<span class="header""><img class="rating" align="top" style="float: right; margin-right: 10px;"/><div><span class="title"></span></div><div><span class="start"></span> on <span class="channel"></span></div></span>')
}jQuery("#epg_info_text span.start").text(epg.date.timeSTR(F.program.start));
jQuery("#epg_info_text span.title").text(F.program.title);
jQuery("#epg_info_text span.channel").text(epg.data.channels[F.program.channelid].title);
if(!F.program.parentalrating||F.program.parentalrating.v=="--"){jQuery("#epg_info_text img.rating").fadeOut()
}else{jQuery("#epg_info_text img.rating").attr("src","images/skin/assets/gif/pr_"+jQuery.trim(String(F.program.parentalrating.v).toLowerCase())+".gif").attr("alt",F.program.parentalrating.v).fadeIn()
}if(jQuery("#epg_info_text .epg_programDescription").length>0){jQuery("#epg_info_text .epg_programDescription").text(F.program.shortDesc)
}else{jQuery("#epg_info_text .desc").text(F.program.shortDesc)
}}}if(epg.config.bubble.programDescriptionTarget=="bubble"){D.push(this.createProgramDescription(F))
}else{if(epg.config.bubble.programDescriptionTarget=="infopanel"){jQuery("#epg_info_text p.desc").html(this.createProgramDescription(F))
}}if(epg.config.bubble.requiresRequest){if(epg.config.bubble.remoteRecordTarget=="bubble"){if(epg.config.api.remote_record.enabled&&epg.config.api.authentication.enabled){if(F.program.scheduleStatus=="NOT_STARTED"&&F.program.remoteRecordable=="true"){D.push(this.createRemoteRecord(F));
C.push(function(){jQuery("p.epg_remoteRecord a").click(epg.bubble.remoteRecordClick)
})
}}}}if(epg.config.bubble.requiresRequest){if((epg.config.general.enable_watch_now)&&(epg.config.bubble.watchNowTarget=="bubble")){if(F.program.scheduleStatus=="PLAYING_NOW"){D.push(this.createWatchNow(F));
C.push(function(){jQuery("a#aWatchNow").click(function(G){parent.ChangeChannel(null,F.program.channelid);
G.preventDefault()
})
})
}}}if(epg.config.bubble.remindMeTarget=="bubble"){if(epg.config.general.enable_remind_me){if(F.program.scheduleStatus=="NOT_STARTED"){D.push(this.createRemindMe(F));
C.push(function(){jQuery("a#epg_RemindMeLink").click(epg.reminders.openRemindMe)
})
}}}if(epg.config.bubble.enableDeepLink){D.push(this.createDeepLink(F));
C.push(function(){jQuery("a.epg_DeepLink").toggle(function(){jQuery(".epg_DeepLinkPopup").show().find("input").select()
},function(){jQuery(".epg_DeepLinkPopup").hide()
})
})
}if(epg.config.bubble.sendToFriendTarget=="bubble"){if(epg.config.general.enable_send_to_friend){D.push(this.createSendToFriend(F));
C.push(function(){jQuery("a.epg_SendToFriend").click(epg.emailToFriend.open)
})
}}D.push(this.createDeepLinkPopUp(F,false));
if((epg.config.general.enable_send_to_friend&&(epg.config.bubble.sendToFriendTarget=="bubble"))||(epg.config.general.enable_remind_me&&(epg.config.bubble.remindMeTarget=="bubble"))){D.push('<div class="epg_BubbleSpacer"></div>')
}if(epg.config.bubble.techDetailsTarget=="bubble"){D.push(this.createTechDetails(F))
}if(epg.config.bubble.editorsChoiceTarget=="bubble"){if(epg.config.api.bubble.editors_choice.enabled){D.push(this.editorsChoice.createInnerPromo(F))
}}if(epg.config.bubble.otherAiringsTarget=="bubble"){if(epg.config.api.bubble.other_airings.enabled){D.push(this.createOtherAirings(F));
C.push(function(){jQuery("#epg_bubble a.vod").click(function(){epg.hitbox.send("skyplayervod")
})
})
}}else{if(epg.config.bubble.otherAiringsTarget=="infopanel"){if(epg.config.api.bubble.other_airings.enabled){jQuery("div#epg_info_otherairings").html(this.createOtherAirings(F))
}jQuery("dl.epg_otherAirings dd").hover(function(){jQuery(this).addClass("hover")
},function(){jQuery(this).removeClass("hover")
})
}}if(epg.config.bubble.relatedTagsTarget=="bubble"){if(epg.config.api.bubble.tags.enabled){D.push(this.createRelatedTags(F))
}}if(D.length>0){for(var B=0,A=D.length;
B<A;
B++){if(D[B]!=null){E.append(D[B])
}}if(jQuery.browser.msie){jQuery("#epg_bubble").each(function(){jQuery(this).width(jQuery(this).find(".m").width()+1)
})
}if(epg.config.bubble.clearingDiv){E.append('<div class="clear"></div>')
}for(var B=0,A=C.length;
B<A;
B++){if(C[B]!=null){C[B]()
}}}else{if(epg.config.bubble.requiresRequest){epg.bubble.closeBubble()
}}return E
},processProgramData_list:function(B){traceBubble("processProgramData_list",arguments);
if(B){var A=epg.bubble.triggerProcessProgramData_list(B);
return A
}},triggerProcessProgramData_list:function(G){traceBubble("triggerProcessProgramData_list",arguments);
jQuery("#epg_bubble").attr("id","epg_oldbubble").css({visibility:"visible",opacity:0}).slideUp("fast",function(){jQuery("#epg_oldbubble").remove()
});
var R=["epg_bubble_horizontal"];
if(typeof G.program.hd!="undefined"&&G.program.hd=="true"){R.push("epg_bubble_hd")
}var L=this.createWrapper("epg_bubble",R);
this.setBubbleInfo(G);
var J=jQuery("#bubble_event_"+G.program.channelid+"_"+G.program.eventid);
J.html("");
J.append(L);
var M=this.createWrapper("",["epg_bubble_header"]);
jQuery("#epg_bubble").append(M);
var N=this.createProgramInfo(G);
jQuery(".epg_bubble_header").append(N);
var D=this.createWrapper("",["epg_bubble_content"]);
jQuery("#epg_bubble").append(D);
var I=this.createWrapper("",["epg_bubble_leftSide"]);
jQuery("#epg_bubble .epg_bubble_content").append(I);
var P=this.createProgramDescription(G);
var Q=this.createTechDetails(G);
var C=this.editorsChoice.createInnerPromo(G);
jQuery("#epg_bubble .epg_bubble_leftSide").append(P);
jQuery("#epg_bubble .epg_bubble_leftSide").append(C);
jQuery("#epg_bubble .epg_bubble_leftSide").append(Q);
var A=this.createWrapper("",["epg_bubble_rightSide"]);
jQuery("#epg_bubble .epg_bubble_content").append(A);
var H=this.createOtherAirings(G);
var F=this.createRelatedTags(G);
if(epg.config.bubble.enable_other_airings){jQuery("#epg_bubble .epg_bubble_rightSide").append(H);
jQuery("dl.epg_otherAirings dd").hover(function(){jQuery(this).addClass("hover")
},function(){jQuery(this).removeClass("hover")
})
}if(epg.config.bubble.enable_tags){jQuery("#epg_bubble .epg_bubble_rightSide").append(F)
}jQuery("#epg_bubble .epg_bubble_content").append('<div class="epg_bubble_footer"></div>');
var B=this.createRemoteRecord(G);
var E=this.createSendToFriend(G);
var O=this.createRemindMe(G);
var K=this.createDeepLink(G);
if(epg.config.bubble.remoteRecordTarget=="bubble"){if(epg.config.api.remote_record.enabled&&epg.config.api.authentication.enabled){if(G.program.scheduleStatus=="NOT_STARTED"&&G.program.remoteRecordable=="true"){jQuery("#epg_bubble .epg_bubble_footer").append(B);
jQuery("p.epg_remoteRecord a").click(epg.bubble.remoteRecordClick)
}}}if(epg.config.bubble.sendToFriendTarget=="bubble"){if(epg.config.general.enable_send_to_friend){jQuery("#epg_bubble .epg_bubble_footer").append(E);
jQuery("a.epg_SendToFriend").click(epg.emailToFriend.open)
}}if(epg.config.bubble.remindMeTarget=="bubble"){if(epg.config.general.enable_remind_me){if(G.program.scheduleStatus=="NOT_STARTED"){jQuery("#epg_bubble .epg_bubble_footer").append(O);
jQuery("a#epg_RemindMeLink").click(epg.reminders.openRemindMe)
}}}if(epg.config.bubble.enableDeepLink){jQuery("#epg_bubble .epg_bubble_footer").append(K).append(this.createDeepLinkPopUp(G,true));
jQuery("a.epg_DeepLink").toggle(function(){jQuery(".epg_DeepLinkPopup").css("display","inline").find("input").select()
},function(){jQuery(".epg_DeepLinkPopup").hide()
})
}jQuery("#epg_bubble").append('<div class="epg_clear"></div>').slideDown();
jQuery("#epg_bubble").height(jQuery("#epg_bubble").height()).css({visibility:"visible",opacity:0}).fadeTo("fast",1,function(){jQuery("#epg_list .epg_stdList .epg_listRow_header, #epg_list .epg_stdList .epg_listRow").each(function(){this.className+="";
document.getElementsByTagName("body")[0].className+=""
})
});
return L
},createProgramInfo:function(F){if(epg.data.channels[F.program.channelid]){traceBubble("createProgramInfo (the time etc.)",arguments);
var G='<div class="epg_programInfo">';
var D=epg.date.timeSTR(F.program.start);
var N='<p class="first">'+D+" on "+epg.data.channels[F.program.channelid].title+"</p>";
if(F.program.hdsimulcast!=null){var H='<p class="epg_alsoOnHd" onclick="epg.bubble.triggerOtherAiringJump(this);" eventID="'+F.program.hdsimulcast.hdeventid+'" channelID="'+F.program.hdsimulcast.hdchannelid+'" startTime="'+F.program.start+'"><a id="alsoonhd" href="#">Also on '+F.program.hdsimulcast.hdchannelname+"</a></p>";
if(typeof epg.data.channels[F.program.hdsimulcast.hdchannelid]!="object"){var H='<p class="epg_alsoOnHd" eventID="'+F.program.hdsimulcast.hdeventid+'" channelID="'+F.program.hdsimulcast.hdchannelid+'" startTime="'+F.program.start+'"><span>Also on '+F.program.hdsimulcast.hdchannelname+"</span></p>"
}}var E=new Date;
E=new Date(Date.parse(E)+epg.date.iLocalTimeOffset);
var I=E.getHours();
var O=E.getMinutes();
var C=new Date();
C.setTime(F.program.start);
var K=C.getHours();
var M=C.getMinutes();
var B=(K*60)+M;
var P=(I*60)+O;
if((B-P)>0&&(B-P)<120){var L=B-P;
var R=epg.bubble.properties.sTimeBefore[0];
var J=epg.bubble.properties.sTimeBefore[1]
}else{if((B-P)<0&&(B-P)>-120){var L=P-B;
var R=epg.bubble.properties.sTimeAfter[0];
var J=epg.bubble.properties.sTimeAfter[1]
}}var Q="<p>"+F.program.dur/60+" mins. ";
G+=N;
if(F.program.hdsimulcast!=null){G+=H
}G+=Q;
if(L&&epg.date.selectedDayIsToday()){var A=R+" "+L+" "+J+"</p>";
G+=A
}G+="</div>";
return G
}},createProgramDescription:function(B){traceBubble("createProgramDescription",arguments);
oProgramDescription='<p class="epg_programDescription">'+B.program.shortDesc;
var A=null;
if(B.program.movielocator&&B.program.movielocator!="null"){A="http://movies.sky.com/movie/"+B.program.movielocator
}if(A!=null){oProgramDescription+=' <a class="epg_programmeTitle" target="_blank" href="'+A+'">More</a></p>'
}return oProgramDescription
},createRemindMe:function(B){if(epg.config.general.enable_remind_me){traceBubble("createRemindMe",arguments);
var A='<a id="epg_RemindMeLink" class="epg_RemindMe';
A+=(B.program.userreminderset=="true"?" epg_UpdateReminder":"");
A+='"">';
A+=B.program.userreminderset=="true"?this.properties.sRemindMeTextEdit:this.properties.sRemindMeText;
A+="</a>";
return A
}return""
},createSendToFriend:function(B){if(epg.config.general.enable_send_to_friend){traceBubble("createSendToFriend",arguments);
var A='<a class="epg_SendToFriend">'+this.properties.sSendToFriendText+"</a>";
return A
}return""
},createDeepLink:function(B){var A='<a class="epg_DeepLink">'+this.properties.sDeepLink+"</a>";
return A
},createDeepLinkPopUp:function(F,A){var B="",C=null,E="UNAVAILABLE";
if(F.program.shortlink){E=epg.config.environment.apiEndpoints.shortLink;
B+=F.program.shortlink
}var D='<div class="epg_DeepLinkPopup"><label>'+this.properties.sDeepLinkTextInfo;
if(A!==true){D+="<br />"
}D+='<input type="text" class="url" value="'+E+B+'" /></label></div>';
return D
},createRemoteRecord:function(A){if(A.program.remoteRecordable=="true"&&epg.config.general.enable_remote_record){traceBubble("createRemoteRecord",arguments);
oRemoteRecordWrapper='<p class="epg_remoteRecord"><a class="SkyWidget:Open" href="'+epg.config.environment.url.tvwidgethost+"/tvlistings-proxy/tvwidget/remoterecord/confirm.do?siteId="+epg.config.siteId+"&amp;channelId="+A.program.channelid+"&amp;eventId="+A.program.eventid+'">'+this.properties.sRemoteRecordText+"</a></p>";
return oRemoteRecordWrapper
}return""
},remoteRecordClick:function(){traceBubble("remoteRecordClick",arguments)
},createWatchNow:function(A){traceBubble("createWatchNow",arguments);
oWatchNowWrapper='<p class="epg_watchNow"><a href="#" id="aWatchNow">'+this.properties.sWatchNowText+"</a></p>";
return oWatchNowWrapper;
return""
},createTechDetails:function(B){traceBubble("createTechDetails",arguments);
var A='<ul class="epg_techDetails">';
if(B.program.hd){A+='<li class="epg_highDef" title="High Definition"></li>'
}if(B.program.sound.v=="Simple stereo"){A+='<li class="epg_stereo" title="Simple Stereo">Simple stereo</li>'
}if(B.program.sound.v=="Digital surround sound"){A+='<li class="epg_dolbyDigital" title="Digital surround sound">Digital surround sound</li>'
}if(B.program.parentalrating.k&&(B.program.parentalrating.k!=0)){A+='<li class="epg_guidance_'+this.properties.ageRating[B.program.parentalrating.k]+'" title="Guidance rating: '+this.properties.ageRating[B.program.parentalrating.k]+'">Guidance rating: '+this.properties.ageRating[B.program.parentalrating.k]+"</li>"
}A+="</ul>";
return A
},createOtherAirings:function(G){traceBubble("createOtherAirings",arguments);
var E=null;
if(G.program.screenings||G.vodonskyplayer){var D=false;
E='<dl class="epg_otherAirings">';
E+="<dt>Other Airings</dt>";
if(G.vodonskyplayer){E+='<dd class="vod">'+epg.config.bubble.vodHtml.replace(/##VODURL##/,G.vodonskyplayer).replace(/##PROGRAM##/,G.program.title);
D=true
}if(G.program.screenings!=undefined){G.program.screenings.program=epg.tools.arrayify(G.program.screenings.program);
var F=G.program.screenings.program;
if(F.length!=undefined){for(var B=0,A=F.length;
B<A;
B++){E+='<dd><span eventID="'+F[B].eventid+'" channelID="'+F[B].channelid+'" startTime="'+F[B].start+'"';
var C=epg.date.dateToString(F[B].start);
var C=new Date();
C.setTime(F[B].start);
var C=epg.date.dateToString(C);
if(epg.data.channels[F[B].channelid]!==undefined){D=true;
E+=' onclick="epg.bubble.triggerOtherAiringJump(this);">'+C+" "+epg.data.channels[F[B].channelid].title
}else{E+=">"
}E+="</span></dd>"
}}else{E+='<dd><span eventID="'+F.eventid+'" channelID="'+F.channelid+'" startTime="'+F.start+'" onclick="epg.bubble.triggerOtherAiringJump(this);">';
var C=new Date();
C.setTime(F.start);
var C=epg.date.dateToString(C);
if(epg.data.channels[F.channelid]!==undefined){D=true;
E+=C+" "+epg.data.channels[F.channelid].title
}E+="</span></dd>"
}}}return D?E:""
},triggerOtherAiringJump:function(A){traceBubble("triggerOtherAiringJump",arguments);
var C=jQuery(A).attr("eventid");
var B=jQuery(A).attr("channelid");
var D=parseInt(jQuery(A).attr("starttime"),10);
epg.bubble.closeBubble();
jQuery(".show").removeClass("highlighted");
jQuery("#grid_"+B+"_"+C).addClass("highlighted");
epg.views.gotoEvent(C,B,D,true)
},relatedJump:function(A){traceBubble("relatedJump",arguments);
epg.search.ajaxSearch(A.innerHTML,true);
epg.bubble.closeBubble()
},createRelatedTags:function(F){traceBubble("createRelatedTags",arguments);
var A="";
if(F.related){A+='<dl class="epg_relatedTags"><dt>Tags</dt>';
var E=F.related.category.length;
var C=[];
if(E!=null){for(var D=0;
D<E;
D++){var B="epg|"+F.related.category[D].k+"|"+F.related.category[D].v;
A+='<dd id="'+B+'" class="epg_block_g4 epg_level_2" onmouseup="epg.bubble.bubbleFilterTags(this);"><span><span><span><span>'+F.related.category[D].v+"</span></span></span></span></dd>"
}}else{A+='<dd class="epg_block_g4 epg_level_2" tagID="'+F.related.k+'"><span><span><span><span>'+F.related.category[D].v+"</span></span></span></span></dd>"
}}return A
},bubbleFilterTags:function(A){traceBubble("bubbleFilterTags",arguments);
var B=A.id.split("|");
epg.filtering.loadTag(B[1],B[2])
},createWrapper:function(A,C){traceBubble("createWrapper",arguments);
var B="<div";
if(A){B+=' id="'+A+'"'
}if(C){B+=' class="'+C.join(" ")+'"'
}B+="></div>";
return B
},createBubbleLists:function(A,D,E){traceBubble("createBubbleLists",arguments);
var C=document.createElement("dl");
$(C).addClassName(A);
var G=document.createElement("dt");
G.innerHTML=D;
C.appendChild(G);
if(E){for(i=0,j=E.length;
i<j;
i++){var B=document.createElement("dd");
var F=document.createElement("span");
F.innerHTML=E[i];
B.appendChild(F);
C.appendChild(B)
}}return C
},addText:function(B,A){traceBubble("addText",arguments);
var C=document.createTextNode(A);
B.appendChild(C);
return B
},addElement:function(B,A){traceBubble("addElement",arguments);
if(A&&B){B.appendChild(A)
}return B
},isChildOf:function(B,A){traceBubble("isChildOf",arguments);
if(A!=null){while(A.parentNode){if((A=A.parentNode)==B){return true
}}}return false
}};
epg.bubble.editorsChoice={createInnerPromo:function(B){traceBubble("createInnerPromo",arguments);
if(B.program.edschoice[0]==="true"){var A='<div class="epg_edschoice">';
if(B.program.edschoice[1].pos==2){A+=epg.bubble.editorsChoice.createPromoImage(B)
}if(B.program.edschoice[1].shortDesc){A+="<p>"+B.program.edschoice[1].shortDesc+"</p>"
}A+="</div>";
return A
}return""
},createOuterPromo:function(A){traceBubble("createOuterPromo",arguments);
if(A.bubblePromo.im){if(A.bubblePromo.pos!=2){this.properties.eBubble.style.background="url("+A.bubblePromo.im+") no-repeat "+this.properties.promoPos[A.bubblePromo.pos]
}}},createPromoImage:function(B){traceBubble("createPromoImage",arguments);
var A='<a id="outer_promo" href="'+B.program.edschoice[1].site+'" target="_blank"><img src="'+B.program.edschoice[1].image+'"/></a>';
return A
}};epg.ui.infoPane={init:function(){var A=jQuery("#"+epg.config.eInfoPane);
A.append(epg.ui.infoPane.html.loader);
if(epg.config.general.infoPane_branding_enabled){A.append(epg.ui.infoPane.html.branding)
}if(epg.config.api.other.branding.enabled&&(epg.config.general.infoPane_branding_enabled)){jQuery("#aTermsConditions").click(function(){epg.tools.popwin(this.href,true);
return false
})
}A.append(epg.ui.infoPane.html.textarea)
},hardReset:function(){clearTimeout(epg.ui.infoPane.infoTimeout);
epg.ui.infoPane.infoTimeout=null;
Element.removeClassName(document.getElementById(epg.config.eInfoPane),"overShow")
},html:{loader:'<div id="epg_loading">Loading data...</div>',branding:'<div id="epg_branding">Sky</div>',textarea:epg.config.general.infoPane_textarea},infoTimeout:null,sDefaultMessage:"Loading Data...",displayLoader:function(A){if(A){document.getElementById(epg.config.eLoader).innerHTML=A
}else{document.getElementById(epg.config.eLoader).innerHTML=epg.ui.infoPane.sDefaultMessage
}Element.addClassName(document.getElementById(epg.config.eLoader),"epg_on");
return false
},hideLoader:function(){Element.removeClassName($(epg.config.eLoader),"epg_on")
},displayInfo:function(C,D,H,E,F,B,A){if(!epg.grid.dragging){var G=jQuery("#"+epg.config.eInfoPane);
if(epg.ui.infoPane.infoTimeout){clearTimeout(epg.ui.infoPane.infoTimeout)
}if(!G.hasClass("overShow")){G.addClass("overShow")
}jQuery("#epg_info_otherairings").html("");
jQuery("ul.init").remove();
G.find(".header").show();
G.find("span.title").text(C);
G.find("span.start").text(D);
G.find("span.dur").text(H);
G.find("span.channel").text(F);
if(G.find(".epg_programDescription").length>0){G.find(".epg_programDescription").text(E)
}else{G.find(".desc").text(E)
}if(B&&epg.config.bubble.enable_other_airings&&epg.config.bubble.otherAiringsTarget=="infopanel"){epg.data.getProgram(A.eventid,A.channelid,epg.date.currentDay,function(I){jQuery("div#epg_info_otherairings").html(epg.bubble.createOtherAirings(I));
jQuery("dl.epg_otherAirings dd").hover(function(){jQuery(this).addClass("hover")
},function(){jQuery(this).removeClass("hover")
})
})
}}},hideInfo:function(){if(!epg.grid.dragging){if(Element.hasClassName(document.getElementById(epg.config.eInfoPane),"overShow")){epg.ui.infoPane.infoTimeout=setTimeout(function(){Element.removeClassName(document.getElementById(epg.config.eInfoPane),"overShow")
},750)
}}}};epg.data.UserCookie={properties:{sCookieLifeSpan:null,iCookieLifeSpan:30,sCookiePath:"path=/"},init:function(){if(epg.data.UserCookie.properties.iCookieLifeSpan){epg.data.UserCookie.properties.sCookieLifeSpan=epg.data.UserCookie.createLifeSpan(epg.data.UserCookie.properties.iCookieLifeSpan)
}},hardReset:function(){epg.data.UserCookie.init()
},setCookie:function(A,C){var D="data = ";
D+=Object.toJSON(C);
D=escape(D);
var B=A+"="+D;
B+=epg.data.UserCookie.properties.sCookieLifeSpan+"; "+epg.data.UserCookie.properties.sCookiePath+"; domain="+document.domain+";";
epg.data.UserCookie.createCookie(B)
},setCookieRaw:function(A,C,D){if(D===undefined){D=epg.data.UserCookie.properties.sCookieLifeSpan
}if(!D){D=""
}var B=A+"="+C+"; domain="+document.domain;
B+=D+"; "+epg.data.UserCookie.properties.sCookiePath+";";
epg.data.UserCookie.createCookie(B)
},createCookie:function(A){document.cookie=A
},getCookie:function(C,E){var G=C+"=";
var B=document.cookie.split(";");
var A=B.length;
for(var D=0;
D<A;
D++){var H=B[D];
while(H.charAt(0)==" "){H=H.substring(1,H.length)
}if(H.indexOf(G)==0){var F=unescape(H.substring(G.length,H.length));
if(E==="plain"){return F
}else{return(F.evalJSON())
}}}return null
},clearCookie:function(A){var B=A+"=";
var B=B+epg.data.UserCookie.createLifeSpan(1)+epg.data.UserCookie.properties.sCookiePath+"; domain="+document.domain;
document.cookie=B
},removeCookie:function(B){var D="";
var C=new Date();
C.setTime(C.getTime()-(1*60*60*1000));
var A="expires="+C.toGMTString();
document.cookie=B+"="+D+"; "+A+"; path=/; domain="+document.domain+";"
},createLifeSpan:function(B){var A=new Date();
A.setTime(A.getTime()+(B*24*60*60*1000));
return"; expires="+A.toGMTString()
}};
epg.data.UserData={properties:{saveMethods:{epg_bubble:{url:null,cookie:true},epg_channelPrefs:{url:null,cookie:true},epg_myChannels:{url:null,cookie:true},epg_filters:{url:null,cookie:true},epg_viewstate:{url:null,cookie:true},epg_listsorttype:{url:null,cookie:true},epg_draginfo:{url:null,cookie:true},epg_siteId:{url:null,cookie:true}}},saveData:function(D,C,B){if(epg.data.UserData.properties.saveMethods[D].cookie===true){if(D=="epg_favourites"){epg.data.UserCookie.setCookie(D,C)
}else{epg.data.UserCookie.setCookie(D+epg.config.cookieSuffix,C)
}}if(B||(epg.Authentication.isAuthenticated()&&epg.data.UserData.properties.saveMethods[D].url!=null)){var A={};
if(epg.data.UserData.properties.saveMethods[D].cookie===false){var A=C
}else{if(D=="epg_favourites"){if(C!=null){A.channelListString=C.join(",")
}}}epg.tools.doAjax({url:(epg.config.folderPrefix+epg.data.UserData.properties.saveMethods[D].url),data:A,type:epg.config.sRPCMethod,success:function(E){if(epg.data.UserData.properties.saveMethods[D].fCallBack){epg.data.UserData.properties.saveMethods[D].fCallBack()
}}})
}}};epg.Authentication={trigger:"",properties:{iAuthState:0,sUserName:null,sFirstTab:"simple",sPasswordLink:"#",sUserNameLink:"#",aSyncActions:[],eOverlay:null,eCover:null,aMessages:{sLoginError:"The login details you have entered are incorrect. Please try again.",sChannelPromo:(epg.config.auth&&epg.config.auth.loginHeader!==undefined)?epg.config.auth.loginHeader:"Welcome to Sky TV listings! Just log in and start to make Sky TV listings your own. And remember, you don't need to be a Sky customer."}},init:function(A,B){traceAuth("init",arguments);
if(epg.config.siteId!=4&&(B==undefined||B==false)&&epg.Authentication.checkAuthenticated()){epg.Authentication.getUserPackage(false,A)
}else{epg.Authentication.getDefaultPackage(A)
}},hardReset:function(A,B){traceAuth("hardReset",arguments);
epg.Authentication.init(A,B)
},tryLogin:function(){jQuery("#"+epg.Authentication.login.properties.sPwordID).css("opacity",0.3);
jQuery("#"+epg.Authentication.login.properties.sUnameID).css("opacity",0.3);
var B=jQuery("#epg_userName").val();
epg.Authentication.properties.sUserName=B;
var A=jQuery("#epg_password").val();
epg.security.setMaxDigits(parseInt(epg.Authentication.publicKey.maxDigits,10)||38);
epg.tools.doAjax({url:epg.config.fileUserLogin,data:{temp:Math.random(),username:B,password:epg.security.encryptedString(new epg.security.RSAKeyPair(epg.Authentication.publicKey.e,epg.Authentication.publicKey.d,epg.Authentication.publicKey.m),A)},success:function(C){epg.Authentication.processLoginResponse(C)
},type:epg.config.sRPCMethod})
},getUserName:function(){traceAuth("getUserName",arguments);
var A=epg.data.UserCookie.getCookie("uifd","plain");
if(A){return A
}else{return false
}},setUserName:function(A){traceAuth("setUserName",arguments);
epg.Authentication.properties.sUserName=A
},processLoginResponse:function(A){if(A.length!==5){epg.Authentication.setLoginAlert(epg.Authentication.properties.aMessages.sLoginError);
jQuery("#"+epg.Authentication.login.properties.sPwordID).css("opacity",1);
jQuery("#"+epg.Authentication.login.properties.sUnameID).css("opacity",1)
}else{epg.emailToFriend.data.userName="";
epg.emailToFriend.data.userEmail="";
epg.emailToFriend.data.friendName="";
epg.emailToFriend.data.friendEmail="";
if(epg.config.siteId!=4){epg.tools.doAjax({url:epg.config.fileUserPackage,type:"get",data:{},dataType:"json",success:function(B){if(B.usersubscription.userType==="primary"||B.usersubscription.userType==="secondary"){epg.Authentication.channelPrefs.properties.packageInfo=B;
epg.ui.modalPane.close();
epg.Authentication.channelPrefs.saveUserPreferences()
}else{epg.ui.modalPane.close();
epg.reloadEPG();
epg.ui.Dropdowns.providers.reset()
}}})
}else{epg.Authentication.getDefaultPackage()
}}},cleanCookies:function(){var B=document.cookie.split("; ");
for(var A=0;
A<B.length;
A++){var C=B[A].split("=");
if(C[1]=='""'||C[1]==""){epg.data.UserCookie.removeCookie(C[0])
}}},logout:function(){traceAuth("logout",arguments);
epg.Authentication.trigger="";
epg.Authentication.properties.iAuthState=0;
epg.data.UserCookie.removeCookie("skySSO");
epg.data.UserCookie.removeCookie("hant");
epg.data.UserCookie.removeCookie("just");
epg.data.UserCookie.removeCookie("uifd");
epg.emailToFriend.data.userName="";
epg.emailToFriend.data.userEmail="";
epg.emailToFriend.data.friendName="";
epg.emailToFriend.data.friendEmail="";
epg.tools.doAjax({url:epg.config.fileUserLogOut,data:{},type:epg.config.sRPCMethod,success:function(A){epg.ui.modalPane.close();
epg.ui.Dropdowns.providers.reset();
epg.Authentication.cleanCookies();
window.location.href=A
}})
},getAvailableChannels:function(){traceAuth("getAvailableChannels",arguments);
epg.tools.doAjax({url:epg.config.fileChannelPrefs,data:{},type:"get",dataType:"json",success:function(A){}})
},getUserPackage:function(A,B){traceAuth("getUserPackage",arguments);
epg.tools.doAjax({url:epg.config.fileUserPackage,data:{},type:"get",dataType:"json",success:function(C){if(C.usersubscription.userType==="primary"||C.usersubscription.userType==="secondary"){epg.Authentication.channelPrefs.processUserPackageData(C);
epg.Authentication.channelPrefs.saveUserPreferences(A);
jQuery("#epg_provider_chosen").text("My Channels ("+epg.ui.Dropdowns.providers.currentRegion+")");
if(B){B()
}}else{epg.Authentication.getDefaultPackage(B)
}}})
},getDefaultPackage:function(A){traceAuth("getDefaultPackage",arguments);
var B=epg.data.UserCookie.getCookie("epg_channelPrefs"+epg.config.cookieSuffix);
if(B){if(B.region){epg.Authentication.channelPrefs.properties.iCurrentRegion=B.region
}}else{if(epg.config.api.defaultPackages!=null){if(epg.config.api.defaultPackages.region){epg.Authentication.channelPrefs.properties.iCurrentRegion=epg.config.api.defaultPackages.region
}}}if(epg.config.api.defaultPackages!=null){if(epg.config.api.defaultPackages.packages!=null){epg.Authentication.channelPrefs.properties.iCurrentChannels=epg.config.api.defaultPackages.packages
}if(epg.config.api.defaultPackages.provider){epg.Authentication.channelPrefs.properties.iCurrentProvider=epg.config.api.defaultPackages.provider
}}if(A){A()
}},setLoginAlert:function(A){traceAuth("setLoginAlert",arguments);
jQuery("#epg_auth_info").html(A).addClass("epg_alertBg")
},display:function(C,B){traceAuth("display",arguments);
if(epg.stateMachine.isHDChannels){epg.stateMachine.isHDChannels=false;
epg.Authentication.channelPrefs.saveSingleCP(0)
}var A=epg.data.UserCookie.getCookie("epg_myChannels"+epg.config.cookieSuffix);
if(C==="channelSetup"&&A&&epg.Authentication.isAuthenticated()){epg.Authentication.channelPrefs.reload(A);
epg.ui.Dropdowns.providers.setup();
epg.bubble.closeBubble();
epg.grid.jumpTo(false,0,true,true);
epg.reloadEPG();
return 
}if(C==="channelSetupEdit"){C="channelSetup"
}epg.Authentication.getAvailableChannels();
epg.Authentication.properties.sType=C;
epg.ui.modalPane.display(epg.Authentication.displayRender,false)
},displayChannelSetup:function(){traceAuth("displayChannelSetup",arguments);
epg.Authentication.properties.sFirstTab="manual";
epg.Authentication.display("channelSetupEdit")
},publicKey:{},getPublicKey:function(){traceAuth("getPublicKey",arguments);
epg.tools.doAjax({url:epg.config.filePublicKey,data:{},dataType:"json",success:function(A){epg.Authentication.publicKey=A
}})
},displayRender:function(B){traceAuth("displayRender",arguments);
epg.Authentication.getPublicKey();
var G=epg.Authentication.properties.sType;
var E="";
var A="";
var C="";
if(G==="loginOnly"){C=epg.Authentication.login.createLoginFieldSet();
helpMessage=epg.Authentication.createHelpMessage(epg.Authentication.properties.aMessages.sChannelPromo)
}else{if(G==="channelSetup"){if(epg.Authentication.properties.iAuthState==0&&epg.Authentication.properties.sFirstTab!="manual"){C=epg.Authentication.login.createLoginFieldSet();
E=epg.Authentication.channelPrefs.createTitle();
A=epg.Authentication.channelPrefs.createTabs()
}else{E=epg.Authentication.channelPrefs.createTitle();
A=epg.Authentication.channelPrefs.createTabs();
if(epg.Authentication.properties.sFirstTab!="simple"||epg.Authentication.isGuest()){C=epg.Authentication.channelPrefs.createManualSetup()
}else{C=epg.Authentication.channelPrefs.createSimpleSetup()
}}}}var F={sNodeType:["div"],aClasses:["epg_authArea"],oContents:[E,E,A,C]};
var D=epg.tools.generateDOM(F);
if(jQuery.browser.chrome){jQuery(D).find("#epg_setupHolder").submit(function(){return false
})
}B.appendChild(D)
},createHelpMessage:function(B){traceAuth("createHelpMessage",arguments);
var A={sNodeType:["p"],sId:["epg_auth_info"],aClasses:["epg_helpArea"],oContents:B};
return epg.tools.generateDOM(A)
},hide:function(){traceAuth("hide",arguments);
epg.Authentication.trigger="";
jQuery("#"+epg.Authentication.properties.eOverlay).removeClass("visible");
epg.ui.Toolbars.enable()
},checkAuthenticated:function(){traceAuth("checkAuthenticated",arguments);
var A=false;
if(epg.data.UserCookie.getCookie("skySSO","plain")&&epg.data.UserCookie.getCookie("skySSO","plain")!='""'){epg.Authentication.properties.iAuthState=1;
epg.Authentication.setUserName(epg.Authentication.getUserName());
epg.ui.Toolbars.toolbar1.setup();
A=true
}else{epg.Authentication.properties.iAuthState=0;
epg.ui.Toolbars.toolbar1.updateAuthentication()
}return A
},isAuthenticated:function(){traceAuth("isAuthenticated",arguments);
if(epg.data.userPreferences!=undefined){epg.Authentication.properties.iAuthState=1;
epg.Authentication.setUserName(epg.Authentication.getUserName())
}if(epg.Authentication.properties.iAuthState!=0){return true
}else{return false
}},isGuest:function(){traceAuth("isGuest",arguments);
var A=false;
if(epg.Authentication.isAuthenticated()&&epg.data.userPreferences!==undefined&&epg.data.userPreferences.userType==="guest"){A=true
}return A
}};
epg.Authentication.login={properties:{sUnameID:"epg_userName",sPwordID:"epg_password"},createLoginFieldSet:function(){traceAuth("createLoginFieldSet",arguments);
var A={sNodeType:["form"],sId:"epg_setupHolder",oContents:[epg.Authentication.createHelpMessage(epg.Authentication.properties.aMessages.sChannelPromo),{sNodeType:["div"],aClasses:["epg_authArea_ColLeft"],oContents:[{sNodeType:["fieldset"],oContents:[{sNodeType:["legend"],oContents:[{sNodeType:["span"],oContents:"Sign in with your "},{sNodeType:["span"],aClasses:["epg_newLineLink"],aBehaviours:[{iNodeNo:0,sAttribute:"target",sValue:"_top",sEvent:"click",fCallBack:function(){window.top.location=epg.tools.createSkyIDURL(epg.config.urlSkyIDSignup,"skyregistration")
}}],oContents:"Sky iD"}]},{sNodeType:["label"],oContents:"Username"},this.roundedTextBox(this.properties.sUnameID,[{iNodeNo:0,sAttribute:"TABINDEX",sValue:"1"}],[{iNodeNo:0,sEvent:"keyup",fCallBack:epg.Authentication.login.captureLoginEvent}]),{sNodeType:["a"],aClasses:["epg_help"],sHref:epg.tools.createSkyIDURL(epg.config.urlSkyIDForgotUsername,"forgottenUserName"),aAttributes:[{iNodeNo:0,sAttribute:"tabindex",sValue:"5"},{iNodeNo:0,sAttribute:"target",sValue:"_top"}],oContents:"Forgot Username?"},{sNodeType:["label"],oContents:"Password"},this.roundedTextBox(this.properties.sPwordID,[{iNodeNo:0,sAttribute:"type",sValue:"password"},{iNodeNo:0,sAttribute:"TABINDEX",sValue:"2"}],[{iNodeNo:0,sEvent:"keyup",fCallBack:epg.Authentication.login.captureLoginEvent}]),{sNodeType:["a"],aClasses:["epg_help"],sHref:epg.tools.createSkyIDURL(epg.config.urlSkyIDForgotPassword,"forgottenPassword"),aAttributes:[{iNodeNo:0,sAttribute:"tabindex",sValue:"6"},{iNodeNo:0,sAttribute:"target",sValue:"_top"}],oContents:"Forgot Password?"}]},this.formButtons(epg.Authentication.tryLogin,epg.ui.modalPane.close)]},this.rightPromo()]};
return epg.tools.generateDOM(A)
},roundedTextBox:function(A,D,C){traceAuth("roundedTextBox",arguments);
var B={sNodeType:["div"],aClasses:["epg_inputCornerLeft"],oContents:[{sNodeType:["div"],aClasses:["epg_inputCornerRight"],oContents:[{sNodeType:["input"],sId:A,aBehaviours:C,aAttributes:D,oContents:""}]}]};
return epg.tools.generateDOM(B)
},formButtons:function(B,A){traceAuth("formButtons",arguments);
var C={sNodeType:["div"],aClasses:["epg_formControls"],oContents:[{sNodeType:["div","span","span","a"],aClasses:["epg_actionButton","epg_positiveButton"],aBehaviours:[{iNodeNo:3,sEvent:"click",fCallBack:B}],oContents:"Sign In"},{sNodeType:["div","span","span","a"],aClasses:["epg_actionButton","epg_negativeButton"],aBehaviours:[{iNodeNo:0,sEvent:"click",fCallBack:A}],oContents:"Cancel"}]};
return epg.tools.generateDOM(C)
},captureLoginEvent:function(B){var A=(window.event)?window.event.keyCode:(B.keyCode)?B.keyCode:(B.which)?B.which:null;
if(A===13){traceAuth("captureLoginEvent",arguments);
epg.Authentication.tryLogin()
}},rightPromo:function(){traceAuth("rightPromo",arguments);
oContents=[{sNodeType:["p"],oContents:[{sNodeType:["span"],oContents:(epg.config.auth&&epg.config.auth.loginCopy!==undefined)?epg.config.auth.loginCopy:"If you are a Sky customer, you can personalise your TV listings view to show only the channels included in your Sky package. If you have registered for Remote Record you can do that here too! Just log in to get started."}]},{sNodeType:["p"],oContents:[{sNodeType:["span"],oContents:"Don't have a Sky iD? "},{sNodeType:["span"],aClasses:["epg_newLineLink"],aBehaviours:[{iNodeNo:0,sAttribute:"target",sValue:"_top",sEvent:"click",fCallBack:function(){window.top.location=epg.tools.createSkyIDURL(epg.config.urlSkyIDSignup,"skyregistration")
}}],oContents:"Sign up now"}]}];
if(epg.config.auth.enableChannelSetup){oContents.push({sNodeType:["p"],oContents:[{sNodeType:["span"],oContents:"Don't have Sky TV? "},{sNodeType:["span"],aClasses:["epg_newLineLink"],aBehaviours:[{iNodeNo:0,sEvent:"click",fCallBack:epg.Authentication.displayChannelSetup}],oContents:"Set channels up yourself"}]})
}var A={sNodeType:["div"],aClasses:["epg_authArea_ColRight"],oContents:oContents};
return epg.tools.generateDOM(A)
}};
epg.Authentication.channelPrefs={properties:{iCurrentProvider:0,iCurrentChannels:[],iCurrentRegion:0,sTitle:"My Channel set up",sTab1:"simple setup",sTab2:"manual setup",sProviderTitle:"Please select your Sky TV Package: ",oArrayProviderMap:{virgin:1,freeview:2,sky:0},packageInfo:{},aRegionList:[],aRegionListCode:[],aRegionListCodeNo:{0:0}},processChannelData:function(D){traceAuth("processChannelData",arguments);
var C={};
for(var B=0,A=D.provider.length;
B<A;
B++){var E=D.provider[B].id;
C[E]=D.provider[B]
}epg.Authentication.channelPrefs.properties.packageInfo=C
},processUserPackageData:function(A){traceAuth("processUserPackageData",arguments);
epg.Authentication.channelPrefs.properties.packageInfo=A
},createTitle:function(){traceAuth("createTitle",arguments);
var B={sNodeType:["h2"],oContents:this.properties.sTitle};
var A=epg.tools.generateDOM(B);
return A
},createTabs:function(){traceAuth("createTabs",arguments);
if(epg.Authentication.isGuest()){return epg.Authentication.channelPrefs.createTabsForGuest()
}else{return epg.Authentication.channelPrefs.createStandardTabs()
}},createTabsForGuest:function(){traceAuth("createTabsForGuest",arguments);
var A={sNodeType:["ul"],aClasses:["epg_tabs"],oContents:[{sNodeType:["li","a"],aClasses:["on"],aBehaviours:[{iNodeNo:0,sEvent:"click",fCallBack:""}],oContents:this.properties.sTab2}]};
return epg.tools.generateDOM(A)
},createStandardTabs:function(){var C="on";
var B="";
if(epg.Authentication.properties.sFirstTab!="simple"){C="";
B="on"
}var A={sNodeType:["ul"],aClasses:["epg_tabs"],oContents:[{sNodeType:["li","a"],aClasses:[C],aBehaviours:[{iNodeNo:0,sEvent:"click",fCallBack:epg.Authentication.channelPrefs.swapTabs}],oContents:this.properties.sTab1},{sNodeType:["li","a"],aClasses:[B],aBehaviours:[{iNodeNo:0,sEvent:"click",fCallBack:epg.Authentication.channelPrefs.swapTabs}],oContents:this.properties.sTab2}]};
return epg.tools.generateDOM(A)
},swapTabs:function(){traceAuth("swapTabs",arguments);
if(!jQuery(this).hasClass("on")){var C=this.parentNode;
for(var B=0,A=C.childNodes.length;
B<A;
B++){jQuery(C.childNodes[B]).removeClass("on")
}jQuery(this).addClass("on");
if(this.innerHTML=="<a>manual setup</a>"||this.innerHTML=="<A>manual setup</A>"){jQuery("#epg_setupHolder").html("");
jQuery("#epg_setupHolder").append(epg.Authentication.channelPrefs.createManualSetup())
}else{if(epg.Authentication.isAuthenticated()){jQuery("#epg_setupHolder").html("");
jQuery("#epg_setupHolder").append(epg.Authentication.channelPrefs.createSimpleSetup())
}else{jQuery("#epg_setupHolder").html("");
jQuery("#epg_setupHolder").append(epg.Authentication.login.createLoginFieldSet())
}}}},createSimpleSetup:function(){traceAuth("createSimpleSetup",arguments);
var A={sNodeType:["div"],sId:"epg_setupHolder",oContents:[{sNodeType:["p"],sId:"epg_auth_info",aClasses:["epg_helpArea"],oContents:[{sNodeType:["span"],oContents:"Want to see what you can watch?"},{sNodeType:["a"],aClasses:["epg_channelLink"],aBehaviours:[{iNodeNo:0,sEvent:"click",fCallBack:epg.Authentication.getUserPackage}],oContents:"...filter my listings based on my subscription"}]}]};
A=epg.tools.generateDOM(A);
return A
},createManualSetup:function(){traceAuth("createManualSetup",arguments);
var A={sNodeType:["div"],sId:"epg_setupHolder",oContents:[this.createProviders(),{sNodeType:["div"],sId:"epg_mixHolder",oContents:[this.generateMixes(this.properties.iCurrentProvider)]}]};
A=epg.tools.generateDOM(A);
return A
},createProviders:function(){traceAuth("createProviders",arguments);
var A=null;
var D=null;
if(this.properties.iCurrentProvider==0){D={iNodeNo:0,sAttribute:"checked",sValue:"checked"}
}else{if(this.properties.iCurrentProvider==1){A={iNodeNo:0,sAttribute:"checked",sValue:"checked"}
}}var C={sNodeType:["div"],sId:"epg_provider",oContents:[{sNodeType:["h3"],oContents:this.properties.sProviderTitle},{sNodeType:["input"],aAttributes:[{iNodeNo:0,sAttribute:"type",sValue:"hidden"},{iNodeNo:0,sAttribute:"value",sValue:this.properties.oArrayProviderMap.sky},{iNodeNo:0,sAttribute:"name",sValue:"provider"},D],aBehaviours:[{iNodeNo:0,sEvent:"click",fCallBack:epg.Authentication.channelPrefs.swapProvider}],oContents:this.properties.packageInfo[this.properties.oArrayProviderMap.sky].name}]};
var B=epg.tools.generateDOM(C);
return B
},generateMixes:function(J){traceAuth("generateMixes",arguments);
var R=document.createElement("div");
jQuery(R).addClass("epg_mixes");
var H=this.properties.packageInfo[J].packageGroups.packagegroup.length;
if(H==undefined){this.properties.packageInfo[J].packageGroups.packagegroup=[this.properties.packageInfo[J].packageGroups.packagegroup];
H=1
}for(var Q=0;
Q<H;
Q++){if(this.properties.packageInfo[J].packageGroups.packagegroup[Q].name!="FREETOAIR"){var S=document.createElement("fieldset");
var K=document.createElement("h5");
K.innerHTML=this.properties.packageInfo[J].packageGroups.packagegroup[Q].name;
S.appendChild(K);
var D=document.createElement("div");
if(this.properties.packageInfo[J].packageGroups.packagegroup[Q].multipleChoice=="true"){var L="checkbox";
var I=""
}else{var L="radio";
var I=this.properties.packageInfo[J].packageGroups.packagegroup[Q].name
}var G=this.properties.packageInfo[J].packageGroups.packagegroup[Q]["packages"]["package"];
var M=G.length;
var T={};
for(var O=0,N=this.properties.iCurrentChannels.length;
O<N;
O++){T[this.properties.iCurrentChannels[O]]=true
}for(var P=0;
P<M;
P++){if(!G[P].code.match(/^HD_/)){var E=document.createElement("div");
jQuery(E).addClass("epg_singleMix");
var A=document.createElement("label");
A.setAttribute("for",G[P].code);
A.innerHTML='<input type="'+L+'" id="'+G[P].code+'" name="'+I+'" value="'+G[P].name+'" '+(T[G[P].code]===true?'checked="checked"':"")+"/>&nbsp;&nbsp;"+G[P].name;
E.appendChild(A);
D.appendChild(E)
}}S.appendChild(D);
R.appendChild(S)
}}if(this.properties.packageInfo[J].regions){var C=this.properties.packageInfo[J].regions.region.length;
this.properties.packageInfo[J].regions.region=this.properties.packageInfo[J].regions.region.sortBy(function(V){var U=(V.defaultRegion=="true"?0:1);
return U
});
for(var Q=0;
Q<C;
Q++){epg.Authentication.channelPrefs.properties.aRegionList[Q]=this.properties.packageInfo[J].regions.region[Q].name;
epg.Authentication.channelPrefs.properties.aRegionListCode[Q]=this.properties.packageInfo[J].regions.region[Q].code;
epg.Authentication.channelPrefs.properties.aRegionListCodeNo[this.properties.packageInfo[J].regions.region[Q].code]=Q
}var B=this.createDropUp(epg.Authentication.channelPrefs.properties.aRegionList);
jQuery(B).bind("mousedown",epg.Authentication.channelPrefs.openDropUp);
R.appendChild(B)
}var F=epg.Authentication.login.formButtons(epg.Authentication.channelPrefs.saveChannelPreferences,epg.ui.modalPane.close);
R.appendChild(F);
return(R)
},swapProvider:function(){traceAuth("swapProvider",arguments);
var D=this.value;
epg.Authentication.channelPrefs.properties.iCurrentProvider=parseInt(D,10);
for(var B=0,A=this.parentNode.childNodes.length;
B<A;
B++){this.parentNode.childNodes[B].checked=false;
this.parentNode.childNodes[B].removeAttribute("checked")
}this.checked="checked";
var C=jQuery("#epg_mixHolder");
if(C.length>0){C.innerHTML="";
C.appendChild(epg.Authentication.channelPrefs.generateMixes(D))
}},saveSingleCP:function(A){traceAuth("saveSingleCP",arguments);
epg.Authentication.channelPrefs.properties.iCurrentProvider=A;
if(A==3){epg.stateMachine.isHDChannels=true
}else{epg.stateMachine.isHDChannels=false
}epg.ui.Dropdowns.providers.setup();
epg.bubble.closeBubble();
epg.reloadEPG()
},saveSpecialFilter:function(C){traceAuth("saveSpecialFilter",arguments);
var B=epg.data.UserCookie.getCookie("epg_channelPrefs"+epg.config.cookieSuffix);
var A={specialFilter:"HD"};
if(B){A.region=(B.region!==undefined?B.region:"")
}epg.data.UserData.saveData("epg_channelPrefs",A);
epg.bubble.closeBubble();
epg.reloadEPG()
},saveChannelPreferences:function(){traceAuth("saveChannelPreferences",arguments);
var B=$("epg_mixHolder");
var F=[];
var A=B.getElementsByTagName("input");
for(var E=0,C=A.length;
E<C;
E++){if(A[E].checked==1){F.push(A[E].id)
}}epg.Authentication.channelPrefs.properties.iCurrentChannels=F;
if(jQuery("#epg_channelDropUp").length==0){epg.Authentication.channelPrefs.properties.iCurrentRegion=0
}var D={provider:epg.Authentication.channelPrefs.properties.packageInfo[epg.Authentication.channelPrefs.properties.iCurrentProvider].id,packages:F,region:epg.Authentication.channelPrefs.properties.iCurrentRegion};
epg.data.UserData.saveData("epg_myChannels",D);
epg.ui.Dropdowns.providers.currentRegion=jQuery("#epg_dropUpSelected").text();
jQuery("#epg_provider_chosen").text("My Channels ("+epg.ui.Dropdowns.providers.currentRegion+")");
epg.Authentication.channelPrefs.reload(D)
},reload:function(A,B){epg.ui.modalPane.close();
epg.reloadEPG(B)
},saveUserPreferences:function(A){traceAuth("saveUserPreferences",arguments);
var C=epg.Authentication.channelPrefs.properties.packageInfo.usersubscription;
var B={region:C.region||epg.Authentication.channelPrefs.properties.iCurrentRegion};
epg.data.UserData.saveData("epg_channelPrefs",B);
if(A==undefined||A==true){epg.ui.modalPane.close();
epg.reloadEPG()
}},createDropUp:function(C,B){traceAuth("createDropUp",arguments);
var A={sNodeType:["fieldset"],sId:"epg_regions",aClasses:["epg_easyDropDown"],oContents:[{sNodeType:["h5"],oContents:"Please select your regional channels"},{sNodeType:["div"],sId:"epg_region_dropUp",oContents:[{sNodeType:["a"],aClasses:["epg_block_g1","epg_level_1"],oContents:[{sNodeType:["span","span","span","span"],oContents:[{sNodeType:["span"],sId:"epg_dropUpSelected",oContents:C[epg.Authentication.channelPrefs.properties.aRegionListCodeNo[this.properties.iCurrentRegion]]}]}]},{sNodeType:["a"],aClasses:["epg_dropdown_arrow"],oContents:" "}]},{sNodeType:["ul"],sId:"epg_channelDropUp",aClasses:["epg_dropdown"],oContents:[{sNodeType:["li","a"],aBehaviours:[{iNodeNo:1,sEvent:"click",fCallBack:epg.Authentication.channelPrefs.selectItem}],oContents:C}]}]};
return epg.tools.generateDOM(A)
},selectItem:function(){traceAuth("selectItem",arguments);
epg.Authentication.channelPrefs.properties.iCurrentRegion=epg.Authentication.channelPrefs.properties.aRegionListCode[this.parentNode.generatedNodeNo];
epg.Authentication.channelPrefs.setDropUp(this.innerHTML);
epg.Authentication.channelPrefs.closeDropUp()
},setDropUp:function(A){traceAuth("setDropUp",arguments);
jQuery("#epg_dropUpSelected").html(A)
},openDropUp:function(){traceAuth("openDropUp",arguments);
var A=jQuery("#epg_region_dropUp");
var B=jQuery("#epg_channelDropUp");
jQuery(B).bind("mouseover",epg.ui.Dropdowns.rollOver);
jQuery(B).bind("mouseout",epg.ui.Dropdowns.rollOut);
jQuery(A).bind("mousedown",epg.Authentication.channelPrefs.openDropUp);
jQuery(A).unbind("mousedown",epg.Authentication.channelPrefs.openDropUp);
B.css("display","block");
jQuery(B).bind("mouseout",epg.Authentication.channelPrefs.dropUpRollOut);
jQuery(B).bind("mouseover",epg.Authentication.channelPrefs.dropUpRollOver)
},dropUpRollOver:function(){traceAuth("dropUpRollOver",arguments);
jQuery("body").unbind("mouseup",epg.Authentication.channelPrefs.closeDropUp)
},dropUpRollOut:function(){traceAuth("dropUpRollOut",arguments);
jQuery("body").bind("mouseup",epg.Authentication.channelPrefs.closeDropUp)
},closeDropUp:function(){traceAuth("closeDropUp",arguments);
var A=jQuery("#epg_region_dropUp");
var B=jQuery("#epg_channelDropUp");
B.hide();
jQuery("body").unbind("mouseup",epg.Authentication.channelPrefs.closeDropUp);
jQuery(B).unbind("mouseover",epg.ui.Dropdowns.rollOver);
jQuery(B).unbind("mouseout",epg.ui.Dropdowns.rollOut);
jQuery(A).bind("mousedown",epg.Authentication.channelPrefs.openDropUp);
jQuery(B).unbind("mouseout",epg.Authentication.channelPrefs.dropUpRollOut);
jQuery(B).unbind("mouseover",epg.Authentication.channelPrefs.dropUpRollOver)
}};if(epg.config.siteId!=4){jQuery(function(){if(typeof Sky=="undefined"||typeof Sky.Widget=="undefined"){var B=document.createElement("script");
B.type="text/javascript";
B.src=epg.config.environment.url.tvwidgethost_nonsecure+"/tvwidget/script/behaviour.js";
var A=function(){Sky.Widget.initialise({host:epg.config.environment.url.tvwidgethost_nonsecure});
var D=jQuery('<div id="#remoteRecordWidgetBackground"></div>');
D.css({backgroundColor:"#000000",position:"absolute",width:"100%",height:"2481px",left:"0px",top:"0px",zIndex:"9999",opacity:"0.8",display:"none"});
jQuery("body").append(D);
var C=Sky.Widget.getEvents();
Sky.Widget.bind(C.openSuccess,function(){D.css("display","block")
});
Sky.Widget.bind(C.close,function(){D.css("display","none")
})
};
B.onload=function(){A()
};
B.onreadystatechange=function(){if(typeof Sky!=="undefined"){A()
}};
document.body.appendChild(B)
}})
};epg.ui.Alerts.modalDialogue={autoCloseTimeout:1500,rawDialogueStack:0,rawDialogueZindex:20000,showRawDialogue:function(G,C,K){if(C===undefined){C=340
}var E=++epg.ui.Alerts.modalDialogue.rawDialogueStack;
var F="raw-dialogue-overlay"+E;
var H="raw-dialogue-container"+E;
epg.ui.Alerts.modalDialogue.rawDialogueZindex+=10;
if(jQuery.browser.msie){K+=-20
}var L=document.createElement("div");
L.setAttribute("id",F);
L.className="epg_overlay";
L.style.height=document.getElementById(epg.config.eEPG).offsetHeight;
L.style.zIndex=parseInt(epg.ui.Alerts.modalDialogue.rawDialogueZindex+E,10);
L.style.position="absolute";
document.body.appendChild(L);
var B=document.createElement("div");
B.id=H;
B.style.zIndex=parseInt(epg.ui.Alerts.modalDialogue.rawDialogueZindex+E+1,10);
B.style.position="absolute";
B.innerHTML=epg.ui.Alerts.modalDialogue.getDialogueTemplate(E);
document.body.appendChild(B);
document.getElementById("raw-dialogue"+E).style.width=C+"px";
if(K!==undefined){}document.getElementById("raw-dialogue-content"+E).style.width=(C-20)+"px";
document.getElementById("raw-dialogue-content"+E).innerHTML=G;
K=$("raw-dialogue"+E).getHeight();
var A=window.innerHeight!==undefined?window.innerHeight:document.body.clientHeight;
var I=window.innerWidth!==undefined?window.innerWidth:document.body.clientWidth;
var J=Math.round(((A/2)-(K/2))/(A*0.01))-5+epg.config.general.modalOffset.top;
var D=Math.round(((I/2)-(C/2))/(I*0.01));
if(J<=0){J=1
}if(D<=0){D=1
}document.getElementById(H).style.top=J+"%";
document.getElementById(H).style.left=D+"%"
},getDialogueTemplate:function(A){if(jQuery.browser.msie&&jQuery.browser.version==6){return'<div class="raw-dialogue" id="raw-dialogue'+A+'"><div class="t"><div class="tl"></div><div class="tm"></div><div class="tr"></div></div><div class="c"><div class="innerc"><div class="raw-dialogue-content" id="raw-dialogue-content'+A+'"></div></div></div><div class="b"><div class="bl"></div><div class="bm"></div><div class="br"></div></div></div>'
}else{return'<div class="raw-dialogue" id="raw-dialogue'+A+'"><div class="t"><div class="tm"></div><div class="tl"></div><div class="tr"></div></div><div class="c"><div class="innerc"><div class="raw-dialogue-content" id="raw-dialogue-content'+A+'"></div></div></div><div class="b"><div class="bm"></div><div class="bl"></div><div class="br"></div></div></div>'
}return'<table class="raw-dialogue" id="raw-dialogue'+A+'"><tr><td class="tl"><div class="raw-dialogue-content" id="raw-dialogue-content'+A+'"></div></td><td class="tm"></td><td class="tr"></td></tr><tr><td class="l"></td><td class="m"></td><td class="r"></td></tr><tr><td class="bl"></td><td class="bm"></td><td class="br"></td></tr></table>'
},closeRawDialogue:function(C){var B="raw-dialogue-overlay"+epg.ui.Alerts.modalDialogue.rawDialogueStack;
var A="raw-dialogue-container"+epg.ui.Alerts.modalDialogue.rawDialogueStack;
document.getElementById(A).parentNode.removeChild(document.getElementById(A));
document.getElementById(B).parentNode.removeChild(document.getElementById(B));
epg.ui.Alerts.modalDialogue.rawDialogueStack--;
epg.ui.Alerts.modalDialogue.rawDialogueZindex-=10
},close:function(A){document.getElementById(epg.config.eModalDialogue).parentNode.removeChild(document.getElementById(epg.config.eModalDialogue));
document.getElementById(epg.config.eModalOverlay).parentNode.removeChild(document.getElementById(epg.config.eModalOverlay))
},open:{noticeFade:function(B){var A='<div class="body notice-dialogue"><div class="notice-icon"></div><div class="notice-message">'+B+"</div></div>";
epg.ui.Alerts.modalDialogue.showRawDialogue(A,340,jQuery.browser.msie?90:105);
setTimeout(function(){epg.ui.doFade("raw-dialogue"+epg.ui.Alerts.modalDialogue.rawDialogueStack,100,epg.ui.Alerts.modalDialogue.closeRawDialogue)
},epg.ui.Alerts.modalDialogue.autoCloseTimeout)
},alreadyBroadcast:function(){epg.ui.Alerts.modalDialogue.open.error("Sorry, we could not find this programme. It is possible it has already been broadcast.")
},ajaxTimeoutDelay:function(){var A='<div class="body notice-dialogue" id="ajaxtimeoutdelaymodal"><div class="notice-icon"></div><div class="notice-message" style="height: 20px;"><p>Sorry, it\'s taking longer than expected retrieving the data. Thanks for your patience.</p></div></div></div>';
epg.ui.Alerts.modalDialogue.showRawDialogue(A,340,jQuery.browser.msie?20:20)
},ajaxTimeoutFailure:function(A){var B='<div class="body error-dialogue" id="ajaxtimeoutfailuremodal"><div class="error-icon"></div><div class="error-message" style="height: 20px;"><p>Sorry, we\'ve been unable to retrieve the data. Please come back later or <a href="#" id="aAjaxRetry">try again</a>.</p></div><div class="buttons"><div class="epg_modalDialogue_buttons"><div class="epg_actionButton epg_negativeButton"><span><span><a onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()">Close</a></span></span></div></div></div></div>';
epg.ui.Alerts.modalDialogue.showRawDialogue(B,340,jQuery.browser.msie?20:20);
setTimeout(function(){jQuery("#aAjaxRetry").click(function(){epg.ui.Alerts.modalDialogue.closeRawDialogue();
A();
return false
})
},500)
},promo:function(E,B,C,D){var A='<div class="header"><div class="close-button" onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()"></div><span class="title">'+E+'</span></div><div class="body"><p>'+B+'</p></div><div class="buttons"><div class="epg_modalDialogue_buttons"><div class="epg_actionButton epg_negativeButton"><span><span><a onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()">Close</a></span></span></div></div><div class="button-spacer">&nbsp;</div><div class="epg_modalDialogue_buttons"><div class="epg_actionButton epg_positiveButton"><span><span><a href="'+C+'" target="'+D+'">Find out more</a></span></span></div></div>';
"</div>";
epg.ui.Alerts.modalDialogue.showRawDialogue(A,300,jQuery.browser.msie?85:100)
},error:function(A){var B='<div class="close-button" onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()"></div><div class="body error-dialogue"><div class="error-icon"></div><div class="error-message">'+A+'</div></div><br clear="all" /><div class="buttons"><div class="epg_modalDialogue_buttons"><div class="epg_actionButton epg_negativeButton"><span><span><a onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()">Close</a></span></span></div></div></div>';
epg.ui.Alerts.modalDialogue.showRawDialogue(B,340,jQuery.browser.msie?110:125)
},notice:function(B){var A='<div class="close-button" onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()"></div><div class="body notice-dialogue"><div class="notice-icon"></div><div class="notice-message">'+B+'</div></div><br clear="all" /><div class="buttons"><div class="epg_modalDialogue_buttons"><div class="epg_actionButton epg_negativeButton"><span><span><a onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()">Close</a></span></span></div></div></div>';
epg.ui.Alerts.modalDialogue.showRawDialogue(A,340,jQuery.browser.msie?110:125)
},confirmYesNo:function(C,B){var A='<div class="close-button" onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()"></div><div class="body notice-dialogue"><div class="notice-icon"></div><div class="notice-message">'+C+'</div></div><br clear="all" /><div class="buttons"><div class="epg_actionButton epg_negativeButton"><span><span><a onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()">&nbsp;No&nbsp;</a></span></span></div><div class="epg_actionButton epg_positiveButton"><span><span><a id="confirmYes">Yes</a></span></span></div>';
"</div>";
epg.ui.Alerts.modalDialogue.showRawDialogue(A,340,jQuery.browser.msie?110:125);
Event.observe(document.getElementById("confirmYes"),"click",function(D){B();
Event.stop(D)
})
},remoteRecord:{notActivated:function(){var A='<div class="close-button" onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()"></div><div class="body notice-dialogue"><div class="notice-icon"></div><div class="notice-message" style="height: 55px;"><p>To use Remote Record you must have Sky+ or Sky+HD and have activated Remote Record.</p><a id="aActivateRemoteRecord" href="'+epg.config.urlActivateRemoteRecord+'" target="_blank">Find out more</a></p></div></div>';
epg.ui.Alerts.modalDialogue.showRawDialogue(A,340,jQuery.browser.msie?110:125);
jQuery("#aActivateRemoteRecord").click(function(){epg.tools.popwin(this.href,true);
return false
})
},noSkyPlus:function(){var A='<div class="close-button" onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()"></div><div class="body notice-dialogue"><div class="notice-icon"></div><div class="notice-message" style="height: 130px;"><p>To use Remote Record you must have Sky+ or Sky+HD and have activated Remote Record.</p><p>Already have Sky+ or Sky+HD?<br /><a id="aActiveRemoteRecord" href="'+epg.config.urlRemoteRecordCheckBoxSetup+'" target="_blank">Activate Remote Record now</a></p><p>Don\'t have Sky+ or Sky+HD?<br /><a id="aRemoteRecordFindOutMore" href="'+epg.config.urlFindOutAboutRemoteRecord+'" target="_blank">Find out more</a></p></div></div><br clear="all" /><div class="buttons"><div class="epg_modalDialogue_buttons"><div class="epg_actionButton epg_negativeButton"><span><span><a onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()">Close</a></span></span></div></div></div>';
jQuery("#aActiveRemoteRecord").click(function(){epg.tools.popwin(this.href,true);
return false
});
jQuery("#aRemoteRecordFindOutMore").click(function(){epg.tools.popwin(this.href,true);
return false
});
epg.ui.Alerts.modalDialogue.showRawDialogue(A,340,jQuery.browser.msie?185:200)
},registerMobile:function(){var A='<div class="close-button" onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()"></div><div class="body notice-dialogue"><div class="notice-icon"></div><div class="notice-message" style="height: 90px;"><p>Ah! Is this the first time you try Remote Record? You will need to register your mobile phone number. This will also enable you to use Remote Record with your mobile phone.</p><a href="'+epg.config.urlFindOutAboutGettingSky+'" target="_parent">Find out more about getting Sky</a></p></div></div><br clear="all" /><div class="buttons"><div class="epg_modalDialogue_buttons"><div class="epg_actionButton epg_negativeButton"><span><span><a onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()">Close</a></span></span></div></div></div>';
epg.ui.Alerts.modalDialogue.showRawDialogue(A,340,jQuery.browser.msie?140:155)
}}}};epg.reminders={stateMachine:{},deleteReminder:function(){var A=jQuery("#reminder-programme-selected")[0].checked?false:true;
epg.tools.doAjax({url:epg.config.ajaxReminderDelete,data:epg.reminders.getPostParms(),dataType:"json",success:function(C){var B=C.result;
if(B.status===undefined||B.status!=="OK"){if(B.errorCode=="ERR_NOT_LOGGED_IN"){epg.ui.Alerts.modalDialogue.open.error(epg.config.strings.sessionTimeout);
if(epg.Authentication.properties.iAuthState==1){epg.Authentication.logout()
}}else{epg.ui.Alerts.modalDialogue.open.error(epg.config.strings.unexpectedError+" (bad reminder delete status)")
}return 
}else{if(A){strTitle=epg.bubble.properties.oCurrentBubbleData.oFullProgrammeData.title;
for(var E in epg.data.events){for(var D in epg.data.events[E]){if(epg.data.events[E][D].program.title==strTitle){epg.data.events[E][D].program.userreminderset="false"
}}}}else{epg.data.events[epg.bubble.properties.oCurrentBubbleData.iBubbleCurrentChannel][epg.bubble.properties.oCurrentBubbleData.iBubbleCurrentShow].program.userreminderset="false"
}jQuery("#epg_RemindMeLink").removeClass("epg_UpdateReminder").text("Remind Me");
epg.ui.Alerts.modalDialogue.closeRawDialogue();
epg.ui.Alerts.modalDialogue.open.noticeFade("Your reminder has been deleted.");
return 
}}})
},closeConfDialogue:function(A){if(jQuery("#"+A).length>0){epg.ui.doFade("raw-dialogue"+epg.ui.Alerts.modalDialogue.rawDialogueStack,100,epg.ui.Alerts.modalDialogue.closeRawDialogue)
}},saveReminder:function(){var A=epg.reminders.getPostParms();
A.reminderForSeries=jQuery("#reminder-programme-selected")[0].checked?false:true;
epg.tools.doAjax({url:epg.config.ajaxReminderSave,data:A,dataType:"json",success:function(C){var B=C.result;
if(B.status===undefined){if(B.errorCode=="ERR_NOT_LOGGED_IN"){epg.ui.Alerts.modalDialogue.open.error(epg.config.strings.sessionTimeout);
if(epg.Authentication.properties.iAuthState==1){epg.Authentication.logout()
}}else{epg.ui.Alerts.modalDialogue.open.error(epg.config.strings.unexpectedError+" (no reminder save status)")
}return 
}if(B.status!=="OK"){if(B.errorCode=="ERR_NOT_LOGGED_IN"){epg.ui.Alerts.modalDialogue.open.error(epg.config.strings.sessionTimeout);
if(epg.Authentication.properties.iAuthState==1){epg.Authentication.logout()
}}else{epg.ui.Alerts.modalDialogue.open.error("We haven't been able to set this reminder. Please try again later.")
}return 
}else{if(A.reminderForSeries){strTitle=epg.bubble.properties.oCurrentBubbleData.oFullProgrammeData.title;
for(var E in epg.data.events){for(var D in epg.data.events[E]){if(epg.data.events[E][D].program.title==strTitle){epg.data.events[E][D].program.userreminderset="true"
}}}}else{epg.data.events[epg.bubble.properties.oCurrentBubbleData.iBubbleCurrentChannel][epg.bubble.properties.oCurrentBubbleData.iBubbleCurrentShow].program.userreminderset="true"
}jQuery("#epg_RemindMeLink").addClass("epg_UpdateReminder").text("Update Reminder");
epg.ui.Alerts.modalDialogue.closeRawDialogue();
epg.ui.Alerts.modalDialogue.open.noticeFade("Your reminder has been saved.");
return 
}}})
},validateForm:function(){return true
},goLogin:function(){epg.ui.Alerts.modalDialogue.closeRawDialogue();
epg.Authentication.trigger="reminders";
epg.Authentication.display("loginOnly")
},openRemindMe:function(){if(epg.Authentication.isAuthenticated()===false){epg.Authentication.trigger="reminders";
epg.Authentication.display("loginOnly");
return 
}epg.tools.doAjax({url:epg.config.ajaxReminderDetails,data:epg.reminders.getPostParms(),dataType:"json",success:function(B){var A=B.result;
if(A.status===undefined||A.content===undefined||A.status!=="OK"){if(A.errorCode=="ERR_NOT_LOGGED_IN"){epg.ui.Alerts.modalDialogue.open.error(epg.config.strings.sessionTimeout);
if(epg.Authentication.properties.iAuthState==1){epg.Authentication.logout()
}}else{epg.ui.Alerts.modalDialogue.open.error(epg.config.strings.unexpectedError+" (reminder details: "+A.errorCode+")")
}return 
}else{var C=A.content;
epg.reminders.stateMachine={email:C.emailAddress,newReminder:C.reminderRequestedEmail==="false"?true:false,seriesAvailable:C.seriesAvailable==="true",reminderForSeries:C.reminderForSeries==="true"?true:false,emailAvailable:C.emailAvailable==="true"?true:false,clickedCancel:false};
epg.reminders.showDialogue.remindMe(epg.reminders.stateMachine)
}}})
},doSaveAction:function(){if(!epg.reminders.validateForm()){return 
}epg.reminders.saveReminder()
},doCloseReminder:function(){epg.ui.Alerts.modalDialogue.closeRawDialogue()
},showDialogue:{remindMe:function(E){var C=epg.bubble.properties.oCurrentBubbleData.oFullProgrammeData;
var B=jQuery.browser.msie?300:310;
var F='<div class="separator"></div><p><input type="radio" value="programme" name="programme-or-series" class="radio" id="reminder-programme-selected" '+(E.reminderForSeries===undefined||!E.reminderForSeries||!E.seriesAvailable?"checked":"")+'> <label for="reminder-programme-selected">Remind me about this programme</label><br />'+(E.seriesAvailable?'<input type="radio" value="series" name="programme-or-series" class="radio" id="reminder-series-selected" '+(E.reminderForSeries!==undefined&&E.reminderForSeries?"checked":"")+'> <label for="reminder-series-selected">Remind me about the entire series</label> ':'<input type="radio" value="series" name="programme-or-series" class="radio" id="reminder-series-selected" disabled> <span style="color: #999;">Remind me about the entire series</span> ')+"</p></div>";
var D='<div class="close-button" onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()"></div><div class="header"><span class="title">Remind me about '+C.title+"</span></div><div class=\"body reminders\"><p>Don't miss another thing! We'll send you an email reminder first thing in the morning on the day this programme is being shown.</p><p"+(epg.reminders.stateMachine.emailAvailable?"":' class="epg_greyedOut"')+'><label for="reminder-email"><b>Email reminders will be sent to:</b> '+E.email+"</label>"+(epg.reminders.stateMachine.emailAvailable?' <a href="#" onclick="epg.reminders.editUserDetails();">edit</a>':"")+"</p>"+((!epg.reminders.stateMachine.emailAvailable&&E.newReminder)?'<p class="error">Sorry, it\'s too late to set a reminder for this programme. Have a look at "Other Airings" in the programme bubble or use the keyword search to find out when it\'s next on.</p>':"")+((!epg.reminders.stateMachine.emailAvailable&&!E.newReminder)?'<p class="error">Sorry, it\'s too late to update your reminder for this programme. Have a look at "Other Airings" in the programme bubble or use the keyword search to find out when it\'s next on.</p>':"")+((epg.reminders.stateMachine.emailAvailable)?F:"")+'<div class="buttons">'+(!E.newReminder?'<div class="epg_actionButton epg_negativeButton"><span><span><a onclick="epg.reminders.deleteReminder()" title="Delete Reminder">Delete</a></span></span></div><div class="epg_actionButton epg_positiveButton"><span><span><a onclick="epg.reminders.doSaveAction()" title="Update Reminder">Update</a></span></span></div>':'<div class="epg_actionButton epg_negativeButton"><span><span><a onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()">Cancel</a></span></span></div>'+((epg.reminders.stateMachine.emailAvailable)?'<div class="epg_actionButton epg_positiveButton"><span><span><a onclick="epg.reminders.doSaveAction()" title="Save Reminder">Save</a></span></span></div>':""))+(!E.newReminder?'<div class="epg_actionButton epg_negativeButton"><span><span><a onclick="epg.reminders.doCloseReminder()">Close</a></span></span></div>':"")+"</div>";
var A=epg.ui.Alerts.modalDialogue.showRawDialogue(D,380,B)
}},getPostParms:function(){var A={channelId:epg.bubble.properties.oCurrentBubbleData.iBubbleCurrentChannel,eventId:epg.bubble.properties.oCurrentBubbleData.iBubbleCurrentShow};
return A
},editUserDetails:function(){var A='<div class="header"><div class="close-button" onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()"></div><span class="title">Update Your Details</span></div><div class="body"><p>When you click OK you\'ll see your My Sky profile page. Amend your details on that page and close that window. You can then carry on setting your reminder.</p></div><div class="buttons"><div class="epg_actionButton epg_negativeButton"><span><span><a onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()">Cancel</a></span></span></div><div class="epg_actionButton epg_positiveButton"><span><span><a onclick="epg.reminders.showUserDetailsWindow()">OK</a></span></span></div></div>';
var B=epg.ui.Alerts.modalDialogue.showRawDialogue(A,250)
},showUserDetailsWindow:function(){epg.ui.Alerts.modalDialogue.closeRawDialogue();
var A='<div class="header"><span class="title">Update Your Details</span></div><div class="body"><p>Click OK to carry on setting your reminder.</p></div><div class="buttons"><div class="epg_actionButton epg_positiveButton"><span><span><a onclick="epg.reminders.updateUserDetails()">OK</a></span></span></div></div>';
var B=epg.ui.Alerts.modalDialogue.showRawDialogue(A,250);
epg.tools.popwin(epg.config.urlMySkyProfile,false)
},updateUserDetails:function(){epg.ui.Alerts.modalDialogue.closeRawDialogue();
epg.ui.Alerts.modalDialogue.closeRawDialogue();
epg.reminders.openRemindMe()
}};epg.emailToFriend={autoCloseTimeout:3000,data:{userEmail:"",userName:"",friendEmail:"",friendName:""},open:function(){if(epg.Authentication.isAuthenticated()===true){epg.emailToFriend.fetchUserDetails()
}else{epg.emailToFriend.data.userName="";
epg.emailToFriend.data.userEmail="";
epg.emailToFriend.data.friendName="";
epg.emailToFriend.data.friendEmail="";
epg.emailToFriend.showDialogue.sendMail(epg.emailToFriend.data)
}},fetchUserDetails:function(){if(epg.emailToFriend.data.userName!=""){epg.emailToFriend.showDialogue.sendMail(epg.emailToFriend.data);
return 
}var A={};
epg.tools.doAjax({url:epg.config.ajaxEmailToFriendDetails,data:A,dataType:"json",success:function(C){var B=C.result;
if(B.status!=="OK"){if(B.errorCode=="ERR_NOT_LOGGED_IN"){epg.ui.Alerts.modalDialogue.open.error(epg.config.strings.sessionTimeout);
if(epg.Authentication.properties.iAuthState==1){epg.Authentication.logout()
}}else{epg.ui.Alerts.modalDialogue.open.error(epg.config.strings.unexpectedError+" (share: "+B.errorCode+")")
}return 
}if(B.content===undefined){epg.ui.Alerts.modalDialogue.open.error("Sorry, we haven't been able to send an email. Please try again later.");
return 
}else{epg.emailToFriend.data.userName=B.content.name;
epg.emailToFriend.data.userEmail=B.content.emailAddress;
epg.emailToFriend.showDialogue.sendMail(epg.emailToFriend.data)
}}})
},showDialogue:{sendMail:function(D){if(epg.Authentication.isAuthenticated()!=true){D.userName="";
D.userEmail="";
D.friendName="";
D.friendEmail=""
}var B=epg.bubble.properties.oCurrentBubbleData.oFullProgrammeData;
var C='<div class="close-button" onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()"></div><div class="header"><span class="title">Share this programme with a friend: '+B.title+'</span></div><div class="body"><p>Pass it on! If you\'d like to tell a friend about this programme just tell us their email address and we will send them your recommendation.</p><div class="section-heading">Please send an email to:</div><div class="right-input">Friend\'s name: <input type="text" id="emailtofriend-friends-name" value="'+D.friendName+'"></div><div class="right-input">Friend\'s email: <input type="text" id="emailtofriend-friends-email" value="'+D.friendEmail+'"></div><div class="separator"></div><div class="right-input">My name: <input type="text" id="emailtofriend-my-name" value="'+D.userName+'"></div><div class="right-input">My email: <input type="text" id="emailtofriend-my-email" value="'+D.userEmail+'"></div><div class="separator"></div><p>The details you provide on this page will only be used to send this e-mail on your behalf. Please make sure your friend is happy to receive this e-mail.</p></div><div class="buttons"><div class="epg_actionButton epg_negativeButton"><span><span><a onclick="epg.ui.Alerts.modalDialogue.closeRawDialogue()">Cancel</a></span></span></div><div class="epg_actionButton epg_positiveButton"><span><span><a id="aEmailToFriend">Send</a></span></span></div></div>';
var A=epg.ui.Alerts.modalDialogue.showRawDialogue(C,380,310);
jQuery("#aEmailToFriend").click(epg.emailToFriend.send)
}},send:function(){if(!epg.emailToFriend.validateForm()){return false
}jQuery("#aEmailToFriend").unbind("click").click(function(){return false
});
var A=epg.emailToFriend.getPostParams();
A.friendName=$("emailtofriend-friends-name").getValue();
A.friendEmail=$("emailtofriend-friends-email").getValue();
A.userName=$("emailtofriend-my-name").getValue();
A.userEmail=$("emailtofriend-my-email").getValue();
epg.emailToFriend.data=A;
epg.tools.doAjax({url:epg.config.ajaxEmailToFriend,data:A,type:"post",dataType:"json",success:function(B){if(B.result.status!=="OK"){epg.ui.Alerts.modalDialogue.open.error("Sorry, we haven't been able to send an email. Please try again later.");
jQuery("#aEmailToFriend").click(epg.emailToFriend.send);
return 
}else{epg.ui.Alerts.modalDialogue.closeRawDialogue();
epg.ui.Alerts.modalDialogue.open.noticeFade("An email has been sent to your friend");
return 
}}});
return true
},validateForm:function(){var B="";
var A=/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if($("emailtofriend-friends-name").getValue()==""){B="Please enter your friend's name"
}else{if($("emailtofriend-friends-email").getValue()==""){B="Please enter your friend's email address"
}else{if(!$("emailtofriend-friends-email").getValue().match(A)){B="Your friend's email address does not appear to be valid.<br />Please enter a valid email address e.g. example@sky.com"
}else{if($("emailtofriend-my-name").getValue()==""){B="Please enter your name"
}}}}if(B!==""){epg.ui.Alerts.modalDialogue.open.error(B);
return false
}return true
},getPostParams:function(){var A={channelId:epg.bubble.properties.oCurrentBubbleData.iBubbleCurrentChannel,eventId:epg.bubble.properties.oCurrentBubbleData.iBubbleCurrentShow};
return A
},closeConfDialogue:function(A){if($(A)){epg.ui.doFade("raw-dialogue"+epg.ui.Alerts.modalDialogue.rawDialogueStack,100,epg.ui.Alerts.modalDialogue.closeRawDialogue)
}}};epg.security={RSAKeyPair:function(B,C,A){this.e=epg.security.biFromHex(B);
this.d=epg.security.biFromHex(C);
this.m=epg.security.biFromHex(A);
this.chunkSize=2*epg.security.biHighIndex(this.m);
this.radix=16;
this.barrett=new epg.security.BarrettMu(this.m)
},encryptedString:function(H,K){var G=new Array();
var A=K.length;
var E=0;
while(E<A){G[E]=K.charCodeAt(E);
E++
}while(G.length%H.chunkSize!=0){G[E++]=0
}var F=G.length;
var L="";
var D,C,B;
for(E=0;
E<F;
E+=H.chunkSize){B=new epg.security.BigInt();
D=0;
for(C=E;
C<E+H.chunkSize;
++D){B.digits[D]=G[C++];
B.digits[D]+=G[C++]<<8
}var J=H.barrett.powMod(B,H.e);
var I=H.radix==16?epg.security.biToHex(J):epg.security.biToString(J,H.radix);
L+=I+" "
}return L.substring(0,L.length-1)
},digitToHex:function(C){var B=15;
var A="";
for(i=0;
i<4;
++i){A+=epg.security.hexToChar[C&B];
C>>>=4
}return epg.security.reverseStr(A)
},biToHex:function(B){var A="";
var D=epg.security.biHighIndex(B);
for(var C=epg.security.biHighIndex(B);
C>-1;
--C){A+=epg.security.digitToHex(B.digits[C])
}return A
},setMaxDigits:function(B){maxDigits=B;
epg.security.ZERO_ARRAY=new Array(maxDigits);
for(var A=0;
A<epg.security.ZERO_ARRAY.length;
A++){epg.security.ZERO_ARRAY[A]=0
}bigZero=new epg.security.BigInt();
bigOne=new epg.security.BigInt();
bigOne.digits[0]=1
},BarrettMu:function(A){this.modulus=epg.security.biCopy(A);
this.k=epg.security.biHighIndex(this.modulus)+1;
var B=new epg.security.BigInt();
B.digits[2*this.k]=1;
this.mu=epg.security.biDivide(B,this.modulus);
this.bkplus1=new epg.security.BigInt();
this.bkplus1.digits[this.k+1]=1;
this.modulo=epg.security.BarrettMu_modulo;
this.multiplyMod=epg.security.BarrettMu_multiplyMod;
this.powMod=epg.security.BarrettMu_powMod
},BarrettMu_modulo:function(H){var G=epg.security.biDivideByRadixPower(H,this.k-1);
var E=epg.security.biMultiply(G,this.mu);
var D=epg.security.biDivideByRadixPower(E,this.k+1);
var C=epg.security.biModuloByRadixPower(H,this.k+1);
var I=epg.security.biMultiply(D,this.modulus);
var B=epg.security.biModuloByRadixPower(I,this.k+1);
var A=epg.security.biSubtract(C,B);
if(A.isNeg){A=epg.security.biAdd(A,this.bkplus1)
}var F=epg.security.biCompare(A,this.modulus)>=0;
while(F){A=epg.security.biSubtract(A,this.modulus);
F=epg.security.biCompare(A,this.modulus)>=0
}return A
},biModuloByRadixPower:function(B,C){var A=new epg.security.BigInt();
epg.security.arrayCopy(B.digits,0,A.digits,0,C);
return A
},biDivideByRadixPower:function(B,C){var A=new epg.security.BigInt();
epg.security.arrayCopy(B.digits,C,A.digits,0,A.digits.length-C);
return A
},BarrettMu_powMod:function(B,E){var A=new epg.security.BigInt();
A.digits[0]=1;
var C=B;
var D=E;
while(true){if((D.digits[0]&1)!=0){A=this.multiplyMod(A,C)
}D=epg.security.biShiftRight(D,1);
if(D.digits[0]==0&&epg.security.biHighIndex(D)==0){break
}C=this.multiplyMod(C,C)
}return A
},biDivide:function(A,B){return epg.security.biDivideModulo(A,B)[0]
},biNumBits:function(C){var E=epg.security.biHighIndex(C);
var D=C.digits[E];
var B=(E+1)*bitsPerDigit;
var A;
for(A=B;
A>B-bitsPerDigit;
--A){if((D&32768)!=0){break
}D<<=1
}return A
},biMultiplyByRadixPower:function(B,C){var A=new epg.security.BigInt();
epg.security.arrayCopy(B.digits,0,A.digits,C,A.digits.length-C);
return A
},biMultiply:function(G,F){var J=new epg.security.BigInt();
var E;
var B=epg.security.biHighIndex(G);
var I=epg.security.biHighIndex(F);
var H,A,C;
for(var D=0;
D<=I;
++D){E=0;
C=D;
for(j=0;
j<=B;
++j,++C){A=J.digits[C]+G.digits[j]*F.digits[D]+E;
J.digits[C]=A&maxDigitVal;
E=A>>>biRadixBits
}J.digits[D+B+1]=E
}J.isNeg=G.isNeg!=F.isNeg;
return J
},biMultiplyDigit:function(A,F){var E,D,C;
result=new epg.security.BigInt();
E=epg.security.biHighIndex(A);
D=0;
for(var B=0;
B<=E;
++B){C=result.digits[B]+A.digits[B]*F+D;
result.digits[B]=C&maxDigitVal;
D=C>>>biRadixBits
}result.digits[1+E]=D;
return result
},biAdd:function(B,F){var A;
if(B.isNeg!=F.isNeg){F.isNeg=!F.isNeg;
A=epg.security.biSubtract(B,F);
F.isNeg=!F.isNeg
}else{A=new BigInt();
var E=0;
var D;
for(var C=0;
C<B.digits.length;
++C){D=B.digits[C]+F.digits[C]+E;
A.digits[C]=D%biRadix;
E=Number(D>=biRadix)
}A.isNeg=B.isNeg
}return A
},biSubtract:function(B,F){var A;
if(B.isNeg!=F.isNeg){F.isNeg=!F.isNeg;
A=epg.security.biAdd(B,F);
F.isNeg=!F.isNeg
}else{A=new epg.security.BigInt();
var E,D;
D=0;
for(var C=0;
C<B.digits.length;
++C){E=B.digits[C]-F.digits[C]+D;
A.digits[C]=E%biRadix;
if(A.digits[C]<0){A.digits[C]+=biRadix
}D=0-Number(E<0)
}if(D==-1){D=0;
for(var C=0;
C<B.digits.length;
++C){E=0-A.digits[C]+D;
A.digits[C]=E%biRadix;
if(A.digits[C]<0){A.digits[C]+=biRadix
}D=0-Number(E<0)
}A.isNeg=!B.isNeg
}else{A.isNeg=B.isNeg
}}return A
},biCompare:function(A,C){if(A.isNeg!=C.isNeg){return 1-2*Number(A.isNeg)
}for(var B=A.digits.length-1;
B>=0;
--B){if(A.digits[B]!=C.digits[B]){if(A.isNeg){return 1-2*Number(A.digits[B]>C.digits[B])
}else{return 1-2*Number(A.digits[B]<C.digits[B])
}}}return 0
},biShiftLeft:function(B,H){var D=Math.floor(H/bitsPerDigit);
var A=new epg.security.BigInt();
epg.security.arrayCopy(B.digits,0,A.digits,D,A.digits.length-D);
var G=H%bitsPerDigit;
var C=bitsPerDigit-G;
for(var E=A.digits.length-1,F=E-1;
E>0;
--E,--F){A.digits[E]=((A.digits[E]<<G)&maxDigitVal)|((A.digits[F]&epg.security.highBitMasks[G])>>>(C))
}A.digits[0]=((A.digits[E]<<G)&maxDigitVal);
A.isNeg=B.isNeg;
return A
},arrayCopy:function(E,H,C,G,F){var A=Math.min(H+F,E.length);
for(var D=H,B=G;
D<A;
++D,++B){C[B]=E[D]
}},biDivideModulo:function(F,E){var A=epg.security.biNumBits(F);
var D=epg.security.biNumBits(E);
var C=E.isNeg;
var K,J;
if(A<D){if(F.isNeg){K=epg.security.biCopy(bigOne);
K.isNeg=!E.isNeg;
F.isNeg=false;
E.isNeg=false;
J=epg.security.biSubtract(E,F);
F.isNeg=true;
E.isNeg=C
}else{K=new epg.security.BigInt();
J=epg.security.biCopy(F)
}return new Array(K,J)
}K=new epg.security.BigInt();
J=F;
var H=Math.ceil(D/bitsPerDigit)-1;
var G=0;
while(E.digits[H]<biHalfRadix){E=epg.security.biShiftLeft(E,1);
++G;
++D;
H=Math.ceil(D/bitsPerDigit)-1
}J=epg.security.biShiftLeft(J,G);
A+=G;
var N=Math.ceil(A/bitsPerDigit)-1;
var S=epg.security.biMultiplyByRadixPower(E,N-H);
while(epg.security.biCompare(J,S)!=-1){++K.digits[N-H];
J=epg.security.biSubtract(J,S)
}for(var Q=N;
Q>H;
--Q){var I=(Q>=J.digits.length)?0:J.digits[Q];
var R=(Q-1>=J.digits.length)?0:J.digits[Q-1];
var P=(Q-2>=J.digits.length)?0:J.digits[Q-2];
var O=(H>=E.digits.length)?0:E.digits[H];
var B=(H-1>=E.digits.length)?0:E.digits[H-1];
if(I==O){K.digits[Q-H-1]=maxDigitVal
}else{K.digits[Q-H-1]=Math.floor((I*biRadix+R)/O)
}var M=K.digits[Q-H-1]*((O*biRadix)+B);
var L=(I*biRadixSquared)+((R*biRadix)+P);
while(M>L){--K.digits[Q-H-1];
M=K.digits[Q-H-1]*((O*biRadix)|B);
L=(I*biRadix*biRadix)+((R*biRadix)+P)
}S=epg.security.biMultiplyByRadixPower(E,Q-H-1);
J=epg.security.biSubtract(J,epg.security.biMultiplyDigit(S,K.digits[Q-H-1]));
if(J.isNeg){J=epg.security.biAdd(J,S);
--K.digits[Q-H-1]
}}J=epg.security.biShiftRight(J,G);
K.isNeg=F.isNeg!=C;
if(F.isNeg){if(C){K=epg.security.biAdd(K,bigOne)
}else{K=epg.security.biSubtract(K,bigOne)
}E=epg.security.biShiftRight(E,G);
J=epg.security.biSubtract(E,J)
}if(J.digits[0]==0&&epg.security.biHighIndex(J)==0){J.isNeg=false
}return new Array(K,J)
},biShiftRight:function(B,H){var C=Math.floor(H/bitsPerDigit);
var A=new epg.security.BigInt();
epg.security.arrayCopy(B.digits,C,A.digits,0,B.digits.length-C);
var F=H%bitsPerDigit;
var G=bitsPerDigit-F;
for(var D=0,E=D+1;
D<A.digits.length-1;
++D,++E){A.digits[D]=(A.digits[D]>>>F)|((A.digits[E]&epg.security.lowBitMasks[F])<<G)
}A.digits[A.digits.length-1]>>>=F;
A.isNeg=B.isNeg;
return A
},BarrettMu_multiplyMod:function(A,C){var B=epg.security.biMultiply(A,C);
return this.modulo(B)
},biCopy:function(B){var A=new epg.security.BigInt(true);
A.digits=B.digits.slice(0);
A.isNeg=B.isNeg;
return A
},biHighIndex:function(B){var A=B.digits.length-1;
while(A>0&&B.digits[A]==0){--A
}return A
},biFromHex:function(E){var B=new epg.security.BigInt();
var A=E.length;
for(var D=A,C=0;
D>0;
D-=4,++C){B.digits[C]=epg.security.hexToDigit(E.substr(Math.max(D-4,0),Math.min(D,4)))
}return B
},BigInt:function(A){if(typeof A=="boolean"&&A==true){this.digits=null
}else{this.digits=epg.security.ZERO_ARRAY.slice(0)
}this.isNeg=false
},hexToDigit:function(D){var B=0;
var A=Math.min(D.length,4);
for(var C=0;
C<A;
++C){B<<=4;
B|=epg.security.charToHex(D.charCodeAt(C))
}return B
},charToHex:function(H){var C=48;
var B=C+9;
var D=97;
var G=D+25;
var F=65;
var E=65+25;
var A;
if(H>=C&&H<=B){A=H-C
}else{if(H>=F&&H<=E){A=10+H-F
}else{if(H>=D&&H<=G){A=10+H-D
}else{A=0
}}}return A
},biFromNumber:function(C){var A=new epg.security.BigInt();
A.isNeg=C<0;
C=Math.abs(C);
var B=0;
while(C>0){A.digits[B++]=C&maxDigitVal;
C=Math.floor(C/biRadix)
}return A
},reverseStr:function(C){var A="";
for(var B=C.length-1;
B>-1;
--B){A+=C.charAt(B)
}return A
},highBitMasks:[0,32768,49152,57344,61440,63488,64512,65024,65280,65408,65472,65504,65520,65528,65532,65534,65535],lowBitMasks:[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],hexToChar:["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],ZERO_ARRAY:[]};
var biRadixBase=2;
var biRadixBits=16;
var bitsPerDigit=biRadixBits;
var biRadix=1<<16;
var biHalfRadix=biRadix>>>1;
var biRadixSquared=biRadix*biRadix;
var maxDigitVal=biRadix-1;
var maxInteger=9999999999999998;
var maxDigits;
var bigZero,bigOne;
var dpl10=15;
var lr10=epg.security.biFromNumber(1000000000000000);
var hexatrigesimalToChar=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");epg.regions={getProviderById:function(C){if(!epg.Authentication.channelPrefs.properties.packageInfo.provider){throw"providers undefined"
}var A=epg.Authentication.channelPrefs.properties.packageInfo.provider.length;
for(var B=0;
B<A;
B++){if(epg.Authentication.channelPrefs.properties.packageInfo.provider[B].id==C){return epg.Authentication.channelPrefs.properties.packageInfo.provider[B]
}}throw false
},getRegions:function(){try{return this.getProviderById(0).regions.region
}catch(A){switch(A){case"providers undefined":return false
}}},setCurrentRegion:function(B){epg.data.selectedRegion=B.name;
this.setRefreshRegion();
epg.ui.modalPane.close();
epg.Authentication.channelPrefs.properties.iCurrentRegion=B.code;
var A={region:epg.Authentication.channelPrefs.properties.iCurrentRegion};
epg.data.UserData.saveData("epg_channelPrefs",A);
epg.filtering.resetFilteringParameters();
epg.list.resetFilters();
epg.Authentication.channelPrefs.reload(A,true)
},setRefreshRegion:function(){jQuery("#epg_region_selector").html(epg.data.selectedRegion)
},getCurrentRegion:function(){return epg.data.selectedRegion
},displayRegions:function(){if(!this.getRegions()){epg.ui.modalPane.displaySuper(epg.regions.renderRegions,true);
epg.tools.doAjax({url:epg.config.fileChannelPrefs,data:{},type:"get",dataType:"json",success:function(A){epg.Authentication.channelPrefs.processUserPackageData(A);
jQuery("#"+epg.config.eModalPane).removeClass("epg_loading")
}})
}else{epg.ui.modalPane.displaySuper(epg.regions.renderRegions)
}jQuery("#"+epg.config.eModalPane).addClass("epg_regions_bubble")
},renderRegions:function(B){var H={};
H.sNodeType=["div"];
H.aClasses=["regions"];
H.oContents=[{sNodeType:["h4"],oContents:["Choose your Region"]}];
var G=epg.regions.getRegions();
var A=G.length;
var F=Math.floor(A/3)+1;
for(var C=0;
C<A;
C++){if(C%F==0){var E={};
E.sNodeType=["ul"];
E.oContents=[];
H.oContents.push(E)
}var D={};
D.sNodeType=["li","a"];
D.aClasses=["regionPETE"];
D.oContents=[G[C].name];
if(G[C].name==epg.data.selectedRegion){D.aClasses.push("selected")
}(function(I){D.aBehaviours=[{iNodeNo:1,sEvent:"click",fCallBack:function(){epg.regions.setCurrentRegion(I)
}}]
})(G[C]);
E.oContents.push(D)
}eContents=epg.tools.generateDOM(H);
B.appendChild(eContents,false)
}};
