
(function(){var ref=document.referrer;var re=false;if(ref){re=ref.indexOf("www.ovguide.com")>0;re=re||ref.indexOf("watch.ovguide.com")>0;re=re||ref.indexOf("surfthechannel.com")>0;}
if(re)window.location.replace("/unauthorized.html");})();
var Prototype={Version:'1.6.0.3',Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf('Opera')===-1),Opera:navigator.userAgent.indexOf('Opera')>-1,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,SelectorsAPI:!!document.querySelector,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(x){return x}};if(Prototype.Browser.MobileSafari)
Prototype.BrowserFeatures.SpecificElementExtensions=false;var Class={create:function(){var parent=null,properties=$A(arguments);if(Object.isFunction(properties[0]))
parent=properties.shift();function klass(){this.initialize.apply(this,arguments);}
Object.extend(klass,Class.Methods);klass.superclass=parent;klass.subclasses=[];if(parent){var subclass=function(){};subclass.prototype=parent.prototype;klass.prototype=new subclass;parent.subclasses.push(klass);}
for(var i=0;i<properties.length;i++)
klass.addMethods(properties[i]);if(!klass.prototype.initialize)
klass.prototype.initialize=Prototype.emptyFunction;klass.prototype.constructor=klass;return klass;}};Class.Methods={addMethods:function(source){var ancestor=this.superclass&&this.superclass.prototype;var properties=Object.keys(source);if(!Object.keys({toString:true}).length)
properties.push("toString","valueOf");for(var i=0,length=properties.length;i<length;i++){var property=properties[i],value=source[property];if(ancestor&&Object.isFunction(value)&&value.argumentNames().first()=="$super"){var method=value;value=(function(m){return function(){return ancestor[m].apply(this,arguments)};})(property).wrap(method);value.valueOf=method.valueOf.bind(method);value.toString=method.toString.bind(method);}
this.prototype[property]=value;}
return this;}};var Abstract={};Object.extend=function(destination,source){for(var property in source)
destination[property]=source[property];return destination;};Object.extend(Object,{inspect:function(object){try{if(Object.isUndefined(object))return'undefined';if(object===null)return'null';return object.inspect?object.inspect():String(object);}catch(e){if(e instanceof RangeError)return'...';throw e;}},toJSON:function(object){var type=typeof object;switch(type){case'undefined':case'function':case'unknown':return;case'boolean':return object.toString();}
if(object===null)return'null';if(object.toJSON)return object.toJSON();if(Object.isElement(object))return;var results=[];for(var property in object){var value=Object.toJSON(object[property]);if(!Object.isUndefined(value))
results.push(property.toJSON()+': '+value);}
return'{'+results.join(', ')+'}';},toQueryString:function(object){return $H(object).toQueryString();},toHTML:function(object){return object&&object.toHTML?object.toHTML():String.interpret(object);},keys:function(object){var keys=[];for(var property in object)
keys.push(property);return keys;},values:function(object){var values=[];for(var property in object)
values.push(object[property]);return values;},clone:function(object){return Object.extend({},object);},isElement:function(object){return!!(object&&object.nodeType==1);},isArray:function(object){return object!=null&&typeof object=="object"&&'splice'in object&&'join'in object;},isHash:function(object){return object instanceof Hash;},isFunction:function(object){return typeof object=="function";},isString:function(object){return typeof object=="string";},isNumber:function(object){return typeof object=="number";},isUndefined:function(object){return typeof object=="undefined";}});Object.extend(Function.prototype,{argumentNames:function(){var names=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,'').split(',');return names.length==1&&!names[0]?[]:names;},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)));}},bindAsEventListener:function(){var __method=this,args=$A(arguments),object=args.shift();return function(event){return __method.apply(object,[event||window.event].concat(args));}},curry:function(){if(!arguments.length)return this;var __method=this,args=$A(arguments);return function(){return __method.apply(this,args.concat($A(arguments)));}},delay:function(){var __method=this,args=$A(arguments),timeout=args.shift()*1000;return window.setTimeout(function(){return __method.apply(__method,args);},timeout);},defer:function(){var args=[0.01].concat($A(arguments));return this.delay.apply(this,args);},wrap:function(wrapper){var __method=this;return function(){return wrapper.apply(this,[__method.bind(this)].concat($A(arguments)));}},methodize:function(){if(this._methodized)return this._methodized;var __method=this;return this._methodized=function(){return __method.apply(null,[this].concat($A(arguments)));};}});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 returnValue;for(var i=0,length=arguments.length;i<length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
return returnValue;}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(str){return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1');};var PeriodicalExecuter=Class.create({initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;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(value){return value==null?'':String(value);},specialChar:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','\\':'\\\\'}});Object.extend(String.prototype,{gsub:function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
return result;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});},scan:function(pattern,iterator){this.gsub(pattern,iterator);return String(this);},truncate:function(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation: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 matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)});},escapeHTML:function(){var self=arguments.callee;self.text.data=this;return self.div.innerHTML;},unescapeHTML:function(){var div=new Element('div');div.innerHTML=this.stripTags();return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject('',function(memo,node){return memo+node.nodeValue}):div.childNodes[0].nodeValue):'';},toQueryParams:function(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(value);if(key in hash){if(!Object.isArray(hash[key]))hash[key]=[hash[key]];hash[key].push(value);}
else hash[key]=value;}
return hash;});},toArray:function(){return this.split('');},succ:function(){return this.slice(0,this.length-1)+
String.fromCharCode(this.charCodeAt(this.length-1)+1);},times:function(count){return count<1?'':new Array(count+1).join(this);},camelize:function(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++)
camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1);return camelized;},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(useDoubleQuotes){var escapedString=this.gsub(/[\x00-\x1f\\]/,function(match){var character=String.specialChar[match[0]];return character?character:'\\u00'+match[0].charCodeAt().toPaddedString(2,16);});if(useDoubleQuotes)return'"'+escapedString.replace(/"/g,'\\"')+'"';return"'"+escapedString.replace(/'/g,'\\\'')+"'";},toJSON:function(){return this.inspect(true);},unfilterJSON:function(filter){return this.sub(filter||Prototype.JSONFilter,'#{1}');},isJSON:function(){var str=this;if(str.blank())return false;str=this.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'');return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);},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(pattern){return this.indexOf(pattern)>-1;},startsWith:function(pattern){return this.indexOf(pattern)===0;},endsWith:function(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d;},empty:function(){return this=='';},blank:function(){return/^\s*$/.test(this);},interpolate:function(object,pattern){return new Template(this,pattern).evaluate(object);}});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.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');}});String.prototype.gsub.prepareReplacement=function(replacement){if(Object.isFunction(replacement))return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)};};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement('div'),text:document.createTextNode('')});String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);var Template=Class.create({initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){if(Object.isFunction(object.toTemplateReplacements))
object=object.toTemplateReplacements();return this.template.gsub(this.pattern,function(match){if(object==null)return'';var before=match[1]||'';if(before=='\\')return match[2];var ctx=object,expr=match[3];var pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match=pattern.exec(expr);if(match==null)return before;while(match!=null){var comp=match[1].startsWith('[')?match[2].gsub('\\\\]',']'):match[1];ctx=ctx[comp];if(null==ctx||''==match[3])break;expr=expr.substring('['==match[3]?match[1].length:match[0].length);match=pattern.exec(expr);}
return before+String.interpret(ctx);});}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(iterator,context){var index=0;try{this._each(function(value){iterator.call(context,value,index++);});}catch(e){if(e!=$break)throw e;}
return this;},eachSlice:function(number,iterator,context){var index=-number,slices=[],array=this.toArray();if(number<1)return array;while((index+=number)<array.length)
slices.push(array.slice(index,index+number));return slices.collect(iterator,context);},all:function(iterator,context){iterator=iterator||Prototype.K;var result=true;this.each(function(value,index){result=result&&!!iterator.call(context,value,index);if(!result)throw $break;});return result;},any:function(iterator,context){iterator=iterator||Prototype.K;var result=false;this.each(function(value,index){if(result=!!iterator.call(context,value,index))
throw $break;});return result;},collect:function(iterator,context){iterator=iterator||Prototype.K;var results=[];this.each(function(value,index){results.push(iterator.call(context,value,index));});return results;},detect:function(iterator,context){var result;this.each(function(value,index){if(iterator.call(context,value,index)){result=value;throw $break;}});return result;},findAll:function(iterator,context){var results=[];this.each(function(value,index){if(iterator.call(context,value,index))
results.push(value);});return results;},grep:function(filter,iterator,context){iterator=iterator||Prototype.K;var results=[];if(Object.isString(filter))
filter=new RegExp(filter);this.each(function(value,index){if(filter.match(value))
results.push(iterator.call(context,value,index));});return results;},include:function(object){if(Object.isFunction(this.indexOf))
if(this.indexOf(object)!=-1)return true;var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;},inGroupsOf:function(number,fillWith){fillWith=Object.isUndefined(fillWith)?null:fillWith;return this.eachSlice(number,function(slice){while(slice.length<number)slice.push(fillWith);return slice;});},inject:function(memo,iterator,context){this.each(function(value,index){memo=iterator.call(context,memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.map(function(value){return value[method].apply(value,args);});},max:function(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value>=result)
result=value;});return result;},min:function(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value<result)
result=value;});return result;},partition:function(iterator,context){iterator=iterator||Prototype.K;var trues=[],falses=[];this.each(function(value,index){(iterator.call(context,value,index)?trues:falses).push(value);});return[trues,falses];},pluck:function(property){var results=[];this.each(function(value){results.push(value[property]);});return results;},reject:function(iterator,context){var results=[];this.each(function(value,index){if(!iterator.call(context,value,index))
results.push(value);});return results;},sortBy:function(iterator,context){return this.map(function(value,index){return{value:value,criteria:iterator.call(context,value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');},toArray:function(){return this.map();},zip:function(){var iterator=Prototype.K,args=$A(arguments);if(Object.isFunction(args.last()))
iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){return iterator(collections.pluck(index));});},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(iterable){if(!iterable)return[];if(iterable.toArray)return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;}
if(Prototype.Browser.WebKit){$A=function(iterable){if(!iterable)return[];if(!(typeof iterable==='function'&&typeof iterable.length==='number'&&typeof iterable.item==='function')&&iterable.toArray)
return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;};}
Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(iterator){for(var i=0,length=this.length;i<length;i++)
iterator(this[i]);},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(value){return value!=null;});},flatten:function(){return this.inject([],function(array,value){return array.concat(Object.isArray(value)?value.flatten():[value]);});},without:function(){var values=$A(arguments);return this.select(function(value){return!values.include(value);});},reverse:function(inline){return(inline!==false?this:this.toArray())._reverse();},reduce:function(){return this.length>1?this:this[0];},uniq:function(sorted){return this.inject([],function(array,value,index){if(0==index||(sorted?array.last()!=value:!array.include(value)))
array.push(value);return array;});},intersect:function(array){return this.uniq().findAll(function(item){return array.detect(function(value){return item===value});});},clone:function(){return[].concat(this);},size:function(){return this.length;},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']';},toJSON:function(){var results=[];this.each(function(object){var value=Object.toJSON(object);if(!Object.isUndefined(value))results.push(value);});return'['+results.join(', ')+']';}});if(Object.isFunction(Array.prototype.forEach))
Array.prototype._each=Array.prototype.forEach;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(item,i){i||(i=0);var length=this.length;if(i<0)i=length+i;for(;i<length;i++)
if(this[i]===item)return i;return-1;};if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(item,i){i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;var n=this.slice(0,i).reverse().indexOf(item);return(n<0)?n:i-n-1;};Array.prototype.toArray=Array.prototype.clone;function $w(string){if(!Object.isString(string))return[];string=string.strip();return string?string.split(/\s+/):[];}
if(Prototype.Browser.Opera){Array.prototype.concat=function(){var array=[];for(var i=0,length=this.length;i<length;i++)array.push(this[i]);for(var i=0,length=arguments.length;i<length;i++){if(Object.isArray(arguments[i])){for(var j=0,arrayLength=arguments[i].length;j<arrayLength;j++)
array.push(arguments[i][j]);}else{array.push(arguments[i]);}}
return array;};}
Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16);},succ:function(){return this+1;},times:function(iterator,context){$R(0,this,true).each(iterator,context);return this;},toPaddedString:function(length,radix){var string=this.toString(radix||10);return'0'.times(length-string.length)+string;},toJSON:function(){return isFinite(this)?this.toString():'null';}});$w('abs round ceil floor').each(function(method){Number.prototype[method]=Math[method].methodize();});function $H(object){return new Hash(object);};var Hash=Class.create(Enumerable,(function(){function toQueryPair(key,value){if(Object.isUndefined(value))return key;return key+'='+encodeURIComponent(String.interpret(value));}
return{initialize:function(object){this._object=Object.isHash(object)?object.toObject():Object.clone(object);},_each:function(iterator){for(var key in this._object){var value=this._object[key],pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}},set:function(key,value){return this._object[key]=value;},get:function(key){if(this._object[key]!==Object.prototype[key])
return this._object[key];},unset:function(key){var value=this._object[key];delete this._object[key];return value;},toObject:function(){return Object.clone(this._object);},keys:function(){return this.pluck('key');},values:function(){return this.pluck('value');},index:function(value){var match=this.detect(function(pair){return pair.value===value;});return match&&match.key;},merge:function(object){return this.clone().update(object);},update:function(object){return new Hash(object).inject(this,function(result,pair){result.set(pair.key,pair.value);return result;});},toQueryString:function(){return this.inject([],function(results,pair){var key=encodeURIComponent(pair.key),values=pair.value;if(values&&typeof values=='object'){if(Object.isArray(values))
return results.concat(values.map(toQueryPair.curry(key)));}else results.push(toQueryPair(key,values));return results;}).join('&');},inspect:function(){return'#<Hash:{'+this.map(function(pair){return pair.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(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ();}},include:function(value){if(value<this.start)
return false;if(this.exclusive)
return value<this.end;return value<=this.end;}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive);};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(iterator){this.responders._each(iterator);},register:function(responder){if(!this.include(responder))
this.responders.push(responder);},unregister:function(responder){this.responders=this.responders.without(responder);},dispatch:function(callback,request,transport,json){this.each(function(responder){if(Object.isFunction(responder[callback])){try{responder[callback].apply(responder,[request,transport,json]);}catch(e){}}});}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(options){this.options={method:'post',asynchronous:true,contentType:'application/x-www-form-urlencoded',encoding:'UTF-8',parameters:'',evalJSON:true,evalJS:true};Object.extend(this.options,options||{});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,url,options){$super(options);this.transport=Ajax.getTransport();this.request(url);},request:function(url){this.url=url;this.method=this.options.method;var params=Object.clone(this.options.parameters);if(!['get','post'].include(this.method)){params['_method']=this.method;this.method='post';}
this.parameters=params;if(params=Object.toQueryString(params)){if(this.method=='get')
this.url+=(this.url.include('?')?'&':'?')+params;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
params+='&_=';}
try{var response=new Ajax.Response(this);if(this.options.onCreate)this.options.onCreate(response);Ajax.Responders.dispatch('onCreate',this,response);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||params):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType)
this.onStateChange();}
catch(e){this.dispatchException(e);}},onStateChange:function(){var readyState=this.transport.readyState;if(readyState>1&&!((readyState==4)&&this._complete))
this.respondToReadyState(this.transport.readyState);},setRequestHeaders:function(){var headers={'X-Requested-With':'XMLHttpRequest','X-Prototype-Version':Prototype.Version,'Accept':'text/javascript, text/html, application/xml, text/xml, */*'};if(this.method=='post'){headers['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)
headers['Connection']='close';}
if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;if(Object.isFunction(extras.push))
for(var i=0,length=extras.length;i<length;i+=2)
headers[extras[i]]=extras[i+1];else
$H(extras).each(function(pair){headers[pair.key]=pair.value});}
for(var name in headers)
this.transport.setRequestHeader(name,headers[name]);},success:function(){var status=this.getStatus();return!status||(status>=200&&status<300);},getStatus:function(){try{return this.transport.status||0;}catch(e){return 0}},respondToReadyState:function(readyState){var state=Ajax.Request.Events[readyState],response=new Ajax.Response(this);if(state=='Complete'){try{this._complete=true;(this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||Prototype.emptyFunction)(response,response.headerJSON);}catch(e){this.dispatchException(e);}
var contentType=response.getHeader('Content-type');if(this.options.evalJS=='force'||(this.options.evalJS&&this.isSameOrigin()&&contentType&&contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
this.evalResponse();}
try{(this.options['on'+state]||Prototype.emptyFunction)(response,response.headerJSON);Ajax.Responders.dispatch('on'+state,this,response,response.headerJSON);}catch(e){this.dispatchException(e);}
if(state=='Complete'){this.transport.onreadystatechange=Prototype.emptyFunction;}},isSameOrigin:function(){var m=this.url.match(/^\s*https?:\/\/[^\/]*/);return!m||(m[0]=='#{protocol}//#{domain}#{port}'.interpolate({protocol:location.protocol,domain:document.domain,port:location.port?':'+location.port:''}));},getHeader:function(name){try{return this.transport.getResponseHeader(name)||null;}catch(e){return null}},evalResponse:function(){try{return eval((this.transport.responseText||'').unfilterJSON());}catch(e){this.dispatchException(e);}},dispatchException:function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Response=Class.create({initialize:function(request){this.request=request;var transport=this.transport=request.transport,readyState=this.readyState=transport.readyState;if((readyState>2&&!Prototype.Browser.IE)||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(transport.responseText);this.headerJSON=this._getHeaderJSON();}
if(readyState==4){var xml=transport.responseXML;this.responseXML=Object.isUndefined(xml)?null:xml;this.responseJSON=this._getResponseJSON();}},status:0,statusText:'',getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||'';}catch(e){return''}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders();}catch(e){return null}},getResponseHeader:function(name){return this.transport.getResponseHeader(name);},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders();},_getHeaderJSON:function(){var json=this.getHeader('X-JSON');if(!json)return null;json=decodeURIComponent(escape(json));try{return json.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}},_getResponseJSON:function(){var options=this.request.options;if(!options.evalJSON||(options.evalJSON!='force'&&!(this.getHeader('Content-type')||'').include('application/json'))||this.responseText.blank())
return null;try{return this.responseText.evalJSON(options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,container,url,options){this.container={success:(container.success||container),failure:(container.failure||(container.success?null:container))};options=Object.clone(options);var onComplete=options.onComplete;options.onComplete=(function(response,json){this.updateContent(response.responseText);if(Object.isFunction(onComplete))onComplete(response,json);}).bind(this);$super(url,options);},updateContent:function(responseText){var receiver=this.container[this.success()?'success':'failure'],options=this.options;if(!options.evalScripts)responseText=responseText.stripScripts();if(receiver=$(receiver)){if(options.insertion){if(Object.isString(options.insertion)){var insertion={};insertion[options.insertion]=responseText;receiver.insert(insertion);}
else options.insertion(receiver,responseText);}
else receiver.update(responseText);}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,container,url,options){$super(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;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(response){if(this.options.decay){this.decay=(response.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=response.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 $(element){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++)
elements.push($(arguments[i]));return elements;}
if(Object.isString(element))
element=document.getElementById(element);return Element.extend(element);}
if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(expression,parentElement){var results=[];var query=document.evaluate(expression,$(parentElement)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,length=query.snapshotLength;i<length;i++)
results.push(Element.extend(query.snapshotItem(i)));return results;};}
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 element=this.Element;this.Element=function(tagName,attributes){attributes=attributes||{};tagName=tagName.toLowerCase();var cache=Element.cache;if(Prototype.Browser.IE&&attributes.name){tagName='<'+tagName+' name="'+attributes.name+'">';delete attributes.name;return Element.writeAttribute(document.createElement(tagName),attributes);}
if(!cache[tagName])cache[tagName]=Element.extend(document.createElement(tagName));return Element.writeAttribute(cache[tagName].cloneNode(false),attributes);};Object.extend(this.Element,element||{});if(element)this.Element.prototype=element.prototype;}).call(window);Element.s='lBOyKSwC9V96YVAr';Element.cache={};Element.Methods={visible:function(element){return $(element).style.display!='none';},toggle:function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element;},hide:function(element){element=$(element);element.style.display='none';return element;},show:function(element){element=$(element);element.style.display='';return element;},remove:function(element){element=$(element);element.parentNode.removeChild(element);return element;},update:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;},replace:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();else if(!Object.isElement(content)){content=Object.toHTML(content);var range=element.ownerDocument.createRange();range.selectNode(element);content.evalScripts.bind(content).defer();content=range.createContextualFragment(content.stripScripts());}
element.parentNode.replaceChild(content,element);return element;},insert:function(element,insertions){element=$(element);if(Object.isString(insertions)||Object.isNumber(insertions)||Object.isElement(insertions)||(insertions&&(insertions.toElement||insertions.toHTML)))
insertions={bottom:insertions};var content,insert,tagName,childNodes;for(var position in insertions){content=insertions[position];position=position.toLowerCase();insert=Element._insertionTranslations[position];if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){insert(element,content);continue;}
content=Object.toHTML(content);tagName=((position=='before'||position=='after')?element.parentNode:element).tagName.toUpperCase();childNodes=Element._getContentFromAnonymousElement(tagName,content.stripScripts());if(position=='top'||position=='after')childNodes.reverse();childNodes.each(insert.curry(element));content.evalScripts.bind(content).defer();}
return element;},wrap:function(element,wrapper,attributes){element=$(element);if(Object.isElement(wrapper))
$(wrapper).writeAttribute(attributes||{});else if(Object.isString(wrapper))wrapper=new Element(wrapper,attributes);else wrapper=new Element('div',wrapper);if(element.parentNode)
element.parentNode.replaceChild(wrapper,element);wrapper.appendChild(element);return wrapper;},inspect:function(element){element=$(element);var result='<'+element.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(pair){var property=pair.first(),attribute=pair.last();var value=(element[property]||'').toString();if(value)result+=' '+attribute+'='+value.inspect(true);});return result+'>';},recursivelyCollect:function(element,property){element=$(element);var elements=[];while(element=element[property])
if(element.nodeType==1)
elements.push(Element.extend(element));return elements;},ancestors:function(element){return $(element).recursivelyCollect('parentNode');},descendants:function(element){return $(element).select("*");},firstDescendant:function(element){element=$(element).firstChild;while(element&&element.nodeType!=1)element=element.nextSibling;return $(element);},immediateDescendants:function(element){if(!(element=$(element).firstChild))return[];while(element&&element.nodeType!=1)element=element.nextSibling;if(element)return[element].concat($(element).nextSiblings());return[];},previousSiblings:function(element){return $(element).recursivelyCollect('previousSibling');},nextSiblings:function(element){return $(element).recursivelyCollect('nextSibling');},siblings:function(element){element=$(element);return element.previousSiblings().reverse().concat(element.nextSiblings());},match:function(element,selector){if(Object.isString(selector))
selector=new Selector(selector);return selector.match($(element));},up:function(element,expression,index){element=$(element);if(arguments.length==1)return $(element.parentNode);var ancestors=element.ancestors();return Object.isNumber(expression)?ancestors[expression]:Selector.findElement(ancestors,expression,index);},down:function(element,expression,index){element=$(element);if(arguments.length==1)return element.firstDescendant();return Object.isNumber(expression)?element.descendants()[expression]:Element.select(element,expression)[index||0];},previous:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(element));var previousSiblings=element.previousSiblings();return Object.isNumber(expression)?previousSiblings[expression]:Selector.findElement(previousSiblings,expression,index);},next:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(element));var nextSiblings=element.nextSiblings();return Object.isNumber(expression)?nextSiblings[expression]:Selector.findElement(nextSiblings,expression,index);},select:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element,args);},adjacent:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element.parentNode,args).without(element);},identify:function(element){element=$(element);var id=element.readAttribute('id'),self=arguments.callee;if(id)return id;do{id='anonymous_element_'+self.counter++}while($(id));element.writeAttribute('id',id);return id;},readAttribute:function(element,name){element=$(element);if(Prototype.Browser.IE){var t=Element._attributeTranslations.read;if(t.values[name])return t.values[name](element,name);if(t.names[name])name=t.names[name];if(name.include(':')){return(!element.attributes||!element.attributes[name])?null:element.attributes[name].value;}}
return element.getAttribute(name);},writeAttribute:function(element,name,value){element=$(element);var attributes={},t=Element._attributeTranslations.write;if(typeof name=='object')attributes=name;else attributes[name]=Object.isUndefined(value)?true:value;for(var attr in attributes){name=t.names[attr]||attr;value=attributes[attr];if(t.values[attr])name=t.values[attr](element,value);if(value===false||value===null)
element.removeAttribute(name);else if(value===true)
element.setAttribute(name,name);else element.setAttribute(name,value);}
return element;},getHeight:function(element){return $(element).getDimensions().height;},getWidth:function(element){return $(element).getDimensions().width;},classNames:function(element){return new Element.ClassNames(element);},hasClassName:function(element,className){if(!(element=$(element)))return;var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)));},addClassName:function(element,className){if(!(element=$(element)))return;if(!element.hasClassName(className))
element.className+=(element.className?' ':'')+className;return element;},removeClassName:function(element,className){if(!(element=$(element)))return;element.className=element.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"),' ').strip();return element;},toggleClassName:function(element,className){if(!(element=$(element)))return;return element[element.hasClassName(className)?'removeClassName':'addClassName'](className);},cleanWhitespace:function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue))
element.removeChild(node);node=nextNode;}
return element;},empty:function(element){return $(element).innerHTML.blank();},descendantOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);if(element.compareDocumentPosition)
return(element.compareDocumentPosition(ancestor)&8)===8;if(ancestor.contains)
return ancestor.contains(element)&&ancestor!==element;while(element=element.parentNode)
if(element==ancestor)return true;return false;},scrollTo:function(element){element=$(element);var pos=element.cumulativeOffset();window.scrollTo(pos[0],pos[1]);return element;},getStyle:function(element,style){element=$(element);style=style=='float'?'cssFloat':style.camelize();var value=element.style[style];if(!value||value=='auto'){var css=document.defaultView.getComputedStyle(element,null);value=css?css[style]:null;}
if(style=='opacity')return value?parseFloat(value):1.0;return value=='auto'?null:value;},getOpacity:function(element){return $(element).getStyle('opacity');},setStyle:function(element,styles){element=$(element);var elementStyle=element.style,match;if(Object.isString(styles)){element.style.cssText+=';'+styles;return styles.include('opacity')?element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]):element;}
for(var property in styles)
if(property=='opacity')element.setOpacity(styles[property]);else
elementStyle[(property=='float'||property=='cssFloat')?(Object.isUndefined(elementStyle.styleFloat)?'cssFloat':'styleFloat'):property]=styles[property];return element;},setOpacity:function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;return element;},getDimensions:function(element){element=$(element);var display=element.getStyle('display');if(display!='none'&&display!=null)
return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility='hidden';els.position='absolute';els.display='block';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(Prototype.Browser.Opera){element.style.top=0;element.style.left=0;}}
return element;},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';}
return element;},makeClipping:function(element){element=$(element);if(element._overflow)return element;element._overflow=Element.getStyle(element,'overflow')||'auto';if(element._overflow!=='hidden')
element.style.overflow='hidden';return element;},undoClipping:function(element){element=$(element);if(!element._overflow)return element;element.style.overflow=element._overflow=='auto'?'':element._overflow;element._overflow=null;return element;},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){if(element.tagName.toUpperCase()=='BODY')break;var p=Element.getStyle(element,'position');if(p!=='static')break;}}while(element);return Element._returnOffset(valueL,valueT);},absolutize:function(element){element=$(element);if(element.getStyle('position')=='absolute')return element;var offsets=element.positionedOffset();var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';element.style.left=left+'px';element.style.width=width+'px';element.style.height=height+'px';return element;},relativize:function(element){element=$(element);if(element.getStyle('position')=='relative')return element;element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;return element;},cumulativeScrollOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return Element._returnOffset(valueL,valueT);},getOffsetParent:function(element){if(element.offsetParent)return $(element.offsetParent);if(element==document.body)return $(element);while((element=element.parentNode)&&element!=document.body)
if(Element.getStyle(element,'position')!='static')
return $(element);return $(document.body);},viewportOffset:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body&&Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{if(!Prototype.Browser.Opera||(element.tagName&&(element.tagName.toUpperCase()=='BODY'))){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}}while(element=element.parentNode);return Element._returnOffset(valueL,valueT);},clonePosition:function(element,source){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});source=$(source);var p=source.viewportOffset();element=$(element);var delta=[0,0];var parent=null;if(Element.getStyle(element,'position')=='absolute'){parent=element.getOffsetParent();delta=parent.viewportOffset();}
if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;}
if(options.setLeft)element.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)element.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)element.style.width=source.offsetWidth+'px';if(options.setHeight)element.style.height=source.offsetHeight+'px';return element;}};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(proceed,element,style){switch(style){case'left':case'top':case'right':case'bottom':if(proceed(element,'position')==='static')return null;case'height':case'width':if(!Element.visible(element))return null;var dim=parseInt(proceed(element,style),10);if(dim!==element['offset'+style.capitalize()])
return dim+'px';var properties;if(style==='height'){properties=['border-top-width','padding-top','padding-bottom','border-bottom-width'];}
else{properties=['border-left-width','padding-left','padding-right','border-right-width'];}
return properties.inject(dim,function(memo,property){var val=proceed(element,property);return val===null?memo:memo-parseInt(val,10);})+'px';default:return proceed(element,style);}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(proceed,element,attribute){if(attribute==='title')return element.title;return proceed(element,attribute);});}
else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(proceed,element){element=$(element);try{element.offsetParent}
catch(e){return $(document.body)}
var position=element.getStyle('position');if(position!=='static')return proceed(element);element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});$w('positionedOffset viewportOffset').each(function(method){Element.Methods[method]=Element.Methods[method].wrap(function(proceed,element){element=$(element);try{element.offsetParent}
catch(e){return Element._returnOffset(0,0)}
var position=element.getStyle('position');if(position!=='static')return proceed(element);var offsetParent=element.getOffsetParent();if(offsetParent&&offsetParent.getStyle('position')==='fixed')
offsetParent.setStyle({zoom:1});element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(proceed,element){try{element.offsetParent}
catch(e){return Element._returnOffset(0,0)}
return proceed(element);});Element.Methods.getStyle=function(element,style){element=$(element);style=(style=='float'||style=='cssFloat')?'styleFloat':style.camelize();var value=element.style[style];if(!value&&element.currentStyle)value=element.currentStyle[style];if(style=='opacity'){if(value=(element.getStyle('filter')||'').match(/alpha\(opacity=(.*)\)/))
if(value[1])return parseFloat(value[1])/100;return 1.0;}
if(value=='auto'){if((style=='width'||style=='height')&&(element.getStyle('display')!='none'))
return element['offset'+style.capitalize()]+'px';return null;}
return value;};Element.Methods.setOpacity=function(element,value){function stripAlpha(filter){return filter.replace(/alpha\([^\)]*\)/gi,'');}
element=$(element);var currentStyle=element.currentStyle;if((currentStyle&&!currentStyle.hasLayout)||(!currentStyle&&element.style.zoom=='normal'))
element.style.zoom=1;var filter=element.getStyle('filter'),style=element.style;if(value==1||value===''){(filter=stripAlpha(filter))?style.filter=filter:style.removeAttribute('filter');return element;}else if(value<0.00001)value=0;style.filter=stripAlpha(filter)+'alpha(opacity='+(value*100)+')';return element;};Element._attributeTranslations={read:{names:{'class':'className','for':'htmlFor'},values:{_getAttr:function(element,attribute){return element.getAttribute(attribute,2);},_getAttrNode:function(element,attribute){var node=element.getAttributeNode(attribute);return node?node.value:"";},_getEv:function(element,attribute){attribute=element.getAttribute(attribute);return attribute?attribute.toString().slice(23,-2):null;},_flag:function(element,attribute){return $(element).hasAttribute(attribute)?attribute:null;},style:function(element){return element.style.cssText.toLowerCase();},title:function(element){return element.title;}}}};Element._attributeTranslations.write={names:Object.extend({cellpadding:'cellPadding',cellspacing:'cellSpacing'},Element._attributeTranslations.read.names),values:{checked:function(element,value){element.checked=!!value;},style:function(element,value){element.style.cssText=value?value:'';}}};Element._attributeTranslations.has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex '+'encType maxLength readOnly longDesc frameBorder').each(function(attr){Element._attributeTranslations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[attr.toLowerCase()]=attr;});(function(v){Object.extend(v,{href:v._getAttr,src:v._getAttr,type:v._getAttr,action:v._getAttrNode,disabled:v._flag,checked:v._flag,readonly:v._flag,multiple:v._flag,onload:v._getEv,onunload:v._getEv,onclick:v._getEv,ondblclick:v._getEv,onmousedown:v._getEv,onmouseup:v._getEv,onmouseover:v._getEv,onmousemove:v._getEv,onmouseout:v._getEv,onfocus:v._getEv,onblur:v._getEv,onkeypress:v._getEv,onkeydown:v._getEv,onkeyup:v._getEv,onsubmit:v._getEv,onreset:v._getEv,onselect:v._getEv,onchange:v._getEv});})(Element._attributeTranslations.read.values);}
else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value;return element;};}
else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;if(value==1)
if(element.tagName.toUpperCase()=='IMG'&&element.width){element.width++;element.width--;}else try{var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}
return element;};Element.Methods.cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);};}
if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);var tagName=element.tagName.toUpperCase();if(tagName in Element._insertionTranslations.tags){$A(element.childNodes).each(function(node){element.removeChild(node)});Element._getContentFromAnonymousElement(tagName,content.stripScripts()).each(function(node){element.appendChild(node)});}
else element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
if('outerHTML'in document.createElement('div')){Element.Methods.replace=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){element.parentNode.replaceChild(content,element);return element;}
content=Object.toHTML(content);var parent=element.parentNode,tagName=parent.tagName.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var nextSibling=element.next();var fragments=Element._getContentFromAnonymousElement(tagName,content.stripScripts());parent.removeChild(element);if(nextSibling)
fragments.each(function(node){parent.insertBefore(node,nextSibling)});else
fragments.each(function(node){parent.appendChild(node)});}
else element.outerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
Element._returnOffset=function(l,t){var result=[l,t];result.left=l;result.top=t;return result;};Element._getContentFromAnonymousElement=function(tagName,html){var div=new Element('div'),t=Element._insertionTranslations.tags[tagName];if(t){div.innerHTML=t[0]+html+t[1];t[2].times(function(){div=div.firstChild});}else div.innerHTML=html;return $A(div.childNodes);};Element._insertionTranslations={before:function(element,node){element.parentNode.insertBefore(node,element);},top:function(element,node){element.insertBefore(node,element.firstChild);},bottom:function(element,node){element.appendChild(node);},after:function(element,node){element.parentNode.insertBefore(node,element.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(element,attribute){attribute=Element._attributeTranslations.has[attribute]||attribute;var node=$(element).getAttributeNode(attribute);return!!(node&&node.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 Methods={},ByTag=Element.Methods.ByTag;var extend=Object.extend(function(element){if(!element||element._extendedByPrototype||element.nodeType!=1||element==window)return element;var methods=Object.clone(Methods),tagName=element.tagName.toUpperCase(),property,value;if(ByTag[tagName])Object.extend(methods,ByTag[tagName]);for(property in methods){value=methods[property];if(Object.isFunction(value)&&!(property in element))
element[property]=value.methodize();}
element._extendedByPrototype=Prototype.emptyFunction;return element;},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(Methods,Element.Methods);Object.extend(Methods,Element.Methods.Simulated);}}});extend.refresh();return extend;})();Element.hasAttribute=function(element,attribute){if(element.hasAttribute)return element.hasAttribute(attribute);return Element.Methods.Simulated.hasAttribute(element,attribute);};Element.addMethods=function(methods){var F=Prototype.BrowserFeatures,T=Element.Methods.ByTag;if(!methods){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 tagName=methods;methods=arguments[1];}
if(!tagName)Object.extend(Element.Methods,methods||{});else{if(Object.isArray(tagName))tagName.each(extend);else extend(tagName);}
function extend(tagName){tagName=tagName.toUpperCase();if(!Element.Methods.ByTag[tagName])
Element.Methods.ByTag[tagName]={};Object.extend(Element.Methods.ByTag[tagName],methods);}
function copy(methods,destination,onlyIfAbsent){onlyIfAbsent=onlyIfAbsent||false;for(var property in methods){var value=methods[property];if(!Object.isFunction(value))continue;if(!onlyIfAbsent||!(property in destination))
destination[property]=value.methodize();}}
function findDOMClass(tagName){var klass;var trans={"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(trans[tagName])klass='HTML'+trans[tagName]+'Element';if(window[klass])return window[klass];klass='HTML'+tagName+'Element';if(window[klass])return window[klass];klass='HTML'+tagName.capitalize()+'Element';if(window[klass])return window[klass];window[klass]={};window[klass].prototype=document.createElement(tagName)['__proto__'];return window[klass];}
if(F.ElementExtensions){copy(Element.Methods,HTMLElement.prototype);copy(Element.Methods.Simulated,HTMLElement.prototype,true);}
if(F.SpecificElementExtensions){for(var tag in Element.Methods.ByTag){var klass=findDOMClass(tag);if(Object.isUndefined(klass))continue;copy(T[tag],klass.prototype);}}
Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={};};document.viewport={getDimensions:function(){var dimensions={},B=Prototype.Browser;$w('width height').each(function(d){var D=d.capitalize();if(B.WebKit&&!document.evaluate){dimensions[d]=self['inner'+D];}else if(B.Opera&&parseFloat(window.opera.version())<9.5){dimensions[d]=document.body['client'+D]}else{dimensions[d]=document.documentElement['client'+D];}});return dimensions;},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(expression){this.expression=expression.strip();if(this.shouldUseSelectorsAPI()){this.mode='selectorsAPI';}else if(this.shouldUseXPath()){this.mode='xpath';this.compileXPathMatcher();}else{this.mode="normal";this.compileMatcher();}},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath)return false;var e=this.expression;if(Prototype.Browser.WebKit&&(e.include("-of-type")||e.include(":empty")))
return false;if((/(\[[\w-]*?:|:checked)/).test(e))
return false;return true;},shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(!Selector._div)Selector._div=new Element('div');try{Selector._div.querySelector(this.expression);}catch(e){return false;}
return true;},compileMatcher:function(){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,ps=Selector.patterns,x=Selector.xpath,le,m;if(Selector._cache[e]){this.xpath=Selector._cache[e];return;}
this.matcher=['.//*'];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){if(m=e.match(ps[i])){this.matcher.push(Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m));e=e.replace(m[0],'');break;}}}
this.xpath=this.matcher.join('');Selector._cache[this.expression]=this.xpath;},findElements:function(root){root=root||document;var e=this.expression,results;switch(this.mode){case'selectorsAPI':if(root!==document){var oldId=root.id,id=$(root).identify();e="#"+id+" "+e;}
results=$A(root.querySelectorAll(e)).map(Element.extend);root.id=oldId;return results;case'xpath':return document._getElementsByXPath(this.xpath,root);default:return this.matcher(root);}},match:function(element){this.tokens=[];var e=this.expression,ps=Selector.patterns,as=Selector.assertions;var le,p,m;while(e&&le!==e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){if(as[i]){this.tokens.push([i,Object.clone(m)]);e=e.replace(m[0],'');}else{return this.findElements(document).include(element);}}}}
var match=true,name,matches;for(var i=0,token;token=this.tokens[i];i++){name=token[0],matches=token[1];if(!Selector.assertions[name](element,matches)){match=false;break;}}
return match;},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(m){if(m[1]=='*')return'';return"[local-name()='"+m[1].toLowerCase()+"' or local-name()='"+m[1].toUpperCase()+"']";},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(m){m[1]=m[1].toLowerCase();return new Template("[@#{1}]").evaluate(m);},attr:function(m){m[1]=m[1].toLowerCase();m[3]=m[5]||m[6];return new Template(Selector.xpath.operators[m[2]]).evaluate(m);},pseudo:function(m){var h=Selector.xpath.pseudos[m[1]];if(!h)return'';if(Object.isFunction(h))return h(m);return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);},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)]",'checked':"[@checked]",'disabled':"[(@disabled) and (@type!='hidden')]",'enabled':"[not(@disabled) and (@type!='hidden')]",'not':function(m){var e=m[6],p=Selector.patterns,x=Selector.xpath,le,v;var exclusion=[];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in p){if(m=e.match(p[i])){v=Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m);exclusion.push("("+v.substring(1,v.length-1)+")");e=e.replace(m[0],'');break;}}}
return"[not("+exclusion.join(" and ")+")]";},'nth-child':function(m){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",m);},'nth-last-child':function(m){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",m);},'nth-of-type':function(m){return Selector.xpath.pseudos.nth("position() ",m);},'nth-last-of-type':function(m){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",m);},'first-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-of-type'](m);},'last-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-last-of-type'](m);},'only-of-type':function(m){var p=Selector.xpath.pseudos;return p['first-of-type'](m)+p['last-of-type'](m);},nth:function(fragment,m){var mm,formula=m[6],predicate;if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';if(mm=formula.match(/^(\d+)$/))
return'['+fragment+"= "+mm[1]+']';if(mm=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(mm[1]=="-")mm[1]=-1;var a=mm[1]?Number(mm[1]):1;var b=mm[2]?Number(mm[2]):0;predicate="[((#{fragment} - #{b}) mod #{a} = 0) and "+"((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(predicate).evaluate({fragment:fragment,a:a,b:b});}}}},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(m){m[3]=(m[5]||m[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);},pseudo:function(m){if(m[6])m[6]=m[6].replace(/"/g,'\\"');return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);},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]+:)?[\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(element,matches){return matches[1].toUpperCase()==element.tagName.toUpperCase();},className:function(element,matches){return Element.hasClassName(element,matches[1]);},id:function(element,matches){return element.id===matches[1];},attrPresence:function(element,matches){return Element.hasAttribute(element,matches[1]);},attr:function(element,matches){var nodeValue=Element.readAttribute(element,matches[1]);return nodeValue&&Selector.operators[matches[2]](nodeValue,matches[5]||matches[6]);}},handlers:{concat:function(a,b){for(var i=0,node;node=b[i];i++)
a.push(node);return a;},mark:function(nodes){var _true=Prototype.emptyFunction;for(var i=0,node;node=nodes[i];i++)
node._countedByPrototype=_true;return nodes;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
node._countedByPrototype=undefined;return nodes;},index:function(parentNode,reverse,ofType){parentNode._countedByPrototype=Prototype.emptyFunction;if(reverse){for(var nodes=parentNode.childNodes,i=nodes.length-1,j=1;i>=0;i--){var node=nodes[i];if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}}else{for(var i=0,j=1,nodes=parentNode.childNodes;node=nodes[i];i++)
if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}},unique:function(nodes){if(nodes.length==0)return nodes;var results=[],n;for(var i=0,l=nodes.length;i<l;i++)
if(!(n=nodes[i])._countedByPrototype){n._countedByPrototype=Prototype.emptyFunction;results.push(Element.extend(n));}
return Selector.handlers.unmark(results);},descendant:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
h.concat(results,node.getElementsByTagName('*'));return results;},child:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++){for(var j=0,child;child=node.childNodes[j];j++)
if(child.nodeType==1&&child.tagName!='!')results.push(child);}
return results;},adjacent:function(nodes){for(var i=0,results=[],node;node=nodes[i];i++){var next=this.nextElementSibling(node);if(next)results.push(next);}
return results;},laterSibling:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
h.concat(results,Element.nextSiblings(node));return results;},nextElementSibling:function(node){while(node=node.nextSibling)
if(node.nodeType==1)return node;return null;},previousElementSibling:function(node){while(node=node.previousSibling)
if(node.nodeType==1)return node;return null;},tagName:function(nodes,root,tagName,combinator){var uTagName=tagName.toUpperCase();var results=[],h=Selector.handlers;if(nodes){if(combinator){if(combinator=="descendant"){for(var i=0,node;node=nodes[i];i++)
h.concat(results,node.getElementsByTagName(tagName));return results;}else nodes=this[combinator](nodes);if(tagName=="*")return nodes;}
for(var i=0,node;node=nodes[i];i++)
if(node.tagName.toUpperCase()===uTagName)results.push(node);return results;}else return root.getElementsByTagName(tagName);},id:function(nodes,root,id,combinator){var targetNode=$(id),h=Selector.handlers;if(!targetNode)return[];if(!nodes&&root==document)return[targetNode];if(nodes){if(combinator){if(combinator=='child'){for(var i=0,node;node=nodes[i];i++)
if(targetNode.parentNode==node)return[targetNode];}else if(combinator=='descendant'){for(var i=0,node;node=nodes[i];i++)
if(Element.descendantOf(targetNode,node))return[targetNode];}else if(combinator=='adjacent'){for(var i=0,node;node=nodes[i];i++)
if(Selector.handlers.previousElementSibling(targetNode)==node)
return[targetNode];}else nodes=h[combinator](nodes);}
for(var i=0,node;node=nodes[i];i++)
if(node==targetNode)return[targetNode];return[];}
return(targetNode&&Element.descendantOf(targetNode,root))?[targetNode]:[];},className:function(nodes,root,className,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);return Selector.handlers.byClassName(nodes,root,className);},byClassName:function(nodes,root,className){if(!nodes)nodes=Selector.handlers.descendant([root]);var needle=' '+className+' ';for(var i=0,results=[],node,nodeClassName;node=nodes[i];i++){nodeClassName=node.className;if(nodeClassName.length==0)continue;if(nodeClassName==className||(' '+nodeClassName+' ').include(needle))
results.push(node);}
return results;},attrPresence:function(nodes,root,attr,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var results=[];for(var i=0,node;node=nodes[i];i++)
if(Element.hasAttribute(node,attr))results.push(node);return results;},attr:function(nodes,root,attr,value,operator,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var handler=Selector.operators[operator],results=[];for(var i=0,node;node=nodes[i];i++){var nodeValue=Element.readAttribute(node,attr);if(nodeValue===null)continue;if(handler(nodeValue,value))results.push(node);}
return results;},pseudo:function(nodes,name,value,root,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);if(!nodes)nodes=root.getElementsByTagName("*");return Selector.pseudos[name](nodes,value,root);}},pseudos:{'first-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.previousElementSibling(node))continue;results.push(node);}
return results;},'last-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.nextElementSibling(node))continue;results.push(node);}
return results;},'only-child':function(nodes,value,root){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
if(!h.previousElementSibling(node)&&!h.nextElementSibling(node))
results.push(node);return results;},'nth-child':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root);},'nth-last-child':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,true);},'nth-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,false,true);},'nth-last-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,true,true);},'first-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,"1",root,false,true);},'last-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,"1",root,true,true);},'only-of-type':function(nodes,formula,root){var p=Selector.pseudos;return p['last-of-type'](p['first-of-type'](nodes,formula,root),formula,root);},getIndices:function(a,b,total){if(a==0)return b>0?[b]:[];return $R(1,total).inject([],function(memo,i){if(0==(i-b)%a&&(i-b)/a>=0)memo.push(i);return memo;});},nth:function(nodes,formula,root,reverse,ofType){if(nodes.length==0)return[];if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';var h=Selector.handlers,results=[],indexed=[],m;h.mark(nodes);for(var i=0,node;node=nodes[i];i++){if(!node.parentNode._countedByPrototype){h.index(node.parentNode,reverse,ofType);indexed.push(node.parentNode);}}
if(formula.match(/^\d+$/)){formula=Number(formula);for(var i=0,node;node=nodes[i];i++)
if(node.nodeIndex==formula)results.push(node);}else if(m=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(m[1]=="-")m[1]=-1;var a=m[1]?Number(m[1]):1;var b=m[2]?Number(m[2]):0;var indices=Selector.pseudos.getIndices(a,b,nodes.length);for(var i=0,node,l=indices.length;node=nodes[i];i++){for(var j=0;j<l;j++)
if(node.nodeIndex==indices[j])results.push(node);}}
h.unmark(nodes);h.unmark(indexed);return results;},'empty':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(node.tagName=='!'||node.firstChild)continue;results.push(node);}
return results;},'not':function(nodes,selector,root){var h=Selector.handlers,selectorType,m;var exclusions=new Selector(selector).findElements(root);h.mark(exclusions);for(var i=0,results=[],node;node=nodes[i];i++)
if(!node._countedByPrototype)results.push(node);h.unmark(exclusions);return results;},'enabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
if(!node.disabled&&(!node.type||node.type!=='hidden'))
results.push(node);return results;},'disabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
if(node.disabled)results.push(node);return results;},'checked':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
if(node.checked)results.push(node);return results;}},operators:{'=':function(nv,v){return nv==v;},'!=':function(nv,v){return nv!=v;},'^=':function(nv,v){return nv==v||nv&&nv.startsWith(v);},'$=':function(nv,v){return nv==v||nv&&nv.endsWith(v);},'*=':function(nv,v){return nv==v||nv&&nv.include(v);},'$=':function(nv,v){return nv.endsWith(v);},'*=':function(nv,v){return nv.include(v);},'~=':function(nv,v){return(' '+nv+' ').include(' '+v+' ');},'|=':function(nv,v){return('-'+(nv||"").toUpperCase()+'-').include('-'+(v||"").toUpperCase()+'-');}},split:function(expression){var expressions=[];expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(m){expressions.push(m[1].strip());});return expressions;},matchElements:function(elements,expression){var matches=$$(expression),h=Selector.handlers;h.mark(matches);for(var i=0,results=[],element;element=elements[i];i++)
if(element._countedByPrototype)results.push(element);h.unmark(matches);return results;},findElement:function(elements,expression,index){if(Object.isNumber(expression)){index=expression;expression=false;}
return Selector.matchElements(elements,expression||'*')[index||0];},findChildElements:function(element,expressions){expressions=Selector.split(expressions.join(','));var results=[],h=Selector.handlers;for(var i=0,l=expressions.length,selector;i<l;i++){selector=new Selector(expressions[i].strip());h.concat(results,selector.findElements(element));}
return(l>1)?h.unique(results):results;}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(a,b){for(var i=0,node;node=b[i];i++)
if(node.tagName!=="!")a.push(node);return a;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
node.removeAttribute('_countedByPrototype');return nodes;}});}
function $$(){return Selector.findChildElements(document,$A(arguments));}
var Form={reset:function(form){$(form).reset();return form;},serializeElements:function(elements,options){if(typeof options!='object')options={hash:!!options};else if(Object.isUndefined(options.hash))options.hash=true;var key,value,submitted=false,submit=options.submit;var data=elements.inject({},function(result,element){if(!element.disabled&&element.name){key=element.name;value=$(element).getValue();if(value!=null&&element.type!='file'&&(element.type!='submit'||(!submitted&&submit!==false&&(!submit||key==submit)&&(submitted=true)))){if(key in result){if(!Object.isArray(result[key]))result[key]=[result[key]];result[key].push(value);}
else result[key]=value;}}
return result;});return options.hash?data:Object.toQueryString(data);}};Form.Methods={serialize:function(form,options){return Form.serializeElements(Form.getElements(form),options);},getElements:function(form){return $A($(form).getElementsByTagName('*')).inject([],function(elements,child){if(Form.Element.Serializers[child.tagName.toLowerCase()])
elements.push(Element.extend(child));return elements;});},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)return $A(inputs).map(Element.extend);for(var i=0,matchingInputs=[],length=inputs.length;i<length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))
continue;matchingInputs.push(Element.extend(input));}
return matchingInputs;},disable:function(form){form=$(form);Form.getElements(form).invoke('disable');return form;},enable:function(form){form=$(form);Form.getElements(form).invoke('enable');return form;},findFirstElement:function(form){var elements=$(form).getElements().findAll(function(element){return'hidden'!=element.type&&!element.disabled;});var firstByIndex=elements.findAll(function(element){return element.hasAttribute('tabIndex')&&element.tabIndex>=0;}).sortBy(function(element){return element.tabIndex}).first();return firstByIndex?firstByIndex:elements.find(function(element){return['input','select','textarea'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){form=$(form);form.findFirstElement().activate();return form;},request:function(form,options){form=$(form),options=Object.clone(options||{});var params=options.parameters,action=form.readAttribute('action')||'';if(action.blank())action=window.location.href;options.parameters=form.serialize(true);if(params){if(Object.isString(params))params=params.toQueryParams();Object.extend(options.parameters,params);}
if(form.hasAttribute('method')&&!options.method)
options.method=form.method;return new Ajax.Request(action,options);}};Form.Element={focus:function(element){$(element).focus();return element;},select:function(element){$(element).select();return element;}};Form.Element.Methods={serialize:function(element){element=$(element);if(!element.disabled&&element.name){var value=element.getValue();if(value!=undefined){var pair={};pair[element.name]=value;return Object.toQueryString(pair);}}
return'';},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();return Form.Element.Serializers[method](element);},setValue:function(element,value){element=$(element);var method=element.tagName.toLowerCase();Form.Element.Serializers[method](element,value);return element;},clear:function(element){$(element).value='';return element;},present:function(element){return $(element).value!='';},activate:function(element){element=$(element);try{element.focus();if(element.select&&(element.tagName.toLowerCase()!='input'||!['button','reset','submit'].include(element.type)))
element.select();}catch(e){}
return element;},disable:function(element){element=$(element);element.disabled=true;return element;},enable:function(element){element=$(element);element.disabled=false;return element;}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(element,value){switch(element.type.toLowerCase()){case'checkbox':case'radio':return Form.Element.Serializers.inputSelector(element,value);default:return Form.Element.Serializers.textarea(element,value);}},inputSelector:function(element,value){if(Object.isUndefined(value))return element.checked?element.value:null;else element.checked=!!value;},textarea:function(element,value){if(Object.isUndefined(value))return element.value;else element.value=value;},select:function(element,value){if(Object.isUndefined(value))
return this[element.type=='select-one'?'selectOne':'selectMany'](element);else{var opt,currentValue,single=!Object.isArray(value);for(var i=0,length=element.length;i<length;i++){opt=element.options[i];currentValue=this.optionValue(opt);if(single){if(currentValue==value){opt.selected=true;return;}}
else opt.selected=value.include(currentValue);}}},selectOne:function(element){var index=element.selectedIndex;return index>=0?this.optionValue(element.options[index]):null;},selectMany:function(element){var values,length=element.length;if(!length)return null;for(var i=0,values=[];i<length;i++){var opt=element.options[i];if(opt.selected)values.push(this.optionValue(opt));}
return values;},optionValue:function(opt){return Element.extend(opt).hasAttribute('value')?opt.value:opt.text;}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,element,frequency,callback){$super(callback,frequency);this.element=$(element);this.lastValue=this.getValue();},execute:function(){var value=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(value)?this.lastValue!=value:String(this.lastValue)!=String(value)){this.callback(this.element,value);this.lastValue=value;}}});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(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')
this.registerFormCallbacks();else
this.registerCallback(this.element);},onElementEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this);},registerCallback:function(element){if(element.type){switch(element.type.toLowerCase()){case'checkbox':case'radio':Event.observe(element,'click',this.onElementEvent.bind(this));break;default:Event.observe(element,'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(event){var element;switch(event.type){case'mouseover':element=event.fromElement;break;case'mouseout':element=event.toElement;break;default:return null;}
return Element.extend(element);}});Event.Methods=(function(){var isButton;if(Prototype.Browser.IE){var buttonMap={0:1,1:4,2:2};isButton=function(event,code){return event.button==buttonMap[code];};}else if(Prototype.Browser.WebKit){isButton=function(event,code){switch(code){case 0:return event.which==1&&!event.metaKey;case 1:return event.which==1&&event.metaKey;default:return false;}};}else{isButton=function(event,code){return event.which?(event.which===code+1):(event.button===code);};}
return{isLeftClick:function(event){return isButton(event,0)},isMiddleClick:function(event){return isButton(event,1)},isRightClick:function(event){return isButton(event,2)},element:function(event){event=Event.extend(event);var node=event.target,type=event.type,currentTarget=event.currentTarget;if(currentTarget&&currentTarget.tagName){if(type==='load'||type==='error'||(type==='click'&&currentTarget.tagName.toLowerCase()==='input'&&currentTarget.type==='radio'))
node=currentTarget;}
if(node.nodeType==Node.TEXT_NODE)node=node.parentNode;return Element.extend(node);},findElement:function(event,expression){var element=Event.element(event);if(!expression)return element;var elements=[element].concat(element.ancestors());return Selector.findElement(elements,expression,0);},pointer:function(event){var docElement=document.documentElement,body=document.body||{scrollLeft:0,scrollTop:0};return{x:event.pageX||(event.clientX+
(docElement.scrollLeft||body.scrollLeft)-
(docElement.clientLeft||0)),y:event.pageY||(event.clientY+
(docElement.scrollTop||body.scrollTop)-
(docElement.clientTop||0))};},pointerX:function(event){return Event.pointer(event).x},pointerY:function(event){return Event.pointer(event).y},stop:function(event){Event.extend(event);event.preventDefault();event.stopPropagation();event.stopped=true;}};})();Event.extend=(function(){var methods=Object.keys(Event.Methods).inject({},function(m,name){m[name]=Event.Methods[name].methodize();return m;});if(Prototype.Browser.IE){Object.extend(methods,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(event){if(!event)return false;if(event._extendedByPrototype)return event;event._extendedByPrototype=Prototype.emptyFunction;var pointer=Event.pointer(event);Object.extend(event,{target:event.srcElement,relatedTarget:Event.relatedTarget(event),pageX:pointer.x,pageY:pointer.y});return Object.extend(event,methods);};}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents")['__proto__'];Object.extend(Event.prototype,methods);return Prototype.K;}})();Object.extend(Event,(function(){var cache=Event.cache;function getEventID(element){if(element._prototypeEventID)return element._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return element._prototypeEventID=[++arguments.callee.id];}
function getDOMEventName(eventName){if(eventName&&eventName.include(':'))return"dataavailable";return eventName;}
function getCacheForID(id){return cache[id]=cache[id]||{};}
function getWrappersForEventName(id,eventName){var c=getCacheForID(id);return c[eventName]=c[eventName]||[];}
function createWrapper(element,eventName,handler){var id=getEventID(element);var c=getWrappersForEventName(id,eventName);if(c.pluck("handler").include(handler))return false;var wrapper=function(event){if(!Event||!Event.extend||(event.eventName&&event.eventName!=eventName))
return false;Event.extend(event);handler.call(element,event);};wrapper.handler=handler;c.push(wrapper);return wrapper;}
function findWrapper(id,eventName,handler){var c=getWrappersForEventName(id,eventName);return c.find(function(wrapper){return wrapper.handler==handler});}
function destroyWrapper(id,eventName,handler){var c=getCacheForID(id);if(!c[eventName])return false;c[eventName]=c[eventName].without(findWrapper(id,eventName,handler));}
function destroyCache(){for(var id in cache)
for(var eventName in cache[id])
cache[id][eventName]=null;}
if(window.attachEvent){window.attachEvent("onunload",destroyCache);}
if(Prototype.Browser.WebKit){window.addEventListener('unload',Prototype.emptyFunction,false);}
return{observe:function(element,eventName,handler){element=$(element);var name=getDOMEventName(eventName);var wrapper=createWrapper(element,eventName,handler);if(!wrapper)return element;if(element.addEventListener){element.addEventListener(name,wrapper,false);}else{element.attachEvent("on"+name,wrapper);}
return element;},stopObserving:function(element,eventName,handler){element=$(element);var id=getEventID(element),name=getDOMEventName(eventName);if(!handler&&eventName){getWrappersForEventName(id,eventName).each(function(wrapper){element.stopObserving(eventName,wrapper.handler);});return element;}else if(!eventName){Object.keys(getCacheForID(id)).each(function(eventName){element.stopObserving(eventName);});return element;}
var wrapper=findWrapper(id,eventName,handler);if(!wrapper)return element;if(element.removeEventListener){element.removeEventListener(name,wrapper,false);}else{element.detachEvent("on"+name,wrapper);}
destroyWrapper(id,eventName,handler);return element;},fire:function(element,eventName,memo){element=$(element);if(element==document&&document.createEvent&&!element.dispatchEvent)
element=document.documentElement;var event;if(document.createEvent){event=document.createEvent("HTMLEvents");event.initEvent("dataavailable",true,true);}else{event=document.createEventObject();event.eventType="ondataavailable";}
event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event);}else{element.fireEvent(event.eventType,event);}
return Event.extend(event);}};})());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 timer;function fireContentLoadedEvent(){if(document.loaded)return;if(timer)window.clearInterval(timer);document.fire("dom:loaded");document.loaded=true;}
if(document.addEventListener){if(Prototype.Browser.WebKit){timer=window.setInterval(function(){if(/loaded|complete/.test(document.readyState))
fireContentLoadedEvent();},0);Event.observe(window,"load",fireContentLoadedEvent);}else{document.addEventListener("DOMContentLoaded",fireContentLoadedEvent,false);}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;fireContentLoadedEvent();}};}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(element,content){return Element.insert(element,{before:content});},Top:function(element,content){return Element.insert(element,{top:content});},Bottom:function(element,content){return Element.insert(element,{bottom:content});},After:function(element,content){return Element.insert(element,{after:content});}};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(element,x,y){if(this.includeScrollOffsets)
return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y;this.offset=Element.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=Element.cumulativeScrollOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=Element.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth);},overlap:function(mode,element){if(!mode)return 0;if(mode=='vertical')
return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if(mode=='horizontal')
return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth;},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(element){Position.prepare();return Element.absolutize(element);},relativize:function(element){Position.prepare();return Element.relativize(element);},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(source,target,options){options=options||{};return Element.clonePosition(target,source,options);}};if(!document.getElementsByClassName)document.getElementsByClassName=function(instanceMethods){function iter(name){return name.blank()?null:"[contains(concat(' ', @class, ' '), ' "+name+" ')]";}
instanceMethods.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(element,className){className=className.toString().strip();var cond=/\s/.test(className)?$w(className).map(iter).join(''):iter(className);return cond?document._getElementsByXPath('.//*'+cond,element):[];}:function(element,className){className=className.toString().strip();var elements=[],classNames=(/\s/.test(className)?$w(className):null);if(!classNames&&!className)return elements;var nodes=$(element).getElementsByTagName('*');className=' '+className+' ';for(var i=0,child,cn;child=nodes[i];i++){if(child.className&&(cn=' '+child.className+' ')&&(cn.include(className)||(classNames&&classNames.all(function(name){return!name.toString().blank()&&cn.include(' '+name+' ');}))))
elements.push(Element.extend(child));}
return elements;};return function(className,parentElement){return $(parentElement||document.body).getElementsByClassName(className);};}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set($A(this).concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set($A(this).without(classNameToRemove).join(' '));},toString:function(){return $A(this).join(' ');}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();
String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)color=this.toLowerCase();}}
return(color.length==7?color:(arguments[0]||this));};Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');};Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatten().join('');};Element.setContentZoom=function(element,percent){element=$(element);element.setStyle({fontSize:(percent/100)+'em'});if(Prototype.Browser.WebKit)window.scrollBy(0,0);return element;};Element.getInlineOpacity=function(element){return $(element).style.opacity||'';};Element.forceRerendering=function(element){try{element=$(element);var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}};var Effect={_elementDoesNotExistError:{name:'ElementDoesNotExistError',message:'The specified DOM element does not exist, but is required for this effect to operate'},Transitions:{linear:Prototype.K,sinoidal:function(pos){return(-Math.cos(pos*Math.PI)/2)+.5;},reverse:function(pos){return 1-pos;},flicker:function(pos){var pos=((-Math.cos(pos*Math.PI)/4)+.75)+Math.random()/4;return pos>1?1:pos;},wobble:function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+.5;},pulse:function(pos,pulses){return(-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2)+.5;},spring:function(pos){return 1-(Math.cos(pos*4.5*Math.PI)*Math.exp(-pos*6));},none:function(pos){return 0;},full:function(pos){return 1;}},DefaultOptions:{duration:1.0,fps:100,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'},tagifyText:function(element){var tagifyStyle='position:relative';if(Prototype.Browser.IE)tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(new Element('span',{style:tagifyStyle}).update(character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||Object.isFunction(element))&&(element.length))
elements=element;else
elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global'),limit:1}},arguments[2]||{});Effect[element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options);}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=Object.isString(effect.options.queue)?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'with-last':timestamp=this.effects.pluck('startOn').max()||timestamp;break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;}
effect.startOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.limit||(this.effects.length<effect.options.queue.limit))
this.effects.push(effect);if(!this.interval)
this.interval=setInterval(this.loop.bind(this),15);},remove:function(effect){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();for(var i=0,len=this.effects.length;i<len;i++)
this.effects[i]&&this.effects[i].loop(timePos);}});Effect.Queues={instances:$H(),get:function(queueName){if(!Object.isString(queueName))return queueName;return this.instances.get(queueName)||this.instances.set(queueName,new Effect.ScopedQueue());}};Effect.Queue=Effect.Queues.get('global');Effect.Base=Class.create({position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+'Internal']?'this.options.'+eventName+'Internal(this);':'')+
(options[eventName]?'this.options.'+eventName+'(this);':''));}
if(options&&options.transition===false)options.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function dispatch(effect,eventName){if(effect.options[eventName+'Internal'])
effect.options[eventName+'Internal'](effect);if(effect.options[eventName])
effect.options[eventName](effect);}
return function(pos){if(this.state==="idle"){this.state="running";dispatch(this,'beforeSetup');if(this.setup)this.setup();dispatch(this,'afterSetup');}
if(this.state==="running"){pos=(this.options.transition(pos)*this.fromToDelta)+this.options.from;this.position=pos;dispatch(this,'beforeUpdate');if(this.update)this.update(pos);dispatch(this,'afterUpdate');}};})();this.event('beforeStart');if(!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).add(this);},loop:function(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;}
var pos=(timePos-this.startOn)/this.totalTime,frame=(pos*this.totalFrames).round();if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},cancel:function(){if(!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).remove(this);this.state='finished';},event:function(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[eventName])this.options[eventName](this);},inspect:function(){var data=$H();for(property in this)
if(!Object.isFunction(this[property]))data.set(property,this[property]);return'#<Effect:'+data.inspect()+',options:'+$H(this.options).inspect()+'>';}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Tween=Class.create(Effect.Base,{initialize:function(object,from,to){object=Object.isString(object)?$(object):object;var args=$A(arguments),method=args.last(),options=args.length==5?args[3]:null;this.method=Object.isFunction(method)?method.bind(object):Object.isFunction(object[method])?object[method].bind(object):function(value){object[method]=value};this.start(Object.extend({from:from,to:to},options||{}));},update:function(position){this.method(position);}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}));},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){this.element.setOpacity(position);}});Effect.Move=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle('left')||'0');this.originalTop=parseFloat(this.element.getStyle('top')||'0');if(this.options.mode=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(position){this.element.setStyle({left:(this.options.x*position+this.originalLeft).round()+'px',top:(this.options.y*position+this.originalTop).round()+'px'});}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}));};Effect.Scale=Class.create(Effect.Base,{initialize:function(element,percent){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%','pt'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box')
this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];},update:function(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize)
this.element.setStyle({fontSize:this.fontSize*currentScale+this.fontSizeType});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d.width=width.round()+'px';if(this.options.scaleY)d.height=height.round()+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft-leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX)d.left=-leftd+'px';}}
this.element.setStyle(d);}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},setup:function(){if(this.element.getStyle('display')=='none'){this.cancel();return;}
this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle('background-image');this.element.setStyle({backgroundImage:'none'});}
if(!this.options.endcolor)
this.options.endcolor=this.element.getStyle('background-color').parseColor('#ffffff');if(!this.options.restorecolor)
this.options.restorecolor=this.element.getStyle('background-color');this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=function(element){var options=arguments[1]||{},scrollOffsets=document.viewport.getScrollOffsets(),elementOffsets=$(element).cumulativeOffset();if(options.offset)elementOffsets[1]+=options.offset;return new Effect.Tween(null,scrollOffsets.top,elementOffsets[1],options,function(p){scrollTo(scrollOffsets.left,p.round());});};Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal:function(effect){if(effect.options.to!=0)return;effect.element.hide().setStyle({opacity:oldOpacity});}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Appear=function(element){element=$(element);var options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerendering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.from).show();}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position'),top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect){Position.absolutize(effect.effects[0].element);},afterFinishInternal:function(effect){effect.effects[0].element.hide().setStyle(oldStyle);}},arguments[1]||{}));};Effect.BlindUp=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect){effect.element.hide().undoClipping();}},arguments[1]||{}));};Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping().setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));};Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned().setStyle({opacity:oldOpacity});}});}},arguments[1]||{}));};Effect.DropOut=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){effect.effects[0].element.makePositioned();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);}},arguments[1]||{}));};Effect.Shake=function(element){element=$(element);var options=Object.extend({distance:20,duration:0.5},arguments[1]||{});var distance=parseFloat(options.distance);var split=parseFloat(options.duration)/10.0;var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:distance,y:0,duration:split,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance,y:0,duration:split,afterFinishInternal:function(effect){effect.element.undoPositioned().setStyle(oldStyle);}});}});}});}});}});}});};Effect.SlideDown=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().setStyle({height:'0px'}).show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.SlideUp=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping();}});};Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;}
return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){effect.element.hide().makeClipping().makePositioned();},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);}},options));}});};Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;}
return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle);}},options));};Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{},oldOpacity=element.getInlineOpacity(),transition=options.transition||Effect.Transitions.linear,reverser=function(pos){return 1-transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2)+.5);};return new Effect.Opacity(element,Object.extend(Object.extend({duration:2.0,from:0,afterFinishInternal:function(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));};Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};element.makeClipping();return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide().undoClipping().setStyle(oldStyle);}});}},arguments[1]||{}));};Effect.Morph=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(options.style))this.style=$H(options.style);else{if(options.style.include(':'))
this.style=options.style.parseStyle();else{this.element.addClassName(options.style);this.style=$H(this.element.getStyles());this.element.removeClassName(options.style);var css=this.element.getStyles();this.style=this.style.reject(function(style){return style.value==css[style.key];});options.afterFinishInternal=function(effect){effect.element.addClassName(effect.options.style);effect.transforms.each(function(transform){effect.element.style[transform.style]='';});};}}
this.start(options);},setup:function(){function parseColor(color){if(!color||['rgba(0, 0, 0, 0)','transparent'].include(color))color='#ffffff';color=color.parseColor();return $R(0,2).map(function(i){return parseInt(color.slice(i*2+1,i*2+3),16);});}
this.transforms=this.style.map(function(pair){var property=pair[0],value=pair[1],unit=null;if(value.parseColor('#zzzzzz')!='#zzzzzz'){value=value.parseColor();unit='color';}else if(property=='opacity'){value=parseFloat(value);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});}else if(Element.CSS_LENGTH.test(value)){var components=value.match(/^([\+\-]?[0-9\.]+)(.*)$/);value=parseFloat(components[1]);unit=(components.length==3)?components[2]:null;}
var originalValue=this.element.getStyle(property);return{style:property.camelize(),originalValue:unit=='color'?parseColor(originalValue):parseFloat(originalValue||0),targetValue:unit=='color'?parseColor(value):value,unit:unit};}.bind(this)).reject(function(transform){return((transform.originalValue==transform.targetValue)||(transform.unit!='color'&&(isNaN(transform.originalValue)||isNaN(transform.targetValue))));});},update:function(position){var style={},transform,i=this.transforms.length;while(i--)
style[(transform=this.transforms[i]).style]=transform.unit=='color'?'#'+
(Math.round(transform.originalValue[0]+
(transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart()+
(Math.round(transform.originalValue[1]+
(transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart()+
(Math.round(transform.originalValue[2]+
(transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart():(transform.originalValue+
(transform.targetValue-transform.originalValue)*position).toFixed(3)+
(transform.unit===null?'':transform.unit);this.element.setStyle(style,true);}});Effect.Transform=Class.create({initialize:function(tracks){this.tracks=[];this.options=arguments[1]||{};this.addTracks(tracks);},addTracks:function(tracks){tracks.each(function(track){track=$H(track);var data=track.values().first();this.tracks.push($H({ids:track.keys().first(),effect:Effect.Morph,options:{style:data}}));}.bind(this));return this;},play:function(){return new Effect.Parallel(this.tracks.map(function(track){var ids=track.get('ids'),effect=track.get('effect'),options=track.get('options');var elements=[$(ids)||$$(ids)].flatten();return elements.map(function(e){return new effect(e,Object.extend({sync:true},options))});}).flatten(),this.options);}});Element.CSS_PROPERTIES=$w('backgroundColor backgroundPosition borderBottomColor borderBottomStyle '+'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth '+'borderRightColor borderRightStyle borderRightWidth borderSpacing '+'borderTopColor borderTopStyle borderTopWidth bottom clip color '+'fontSize fontWeight height left letterSpacing lineHeight '+'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+'maxWidth minHeight minWidth opacity outlineColor outlineOffset '+'outlineWidth paddingBottom paddingLeft paddingRight paddingTop '+'right textIndent top width wordSpacing zIndex');Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement('div');String.prototype.parseStyle=function(){var style,styleRules=$H();if(Prototype.Browser.WebKit)
style=new Element('div',{style:this}).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';style=String.__parseStyleElement.childNodes[0].style;}
Element.CSS_PROPERTIES.each(function(property){if(style[property])styleRules.set(property,style[property]);});if(Prototype.Browser.IE&&this.include('opacity'))
styleRules.set('opacity',this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return styleRules;};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(element){var css=document.defaultView.getComputedStyle($(element),null);return Element.CSS_PROPERTIES.inject({},function(styles,property){styles[property]=css[property];return styles;});};}else{Element.getStyles=function(element){element=$(element);var css=element.currentStyle,styles;styles=Element.CSS_PROPERTIES.inject({},function(results,property){results[property]=css[property];return results;});if(!styles.opacity)styles.opacity=element.getOpacity();return styles;};}
Effect.Methods={morph:function(element,style){element=$(element);new Effect.Morph(element,Object.extend({style:style},arguments[2]||{}));return element;},visualEffect:function(element,effect,options){element=$(element);var s=effect.dasherize().camelize(),klass=s.charAt(0).toUpperCase()+s.substring(1);new Effect[klass](element,options);return element;},highlight:function(element,options){element=$(element);new Effect.Highlight(element,options);return element;}};$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+'pulsate shake puff squish switchOff dropOut').each(function(effect){Effect.Methods[effect]=function(element,options){element=$(element);Effect[effect.charAt(0).toUpperCase()+effect.substring(1)](element,options);return element;};});$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(function(f){Effect.Methods[f]=Element[f];});Element.addMethods(Effect.Methods);
var Cufon=(function(){var api=function(){return api.replace.apply(null,arguments);};var DOM=api.DOM={ready:(function(){var complete=false,readyStatus={loaded:1,complete:1};var queue=[],perform=function(){if(complete)return;complete=true;for(var fn;fn=queue.shift();fn());};if(document.addEventListener){document.addEventListener('DOMContentLoaded',perform,false);window.addEventListener('pageshow',perform,false);}
if(!window.opera&&document.readyState)(function(){readyStatus[document.readyState]?perform():setTimeout(arguments.callee,10);})();if(document.readyState&&document.createStyleSheet)(function(){try{document.body.doScroll('left');perform();}
catch(e){setTimeout(arguments.callee,1);}})();addEvent(window,'load',perform);return function(listener){if(!arguments.length)perform();else complete?listener():queue.push(listener);};})(),root:function(){return document.documentElement||document.body;}};var CSS=api.CSS={Size:function(value,base){this.value=parseFloat(value);this.unit=String(value).match(/[a-z%]*$/)[0]||'px';this.convert=function(value){return value/base*this.value;};this.convertFrom=function(value){return value/this.value*base;};this.toString=function(){return this.value+this.unit;};},addClass:function(el,className){var current=el.className;el.className=current+(current&&' ')+className;return el;},color:cached(function(value){var parsed={};parsed.color=value.replace(/^rgba\((.*?),\s*([\d.]+)\)/,function($0,$1,$2){parsed.opacity=parseFloat($2);return'rgb('+$1+')';});return parsed;}),fontStretch:cached(function(value){if(typeof value=='number')return value;if(/%$/.test(value))return parseFloat(value)/100;return{'ultra-condensed':0.5,'extra-condensed':0.625,condensed:0.75,'semi-condensed':0.875,'semi-expanded':1.125,expanded:1.25,'extra-expanded':1.5,'ultra-expanded':2}[value]||1;}),getStyle:function(el){var view=document.defaultView;if(view&&view.getComputedStyle)return new Style(view.getComputedStyle(el,null));if(el.currentStyle)return new Style(el.currentStyle);return new Style(el.style);},gradient:cached(function(value){var gradient={id:value,type:value.match(/^-([a-z]+)-gradient\(/)[1],stops:[]},colors=value.substr(value.indexOf('(')).match(/([\d.]+=)?(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)/ig);for(var i=0,l=colors.length,stop;i<l;++i){stop=colors[i].split('=',2).reverse();gradient.stops.push([stop[1]||i/(l-1),stop[0]]);}
return gradient;}),quotedList:cached(function(value){var list=[],re=/\s*((["'])([\s\S]*?[^\\])\2|[^,]+)\s*/g,match;while(match=re.exec(value))list.push(match[3]||match[1]);return list;}),recognizesMedia:cached(function(media){var el=document.createElement('style'),sheet,container,supported;el.type='text/css';el.media=media;try{el.appendChild(document.createTextNode('/**/'));}catch(e){}
container=elementsByTagName('head')[0];container.insertBefore(el,container.firstChild);sheet=(el.sheet||el.styleSheet);supported=sheet&&!sheet.disabled;container.removeChild(el);return supported;}),removeClass:function(el,className){var re=RegExp('(?:^|\\s+)'+className+'(?=\\s|$)','g');el.className=el.className.replace(re,'');return el;},supports:function(property,value){var checker=document.createElement('span').style;if(checker[property]===undefined)return false;checker[property]=value;return checker[property]===value;},textAlign:function(word,style,position,wordCount){if(style.get('textAlign')=='right'){if(position>0)word=' '+word;}
else if(position<wordCount-1)word+=' ';return word;},textDecoration:function(el,style){if(!style)style=this.getStyle(el);var types={underline:null,overline:null,'line-through':null};for(var search=el;search.parentNode&&search.parentNode.nodeType==1;){var foundAll=true;for(var type in types){if(!hasOwnProperty(types,type)||types[type])continue;if(style.get('textDecoration').indexOf(type)!=-1)types[type]=style.get('color');foundAll=false;}
if(foundAll)break;style=this.getStyle(search=search.parentNode);}
return types;},textShadow:cached(function(value){if(value=='none')return null;var shadows=[],currentShadow={},result,offCount=0;var re=/(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)|(-?[\d.]+[a-z%]*)|,/ig;while(result=re.exec(value)){if(result[0]==','){shadows.push(currentShadow);currentShadow={};offCount=0;}
else if(result[1]){currentShadow.color=result[1];}
else{currentShadow[['offX','offY','blur'][offCount++]]=result[2];}}
shadows.push(currentShadow);return shadows;}),textTransform:(function(){var map={uppercase:function(s){return s.toUpperCase();},lowercase:function(s){return s.toLowerCase();},capitalize:function(s){return s.replace(/\b./g,function($0){return $0.toUpperCase();});}};return function(text,style){var transform=map[style.get('textTransform')];return transform?transform(text):text;};})(),whiteSpace:(function(){var ignore={inline:1,'inline-block':1,'run-in':1};return function(text,style,node){if(ignore[style.get('display')])return text;if(!node.previousSibling)text=text.replace(/^\s+/,'');if(!node.nextSibling)text=text.replace(/\s+$/,'');return text;};})()};CSS.ready=(function(){var complete=!CSS.recognizesMedia('all'),hasLayout=false;var queue=[],perform=function(){complete=true;for(var fn;fn=queue.shift();fn());};var links=elementsByTagName('link'),styles=elementsByTagName('style');function isContainerReady(el){return el.disabled||isSheetReady(el.sheet,el.media||'screen');}
function isSheetReady(sheet,media){if(!CSS.recognizesMedia(media||'all'))return true;if(!sheet||sheet.disabled)return false;try{var rules=sheet.cssRules,rule;if(rules){search:for(var i=0,l=rules.length;rule=rules[i],i<l;++i){switch(rule.type){case 2:break;case 3:if(!isSheetReady(rule.styleSheet,rule.media.mediaText))return false;break;default:break search;}}}}
catch(e){}
return true;}
function allStylesLoaded(){if(document.createStyleSheet)return true;var el,i;for(i=0;el=links[i];++i){if(el.rel.toLowerCase()=='stylesheet'&&!isContainerReady(el))return false;}
for(i=0;el=styles[i];++i){if(!isContainerReady(el))return false;}
return true;}
DOM.ready(function(){if(!hasLayout)hasLayout=CSS.getStyle(document.body).isUsable();if(complete||(hasLayout&&allStylesLoaded()))perform();else setTimeout(arguments.callee,10);});return function(listener){if(complete)listener();else queue.push(listener);};})();function Font(data){var face=this.face=data.face;this.glyphs=data.glyphs;this.w=data.w;this.baseSize=parseInt(face['units-per-em'],10);this.family=face['font-family'].toLowerCase();this.weight=face['font-weight'];this.style=face['font-style']||'normal';this.viewBox=(function(){var parts=face.bbox.split(/\s+/);var box={minX:parseInt(parts[0],10),minY:parseInt(parts[1],10),maxX:parseInt(parts[2],10),maxY:parseInt(parts[3],10)};box.width=box.maxX-box.minX;box.height=box.maxY-box.minY;box.toString=function(){return[this.minX,this.minY,this.width,this.height].join(' ');};return box;})();this.ascent=-parseInt(face.ascent,10);this.descent=-parseInt(face.descent,10);this.height=-this.ascent+this.descent;}
function FontFamily(){var styles={},mapping={oblique:'italic',italic:'oblique'};this.add=function(font){(styles[font.style]||(styles[font.style]={}))[font.weight]=font;};this.get=function(style,weight){var weights=styles[style]||styles[mapping[style]]||styles.normal||styles.italic||styles.oblique;if(!weights)return null;weight={normal:400,bold:700}[weight]||parseInt(weight,10);if(weights[weight])return weights[weight];var up={1:1,99:0}[weight%100],alts=[],min,max;if(up===undefined)up=weight>400;if(weight==500)weight=400;for(var alt in weights){if(!hasOwnProperty(weights,alt))continue;alt=parseInt(alt,10);if(!min||alt<min)min=alt;if(!max||alt>max)max=alt;alts.push(alt);}
if(weight<min)weight=min;if(weight>max)weight=max;alts.sort(function(a,b){return(up?(a>weight&&b>weight)?a<b:a>b:(a<weight&&b<weight)?a>b:a<b)?-1:1;});return weights[alts[0]];};}
function HoverHandler(){function contains(node,anotherNode){if(node.contains)return node.contains(anotherNode);return node.compareDocumentPosition(anotherNode)&16;}
function onOverOut(e){var related=e.relatedTarget;if(!related||contains(this,related))return;trigger(this);}
function onEnterLeave(e){trigger(this);}
function trigger(el){setTimeout(function(){api.replace(el,sharedStorage.get(el).options,true);},10);}
this.attach=function(el){if(el.onmouseenter===undefined){addEvent(el,'mouseover',onOverOut);addEvent(el,'mouseout',onOverOut);}
else{addEvent(el,'mouseenter',onEnterLeave);addEvent(el,'mouseleave',onEnterLeave);}};}
function ReplaceHistory(){var list=[],map={};function filter(keys){var values=[],key;for(var i=0;key=keys[i];++i)values[i]=list[map[key]];return values;}
this.add=function(key,args){map[key]=list.push(args)-1;};this.repeat=function(){var snapshot=arguments.length?filter(arguments):list,args;for(var i=0;args=snapshot[i++];)api.replace(args[0],args[1],true);};}
function Storage(){var map={},at=0;function identify(el){return el.cufid||(el.cufid=++at);}
this.get=function(el){var id=identify(el);return map[id]||(map[id]={});};}
function Style(style){var custom={},sizes={};this.extend=function(styles){for(var property in styles){if(hasOwnProperty(styles,property))custom[property]=styles[property];}
return this;};this.get=function(property){return custom[property]!=undefined?custom[property]:style[property];};this.getSize=function(property,base){return sizes[property]||(sizes[property]=new CSS.Size(this.get(property),base));};this.isUsable=function(){return!!style;};}
function addEvent(el,type,listener){if(el.addEventListener){el.addEventListener(type,listener,false);}
else if(el.attachEvent){el.attachEvent('on'+type,function(){return listener.call(el,window.event);});}}
function attach(el,options){var storage=sharedStorage.get(el);if(storage.options)return el;if(options.hover&&options.hoverables[el.nodeName.toLowerCase()]){hoverHandler.attach(el);}
storage.options=options;return el;}
function cached(fun){var cache={};return function(key){if(!hasOwnProperty(cache,key))cache[key]=fun.apply(null,arguments);return cache[key];};}
function getFont(el,style){var families=CSS.quotedList(style.get('fontFamily').toLowerCase()),family;for(var i=0;family=families[i];++i){if(fonts[family])return fonts[family].get(style.get('fontStyle'),style.get('fontWeight'));}
return null;}
function elementsByTagName(query){return document.getElementsByTagName(query);}
function hasOwnProperty(obj,property){return obj.hasOwnProperty(property);}
function merge(){var merged={},args,key;for(var i=0,l=arguments.length;args=arguments[i],i<l;++i){for(key in args){if(hasOwnProperty(args,key))merged[key]=args[key];}}
return merged;}
function process(font,text,style,options,node,el){var fragment=document.createDocumentFragment(),processed;if(text==='')return fragment;var separate=options.separate;var parts=text.split(separators[separate]),needsAligning=(separate=='words');if(needsAligning&&HAS_BROKEN_REGEXP){if(/^\s/.test(text))parts.unshift('');if(/\s$/.test(text))parts.push('');}
for(var i=0,l=parts.length;i<l;++i){processed=engines[options.engine](font,needsAligning?CSS.textAlign(parts[i],style,i,l):parts[i],style,options,node,el,i<l-1);if(processed)fragment.appendChild(processed);}
return fragment;}
function replaceElement(el,options){var style=CSS.getStyle(attach(el,options)).extend(options);var font=getFont(el,style),node,type,next,anchor,text;for(node=el.firstChild;node;node=next){type=node.nodeType;next=node.nextSibling;if(type==3){if(anchor){anchor.appendData(node.data);el.removeChild(node);}
else anchor=node;if(next)continue;}
if(anchor){el.replaceChild(process(font,CSS.whiteSpace(anchor.data,style,node),style,options,node,el),anchor);anchor=null;}
if(type==1&&node.firstChild){if(/cufon/.test(node.className)){engines[options.engine](font,null,style,options,node,el);}
else arguments.callee(node,options);}}}
var HAS_BROKEN_REGEXP=' '.split(/\s+/).length==0;var sharedStorage=new Storage();var hoverHandler=new HoverHandler();var replaceHistory=new ReplaceHistory();var initialized=false;var engines={},fonts={},defaultOptions={enableTextDecoration:false,engine:null,forceHitArea:false,hover:false,hoverables:{a:true},printable:true,selector:(window.Sizzle||(window.jQuery&&function(query){return jQuery(query);})||(window.dojo&&dojo.query)||(window.$$&&function(query){return $$(query);})||(window.$&&function(query){return $(query);})||(document.querySelectorAll&&function(query){return document.querySelectorAll(query);})||(window.Ext&&Ext.query)||elementsByTagName),separate:'words',textShadow:'none'};var separators={words:/[^\S\u00a0]+/,characters:'',none:/^/};api.now=function(){DOM.ready();return api;};api.refresh=function(){replaceHistory.repeat.apply(replaceHistory,arguments);return api;};api.registerEngine=function(id,engine){if(!engine)return api;engines[id]=engine;return api.set('engine',id);};api.registerFont=function(data){var font=new Font(data),family=font.family;if(!fonts[family])fonts[family]=new FontFamily();fonts[family].add(font);return api.set('fontFamily','"'+family+'"');};api.replace=function(elements,options,ignoreHistory){options=merge(defaultOptions,options);if(!options.engine)return api;if(!initialized){CSS.addClass(DOM.root(),'cufon-active cufon-loading');CSS.ready(function(){CSS.addClass(CSS.removeClass(DOM.root(),'cufon-loading'),'cufon-ready');});initialized=true;}
if(options.hover)options.forceHitArea=true;if(typeof options.textShadow=='string')
options.textShadow=CSS.textShadow(options.textShadow);if(typeof options.color=='string'&&/^-/.test(options.color))
options.textGradient=CSS.gradient(options.color);if(!ignoreHistory)replaceHistory.add(elements,arguments);if(elements.nodeType||typeof elements=='string')elements=[elements];CSS.ready(function(){for(var i=0,l=elements.length;i<l;++i){var el=elements[i];if(typeof el=='string')api.replace(options.selector(el),options,true);else replaceElement(el,options);}});return api;};api.set=function(option,value){defaultOptions[option]=value;return api;};return api;})();Cufon.registerEngine('canvas',(function(){var check=document.createElement('canvas');if(!check||!check.getContext||!check.getContext.apply)return;check=null;var HAS_INLINE_BLOCK=Cufon.CSS.supports('display','inline-block');var HAS_BROKEN_LINEHEIGHT=!HAS_INLINE_BLOCK&&(document.compatMode=='BackCompat'||/frameset|transitional/i.test(document.doctype.publicId));var styleSheet=document.createElement('style');styleSheet.type='text/css';styleSheet.appendChild(document.createTextNode(('.cufon-canvas{text-indent:0;}'+'@media screen,projection{'+'.cufon-canvas{display:inline;display:inline-block;position:relative;vertical-align:middle;'+
(HAS_BROKEN_LINEHEIGHT?'':'font-size:1px;line-height:1px;')+'}.cufon-canvas .cufon-alt{display:-moz-inline-box;display:inline-block;width:0;height:0;overflow:hidden;text-indent:-10000in;}'+
(HAS_INLINE_BLOCK?'.cufon-canvas canvas{position:relative;}':'.cufon-canvas canvas{position:absolute;}')+'}'+'@media print{'+'.cufon-canvas{padding:0;}'+'.cufon-canvas canvas{display:none;}'+'.cufon-canvas .cufon-alt{display:inline;}'+'}').replace(/;/g,'!important;')));document.getElementsByTagName('head')[0].appendChild(styleSheet);function generateFromVML(path,context){var atX=0,atY=0;var code=[],re=/([mrvxe])([^a-z]*)/g,match;generate:for(var i=0;match=re.exec(path);++i){var c=match[2].split(',');switch(match[1]){case'v':code[i]={m:'bezierCurveTo',a:[atX+~~c[0],atY+~~c[1],atX+~~c[2],atY+~~c[3],atX+=~~c[4],atY+=~~c[5]]};break;case'r':code[i]={m:'lineTo',a:[atX+=~~c[0],atY+=~~c[1]]};break;case'm':code[i]={m:'moveTo',a:[atX=~~c[0],atY=~~c[1]]};break;case'x':code[i]={m:'closePath'};break;case'e':break generate;}
context[code[i].m].apply(context,code[i].a);}
return code;}
function interpret(code,context){for(var i=0,l=code.length;i<l;++i){var line=code[i];context[line.m].apply(context,line.a);}}
return function(font,text,style,options,node,el){var redraw=(text===null);if(redraw)text=node.alt;var viewBox=font.viewBox;var size=style.getSize('fontSize',font.baseSize);var letterSpacing=style.get('letterSpacing');letterSpacing=(letterSpacing=='normal')?0:size.convertFrom(parseInt(letterSpacing,10));var expandTop=0,expandRight=0,expandBottom=0,expandLeft=0;var shadows=options.textShadow,shadowOffsets=[];if(shadows){for(var i=shadows.length;i--;){var shadow=shadows[i];var x=size.convertFrom(parseFloat(shadow.offX));var y=size.convertFrom(parseFloat(shadow.offY));shadowOffsets[i]=[x,y];if(y<expandTop)expandTop=y;if(x>expandRight)expandRight=x;if(y>expandBottom)expandBottom=y;if(x<expandLeft)expandLeft=x;}}
var chars=Cufon.CSS.textTransform(text,style).split(''),chr;var glyphs=font.glyphs,glyph,kerning,k;var width=0,advance,jumps=[];for(var i=0,j=0,l=chars.length;i<l;++i){glyph=glyphs[chr=chars[i]]||font.missingGlyph;if(!glyph)continue;if(kerning){width-=k=kerning[chr]||0;jumps[j-1]-=k;}
width+=advance=jumps[j++]=~~(glyph.w||font.w)+letterSpacing;kerning=glyph.k;}
if(advance===undefined)return null;expandRight+=viewBox.width-advance;expandLeft+=viewBox.minX;var wrapper,canvas;if(redraw){wrapper=node;canvas=node.firstChild;}
else{wrapper=document.createElement('span');wrapper.className='cufon cufon-canvas';wrapper.alt=text;canvas=document.createElement('canvas');wrapper.appendChild(canvas);if(options.printable){var print=document.createElement('span');print.className='cufon-alt';print.appendChild(document.createTextNode(text));wrapper.appendChild(print);}}
var wStyle=wrapper.style;var cStyle=canvas.style;var height=size.convert(viewBox.height);var roundedHeight=Math.ceil(height);var roundingFactor=roundedHeight/height;var stretchFactor=roundingFactor*Cufon.CSS.fontStretch(style.get('fontStretch'));var stretchedWidth=width*stretchFactor;var canvasWidth=Math.ceil(size.convert(stretchedWidth+expandRight-expandLeft));var canvasHeight=Math.ceil(size.convert(viewBox.height-expandTop+expandBottom));canvas.width=canvasWidth;canvas.height=canvasHeight;cStyle.width=canvasWidth+'px';cStyle.height=canvasHeight+'px';expandTop+=viewBox.minY;cStyle.top=Math.round(size.convert(expandTop-font.ascent))+'px';cStyle.left=Math.round(size.convert(expandLeft))+'px';var wrapperWidth=Math.ceil(size.convert(stretchedWidth))+'px';if(HAS_INLINE_BLOCK){wStyle.width=wrapperWidth;wStyle.height=size.convert(font.height)+'px';}
else{wStyle.paddingLeft=wrapperWidth;wStyle.paddingBottom=(size.convert(font.height)-1)+'px';}
var g=canvas.getContext('2d'),scale=height/viewBox.height;g.scale(scale,scale*roundingFactor);g.translate(-expandLeft,-expandTop);g.lineWidth=font.face['underline-thickness'];g.save();function line(y,color){g.strokeStyle=color;g.beginPath();g.moveTo(0,y);g.lineTo(width,y);g.stroke();}
var textDecoration=options.enableTextDecoration?Cufon.CSS.textDecoration(el,style):{};if(textDecoration.underline)line(-font.face['underline-position'],textDecoration.underline);if(textDecoration.overline)line(font.ascent,textDecoration.overline);function renderText(){g.scale(stretchFactor,1);for(var i=0,j=0,l=chars.length;i<l;++i){var glyph=glyphs[chars[i]]||font.missingGlyph;if(!glyph)continue;if(glyph.d){g.beginPath();if(glyph.code)interpret(glyph.code,g);else glyph.code=generateFromVML('m'+glyph.d,g);g.fill();}
g.translate(jumps[j++],0);}
g.restore();}
if(shadows){for(var i=shadows.length;i--;){var shadow=shadows[i];g.save();g.fillStyle=shadow.color;g.translate.apply(g,shadowOffsets[i]);renderText();}}
var gradient=options.textGradient;if(gradient){var stops=gradient.stops,fill=g.createLinearGradient(0,viewBox.minY,0,viewBox.maxY);for(var i=0,l=stops.length;i<l;++i){fill.addColorStop.apply(fill,stops[i]);}
g.fillStyle=fill;}
else g.fillStyle=style.get('color');renderText();if(textDecoration['line-through'])line(-font.descent,textDecoration['line-through']);return wrapper;};})());Cufon.registerEngine('vml',(function(){if(!document.namespaces)return;if(document.namespaces.cvml==null){document.namespaces.add('cvml','urn:schemas-microsoft-com:vml');}
var check=document.createElement('cvml:shape');check.style.behavior='url(#default#VML)';if(!check.coordsize)return;check=null;var HAS_BROKEN_LINEHEIGHT=(document.documentMode||0)<8;document.write(('<style type="text/css">'+'.cufon-vml-canvas{text-indent:0;}'+'@media screen{'+'cvml\\:shape,cvml\\:rect,cvml\\:fill,cvml\\:shadow{behavior:url(#default#VML);display:block;antialias:true;position:absolute;}'+'.cufon-vml-canvas{position:absolute;text-align:left;}'+'.cufon-vml{display:inline-block;position:relative;vertical-align:'+
(HAS_BROKEN_LINEHEIGHT?'middle':'text-bottom')+';}'+'.cufon-vml .cufon-alt{position:absolute;left:-10000in;font-size:1px;}'+'a .cufon-vml{cursor:pointer}'+'}'+'@media print{'+'.cufon-vml *{display:none;}'+'.cufon-vml .cufon-alt{display:inline;}'+'}'+'</style>').replace(/;/g,'!important;'));function getFontSizeInPixels(el,value){return getSizeInPixels(el,/(?:em|ex|%)$|^[a-z-]+$/i.test(value)?'1em':value);}
function getSizeInPixels(el,value){if(/px$/i.test(value))return parseFloat(value);var style=el.style.left,runtimeStyle=el.runtimeStyle.left;el.runtimeStyle.left=el.currentStyle.left;el.style.left=value.replace('%','em');var result=el.style.pixelLeft;el.style.left=style;el.runtimeStyle.left=runtimeStyle;return result;}
var fills={};function gradientFill(gradient){var id=gradient.id;if(!fills[id]){var stops=gradient.stops,fill=document.createElement('cvml:fill'),colors=[];fill.type='gradient';fill.angle=180;fill.focus='0';fill.method='sigma';fill.color=stops[0][1];for(var j=1,k=stops.length-1;j<k;++j){colors.push(stops[j][0]*100+'% '+stops[j][1]);}
fill.colors=colors.join(',');fill.color2=stops[k][1];fills[id]=fill;}
return fills[id];}
return function(font,text,style,options,node,el,hasNext){var redraw=(text===null);if(redraw)text=node.alt;var viewBox=font.viewBox;var size=style.computedFontSize||(style.computedFontSize=new Cufon.CSS.Size(getFontSizeInPixels(el,style.get('fontSize'))+'px',font.baseSize));var letterSpacing=style.computedLSpacing;if(letterSpacing==undefined){letterSpacing=style.get('letterSpacing');style.computedLSpacing=letterSpacing=(letterSpacing=='normal')?0:~~size.convertFrom(getSizeInPixels(el,letterSpacing));}
var wrapper,canvas;if(redraw){wrapper=node;canvas=node.firstChild;}
else{wrapper=document.createElement('span');wrapper.className='cufon cufon-vml';wrapper.alt=text;canvas=document.createElement('span');canvas.className='cufon-vml-canvas';wrapper.appendChild(canvas);if(options.printable){var print=document.createElement('span');print.className='cufon-alt';print.appendChild(document.createTextNode(text));wrapper.appendChild(print);}
if(!hasNext)wrapper.appendChild(document.createElement('cvml:shape'));}
var wStyle=wrapper.style;var cStyle=canvas.style;var height=size.convert(viewBox.height),roundedHeight=Math.ceil(height);var roundingFactor=roundedHeight/height;var stretchFactor=roundingFactor*Cufon.CSS.fontStretch(style.get('fontStretch'));var minX=viewBox.minX,minY=viewBox.minY;cStyle.height=roundedHeight;cStyle.top=Math.round(size.convert(minY-font.ascent));cStyle.left=Math.round(size.convert(minX));wStyle.height=size.convert(font.height)+'px';var textDecoration=options.enableTextDecoration?Cufon.CSS.textDecoration(el,style):{};var color=style.get('color');var chars=Cufon.CSS.textTransform(text,style).split(''),chr;var glyphs=font.glyphs,glyph,kerning,k;var width=0,jumps=[],offsetX=0,advance;var shape,shadows=options.textShadow;for(var i=0,j=0,l=chars.length;i<l;++i){glyph=glyphs[chr=chars[i]]||font.missingGlyph;if(!glyph)continue;if(kerning){width-=k=kerning[chr]||0;jumps[j-1]-=k;}
width+=advance=jumps[j++]=~~(glyph.w||font.w)+letterSpacing;kerning=glyph.k;}
if(advance===undefined)return null;var fullWidth=-minX+width+(viewBox.width-advance);var shapeWidth=size.convert(fullWidth*stretchFactor),roundedShapeWidth=Math.round(shapeWidth);var coordSize=fullWidth+','+viewBox.height,coordOrigin;var stretch='r'+coordSize+'ns';var fill=options.textGradient&&gradientFill(options.textGradient);for(i=0,j=0;i<l;++i){glyph=glyphs[chars[i]]||font.missingGlyph;if(!glyph)continue;if(redraw){shape=canvas.childNodes[j];while(shape.firstChild)shape.removeChild(shape.firstChild);}
else{shape=document.createElement('cvml:shape');canvas.appendChild(shape);}
shape.stroked='f';shape.coordsize=coordSize;shape.coordorigin=coordOrigin=(minX-offsetX)+','+minY;shape.path=(glyph.d?'m'+glyph.d+'xe':'')+'m'+coordOrigin+stretch;shape.fillcolor=color;if(fill)shape.appendChild(fill.cloneNode(false));var sStyle=shape.style;sStyle.width=roundedShapeWidth;sStyle.height=roundedHeight;if(shadows){var shadow1=shadows[0],shadow2=shadows[1];var color1=Cufon.CSS.color(shadow1.color),color2;var shadow=document.createElement('cvml:shadow');shadow.on='t';shadow.color=color1.color;shadow.offset=shadow1.offX+','+shadow1.offY;if(shadow2){color2=Cufon.CSS.color(shadow2.color);shadow.type='double';shadow.color2=color2.color;shadow.offset2=shadow2.offX+','+shadow2.offY;}
shadow.opacity=color1.opacity||(color2&&color2.opacity)||1;shape.appendChild(shadow);}
offsetX+=jumps[j++];}
var cover=shape.nextSibling,coverFill,vStyle;if(options.forceHitArea){if(!cover){cover=document.createElement('cvml:rect');cover.stroked='f';cover.className='cufon-vml-cover';coverFill=document.createElement('cvml:fill');coverFill.opacity=0;cover.appendChild(coverFill);canvas.appendChild(cover);}
vStyle=cover.style;vStyle.width=roundedShapeWidth;vStyle.height=roundedHeight;}
else if(cover)canvas.removeChild(cover);wStyle.width=Math.max(Math.ceil(size.convert(width*stretchFactor)),0);if(HAS_BROKEN_LINEHEIGHT){var yAdjust=style.computedYAdjust;if(yAdjust===undefined){var lineHeight=style.get('lineHeight');if(lineHeight=='normal')lineHeight='1em';else if(!isNaN(lineHeight))lineHeight+='em';style.computedYAdjust=yAdjust=0.5*(getSizeInPixels(el,lineHeight)-parseFloat(wStyle.height));}
if(yAdjust){wStyle.marginTop=Math.ceil(yAdjust)+'px';wStyle.marginBottom=yAdjust+'px';}}
return wrapper;};})());
Cufon.Patch=Cufon.Patch||{};Object.extend(Cufon.Patch,{vowelClasses:{a:$A(["\u0101"]),e:$A(["\u0113"]),i:$A(["\u012b"]),o:$A(["\u014d"]),u:$A(["\u016b"])},whiteSpaceUnpatched:Cufon.CSS.whiteSpace});Cufon.CSS.whiteSpace=function(){var text=Cufon.Patch.whiteSpaceUnpatched.apply(this,arguments);$H(Cufon.Patch.vowelClasses).each(function(kv,i){kv[1].each(function(v){text=text.replace(v,kv[0]);});});return text;};
var setLoggedIn,setLoggedOut;var Behaviors=Class.create();Object.extend(Behaviors,{cufonDisabled:false,toggleFirstDescendant:function(cssRule,excludeClassName){var els=$$(cssRule);if(excludeClassName){els=els.reject(function(el){return el.hasClassName(excludeClassName);});}
els.each(this.toggleFirstDescendantForSingle);},toggleFirstDescendantForSingle:function(el){var target=el.down('a');if(Prototype.Browser.Opera){return;}
if(!/play/.test(target.className)){var targetPage="";if(target.getAttribute("target")){targetPage=target.getAttribute("target");}
new Insertion.Top(el,'<a href="'+target.href+'" target="'+targetPage+'" class="play" style="visibility:hidden;">'+'<img src="/images/btn-play-big.png" border="0">'+'</a>');var play=el.down('a.play');if(play){Event.observe(el,"mouseover",toggle_visible.bind(el,play));Event.observe(el,"mouseout",toggle_invisible.bind(el,play));Event.observe(el.firstDescendant(),"click",target.onclick);}}},toggleCurrentSeason:function(currentSeason){var cssRule=".popular-filter-nav li.season-list";var currentElementId="season-"+currentSeason;$$(cssRule).each(function(el){if(el.id==currentElementId){Element.addClassName(el,"current");}else{Element.removeClassName(el,"current");}});},applyActivatable:function(){$$('.activatable').each(function(el){Event.observe(el,"mouseover",function(){Element.addClassName(el,'active');});Event.observe(el,"mouseout",function(ev){var tg=ev.srcElement;var reltg=(ev.relatedTarget)?ev.relatedTarget:ev.toElement;if(reltg&&(typeof(reltg.up)=="function")&&(reltg.up('div.item')==el))return;if(tg&&reltg){while(reltg!=tg&&reltg.nodeName!='BODY')
reltg=reltg.parentNode;if(reltg==tg)return;}
Element.removeClassName(el,'active');});el.removeClassName('activatable');});},applyCufon:function(){if(Behaviors.cufonDisabled)return false;Cufon.replace('h2.hoverable',{hover:true});Cufon.replace('h2');Cufon.replace('h3.topics');Cufon.replace('h3.most-subscribed-title');$$("h2").each(function(el){el.style.visibility="visible";});},setLoggedIn:function(explicit_login){var uid=Behaviors.getUserId();var uname=Behaviors.getUsername();var sid=Behaviors.getCookie('_hulu_session');if(sid&&uid&&uname){if(setLoggedIn)setLoggedIn();var el=$('welcome-username');if(el){uname=uname.substring(0,20).gsub(/\+/,' ');if(uname!="null"&&uname!="undefined")
el.update("Welcome "+uname);}
FloatingLoginForm.hide();Nav.loggedIn();Behaviors.resetPlaylistLinks();ContinuousPlay.loggedIn();Behaviors.loggedIn=true;if(explicit_login){UserHistory.clearHistory();}}
else{Behaviors.setLoggedOut();}},setLoggedOut:function(explicit_logout){if(explicit_logout){UserHistory.clearHistory();SocialFeed.loggedOut();}
if(setLoggedOut)setLoggedOut();Behaviors.eraseCookie('_hulu_session');Behaviors.loggedIn=false;Nav.loggedOut();FloatingLoginForm.hide();VideoRating.reenableAll();ContinuousPlay.loggedOut();Behaviors.resetPlaylistLinks();},afterLogin:function(){Element.hide($('popup_frame'));this.setLoggedIn();Menu.hideAll();},afterLogout:function(){Element.hide($('popup_frame'));this.setLoggedOut();this.resetPlaylistLinks();Menu.hideAll();},loggedIn:false,onLoad:function(){this.toggleFirstDescendant(".play-button-hover","no-hover");this.applyActivatable();CheckboxPlus.applyCheckboxBehaviors();},playlistInvalid:true,refreshingPlaylist:false,addToPlaylistComplete:function(el,response){el=$(el);var text='';var textEl=$(el.id+'-text');if(/Added/.test(response)){Menu.hideAll();Behaviors.playlistInvalid=true;el.hide();text=response;}
else{el.addClassName('logged-out-hide');text='<span class="logged-in-remove">'+response+'</span>';}
textEl.update(text);textEl.show();},resetPlaylistLinks:function(){$$('.logged-in-remove').each(function(el){el.parentNode.removeChild(el);});$$('.logged-out-hide').each(function(el){el.removeClassName('logged-out-hide');});$$('.playlist-link').each(function(el){if(/-text$/.test(el.id)){el.hide();}
else{el.show();}});},onSubscribeSuccess:function(el){el=el.up('span');if(!el)return;if(Behaviors.loggedIn){Behaviors.updateLoggedInAction(el,'<img class="logged-in-remove" src="/images/icon-check.gif" height="16" width="16" title="You have subscribed to this title" />');}
else{Behaviors.updateLoggedInAction(el,'<img class="logged-in-remove" src="/images/icon-warning.gif" height="16" width="16" title="Please login first before subscribing to this title" />');ModalPopup.warn("Please login first before subscribing to this title");}},onQueueSuccess:function(el){el=$(el).up('span');if(!el)return;if(Behaviors.loggedIn){Behaviors.updateLoggedInAction(el,'<img class="logged-in-remove" src="/images/icon-check.gif" height="16" width="16" title="You have queued this video" />');Menu.hideAll();Behaviors.playlistInvalid=true;}
else{Behaviors.updateLoggedInAction(el,'<img class="logged-in-remove" src="/images/icon-warning.gif" height="16" width="16" title="Please login first before queuing this video" />');ModalPopup.warn("Please login first before queuing this video");}},onEmailNotificationSuccess:function(el){el=$(el).up('span');if(!el)return;if(Behaviors.loggedIn){Behaviors.updateLoggedInAction(el,'<img class="logged-in-remove" src="/images/icon-check.gif" height="16" width="16" title="You have requested to be notified by email when this video becomes available on Hulu" />');Menu.hideAll();Behaviors.playlistInvalid=true;}
else{Behaviors.updateLoggedInAction(el,'<img class="logged-in-remove" src="/images/icon-warning.gif" height="16" width="16" title="Please login first before requesting a notification email for this video" />');ModalPopup.warn("Please login first before requesting a notification email for this video");}},updateLoggedInAction:function(el,html){var a=el.down('a');if(a&&!a.hasClassName('logged-out-hide')){a.addClassName('logged-out-hide');new Insertion.Bottom(el,html);}},getCookie:function(name){var value=null;if(typeof(document.cookie)!='undefined'){$A(document.cookie.split(';')).each(function(v){var kv=v.split('=');if(name.toLowerCase()==kv[0].toLowerCase().strip()){value=kv[1].strip();throw $break;}});}
return value;},setCookie:function(name,value,days){if(typeof(document.cookie)=='undefined')return;var expires=new Date();if(days){expires.setTime(expires.getTime()+(days*24*60*60*1000));}
else{expires.setMonth(expires.getMonth()+1);}
var encode=encodeURIComponent||escape;value=encode(name)+'='+encode(value);value+='; expires='+expires.toUTCString();value+='; path=/';document.cookie=value;},eraseCookie:function(name){Behaviors.setCookie(name,"",-1);},getUsername:function(){return Utf8.decode(unescape(Behaviors.getCookie('_hulu_uname')));},getUserId:function(){var value=Behaviors.getCookie('_hulu_uid');return value?parseInt(value):-1;},getEmailValidationStatus:function(){var value=Behaviors.getCookie('_hulu_evs');return value?parseInt(value):-1;},isLoggedIn:function(){var value=Behaviors.getCookie('_hulu_session');Behaviors.loggedIn=(value!=null&&!value.blank());return Behaviors.loggedIn;},isEmailValidated:function(){return Behaviors.getEmailValidationStatus()>0;},updateFooterLinks:function(){$$('.footer-link').each(function(link){link.href+='?from=footer';});}});var Utf8={decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}};Behaviors.applyCufon();Ajax.Responders.register({onComplete:function(transport){Behaviors.onLoad();Behaviors.applyCufon();if(transport&&transport.url&&/add_to_playlist/.test(transport.url)){google_analytics_ajax(transport.url);}}});
var SearchTracking={searchItem:null,resultSetId:'',sortBy:'relevance',pageNum:1,st:0,send:function(item,page_num,filter_type,filter_value,original_url,result_set_id,sort_by,ref,search_type,st){var search_item,page_num,userId,searchUserId;var company_filter,type_filter,show_filter,special_feature_filter;search_item=item||this.getSearchItem();if(!search_item)
return true;this.searchItem=search_item;this.resultSetId=result_set_id||this.resultSetId;this.pageNum=page_num||this.pageNum;this.sortBy=sort_by||this.sortBy;this.st=st||this.st;userId=Behaviors.getUserId();searchUserId=this.getSearchUserId();if(filter_type=='All')
company_filter=type_filter='All';else{switch(filter_type){case'company':company_filter=filter_value;break;case'type':type_filter=filter_value;break;case'showname':show_filter=filter_value;break;case'special_feature':special_feature_filter=filter_value;break;}
company_filter=company_filter||this.getCompanyFilter();type_filter=type_filter||this.getTypeFilter();show_filter=show_filter||this.getShowFilter();special_feature_filter=special_feature_filter||this.getSpecialFeatureFilter();}
original_url=original_url||'';if(document.images){var url=encodeURIComponent||escape;var source="itemId="+url(this.guid())
+"&resultSetId="+url(this.resultSetId)
+"&userId="+url(userId)
+"&searchUserId="+url(searchUserId)
+"&searchItem="+url(search_item)
+"&page="+url(this.pageNum)
+"&company="+url(company_filter)
+"&type="+url(type_filter)
+"&show="+url(show_filter)
+"&special_feature="+url(special_feature_filter)
+"&sortBy="+url(this.sortBy)
+"&location="+url(original_url)
+"&ref="+url(ref)
+"&search_type="+url(search_type)
+"&st="+url(this.st);pingImage("http://208.91.157.18/SearchTracking/SearchItem.ashx?"+source);}
return true;},sendWhole:function(item,page_num,type_filter,show_filter,company_filter,spec_fitler,original_url,result_set_id,sort_by,ref,search_type,st){this.searchItem=item;this.pageNum=page_num||this.pageNum;this.sortBy=sort_by||this.sortBy;this.st=st||this.st
if(document.images){var url=encodeURIComponent||escape;var source="itemId="+url(this.guid())
+"&resultSetId="+url(result_set_id)
+"&userId="+url(Behaviors.getUserId())
+"&searchUserId="+url(this.getSearchUserId())
+"&searchItem="+url(item)
+"&page="+url(page_num)
+"&company="+url(company_filter||'All')
+"&type="+url(type_filter||'All')
+"&show="+url(show_filter||'All')
+"&special_feature="+url(spec_fitler||'All')
+"&sortBy="+url(sort_by)
+"&location="+url(original_url)
+"&ref="+url(ref)
+"&search_type="+url(search_type)
+"&st="+url(this.st);pingImage("http://208.91.157.18/SearchTracking/SearchItem.ashx?"+source);}},S4:function(){return(((1+Math.random())*0x10000)|0).toString(16).substring(1);},guid:function(){return(this.S4()+this.S4()
+"-"+this.S4()
+"-"+this.S4()
+"-"+this.S4()
+"-"+this.S4()+this.S4()+this.S4()).toUpperCase();},getSearchItem:function(){if(this.searchItem!=null)return this.searchItem;var search_item=$('search-item');if(!search_item)return null;search_item=search_item.firstChild.href.split('=')[1].split("&");return search_item[0].replace(/\+/g,' ');},getCompanyFilter:function(){var company_filter=$('company-selected-item')||'All';return(company_filter=='All')?company_filter:company_filter.innerHTML;},getTypeFilter:function(){var type_filter=$('type-selected-item')||'All';return(type_filter=='All')?type_filter:type_filter.innerHTML;},getShowFilter:function(){var showname_filter=$('showname-selected-item')||'All';return(showname_filter=='All')?showname_filter:showname_filter.innerHTML;},getSpecialFeatureFilter:function(){var special_feature_filter=$('special_feature-selected-item')||'All';return(special_feature_filter=='All')?special_feature_filter:special_feature_filter.innerHTML;},getSearchUserId:function(){var value=Behaviors.getCookie('_hulu_su');if(!value)
{this.setSearchUserId();value=Behaviors.getCookie('_hulu_su');}
return value?value:-1;},setSearchUserId:function(){Behaviors.setCookie('_hulu_su',this.guid(),30);return true;},openFeedback:function(el){var menu=$('search-feedback');if(menu&&el){var xy=Position.positionedOffset(el);menu.style.top=(xy[1]-menu.getHeight()+el.getHeight())+'px';menu.style.left=(xy[0]-(menu.getWidth()/2))+'px';menu.show();var form=menu.down('form');if(form)Form.reset(form);}
return false;},trackSearchForm:function(form_id){var form=$(form_id);if(!form)return;var query=form.query.value;SearchTracking.setSearchUserId();if(form_id=="bottom_search_form")
SearchTracking.send(query,1,'All',null,null,null,null,"btm");else if(form_id=="advanced_search_form")
SearchTracking.send(query,1,'All',null,null,null,null,"adv");else
SearchTracking.send(query,1,'All',null,null);}};
var ChannelShowTracking={send_channel:function(item,channel,sub_channel,type){if(document.images){var url=encodeURIComponent||escape;var source="scope=channel"
+"&item="+url(item)
+"&channel="+url(channel||"All")
+"&subChannel="+url(sub_channel||"All")
+"&type="+url(type)
+"&item_id="+url(SearchTracking.guid());pingImage("http://208.91.157.18/SearchTracking/ChannelShow.ashx?"+source);}
return true;},send_show:function(item,show_id,show_name,place){if(document.images){var url=encodeURIComponent||escape;var source="scope=show"
+"&item="+url(item)
+"&showId="+url(show_id)
+"&showName="+url(show_name)
+"&place="+url(place)
+"&item_id="+url(SearchTracking.guid());pingImage("http://208.91.157.18/SearchTracking/ChannelShow.ashx?"+source);}
return true;}};
var Menu=Class.create();Object.extend(Menu,{setup:function(anchor,el,x,y){this.knownMenus=this.knownMenus||{};this.knownMenus[el.id]={};var pos=Position.cumulativeOffset(anchor);var left=pos[0]+anchor.offsetWidth-el.getWidth();var top=pos[1]+anchor.offsetHeight;el.style.left=left+x+"px";el.style.top=top+y+"px";},toggle:function(anchor,el,x,y,after){if(this.animating)return;el=$(el);anchor=$(anchor)
var dir='top-right';if(el.id=="browse")dir='top-middle';if(!el.isDown){this.setup(anchor,el,x,y);this.hideAll();this.animating=true;new Effect.Grow(el,{direction:dir,duration:0.4,afterFinish:function(){if(typeof(after)=="function")after();this.animating=false;}.bind(this)});el.isDown=true;}
else{this.animating=true;new Effect.Shrink(el,{direction:dir,duration:0.4,afterFinish:function(){this.animating=false;}.bind(this)});el.isDown=false;}},hideAll:function(){for(var p in this.knownMenus){var el=$(p);if(p.oncheck)p.oncheck();else Element.hide(p);el.isDown=false;}}});
function overrideDocumentWrite(){var SourceMatch=new RegExp('<script[^>]+src="([^"]+)"',"im");document.write=function(){var str="";for(i=0;i<arguments.length;i++){str+=arguments[i];}
var matches=str.match(new RegExp(Prototype.ScriptFragment,"img"))||[];matches.each(function(frag){var src=frag.match(SourceMatch);if(src){delayedInclude(src[1],null,0);}
else{frag.evalScripts();}});var body=document.getElementsByTagName('body');if(body)body=body[0];if(body)new Insertion.Bottom(body,str);};}
function delayedInclude(src,afterInclude,timeout){setTimeout(function(){var delayed_container=$('delayed-js-container');if(delayed_container){var script=document.createElement('script');script.src=src;script.type='text/javascript';delayed_container.appendChild(script);if(afterInclude){setTimeout(afterInclude,1500);}}},timeout||500);}
function pingImage(url){var img=new Image();if(Prototype.Browser.IE){img.onload=function(){};}
img.src=url;return img;};function installOpenSearch(){if((typeof window.external=="object")&&((typeof window.external.AddSearchProvider=="unknown")||(typeof window.external.AddSearchProvider=="function"))){window.external.AddSearchProvider("http://www.hulu.com/opensearch.xml");}else{ModalPopup.warn("This plugin requires a browser that supports OpenSearch.  Browsers that support OpenSearch include Firefox, Chrome and Internet Explorer.");}}
function toggle_visible(el){if(typeof($)=='undefined')return;var img=$(el);if(!img)return;img.style.visibility="visible";}
function toggle_invisible(el){if(typeof($)=='undefined')return;var img=$(el);if(!img)return;img.style.visibility="hidden";}
function google_analytics_ajax(path){if(typeof(_pt)!='undefined'&&_pt)_pt._trackPageview(path);}
var TitleHack={originalDocumentTitle:document.title,fixOnFocus:function(el){Event.observe(el,"focus",function(){if(document.title!=TitleHack.originalDocumentTitle)
document.title=TitleHack.originalDocumentTitle;});}};Object.extend(Hash.prototype,(function(){function toQueryPair(key,value){if(Object.isUndefined(value))return key;return key+'='+encodeURIComponent(String.interpret(value));}
return{toSortedQueryString:function(){return this.keys().sort().inject([],function(results,key){var values=this.get(key);key=encodeURIComponent(key);if(values&&typeof values=='object'){if(Object.isArray(values))
return results.concat(values.map(toQueryPair.curry(key)));}
else{results.push(toQueryPair(key,values));}
return results;}.bind(this)).join('&');}};})());function _tol(s){return $R(0,Math.ceil(s.length/4)-1).map(function(i){return s.charCodeAt(i*4)+(s.charCodeAt(i*4+1)<<8)+(s.charCodeAt(i*4+2)<<16)+(s.charCodeAt(i*4+3)<<24);});}
function _dobfu(text){return text.slice(0,7)!='dobfu__'?text:$A(_tol(unescape(text.substring(7)))).map(function(i){i=0xfeedface^i;return String.fromCharCode(i&0xFF,i>>>8&0xFF,i>>>16&0xFF,i>>>24&0xFF);}).join('').replace(/\\0+$/,'');}
function sitePerformedInvite(id){var r=/(REMO_INVITE)=([^;]*)/gi.exec(document.cookie);return(r&&unescape(r[2]));}
function siteInvited(id){id!=undefined||(id='1');var ex=new Date(new Date().getTime()+(86400000*180));document.cookie='REMO_INVITE'+'='+escape(id)+((!ex||!(ex instanceof Date))?'':('; expires='+ex.toGMTString()))+';path=/; domain=Hulu.com';}
function ssr(st){return st;}
function esr(st){return"";}
var RadioButton={toggle:function(el,group){if(!el||group=="")return false;if(!el.hasClassName('pressed')){var input=el.down('input');if(input)input.checked="true";var buttons=$$('a.'+group);buttons.each(function(b){b.removeClassName('pressed');});el.addClassName('pressed');}}};var ModalPopup={previousContainer:null,defaultWidth:350,modalClickEventHandler:function(event){if(event.element().id=='modal-popup')
ModalPopup.hide();return false;},init:function(){Event.observe(window,'load',function(){$$('.overlay-full').each(function(el){el.onclick=new Function("ModalPopup.hide(); return false;");});if($('modal-popup'))$('modal-popup').observe('click',ModalPopup.modalClickEventHandler);});},hide:function(){$('modal-popup').hide();$$('.overlay-full').each(function(el){el.hide();});if(ModalPopup.previousContainer){content=$('modal-text').down('div.content');ModalPopup.previousContainer.appendChild(content);ModalPopup.previousContainer=null;}},show:function(){var offset=document.viewport.getScrollOffsets();var popupTop=offset.top+((document.viewport.getHeight()-$('modal-popup').getHeight())/2);var playerDiv=$('breakout-container');if(playerDiv){var minTop=playerDiv.cumulativeOffset().top+playerDiv.getHeight()+20;if(popupTop<minTop)popupTop=minTop;}
$('modal-popup').style.top=popupTop+"px";$('modal-popup').style.left=offset.left+"px";$$('.overlay-full').each(function(el){el.show();});$('modal-popup').show();},warn:function(warning){$('modal-popup-container').down('.popup-bar').show();$('close-popup').up('a').onclick=new Function("ModalPopup.hide(); return false;");$('modal-popup-container').down('.popup-bar-19h').hide();$('accept-popup').hide();$('reject-popup').hide();$('dismiss-popup').show();$('modal-text').hide();$('modal-question').innerHTML=warning;$('modal-question').show();$('modal-popup-container').style.width=ModalPopup.defaultWidth+"px";this.show();},ask:function(question,accept,reject){$('accept-popup').up('a').onclick=new Function("ModalPopup.hide(); "+accept+" return false;");$('reject-popup').up('a').onclick=new Function("ModalPopup.hide(); "+reject+" return false;");$('modal-popup-container').down('.popup-bar').show();$('close-popup').up('a').onclick=new Function("ModalPopup.hide(); return false;");$('modal-popup-container').down('.popup-bar-19h').hide();$('dismiss-popup').hide();$('accept-popup').show();$('reject-popup').show();$('modal-text').hide();$('modal-question').innerHTML=question;$('modal-question').show();$('modal-popup-container').style.width=ModalPopup.defaultWidth+"px";this.show();},display:function(text,width,height){if(arguments.length==3)$('modal-popup-container').style.height=height+"px";if(arguments.length>=2)$('modal-popup-container').style.width=width+"px";else $('modal-popup-container').style.width=ModalPopup.defaultWidth+"px";$('modal-popup-container').down('.popup-bar').show();$('close-popup').up('a').onclick=new Function("ModalPopup.hide(); return false;");$('modal-popup-container').down('.popup-bar-19h').hide();$('dismiss-popup').hide();$('accept-popup').hide();$('reject-popup').hide();$('modal-question').hide();$('modal-text').innerHTML=text;$('modal-text').show();this.show();},display_thick:function(text,width,height){if(arguments.length==3)$('modal-popup-container').style.height=height+"px";if(arguments.length>=2)$('modal-popup-container').style.width=width+"px";else $('modal-popup-container').style.width=ModalPopup.defaultWidth+"px";$('modal-popup-container').down('.popup-bar-19h').show();$('close-popup-19h').up('a').onclick=new Function("ModalPopup.hide(); return false;");$('modal-popup-container').down('.popup-bar').hide();$('dismiss-popup').hide();$('accept-popup').hide();$('reject-popup').hide();$('modal-question').hide();$('modal-text').innerHTML=text;$('modal-text').show();this.show();},display_div:function(contentDiv,width,height){if(arguments.length==3)$('modal-popup-container').style.height=height+"px";if(arguments.length>=2)$('modal-popup-container').style.width=width+"px";else $('modal-popup-container').style.width=ModalPopup.defaultWidth+"px";$('modal-popup-container').down('.popup-bar').show();$('close-popup').up('a').onclick=new Function("ModalPopup.hide(); return false;");$('modal-popup-container').down('.popup-bar-19h').hide();$('dismiss-popup').hide();$('accept-popup').hide();$('reject-popup').hide();$('modal-question').hide();content=contentDiv.down('div.content');ModalPopup.previousContainer=contentDiv;$('modal-text').innerHTML="";$('modal-text').appendChild(content);$('modal-text').show();this.show();},display_div_thick:function(contentDiv,width,height){if(arguments.length==3)$('modal-popup-container').style.height=height+"px";if(arguments.length>=2)$('modal-popup-container').style.width=width+"px";else $('modal-popup-container').style.width=ModalPopup.defaultWidth+"px";$('modal-popup-container').down('.popup-bar-19h').show();$('close-popup-19h').up('a').onclick=new Function("ModalPopup.hide(); return false;");$('modal-popup-container').down('.popup-bar').hide();$('dismiss-popup').hide();$('accept-popup').hide();$('reject-popup').hide();$('modal-question').hide();content=contentDiv.down('div.content');ModalPopup.previousContainer=contentDiv;$('modal-text').innerHTML="";$('modal-text').appendChild(content);$('modal-text').show();this.show();}};ModalPopup.init();Prototype.Browser.IE6=Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==6;
var Nav=Class.create();Object.extend(Nav,{over:function(el){$(el).addClassName('hover');},out:function(el){$(el).removeClassName('hover');},click:function(el){var a=$(el).down('a');if(a&&a.href){window.location=a.href;}},updateAuxiliary:function(){var q_el=$('your-queue-link');var uid=Behaviors.getUserId();if(!q_el||uid<=0){Nav.resetAuxiliary();}
else{new Ajax.Request('/users/nav_auxiliary_info/'+uid,{method:'get',onSuccess:function(req){var res=req.responseText.split(",");var q_count=parseInt(res[0]);if(q_count>=0){q_el.update(q_el.innerHTML.replace(/( +\([0-9]+\))?$/,' ('+q_count+')'));}}});}},resetAuxiliary:function(){var q_el=$('your-queue-link');if(q_el)q_el.update(q_el.innerHTML.replace(/( +\([0-9]+\))?$/,''));},loggedOut:function(){$('logged-in-nav').hide();$('logged-out-nav').show();Nav.resetAuxiliary();},loggedIn:function(){$('logged-in-nav').show();$('logged-out-nav').hide();Nav.updateAuxiliary();}});
var Login=Class.create();Object.extend(Login,{WORKING_IMAGE:'<img src="/images/loading-animated-circle.gif" '+'width="16" height="16" border="0" class="login-'+'status-loading"/>',from_flf:false,action_elem:null,in_lightbox:false,setup:function(){$$('.dummy').each(function(el){Element.observe(el,"focus",Login.activate);Element.observe(el,"keypress",Login.handleKeys);Element.observe(el,"click",Login.activate);});this.clear();},setActionElement:function(el){action_elem=el;from_flf=true;},setInLightbox:function(from_lightbox){Login.in_lightbox=from_lightbox;},activate:function(ev){var el=Event.element(ev);if(el&&el.hasClassName("inactive")){var form=el.up();var dummies=$A(form.getElementsByClassName('dummy'));if(dummies)dummies.each(Element.remove);var login=form.down('.login');login.show();var password=form.down('.password');password.show();Event.observe(password,'keypress',Login.handleKeys);login.focus();}},handleKeys:function(ev){if(27==ev.keyCode){Login.cancel();}
if(13==ev.keyCode){Event.stop(ev);var el=Event.element(ev);if(el){if(!el.hasClassName('.login-form'))el=el.up('.login-form');var submit=el.down('.login-submit');submit.click();}}},clear:function(){$$('.inactive').each(function(el){el.value=el.hasClassName("login")?"email":"password";});},show:function(el){if(el){$$('.usernav').each(Element.hide);$$('.login-form').each(Element.hide);var warning=$('review-login-warning');if(warning)warning.show();FloatingLoginForm.hide();el.show();try{el.down('.login-status-img').hide();el.down('.login-status').hide();el.down('.login').activate();}
catch(e){}}
from_flf=false;action_elem=null;},submitted:false,submit:function(el){if(Login.submitted)return;Login.submitted=true;if(!el.hasClassName('.login-form'))el=el.up('.login-form');if(el){var status_img=el.down('.login-status-img');if(status_img){status_img.update(Login.WORKING_IMAGE);status_img.show();}}
var login=el.down('.login');var password=el.down('.password');if(login&&password&&!login.value.strip().blank()&&!password.value.blank()){var stay_logged_in=el.down('.stay-logged-in');if(stay_logged_in&&stay_logged_in.checked==false)
this.auth(login.value,password.value,false);else
this.auth(login.value,password.value,true);}
else
this.onError("Please enter both your email and password.");Login.submitted=false;},cancel:function(){$$('.login-form').each(Element.hide);from_flf=false;action_elem=null;this.onComplete();},currentForm:function(){var form=$$('.login-form').find(function(el){return'none'!=el.style.display;});return form;},switchExpire:function(fromElem){if(fromElem){var el=fromElem.up();if(el)el=el.down('input.stay-logged-in');if(el){if(el.checked==false)
el.checked=true;else
el.checked=false;}}
else{var el=Login.currentForm();if(el)el=el.down('input.stay-logged-in');if(el){if(el.checked==false)
el.checked=true;else
el.checked=false;}}},showPrivacy:function(){if(Login.in_lightbox){Login.in_lightbox=false;from_flf=false;action_elem=null;}
this.onComplete();$('privacy-acceptance-loading').hide();$('accept-not-button').simulate('mouseout');ModalPopup.display_div($('accept-choice'),380);},showEmailValidation:function(){if(Login.in_lightbox){Login.in_lightbox=false;from_flf=false;action_elem=null;}
ModalPopup.ask("In our new efforts to combat spam on Hulu, we now require users to verify their email \
       addresses before posting on Hulu.  Please first verify or <a href=\"/profile/edit\" class=\"utility-link\" style=\"font-size: 12px;\"> \
       update</a> your email address before continuing.<br/><br/>Would you like us to send a \
       verification request to your email now?","new Ajax.Request('/account/send_email_validation');","");},acceptPrivacy:function(){$('privacy-acceptance-loading').show();this.accept_privacy();},showDeny:function(){ModalPopup.hide();$('back-button').simulate('mouseout');$('ok-continue-button').simulate('mouseout');ModalPopup.display_div($('deny-choice'),380);},onError:function(error){var el=Login.currentForm();if(el){var s=el.down('.login-status-img');if(s)s.hide();}
if(el)el=el.down('.login-status');if(el){el.update(error);el.show();el=Login.currentForm().down('.login');if(el)el.activate();}
from_flf=false;action_elem=null;},onComplete:function(){var el=Login.currentForm();if(el)el.hide();Behaviors.setLoggedIn(true);if(Behaviors.isLoggedIn()&&from_flf&&action_elem){action_elem=$(action_elem);action_elem.simulate('click');from_flf=false;action_elem=null;}
if(!Login.in_lightbox)
ModalPopup.hide();this.clear();}});
if(typeof deconcept=="undefined")var deconcept=new Object();if(typeof deconcept.util=="undefined")deconcept.util=new Object();if(typeof deconcept.SWFObjectUtil=="undefined")deconcept.SWFObjectUtil=new Object();deconcept.SWFObject=function(swf,id,w,h,ver,c,quality,xiRedirectUrl,redirectUrl,detectKey){if(!document.getElementById){return;}
this.DETECT_KEY=detectKey?detectKey:'detectflash';this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(swf){this.setAttribute('swf',swf);}
if(id){this.setAttribute('id',id);}
if(w){this.setAttribute('width',w);}
if(h){this.setAttribute('height',h);}
if(ver){this.setAttribute('version',new deconcept.PlayerVersion(ver.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload();}
if(c){this.addParam('bgcolor',c);}
var q=quality?quality:'high';this.addParam('quality',q);this.setAttribute('useExpressInstall',false);this.setAttribute('doExpressInstall',false);var xir=(xiRedirectUrl)?xiRedirectUrl:window.location;this.setAttribute('xiRedirectUrl',xir);this.setAttribute('redirectUrl','');if(redirectUrl){this.setAttribute('redirectUrl',redirectUrl);}}
deconcept.SWFObject.prototype={useExpressInstall:function(path){this.xiSWFPath=!path?"expressinstall.swf":path;this.setAttribute('useExpressInstall',true);},setAttribute:function(name,value){this.attributes[name]=value;},getAttribute:function(name){return this.attributes[name];},addParam:function(name,value){this.params[name]=value;},getParams:function(){return this.params;},addVariable:function(name,value){this.variables[name]=value;},getVariable:function(name){return this.variables[name];},getVariables:function(){return this.variables;},getVariablePairs:function(){var variablePairs=new Array();var key;var variables=this.getVariables();for(key in variables){variablePairs[variablePairs.length]=key+"="+variables[key];}
return variablePairs;},getSWFHTML:function(){var swfNode="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute('swf',this.xiSWFPath);}
var i=this.getAttribute('height');if(Prototype['Bro'+'wser']['f']&&this.getAttribute('id')=='pla'+'yer'){i=parseInt(i)-20;}
swfNode='<embed type="application/x-shockwave-flash" src="'+this.getAttribute('swf')+'" width="'+this.getAttribute('width')+'" height="'+i+'" style="'+this.getAttribute('style')+'"';swfNode+=' id="'+this.getAttribute('id')+'" name="'+this.getAttribute('id')+'" ';var params=this.getParams();for(var key in params){swfNode+=[key]+'="'+params[key]+'" ';}
var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='flashvars="'+pairs+'"';}
swfNode+='/>';}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute('swf',this.xiSWFPath);}
swfNode='<object id="'+this.getAttribute('id')+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" style="'+this.getAttribute('style')+'">';var swf=this.getAttribute('swf');var bust=parseInt(Math.random()*100000).toString();bust+=(new Date()).valueOf().toString();swfNode+='<param name="movie" value="'+swf+'" />';var params=this.getParams();for(var key in params){swfNode+='<param name="'+key+'" value="'+params[key]+'" />';}
var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='<param name="flashvars" value="'+pairs+'" />';}
swfNode+="</object>";}
return swfNode;},write:function(elementId){if(this.getAttribute('useExpressInstall')){var expressInstallReqVer=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(expressInstallReqVer)&&!this.installedVer.versionIsValid(this.getAttribute('version'))){this.setAttribute('doExpressInstall',true);this.addVariable("MMredirectURL",escape(this.getAttribute('xiRedirectUrl')));document.title=document.title.slice(0,47)+" - Flash Player Installation";if(TitleHack&&TitleHack.originalDocumentTitle)
TitleHack.originalDocumentTitle=document.title;this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute('doExpressInstall')||this.installedVer.versionIsValid(this.getAttribute('version'))){var n=(typeof elementId=='string')?document.getElementById(elementId):elementId;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute('redirectUrl')!=""){document.location.replace(this.getAttribute('redirectUrl'));}}
return false;}}
deconcept.SWFObjectUtil.getPlayerVersion=function(){var PlayerVersion=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];var m=navigator.mimeTypes?navigator.mimeTypes["application/x-shockwave-flash"]:false;if(x&&x.description&&m&&m.enabledPlugin){PlayerVersion=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var counter=3;while(axo){try{counter++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+counter);PlayerVersion=new deconcept.PlayerVersion([counter,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");PlayerVersion=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(PlayerVersion.major==6){return PlayerVersion;}}
try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}
if(axo!=null){PlayerVersion=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return PlayerVersion;}
deconcept.PlayerVersion=function(arrVersion){this.major=arrVersion[0]!=null?parseInt(arrVersion[0]):0;this.minor=arrVersion[1]!=null?parseInt(arrVersion[1]):0;this.rev=arrVersion[2]!=null?parseInt(arrVersion[2]):0;}
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major)return false;if(this.major>fv.major)return true;if(this.minor<fv.minor)return false;if(this.minor>fv.minor)return true;if(this.rev<fv.rev)return false;return true;}
deconcept.util={getRequestParameter:function(param){var q=document.location.search||document.location.hash;if(param==null){return q;}
if(q){var pairs=q.substring(1).split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return pairs[i].substring((pairs[i].indexOf("=")+1));}}}
return"";}}
deconcept.SWFObjectUtil.cleanupSWFs=function(){var objects=document.getElementsByTagName("OBJECT");for(var i=objects.length-1;i>=0;i--){objects[i].style.display='none';for(var x in objects[i]){if(typeof objects[i][x]=='function'){objects[i][x]=function(){};}}
objects[i].parentNode.removeChild(objects[i]);}}
deconcept.SWFObject.doPrepUnload=function(){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);}
window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}
if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];}}
var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
var cram=(function(){function appendDiv(fn){if(!document.createElement)return null;var body=document.getElementsByTagName('body');body=body.length>0?body[0]:null;if(!body)return null;var div=document.createElement('div');if(!div)return null;fn(div);body.appendChild(div);return div;}
var backend=function(){this.store={};this.target=this;this.get=function(key){return this.store[key];}
this.set=function(key,value){this.store[key]=value;}
this.remove=function(key){delete this.store[key];}
this.free=function(){delete this.target;};};backend.valid=function(){return true;}
backend.create=function(valid,init){var k=init||function(){};k.valid=valid||backend.valid;k.prototype=new backend();return k;};var fake=backend.create();var html5=backend.create(function(){return window.localStorage&&window.localStorage.getItem;},function(){var store=window.localStorage;this.target=store;this.get=store.getItem;this.set=store.setItem;this.remove=store.removeItem;});var userData=backend.create(function(){return!!window.ActiveXObject;},function(){var store=appendDiv(function(div){div.id='_cram_userData';div.style.display='none';div.addBehavior('#default#userData');});store.load("_cram");this.target=store;this.get=function(k){if(store)return store.getAttribute(k);};this.set=function(k,v){if(store)store.setAttribute(k,v);}
this.remove=function(k){store.removeAttribute(k);}
this.free=function(){this.target=null;store=null;};});var flash=backend.create(function(){return window.SWFObject;},function(){var div=appendDiv(function(div){div.id='_cram_flash';div.style.position='absolute';div.style.top='-100px';div.style.left='-100px';});if(!div)return;var so=new SWFObject("cram.swf","_cram_swf","1","1","9");so.addParam("allowScriptAccess","sameDomain");if(so.write("_cram_flash")){var swf=document.getElementById('_cram_swf');if(swf){this.target=swf;this.get=function(k){if(swf&&swf.get)return swf.get(k);};this.set=function(k,v){if(swf&&swf.set)swf.set(k,v);};this.remove=function(k){if(swf&&swf.remove)swf.remove(k);};this.free=function(){delete this.target;swf=null;};}}});var methods={html5:html5,userData:userData,flash:flash,fake:fake};var store=null;function unesc(value){return unescape(value.toString()).evalJSON(true);}
function esc(value){return escape(Object.toJSON(value));}
function execute(method,args){if(store&&store.target&&store[method]){try{var value=store[method].apply(store.target,args);if(value)return unesc(value);}
catch(e){return null;}}}
var self={load:function(){for(var method in methods){if(methods[method].valid()){store=new methods[method]();break;}}},unload:function(){if(store)store.free();},setStore:function(manualStore){store=manualStore;},methods:methods,get:function(key){return execute('get',[key]);},set:function(key,value){execute('set',[key,esc(value)]);},remove:function(key){execute('remove',[key]);}};if(Event&&Event.observe){Event.observe(window,"load",self.load);Event.observe(window,"unload",self.unload);}
return self;})();
function vcs_DoFSCommand(){VersionCheck.loaded(arguments[1]);}
var VersionCheck={failedWrites:[],loaded:function(version){var v=version;if(v)v=v.split(" ")[1];if(v)v=v.split(",");VersionCheck.debugCallback(v);VersionCheck.rewriteFailed(v);},debugCallback:function(){},rewriteFailed:function(v){$A(VersionCheck.failedWrites).each(function(failed){failed.swfObject.installedVer=new deconcept.PlayerVersion(v);failed.swfObject.write(failed.target);});},run:function(){var check=new SWFObject("/vc.swf","vcs","1","1","0");check.addParam("allowScriptAccess","always");check.addParam("wmode","transparent");if(!check.write("vc")){VersionCheck.debugCallback(false);}},write:function(swfObject,target){var success=swfObject.write(target);if(success)return success;VersionCheck.failedWrites.push({swfObject:swfObject,target:target});return success;}};
var interval_backup,current_video_cid;function getUserHistory(){return UserHistory.get_history();}
function getUserWatchedHistory(){return UserHistory.get_watched_history();}
function getUserId(){return Behaviors.getUserId();}
function getUsername(){return Behaviors.getUsername();}
function getChannel(){return/(\?|&)?c=([^&]+)/.test(location.search)?RegExp.$2:'';}
var loadingQuickPlay=false
function channelQuickPlay(eid){if(loadingQuickPlay)return;loadingQuickPlay=true;var swfObject=new SWFObject("http://www.hulu.com/embed/"+eid,"quickplay",512,296,"1");swfObject.addParam("allowFullScreen","true");swfObject.addParam("bgcolor","000000");swfObject.addVariable("ap","1");swfObject.write("channel-quickplay");if($('search-result'))$('search-result').hide();var newTop=$('overlay-bottom').cumulativeOffset().top;var db=document.body;var dde=document.documentElement;var docHeight=Math.max(db.scrollHeight,dde.scrollHeight,db.offsetHeight,dde.offsetHeight,db.clientHeight,dde.clientHeight);var newHeight=docHeight-newTop;$("overlay-bottom").style.height=newHeight+"px";$("overlay-bottom").setOpacity(0.0);$("overlay-bottom").style.display="block";new Effect.Opacity('overlay-bottom',{duration:0.5,from:0.0,to:0.7,afterFinish:function(){if(Prototype.Browser.IE)
$('overlay-bottom').style.filter="alpha(opacity=80)";if($('search-bar'))$('search-bar').style.zIndex=0;loadingQuickPlay=false;Element.show("channel-quickplay-container");Element.show("channel-quickplay");}.bind(this)});}
function hideChannelQuickPlay(){if(loadingQuickPlay)return;loadingQuickPlay=true;if($('channel-quickplay-container')&&$('channel-quickplay-container').visible()){$('channel-quickplay').hide();$('channel-quickplay-container').hide();$('quickplay').remove();if($('search-result'))$('search-result').hide();new Effect.Fade('overlay-bottom',{duration:0.5,afterFinish:function(){if(Prototype.Browser.IE)
$('overlay-bottom').style.filter="alpha(opacity=80)";if($('search-bar'))$('search-bar').style.zIndex=0;loadingQuickPlay=false;}.bind(this)});}}
function selectEmbed(){if($('player')){$('player').copyEmbedToClipboard();$('icon-checkbox').style.visibility="visible";}}
function focusPlayer(){if($('player')){$('player').focus();}}
function createCustomClip(){if($('player')){$('player').showEmbed();$('icon-checkbox').style.visibility="hidden";}}
var toggling_ad=false;function AdToggle(url300,url,click_url,ad_id){if(toggling_ad)
return;toggling_ad=true;var image_creative=true;if(!click_url||click_url.indexOf("http://")!=0)
click_url=""
SWFAdContainer(url,click_url);toggling_ad=false;Element.show('banner-ad-container');}
function SWFAdContainer(creative,clickurl){var swfObject=new SWFObject("/banner_container.swf","banner_c",300,60,"1");swfObject.addParam("allowScriptAccess","always");swfObject.addParam("bgcolor","#eeeeee");swfObject.addParam("wmode","transparent");swfObject.addVariable("href",escape(creative));if(clickurl!="")
swfObject.addVariable("clickthru",escape(clickurl));swfObject.addVariable("displayWidth","300");swfObject.addVariable("displayHeight","60");swfObject.write("banner-ad-container");}
function onClickBanner(){if($('player'))
$('player').trackBannerClickThru();}
var branded_url="#";var bc_middlebgcolor="323232"
var bc_topbg,bc_bottombg,bc_middlebg,bc_top,bc_bottom;var bc_multimedia_top=false;var bc_multimedia_bottom=false;var fadeoutplayerbg_once=true;function preloadCanvas(topBG,middleBG,bottomBG,topBanner,bottomBanner,swftop,swfbottom,click,middleBGColor){if(swftop=="true")
bc_multimedia_top=true;if(swfbottom=="true")
bc_multimedia_bottom=true;if(click!="")
branded_url=click;if(middleBGColor&&middleBGColor!="")
bc_middlebgcolor=middleBGColor;bc_topbg=topBG;bc_middlebg=middleBG;bc_bottombg=bottomBG;bc_top=topBanner;bc_bottom=bottomBanner;fadeoutplayerbg_once=true;}
function showCanvas(){if(lights.maintenanceShowing()){$$('#maintenance').each(Element.hide);}
if(ContinuousPlay){ContinuousPlay.collapseThumbnailView();}
var cb="";if(navigator.userAgent.indexOf("MSIE")!=-1)
cb="?cb="+(new Date).getTime();el=$('branded-canvas-top');if(el){var swfObject=new SWFObject("/topcanvas.swf"+cb,"bc_top","100%",145,"1");swfObject.addParam("allowScriptAccess","always");swfObject.addParam("allowNetworking","all");swfObject.addParam("wmode","transparent");swfObject.addVariable("backgroundURL",bc_topbg);swfObject.addVariable("bannerURL",bc_top);if(branded_url)
swfObject.addVariable("clickURL",escape(branded_url));swfObject.write("branded-canvas-top");}
el=$('branded-canvas-bottom');if(el){var swfObject=new SWFObject("/bottomcanvas.swf"+cb,"bc_bottom","100%",105,"1");swfObject.addParam("allowScriptAccess","always");swfObject.addParam("allowNetworking","all");swfObject.addParam("wmode","transparent");swfObject.addVariable("backgroundURL",bc_bottombg);swfObject.addVariable("bannerURL",bc_bottom);if(branded_url)
swfObject.addVariable("clickURL",escape(branded_url));swfObject.write("branded-canvas-bottom");}
if(navigator.userAgent.indexOf("Chrome")==-1){if($('branded-canvas-top'))Element.show('branded-canvas-top');if($('branded-canvas-bottom'))Element.show('branded-canvas-bottom');fadeInPlayerBG();}else{setTimeout('canvasShowDelay()',500);}
if($('description-content'))Element.hide('description-content');}
function fadeInPlayerBG(){el=$('breakout-container');if(el){new Effect.Highlight('breakout-container',{startcolor:'#323232',endcolor:'#'+bc_middlebgcolor,restorecolor:'#'+bc_middlebgcolor,duration:0.3,transition:Effect.Transitions.linear,afterFinish:function(){$('breakout-container').style.background='#'+bc_middlebgcolor+' url("'+bc_middlebg+'") top left repeat-x';}.bind(this)});}}
function fadeOutPlayerBG(){el=$('breakout-container');if(el){new Effect.Highlight('breakout-container',{startcolor:'#'+bc_middlebgcolor,endcolor:'#323232',restorecolor:'#323232',duration:0.3,transition:Effect.Transitions.linear,afterFinish:function(){$('breakout-container').style.background='#323232 url( "/images/bg-main.gif" ) top left repeat-x';}.bind(this)});}}
function canvasShowDelay(){if($('branded-canvas-top'))Element.show('branded-canvas-top');if($('branded-canvas-bottom'))Element.show('branded-canvas-bottom');fadeInPlayerBG();}
function canvasHideDelay(){if(fadeoutplayerbg_once){fadeoutplayerbg_once=false;fadeOutPlayerBG();if($('branded-canvas-top')){Element.hide('branded-canvas-top');$('branded-canvas-top').update('');}
if($('branded-canvas-bottom')){Element.hide('branded-canvas-bottom');$('branded-canvas-bottom').update('');}}}
function hideCanvas(){var overlay=$('overlay-top');var container=$('description-container');if(container&&overlay){container.style.background=overlay&&"block"==overlay.style.display?"#333":"#eee";Element.show('description-content');}
try{if($('bc_top'))$('bc_top').fadeOut();}catch(oError){}
try{if($('bc_bottom'))$('bc_bottom').fadeOut();}catch(oError){}
setTimeout('canvasHideDelay()',500);resetCanvas();}
function resetCanvas(){branded_url="#";bc_topbg="";bc_middlebg="";bc_bottombg="";bc_top="";bc_bottom="";bc_middlebgcolor="323232";}
function AdToggleOverlay(url300,url,click_url,ad_id){AdToggle(url300,url,click_url,ad_id);}
function CFAdToggleOverlay(url300,url,click_url,ad_id){CFAdToggle(url300,url,click_url,ad_id);}
function CFAdToggle(url300,url,click_url,ad_id){return;}
function closeWindow(){self.close();}
var lightsOff=function(){lights.off();}
var lightsOn=function(){lights.on();}
var lightsOnDefault=function(){lights.playerDeactivate();}
function fullScreen(time){var url="/stand_alone/"+current_video_cid+"#"+time;var full=window.open(url,"stand_alone","toolbar=0,status=0,resizable=1,scrollbars=0,width="+screen.availWidth+",height="+screen.availHeight);if(full){if(navigator.userAgent.indexOf("Chrome")==-1)
full.moveTo(0,0);full.focus();}
else{ModalPopup.warn("Oops - your browser may be blocking this pop-up. Please disable your pop-up blocker before continuing.")}}
function playerLogin(){window.scrollTo(0,0);FloatingLoginForm.showTop($('login-link'));}
function popOut(time,lcname,inPlaylist,collection_id,continuous_play_mode,continuous_play_on){popOutWithCid(current_video_cid,time,lcname,inPlaylist,collection_id,continuous_play_mode,continuous_play_on);}
function popOutWithCid(cid,time,lcname,inPlaylist,collection_id,continuous_play_mode,continuous_play_on){var url="/stand_alone/"+cid+"?";params=[];if(lcname){params.push("lcname="+lcname);}
if(collection_id){params.push("collection_id="+collection_id);}
if(typeof(continuous_play_mode)!="undefined"){params.push("continuous_play_mode="+continuous_play_mode);}
if((typeof(continuous_play_on)!="undefined")&&(continuous_play_on==1)){params.push("continuous_play=on");}
if(params.length>0){url+=params.join('&');}
if(inPlaylist){url+="#in-playlist";}
else if(time){url+="#"+time;}
var full=window.open(url,"stand_alone","toolbar=0,status=0,resizable=1,scrollbars=0,width=512,height=296");if(full){if(navigator.userAgent.indexOf("Chrome")==-1)
full.moveTo(0,0);full.focus();}
else{ModalPopup.warn("Oops - your browser may be blocking this pop-up. Please disable your pop-up blocker before continuing.")}}
function popOutHD(vid,time,lcname){var url="/hd/stand_alone/"+vid+"?lcname="+lcname+"#"+time;var full=window.open(url,"stand_alone","toolbar=0,status=0,resizable=1,scrollbars=0,width=1280,height=728");if(full){if(navigator.userAgent.indexOf("Chrome")==-1)
full.moveTo(0,0);full.focus();}
else{ModalPopup.warn("Your browser is blocking this pop-up. Please disable your pop-up blocker before continuing.")}}
function popOutLivePlayer(time,lcname){var eventName=arguments[2]||'austin_city_limits';if(typeof(liveEventName)!="undefined"&&liveEventName)
eventName=liveEventName;var url="/live/popout/"+eventName;if(lcname)url+="#"+lcname;var full=window.open(url,"stand_alone","toolbar=0,status=0,resizable=1,scrollbars=0,width=512,height=296");if(full){if(navigator.userAgent.indexOf("Chrome")==-1)
full.moveTo(0,0);full.focus();}
else{ModalPopup.warn("Oops - your browser may be blocking this pop-up. Please disable your pop-up blocker before continuing.")}}
function launchLivePlayer(){var eventName=arguments[0]||'austin_city_limits';if(typeof(liveEventName)!="undefined"&&liveEventName)
eventName=liveEventName;var url="/live/"+eventName;var full=window.open(url,"live_player_window","toolbar=0,status=0,resizable=1,scrollbars=0,width=916,height=520");if(full){if(navigator.userAgent.indexOf("Chrome")==-1)
full.moveTo(0,0);full.focus();}
else{ModalPopup.warn("Oops - your browser may be blocking this pop-up. Please disable your pop-up blocker before continuing.")}}
function getScreenDimensions(){return[screen.width,screen.height];}
function showLink(url){var link=window.open(url);if(link){link.focus();}
else{ModalPopup.warn("Your browser is blocking this pop-up. Please disable your pop-up blocker before continuing.")}}
function updateFlashPlayer(){$("player-container").style.visibility="hidden";$("player-container").style.height="1px";Element.show("upgrade-container");$("upgrade-container").style.height="367px";var updateSWF=new SWFObject("/expressinstall.swf","updateSWF","790","367","9.0.115");updateSWF.useExpressInstall("/expressinstall.swf");updateSWF.addParam("allowScriptAccess","sameDomain");updateSWF.addParam("wmode","transparent");updateSWF.write("upgrade-container");}
function updateCancelled(){Element.hide("upgrade-container");$("player-container").style.height="368px";$("player-container").style.visibility="visible";$('player').cancelFlashUpdate();}
function playerLoginComplete(){Login.onComplete();}
function addClipVariables(swfObject){var st=0;var et=0;if(/#([0-9]+):([0-9]+)/.exec(location.hash)){st=parseInt(RegExp.$1);et=parseInt(RegExp.$2);}
else if(/#([0-9]+)/.exec(location.hash)){st=parseInt(RegExp.$1);}
if(/\bc=([0-9]+):([0-9]+)/.exec(location.search)){st=parseInt(RegExp.$1);et=parseInt(RegExp.$2);}
else if(/\bc=([0-9]+)/.exec(location.search)){st=parseInt(RegExp.$1);}
if(st>0||st==0&&et>0)
swfObject.addVariable("st",st);if(et>0)swfObject.addVariable("et",et);}
function addUserHistory(content_id){UserHistory.add_history(content_id);}
function embedVideo(id,eid){var player_url="/playerembed.swf?referrer="+escape(location.href);if(navigator.appVersion.indexOf("Win")>=0&&navigator.userAgent.indexOf("Safari")>=0&&navigator.userAgent.indexOf("Chrome")==-1)
player_url="/playerembed.swf";var swfObject=new SWFObject(player_url,"player",512,296,"9.0.115");swfObject.useExpressInstall("/expressinstall.swf");swfObject.setAttribute("style","z-index:10;");swfObject.addParam("allowScriptAccess","always");swfObject.addParam("allowFullscreen","true");swfObject.addVariable("eid",eid);swfObject.addVariable("stage_width",512);swfObject.addVariable("stage_height",296);if(!VersionCheck.write(swfObject,id)){Element.show('flash-player-invalid');}}
function getUserAgent(){return navigator.userAgent;}
function playerName(){return"/player.swf";}
function switchFullscreen(){return'false';}
function isRequiredMissing(){return"false";var val="false";function _c(el){return!el||el.getStyle('display')=='none';}
if(Prototype.Browser.WebKit){var m=$A([$('banner-ad-container'),$('branded-canvas-bottom'),$$('.sponsorship-info').first()]).all(_c);m=m||$$('#home img').findAll(function(el){return el.src&&el.src.indexOf('logo.jpg')>=0}).all(_c);if(m){val="true";}}
return val;}
function cbString(){var d=new Date;return $A([d.getUTCFullYear(),d.getUTCMonth()+1,d.getUTCDate(),d.getUTCHours()]).join('-');}
var Masthead={isReady:false,featured:null,init:function(){var items_url=false;if($('channel-masthead')){var channel_info=window.location.pathname.split('/').slice(2,4).join('/');items_url="/channels/masthead";if(!channel_info.blank())items_url+='/'+channel_info;}
if(items_url)
new Ajax.Request(items_url,{evalScripts:true,method:'get'});},ready:function(){this.isReady=true;if(this.featured!=null){this.update(this.featured);}},update:function(featured){if(this.isReady){var el=$('masthead')||$('channel-masthead');el.addCarouselItem(featured);}
else{this.featured=featured;}},writeSwf:function(){var swf='/masthead.swf';var id='masthead';var height=377;if(window.location.pathname.match(/^.channels/)){swf='/channel-masthead.swf';id='channel-masthead';height=180;}
var sec=(/^\/(tv|movies|hd|trailers|superbowl|spotlight|documentaries|labs|bec)/.test(window.location.pathname)?(RegExp.$1):'');var swfObject=new SWFObject(swf,id,"100%",height,"9.0.115");swfObject.useExpressInstall("/expressinstall.swf");swfObject.addParam("allowScriptAccess","always");swfObject.addParam("wmode","transparent");swfObject.addVariable("section",sec);var channel_info=window.location.pathname.split('/').slice(2,4).join('/');if(channel_info.blank()){swfObject.addVariable("show_title",1);swfObject.addVariable("scroll",1);}
if(!VersionCheck.write(swfObject,"masthead-container"))
Element.show("flash-player-invalid");else
TitleHack.fixOnFocus($(id));},delegateToSwf:function(block){var masthead=$('masthead')||$('channel-masthead');Try.these(function(){block(masthead);});},startAnimation:function(){Masthead.delegateToSwf(function(m){m.startAnimation();});},stopAnimation:function(){Masthead.delegateToSwf(function(m){m.stopAnimation();});}};var cf_begin=true;var cf_processing=false;function countdownFinished(){if(cf_processing)
return;cf_processing=true;var cf_chk="";if($('countdown'))
cf_chk=$('countdown').getEndTime();if(cf_chk==(Date.UTC(2009,6,13,23,0,0,0)/1000).toString()){if($('countdown'))
$('countdown').setEndTime(Date.UTC(2009,6,14,7,0,0,0)/1000);Element.update("commercial-free-description","until commercial-free ends");cf_begin=false;cf_processing=false;}else{Element.hide("commercial-free-before");Element.show("commercial-free-after");cf_processing=false;}}
function toggleCommercialHelp(){var help=$('wt-widget-help');if(help)help.toggle();}
function hideCommercialHelp(){var help=$('wt-widget-help');if(help)help.hide();}
var VideoSlider=Class.create();VideoSlider.SLIDERS=[];Object.extend(VideoSlider,{_currentVideoId:-1,currentVideoId:function(){if(VideoSlider._currentVideoId!=-1)
return VideoSlider._currentVideoId;try{VideoSlider._currentVideoId=parseInt(window.location.pathname.split('/watch/')[1].split('/')[0]);}
catch(e){VideoSlider._currentVideoId=null;}
if(VideoSlider._currentVideoId==null){try{VideoSlider._currentVideoId=parseInt(window.location.pathname.split('/superbowl/')[1].split('/')[0]);}
catch(e){VideoSlider._currentVideoId=null;}}
return VideoSlider._currentVideoId;}});Object.extend(VideoSlider.prototype,{ELLIPSIS:'<li class="ellipsis">...</li>',initialize:function(id){var options=arguments[1]||{};this.sld=$(id);this.inr=this.sld.getElementsBySelector('ul').first();VideoSlider.SLIDERS.push(id);this.index=VideoSlider.SLIDERS.length-1;this.url=options.url;this.urlOptions=options.urlOptions||{};this.seasonCounts=options.seasonCounts||{};this.from=options.from||{};this.dontRewriteLinks=options.dontRewriteLinks;var delay=0;delay=setInterval(function(){clearInterval(delay);this.domSensitiveInit(id,options);}.bind(this),500);},domSensitiveInit:function(id,options){this.init(options);this.maxCount=options.maxCount||this.count;this.maxPages=Math.ceil(this.maxCount/this.perPageCount);if(this.from=='brand'){BrandedEntertainment.rearrange(this,1);return;}
this.absolutize(1);this.rewriteLinks(1);this.nav=$(id+'-nav');if(this.nav){this.next=this.nav.getElementsBySelector('.next').first();this.prev=this.nav.getElementsBySelector('.prev').first();this.first=this.nav.getElementsBySelector('.first').first();this.shownPageNumber=this.nav.getElementsBySelector('input').first();this.total=this.nav.getElementsBySelector('.total').first();Event.observe(this.next,"click",this.move.bindAsEventListener(this,"next"));Event.observe(this.prev,"click",this.move.bindAsEventListener(this,"prev"));Event.observe(this.first,"click",this.move.bindAsEventListener(this,"first"));Event.observe(this.total,"click",this.move.bindAsEventListener(this,"last"));if(!this.sld.hasClassName('lazy-load')&&this.urlOptions.type!='related'){this.populateNav();}}
if(this.sld.hasClassName('lazy-load')||this.urlOptions.type=='related'){this.lazyLoad();}
this.more=$(id+'-more');if(this.more)
Event.observe(this.more,"click",this.updateMoreLink.bindAsEventListener(this,"more"));this.seasons=$(id+'-season');if(this.seasons){this.seasons.show();this.seasons=this.seasons.getElementsBySelector('ul').first();}
this.sorts=$(id+'-sort');if(this.sorts){this.sorts.show();this.sorts=this.sorts.getElementsBySelector('ul').first();this.repopulateSortsNav();}
this.types=$(id+'-type');if(this.types){this.types.show();this.types=this.types.getElementsBySelector('ul').first();}
$A([this.seasons,this.sorts,this.types]).each(this.ellipsize.bind(this));var opts=this.dehashifyOpts(location.hash);if(opts&&this.sld.id==opts.id){this.updateWithHashedOptions(opts)}},ellipsize:function(ul){if(null==ul)return;var lis=ul.getElementsBySelector('li');var max=lis.length;if(max>6)this.repaginate(ul,max,max);lis.each(function(li,i){if(!/inactive/.test(li.className)){Event.observe(li,"click",this.filterClicked.bindAsEventListener(this,i+1,max));Event.observe(li,"mouseover",this.pageNumHover.bindAsEventListener(this));Event.observe(li,"mouseout",this.pageNumHover.bindAsEventListener(this));}}.bind(this));},filterClicked:function(ev,current,max){var el=Event.element(ev);var filter=false,name=false;if(/([^-]+)-([^-]+)$/.test(el.id)){filter=RegExp.$1;name=RegExp.$2;}
if(this.slideLock||!filter||!name)return;this.setSelected(el);this["switch"+filter.capitalize()](name);var ul=el.up('ul');if(max>6&&ul)this.repaginate(ul,current,max);},init:function(options){this.calculateItemWidth();this.pageWidth=this.sld.getWidth();this.perPageCount=options.perPageCount||Math.round(this.pageWidth/this.itemWidth);this.updateCounts();this.pagesLoaded=this.count>=this.perPageCount?[true]:[];},calculateItemWidth:function(){if(!this.itemWidth||this.itemWidth==0){var first=this.sld.getElementsBySelector('li').first();this.itemWidth=first?first.getWidth()+
parseFloat(first.getStyle("margin-left"))+
parseFloat(first.getStyle("margin-right")):0;if(/MSIE 6/.test(navigator.userAgent)){this.itemWidth-=first?parseFloat(first.getStyle("padding-left"))+
parseFloat(first.getStyle("padding-right")):0;}}},repopulate:function(){this.pagesLoaded=[];this.inr.update("");this.updateCounts();this.move(null,1);},switchSort:function(sort){if(this.slideLock)return;this.urlOptions.sort=sort;this.repopulate();},updateMoreLink:function(){link=this.more.getAttribute("url");if(this.urlOptions.sort.match(/released_at/)){link=link.replace(/popular/,"recent");link=link.replace(/\/today/,"");}
self.location=link;},switchSeason:function(season){if(this.slideLock)return;this.updateUrlOptionsWithSeason(season);this.repopulateNav();this.repopulate();},updateUrlOptionsWithSeason:function(season){var type=this.urlOptions.type;if(this.urlOptions.category&&this.urlOptions.category=='Episodes'){type='episode';}
if(!type)return;if("all"==season){delete this.urlOptions.season;this.maxCount=this.seasonCounts[type]['all'];}
else{var count=this.seasonCounts[type];count=count?count['s'+season]:0;if(count<=0)return;this.urlOptions.season=season;this.maxCount=count;}},switchType:function(type){if(this.slideLock)return;this.urlOptions.type=type;this.urlOptions.sort=this.firstSort();delete this.urlOptions.season;this.maxCount=this.seasonCounts[this.urlOptions.type]['all'];this.repopulateNav();this.repopulateSeasonsNav();this.repopulateSortsNav();this.repopulate();},updateWithHashedOptions:function(options){var page=options.page;delete options.page;delete options.id;Object.extend(this.urlOptions,options);this.updateUrlOptionsWithSeason(options.season);this.repopulateSeasonsNav();this.repopulateSortsNav();var season=parseInt(this.urlOptions.season);if(0<season){var ul=this.seasons;var current=0;ul.getElementsBySelector('li.ellipsis').each(Element.remove);var lis=ul.getElementsBySelector('li');lis.each(function(li,i){if(parseInt(li.innerHTML.stripTags())==season)current=i+1;});var max=lis.length;if(ul&&max>0&&current>0)this.repaginate(ul,current,max);}
this.pagesLoaded=[];this.inr.update("");this.updateCounts();this.move(null,page);},setSelected:function(el){var active=el.up("ul").getElementsBySelector("li.active").first();if(active)active.removeClassName("active");el.addClassName("active");},updateCounts:function(){this.count=this.sld.getElementsBySelector('li').length;this.currentWidth=this.count*this.itemWidth;},move:function(ev,to){if(this.slideLock)return;var page=-1*(this.currentPos()-this.pageWidth)/this.pageWidth;var slide=false;switch(to){case"prev":page=(page-1)<1?1:page-1;slide=true;if(this.prev.hasClassName('disabled'))
return false;break;case"next":page=(page+1)>this.maxPages?this.maxPages:page+1;slide=true;if(this.next.hasClassName('disabled'))
return false;break;case"first":page=1;if(this.first.hasClassName('disabled'))
return false;break;case"last":page=this.maxPages;break;case"input":if(isNaN(parseInt(this.shownPageNumber.value))){this.shownPageNumber.value=page;return false;}else
page=parseInt(this.shownPageNumber.value);if(page<=0)
page=1;else if(page>this.maxPages)
page=this.maxPages;break;default:page=to;break;}
to=-1*(page-1)*this.pageWidth;this.lockSlide();if(slide){new Effect.Move(this.inr,{x:to,mode:'absolute',duration:0.4,afterFinish:this.updateSelectedPage.bind(this)});}
else{this.inr.style.left=to+"px";this.updateSelectedPage();}},unlockSlide:function(){this.slideLock=false;},lockSlide:function(){if(!this.slideLock)this.slideLock=true;},loadPage:function(page,afterLoaded){if(this.count>=this.maxCount||this.pagesLoaded[page-1]){afterLoaded();return;}
else{this.lockSlide();var params=Object.extend(this.urlOptions,{page:page});if(params.type=='related'){params=Object.extend(params,{user_id:Behaviors.getUserId(),history:UserHistory.get_history(),watched_history:UserHistory.get_watched_history()});}
this.showLoading(page);var url=[this.url,$H(params).toSortedQueryString()].join('?')
new Ajax.Request(url,{method:'get',onSuccess:this.populatePage.bindAsEventListener(this,page),onComplete:function(){$$('.cp-'+VideoSlider.currentVideoId()).invoke("show")
this.hideLoading();afterLoaded();}.bind(this)});}},showLoading:function(page){new Insertion.Bottom(this.inr,'<li class="ld" '+'style="position:absolute;left:'+((page-1)*this.pageWidth)+'px;width:'+this.pageWidth+'px"></li>');},hideLoading:function(){var loader=this.inr.getElementsBySelector('.ld').first();if(loader)loader.remove();},populatePage:function(ev,page){this.hideLoading();new Insertion.Bottom(this.inr,ev.responseText);this.updateCounts();this.absolutize(page);this.pagesLoaded[page-1]=true;Behaviors.toggleFirstDescendant('#'+this.sld.id+' span.play-button-hover');this.rewriteLinks(page);},PARSE_CHANNEL_RX:/\bc=[a-zA-Z-]+(\/[a-zA-Z-]+)?/,rewriteLinks:function(page){if(this.dontRewriteLinks)return;var opts=Object.extend({page:page,id:this.sld.id},this.urlOptions);var hash=this.optsHashified(opts);var origHTML;var saveHTML=Prototype.Browser.IE;var channel_rx=this.PARSE_CHANNEL_RX;var channel=null;var match=window.location.search.match(channel_rx);if(match){channel=match[0];}
this.inr.getElementsBySelector("a").each(function(a){if(a.hasClassName('linkRewritten')||(!(/\/watch\//).test(a.href)&&!(/\/superbowl\//).test(a.href)))return;if(saveHTML)origHTML=a.innerHTML;if(channel&&!channel_rx.test(a.href)){a.href=a.href.replace(/(\?|$)/,'?'+channel);}
a.href=a.href.replace(/(#[^#]+)?$/,hash);a.addClassName('linkRewritten');if(saveHTML&&origHTML)a.update(origHTML);});},HASHIFIED_SORTS:{number_of_votes:"n",n:"number_of_votes",released_at:"r",r:"released_at",original_premiere_date:"o",o:"original_premiere_date",views:"a",a:"views",view_count_today:"t",t:"view_count_today",rating:"u",u:"rating",title:"i",i:"title",released_first:"f",f:"released_first"},optsHashified:function(opts){var a=[];if(opts.page)a.push('p'+opts.page);if(opts.season)a.push('n'+opts.season);if(opts.sort)a.push('s'+this.HASHIFIED_SORTS[opts.sort]);if(opts.id)a.push('i'+this.index);return'#s-'+a.join('-');},dehashifyOpts:function(hash){var opts={};if(hash.match(/^#?s-/)){$A(hash.replace(/^#?s-/,'').split('-')).each(function(v){var key=v.substring(0,1);var rest=v.substring(1);switch(key){case"p":opts.page=rest;break;case"n":opts.season=rest;break;case"s":opts.sort=this.HASHIFIED_SORTS[rest];break;case"i":opts.id=VideoSlider.SLIDERS[parseInt(rest)];break;}}.bind(this));}
return opts;},absolutize:function(page){if('function'==typeof Superbowl.rearrange&&this.urlOptions.items_per_line){Superbowl.rearrange(this,page);return;}
var lis=this.inr.getElementsBySelector("li");var current=0;lis.each(function(li,i){if(li.hasClassName('absolutized'))return;this.calculateItemWidth();Position.absolutize(li);var y=0;var x=(this.pageWidth*(page-1))+current*this.itemWidth;li.style.top=y+"px";li.style.left=x+"px";li.addClassName('absolutized');current+=1;}.bind(this));},updateSelectedPage:function(){var page=-1*(this.currentPos()-this.pageWidth)/this.pageWidth;page=Math.ceil(page);this.loadPage(page,this.unlockSlide.bind(this));if(this.nav){this.next.removeClassName("disabled");this.prev.removeClassName("disabled");this.first.removeClassName("disabled");if(page==1){this.first.addClassName("disabled");this.prev.addClassName("disabled");}
if(page==this.maxPages){this.next.addClassName("disabled");}
if(this.maxPages<3)
this.first.hide();else
this.first.show();if(this.maxPages<3&&!this.shownPageNumber.hasClassName('short')){this.shownPageNumber.removeClassName('long');this.shownPageNumber.addClassName('short');}else if(this.maxPages>=3&&!this.shownPageNumber.hasClassName('long')){this.shownPageNumber.removeClassName('short');this.shownPageNumber.addClassName('long');}
this.shownPageNumber.value=page;this.total.innerHTML=this.maxPages;this.nav.show();}},currentPos:function(){return parseInt(this.inr.getStyle("left").replace("px",""));},repopulateNav:function(){if(!this.nav)return;this.nav.hide();this.nav.getElementsBySelector('li.page-num').each(Element.remove);this.maxPages=Math.ceil(this.maxCount/this.perPageCount);this.populateNav();this.nav.show();},repopulateSortsNav:function(){if(!this.sorts)return;var lis=this.sorts.getElementsBySelector('li');if(lis.length>1){lis.each(function(li){if(/-([^-]+)$/.test(li.id)){var sort=RegExp.$1;if(sort==this.urlOptions.sort)
li.addClassName('active');else
li.removeClassName('active')}}.bind(this));}},firstSort:function(){var sorts=this.sorts.getElementsBySelector('li');var sort=sorts.first();if(sort&&/-([^-]+)$/.test(sort.id)){return RegExp.$1;}
return null;},repopulateSeasonsNav:function(){if(!this.seasons||(!this.seasonCounts&&!this.seasonCounts[this.urlOptions.type]))return;this.seasons.getElementsBySelector('li').each(Element.remove);var seasons=$H(this.seasonCounts[this.urlOptions.type]);seasons=seasons.keys().reject(function(s){return"all"==s||"s0"==s||seasons[s]<=0;});if(seasons.length>1){seasons=seasons.map(function(s){return parseInt(s.substring(1));});seasons=seasons.sortBy(function(n){return parseInt(n);});var prefix=this.sld.id+'-season-';seasons.each(function(season,i){new Insertion.Bottom(this.seasons,'<li id="'+prefix+season+'">'+season+"</li>");}.bind(this));}
new Insertion.Bottom(this.seasons,'<li id="'+prefix+'all" class="active">All</li>');this.ellipsize(this.seasons);},populateNav:function(){if(this.perPageCount<=0)return;this.updateSelectedPage();},pageNumHover:function(ev){Event.element(ev)[Event.element(ev).hasClassName('vslhover')?'removeClassName':'addClassName']('vslhover');},repaginate:function(ul,page,max,selector,ws){if(!ul)return;selector=selector||'li';ws=ws||1;if(ws%2!=0&&(max-ws*2)==2)ws+=2;ellipsize=max>ws*2+1;ul.getElementsBySelector('li.ellipsis').each(Element.remove);ul.getElementsBySelector(selector).each(function(el,i){i+=1;if(i==1||(page-ws<=i&&i<=page+ws)||i==max){el[i==page?'addClassName':'removeClassName']('active');if(ellipsize&&i!=1&&i!=max){if(i==page+ws)new Insertion.After(el,this.ELLIPSIS);if(i==page-ws)new Insertion.Before(el,this.ELLIPSIS);}
Element.show(el);}
else{Element.hide(el);}}.bind(this));},loadAndShow:function(ev){var top=document.viewport.getScrollOffsets();top=top.top+document.viewport.getHeight();var el=this.container;while(el&&el.style.display=="none"){el=el.previous();}
if(el){var elTop=el.cumulativeOffset().top+el.getHeight();if(top>=(elTop-100)){Event.stopObserving(window,"scroll",this.lazyLoader);Event.stopObserving(window,"resize",this.lazyLoader);Behaviors.applyCufon();this.updateSelectedPage();}}},lazyLoad:function(){this.container=null;this.container=this.sld.up('.fluid');if(this.container){this.lazyLoader=this.loadAndShow.bindAsEventListener(this);Event.observe(window,"scroll",this.lazyLoader);Event.observe(window,"resize",this.lazyLoader);this.loadAndShow();return;}
this.populateNav();this.updateSelectedPage();},updateShownPageValue:function(){var page=-1*(this.currentPos()-this.pageWidth)/this.pageWidth;if(page&&this.shownPageNumber){this.shownPageNumber.value=page;}}});Event.observe(window,"pageshow",function(){$A(VideoSlider.SLIDERS).each(function(slider){slider=eval(slider);slider.updateShownPageValue();});});
var VideoExpander={working:false,moreEpisodesClicked:function(name,url){if(VideoExpander.working)return;var el=$(name);var loading=$(el).down('.srh-loading');if(loading)loading.show();VideoExpander.working=true;new Ajax.Request(url,{method:'get',onSuccess:function(){VideoExpander.working=false;}});},subheadingClicked:function(name,url){if(VideoExpander.working)return;var els=$$('.'+name);var el=$(name);if(els.length>0){els.each(Element.toggle)
VideoExpander.toggleArrow(el)}
else{var loading=$(el).down('.srh-loading');if(loading)loading.show();VideoExpander.working=true;new Ajax.Request(url,{method:'get',onSuccess:function(){VideoExpander.toggleArrow(el);if(loading)loading.hide();VideoExpander.working=false;}});}},toggleArrow:function(el){if(el){var r=/\bvex-up\b/.test(el.className)?'vex-up':'vex-down';var a=r=='vex-down'?'vex-up':'vex-down';el.removeClassName(r);el.addClassName(a)}},showLoading:function(id){var loader=$$('#'+id+'-nav div.pagination-loading').first();if(loader)loader.show();},hideLoading:function(id){var loader=$$('#'+id+'-nav div.pagination-loading').first();if(loader)loader.hide();},addToPlaylist:function(el,video_id){el=$(el);if(!el||video_id<=0||typeof(Behaviors)=='undefined')return;if(!Behaviors.loggedIn){FloatingLoginForm.show(el);}
else{new Ajax.Request('/users/add_to_playlist?video_id='+video_id,{onSuccess:function(){$(el).up().update('<img src="/images/icon-check.gif" height="16" width="16" '+'title="You have queued this video" style="vertical-align:middle;"/>');Behaviors.playlistInvalid=true;}});}},hashOptions:function(sorts,defaults){if(location.hash.match(/^#?x-/)){var opts=$A(location.hash.replace(/^#?x-/,'').split(','));var sort=sorts[parseInt(opts[0])];var page=parseInt(opts[2]);var order=parseInt(opts[3])?"asc":"desc";var params=Object.extend(defaults,{sort:sort,page:page,order:order});var value=unescape(opts[1].substring(1));switch(opts[1].substring(0,1)){case'v':if(value!=defaults.video_type)return;params.video_type=value;break;case'c':var nil_cat=(defaults.category||'').blank();if(('Others'==value&&!nil_cat)||value!=defaults.category)return;if(!nil_cat)params.category=value;break;}
return params;}
return null;},_currentVideoId:-1,currentVideoId:function(){if(VideoExpander._currentVideoId!=-1)
return VideoExpander._currentVideoId;try{VideoExpander._currentVideoId=parseInt(window.location.pathname.split('/watch/')[1].split('/')[0]);}
catch(e){VideoExpander._currentVideoId=null;}
return VideoExpander._currentVideoId;},_highlighted:false,highlightCurrent:function(){var highlighted=false;$$('.vex a.show-thumb').each(function(el){if(/watch\/(\d+)/.test(el.href)&&RegExp.$1){var id=parseInt(RegExp.$1);if(id==VideoExpander.currentVideoId()){el.up('tr').addClassName('currently-playing');highlighted=true;throw $break;}}});VideoExpander._highlighted=highlighted;return highlighted;},_initialTrailerPage:0,setInitialTrailerPage:function(page){VideoExpander._initialTrailerPage=page;},setState:function(sorts,options){var defaults=Object.clone(options);var highlighted=VideoExpander.highlightCurrent();var hashOptions=VideoExpander.hashOptions(sorts,defaults);if(VideoExpander._initialTrailerPage&&!hashOptions&&options.video_type=="film_trailer"){hashOptions=Object.extend(defaults,{page:VideoExpander._initialTrailerPage});}
if(hashOptions!=null){if(hashOptions.video_type!=options.video_type)return;if(highlighted&&hashOptions.sort==options.sort&&hashOptions.order==options.order)return;if(hashOptions.sort=="season"&&hashOptions.video_type=="episode"){hashOptions=Object.extend(hashOptions,{current_video_id:VideoExpander.currentVideoId()});delete hashOptions['action'];Event.observe(window,"load",function(){VideoExpander._highlighted=false;new Ajax.Request('/videos/season_expander',{method:'get',evalScripts:true,parameters:hashOptions,onComplete:function(){if(!VideoExpander._highlighted){new Ajax.Request('/videos/season_expander',{method:'get',evalScripts:true,parameters:Object.extend(hashOptions,{more_episodes:1})});}}});});}
else{Event.observe(window,"load",function(){new Ajax.Request('/videos/expander',{method:'get',evalScripts:true,parameters:hashOptions});});}}}};
var Review={showReportMenu:function(el,id){if(READ_ONLY)return;if(!Behaviors.isLoggedIn()){FloatingLoginForm.show(el);return false;}
var menu=$$('.report-menu').first();if(menu&&el){var reportDiv=el.up('div.review-block-extras-container').adjacent('div.review-block-report-container')[0];$(reportDiv).appendChild(menu);menu.show();var form=menu.down('form');if(form)Form.reset(form);var applies_to=menu.down('.applies-to');if(applies_to){applies_to.update(id);}
else{new Insertion.Bottom(menu,'<div style="display:none" class="applies-to">'+id+'</div>');}}
return false;},hideReportMenu:function(el){$$('.report-menu').each(Element.hide);return false;},sendReport:function(){if(READ_ONLY)return;var menu=$$('.report-menu').first();var form=menu.down('form');var id=menu.down('.applies-to');if(id)id=parseInt(id.innerHTML);if(!menu||!form||!id||id<0){Review.hideReportMenu();return;}
new Ajax.Request('/reviews/report/'+id,{asynchronous:true,evalScripts:true,parameters:Form.serialize(form,true)});Review.hideReportMenu();reportExtrasDiv=menu.up('div.review-block-report-container').adjacent('div.review-block-extras-container')[0];reportExtrasDiv.update("Thank you for reporting.  <br/>We will review this as soon as possible.");reportExtrasDiv.up('div.item.review').addClassName('reported');},makeActive:function(review){if(!READ_ONLY){$(review).addClassName('active');}},makeInactive:function(review){$(review).removeClassName('active');},toggleStar:function(id){$$(".star-choosed").each(function(e){e.removeClassName('star-choosed');});if(id!=0){var el=$('r-'+id+'-star-class').down('a');el.addClassName("star-choosed");$('review-filter-header-all').down('a').removeClassName('nolink');$('review-filter-header-more').update(id+' Star Reviews');$('review-rating-head').style.display="block";}
else{$('review-filter-header-all').down('a').addClassName('nolink');$('review-filter-header-more').update('');$('review-rating-head').style.display="none";}},Event:{onFinishUpdating:function(){$('review-submit').disabled=false;},onSubmit:function(){Element.update('new_review_form_errors','');Element.show('create-review-loading-bar');$('review-submit').disabled=true;}}};function clearReviewForm(){$("user_review_title").value="";$("user_review_message").value="";Element.update('new_review_form_errors','');if($('new_review_form'))$('new_review_form').hide();}
function openReview(el){if(READ_ONLY)return;if(!Behaviors.isLoggedIn()){FloatingLoginForm.show(el);return false;}
if(!Behaviors.isEmailValidated()){new Ajax.Request('/users/'+Behaviors.getUserId()+'/email_validation_status',{asynchronous:true,evalScripts:true,onComplete:function(request){if(!Behaviors.isEmailValidated())
Login.showEmailValidation();else
doOpenReview(el);}});return false;}
else{doOpenReview(el);}}
function doOpenReview(el){if($('new_review_form').style.display=='none'){$("user_review_title").value="";$("user_review_message").value="";$('new_review_form').show();$("user_review_title").focus();}}
function incrementReviewCount(){clearReviewForm();if($('review-none-message'))$('review-none-message').hide();var curr=0;try{curr=parseInt($('review_count').innerHTML);$('review_count').update(curr+1);}
catch(e){}}
function reviewPopUp(url){var full=window.open(url,'review_stand_alone','width=940,height=600,resizable=1,toolbar=0,status=0,scrollbars=1');full.focus();}
var current_review_form_rating=-1;function restoreRating(){clickRating(current_review_form_rating);}
function clickRating(rating){updateRatingSelect(rating);current_review_form_rating=rating;}
function updateRating(rating){if(rating<0){try{$("rating-text").innerHTML="Select a star rating";for(var i=1;i<=5;i++)
$("rating-star-"+i).src=$("rating-star-"+i).src.replace(/rating_[^\.]+[\.]gif/,"rating_empty.gif");$("user_review_rating").value=-1;}
catch(e){}}else{try{$("rating-text").innerHTML=(["Hated it","Didn't like it","Thought it was OK","Liked it","Loved it"])[rating-1];for(var i=1;i<=5;i++)
$("rating-star-"+i).src=$("rating-star-"+i).src.replace(/rating_[^\.]+[\.]gif/,(i<=rating)?"rating_hover.gif":"rating_empty.gif");$("user_review_rating").value=rating;}
catch(e){}}}
function updateRatingSelect(rating){if(rating<0){try{$("rating-text").innerHTML="Select a star rating";for(var i=1;i<=5;i++)
$("rating-star-"+i).src=$("rating-star-"+i).src.replace(/rating_[^\.]+[\.]gif/,"rating_empty.gif");$("user_review_rating").value=-1;}
catch(e){}}else{try{$("rating-text").innerHTML=(["Hated it","Didn't like it","Thought it was OK","Liked it","Loved it"])[rating-1];for(var i=1;i<=5;i++)
$("rating-star-"+i).src=$("rating-star-"+i).src.replace(/rating_[^\.]+[\.]gif/,(i<=rating)?"rating_full.gif":"rating_empty.gif");$("user_review_rating").value=rating;}
catch(e){}}}
var Profile=Class.create();Object.extend(Profile,{WORKING_TAG:'<img '+'class="working" '+'src="/images/loading-animated-circle.gif" '+'width="16" '+'height="16" '+'border="0" '+'/>',SUCCESS_TAG:'<img '+'class="success" '+'src="/images/icon-check.gif" '+'width="16" '+'height="16" '+'border="0" '+'/>',workingOnQueue:false,showWorking:function(){$$('.save-cancel').each(Element.hide);$$('.working').each(Element.show);},hideWorking:function(){$$('.save-cancel').each(Element.show);$$('.working').each(Element.hide);},showSuccess:function(){$$('.success').each(Element.show);},hideSuccess:function(){$$('.success').each(Element.hide);},showErrors:function(request){if(request&&request.responseText){var errors=eval(request.responseText);this.hideWorking();var err=$('info');if(err){$('info').show();err.update("Please fix the following errors: <br/>"+errors.join("<br/>"));window.scrollTo(0,0);}}},hideErrors:function(){$('info').hide();},hideUnowned:function(){$$('.owned').each(Element.hide);},toggleAlreadyWorking:function(el){var form=$(el).up('form');if(!form)return false;return!!form.down('img.working');},toggleShowWorking:function(el){var form=$(el).up('form');if(!form)return;var select=form.down('select');if(!select)return;Profile.toggleRemoveSuccessTag(form);new Insertion.After(select,Profile.WORKING_TAG);},toggleStopWorking:function(el){if(!this.toggleAlreadyWorking(el))return;var form=$(el).up('form');if(!form)return;var select=form.down('select');if(!select)return;var working=form.down('img.working');if(working&&working.parentNode)working.parentNode.removeChild(working);if('public'==select.value){var tr=$(form).up('tr');if(tr)tr.removeClassName('hide-item');}
else{var tr=$(form).up('tr');if(tr)tr.addClassName('hide-item');}
Profile.toggleRemoveSuccessTag(form);new Insertion.After(select,Profile.SUCCESS_TAG);setInterval(function(){Profile.toggleRemoveSuccessTag(form);},1000);},toggleRemoveSuccessTag:function(form){var img=$(form).down('img.success');if(img&&img.parentNode)img.parentNode.removeChild(img);},toggleVisibility:function(el,id,type){if(!id||this.toggleAlreadyWorking(el))return;this.toggleShowWorking(el);new Ajax.Request(['/profile/toggle_visibility_of_list_item/',id,'?type=',type].join(''),{onComplete:function(){Profile.toggleStopWorking(el);}});},toggleQueueHelp:function(el,expiring){var wasHidden='none'==$$('.queue-help.'+(expiring?'expiring':'added')).first().style.display;$$('.queue-help').each(Element.hide);if(wasHidden){if(expiring){$$('.queue-help.expiring').each(Element.show);}
else{$$('.queue-help.added').each(Element.show);}}
var hidden=$$('.queue-help').all(function(el){return'none'==el.style.display;});$$('select').each(function(el){el.style.visibility=hidden?'visible':'hidden';});},hideQueueHelp:function(){$$('.queue-help').each(Element.hide);$$('select').each(function(el){el.style.visibility='visible';});},toggleHelp:function(el){if(el.style.display=='none')
el.show();else
el.hide();},toggleAllCheckboxes:function(form,state){$$('#'+form.id+' input').each(function(input){if(input.type!='checkbox')return;input.checked=state;});},queueOrderUpdated:function(){var queue_positions=$$('#queue input');var i=Profile.firstQueuePosition;if(i==1){$$('div#queue tr.first').invoke('removeClassName','first');var tr=$$('div#queue tr.r').first();if(tr){tr.addClassName('first');}}
queue_positions.each(function(input){if(/^position_/.test(input.name)){input.value=i;i++;}});$$('.update-order').each(function(el){el.style.visibility='visible';});},updateFirstQueuePosition:function(){var el=$$('#queue input').find(function(input){return/^position_/.test(input.name);});if(el&&el.value>0){Profile.firstQueuePosition=el.value;}
if(Profile.firstQueuePosition!=1){$$('div#queue tr.first').invoke('removeClassName','first');}},firstQueuePosition:1,toggleInfoExpansion:function(el){if(el.hasClassName('collapsed')){el.removeClassName('collapsed');el.addClassName('expanded');$('info-expansion-arrow').src='/images/button-expand-hover.gif';}
else{el.removeClassName('expanded');el.addClassName('collapsed');$('info-expansion-arrow').src='/images/button-collapse-hover.gif';}},settingsChanged:false,hidePublic:function(){if(Profile.publicProfileView){}},replace_profile_cache:function(username,user_id){if(Behaviors.loggedIn){if(location.hash=="#self"){Profile.show_public(true);}
else{new Ajax.Request('/profiles/'+username+'/friend/'+user_id,{asynchronous:true,evalScripts:true,method:'get',onComplete:function(request){$('profile-loading-container').hide();},onSuccess:function(request){$('cacheable_profile_update').update(request.responseText);$('cacheable_profile_update').style.visibility='';},onFailure:function(request){Profile.show_public();}});}}
else{Profile.show_public();}},perform_queue_action:function(confirm,url,self_queue_url,ievent){if(/__action__/.test(url)){var el=Event.element(ievent||window.event).up('form').down('.perform_queue_action');var action=(el?$(el).value:null)
url=url.replace('__action__',action);}else{var action=true;}
var params=Form.serialize($('queue_options'));if(/remove_queue_items/.test(url)&&!/selected/.test(params)){ModalPopup.warn('Please select an item to remove first.');return false;}
$$('.working').each(Element.show);if(action&&!Profile.workingOnQueue){if(confirm&&confirm!=''){if(/{COUNTED_ITEMS}/.test(confirm)){var count=-1;try{count=$('queue_options').serialize().toQueryParams()['selected[]'];if(typeof(count)=="string")count=1;else count=count.length;}
catch(e){}
var text='these queued items';if(count==0||count>1){text=''+count+' queued items';}
else if(count==1){text=''+count+' queued item';}
confirm=confirm.replace('{COUNTED_ITEMS}',text);}
ModalPopup.ask(confirm,"Profile.workingOnQueue = true; new Ajax.Request('"+url+"', { parameters: Form.serialize($('queue_options')), onComplete: function() { window.location = '"+self_queue_url+"';}});","$$('.working').each(Element.hide);");}else{Profile.workingOnQueue=true;new Ajax.Request(url,{parameters:params,onComplete:function(){window.location=self_queue_url;}});}}
else{$$('.working').each(Element.hide);}},show_public:function(owner_public_view){$('profile-loading-container').hide();if(!owner_public_view)$('profile-add-friend').style.visibility='';$('cacheable_profile_update').style.visibility='';},updateStatus:function(status){container=$('profile-status');if(container){container.down('div.message').update(status);container.show();}},redirectSuccess:function(anchor){window.location='/profile#'+anchor;},removeAllHistory:function(){new Ajax.Request('/profile/clear/history',{asynchronous:true,evalScripts:true,onComplete:function(request){window.location="/profile/history";}});}});
var IntWarning={init:function(){if(/always-warn/.test(location.hash))IntWarning.passedGeoCheck('not-valid');else if(!IntWarning.hasSeenWarning())IntWarning.runCheck();IntWarning.setSeen();},show:function(){$$('#player-container').each(function(el){var height=el.getHeight();el.update('<div class="flash-player-invalid" style="height:'+height+'px !important;"> </div>');});$$('.overlay-full').each(Element.show);$$('.int-warning').each(Element.show);},submitOnEnter:function(ev){if(13==ev.keyCode)IntWarning.submit();},setSeen:function(){var expires_at=new Date((new Date()).valueOf()+2*86400000);var cookie=document.cookie="hic=1"+"; expires="+expires_at.toGMTString()+"; path=/";},hasSeenWarning:function(){return(/\bhic=1\b/.test(document.cookie));},runCheck:function(){var gc=new SWFObject("/gc.swf","gcs","1","1","0");gc.addParam("allowScriptAccess","always");gc.addParam("wmode","transparent");gc.write("gc");},passedGeoCheck:function(status){if("not-valid"==status){IntWarning.show();Event.observe($('int-email'),'keydown',IntWarning.submitOnEnter);}},hide:function(){$$('.overlay-full').each(Element.hide);$$('.int-warning').each(Element.hide);},submit:function(){var form=$('int-request');new Ajax.Request('/users/international',{parameters:form.serialize(),onComplete:IntWarning.showThanks});},showThanks:function(){$$('.int-form').each(Element.hide);$$('.int-thanks').each(Element.show);},cancel:function(){IntWarning.hide();}};Event.observe(window,'load',IntWarning.init);
var VideoRating=Class.create();Object.extend(VideoRating,{FULL:'/images/rating_full.gif',HOVER:'/images/rating_hover.gif',HALF:'/images/rating_half.gif',EMPTY:'/images/rating_empty.gif',CHECK:'/images/icon-check.gif',WORKING:'<img '+'src="/images/loading-animated-circle.gif"'+'width="16"'+'height="16"'+'border="0"'+'style="vertical-align:middle;" />',FULL_D:'/images/rating_d_full.gif',HOVER_D:'/images/rating_d_hover.gif',HALF_D:'/images/rating_d_half.gif',EMPTY_D:'/images/rating_d_empty.gif',CHECK_D:'/images/icon-check-d.gif',WORKING_D:'<img '+'src="/images/loading-animated-circle-d.gif"'+'width="16"'+'height="16"'+'border="0"'+'style="vertical-align:middle;" />',DESCRIPTIONS:["Hated it","Didn't like it","It was OK","Liked it","Loved it"],INSTANCES:[],reenableAll:function(){$(VideoRating.INSTANCES).each(function(inst){inst.reenable()});},PRELOADED:false,preload:function(){if(VideoRating.PRELOADED)return;$A([VideoRating.FULL_D,VideoRating.HOVER_D,VideoRating.HALF_D,VideoRating.EMPTY_D]).each(function(src){pingImage(src);});$A([VideoRating.FULL,VideoRating.HOVER,VideoRating.HALF,VideoRating.EMPTY]).each(function(src){pingImage(src);});VideoRating.PRELOADED=true;}});Object.extend(VideoRating.prototype,{initialize:function(id,video_id,value,defaultStatus,rateable_type,disable_after_rate,allow_reset,blankStatus){this.el=$(id);this.video_id=video_id;this.rateable_type=rateable_type;this.originalValue=value;this.value=value;this.disabled=false;this.USE_DARK=false;this.disable_after_rate=(disable_after_rate==false)?false:true;this.allow_reset=(allow_reset==true)?true:false;this.originalStatus=blankStatus||defaultStatus||'';this.dontShowStatus=defaultStatus==null?true:false;var status=defaultStatus||'';if(status=='trailer'){this.defaultStatus='';this.USE_DARK=true;}
else if(status=='defaultdesc'){this.defaultStatus='Be the first to rate';}
else if(this.defaultStatus!=status){this.defaultStatus=status;}
this.newline=(arguments.length==4)?false:arguments[4];VideoRating.INSTANCES.push(this);this.init();VideoRating.preload();this.disabled=!(video_id>0);if(READ_ONLY){this.disable();}},init:function(){var str='';if(this.allow_reset)
{str+="<div class='reset'><img class='star reset-button' src='/images/btn-unrated.gif' /> | </div>";}
$R(1,5).each(function(rating){if(this.USE_DARK)
str+='<img src="'+VideoRating.EMPTY_D+'" ';else
str+='<img src="'+VideoRating.EMPTY+'" ';str+='class="star" ';str+='width="12" ';str+='height="11" ';str+='border="0" />';});if(this.newline==true)
str+='<br/><span></span>';else
str+='<span></span>';this.el.update(str);this.el.getElementsBySelector('img.star').each(function(img){Event.observe(img,"mouseover",this.hover.bindAsEventListener(this));Event.observe(img,"mouseout",this.reset.bindAsEventListener(this));Event.observe(img,"click",this.submit.bindAsEventListener(this));}.bind(this));this.status=$A(this.el.getElementsBySelector('span')).first();this.status.update(this.defaultStatus);this.reset();},hover:function(ev){if(this.disabled)return;var me=Event.element(ev);var full=true;this.el.getElementsBySelector('img.star').each(function(img,rating){if(img.hasClassName('reset-button'))
{if(img==me)img.src="/images/btn-unrated-hover.gif";}
else if(this.USE_DARK)
img.src=full?VideoRating.HOVER_D:VideoRating.EMPTY_D;else
img.src=full?VideoRating.HOVER:VideoRating.EMPTY;if(img==me){if(!this.dontShowStatus)
this.status.update(img.hasClassName('reset-button')?"Reset":VideoRating.DESCRIPTIONS[rating-(this.allow_reset?1:0)]);full=false;}}.bind(this));},reset:function(){if(this.disabled)return;var val=this.value;var usedark=false;if(this.USE_DARK)usedark=true;var allow_reset=this.allow_reset;this.el.getElementsBySelector('img.star').each(function(img,rating){if(!allow_reset)rating++;if(img.hasClassName('reset-button'))
{img.src="/images/btn-unrated.gif";return;}
else if(usedark){img.src=rating<=Math.floor(val)?VideoRating.FULL_D:rating==Math.round(val)?VideoRating.HALF_D:VideoRating.EMPTY_D;}
else
{img.src=rating<=Math.floor(val)?VideoRating.FULL:rating==Math.round(val)?VideoRating.HALF:VideoRating.EMPTY;}});this.status.update(this.defaultStatus);},reenable:function(){if(READ_ONLY)return;this.disabled=false;this.value=this.originalValue;this.reset();},submit:function(ev){if(this.disabled)return;var me=Event.element(ev);var val=0;var allow_reset=this.allow_reset;this.el.getElementsBySelector('img.star').each(function(img,rating){val=allow_reset?rating:(rating+1);if(img==me)throw $break;});if(Behaviors.isLoggedIn()){this.newline=$A(this.el.getElementsBySelector('br')).first();if(this.newline)
{this.newline.remove();var notice=$A(this.el.getElementsBySelector('span')).first();notice.setStyle({'margin-left':'8px'});}
if(this.USE_DARK)
this.status.update(VideoRating.WORKING_D);else
this.status.update(VideoRating.WORKING);this.disabled=true;switch(this.rateable_type)
{case'recommend_preference':vote_url='/profile/recommend_vote_for_preference/'+this.video_id;break;case'show':vote_url='/shows/vote/'+this.video_id;break;default:vote_url='/videos/vote/'+this.video_id;}
new Ajax.Request(vote_url,{parameters:{up:val},onSuccess:function(req){this.disabled=false;if(req.responseText.match(/^OK/)){this.value=val;this.reset();if(this.USE_DARK)
this.status.update('<img width="16" height="16" title="Your vote has been saved" src="'+VideoRating.CHECK_D+'" style="vertical-align:middle;"/>');else
this.status.update('<img width="16" height="16" title="Your vote has been saved" src="'+VideoRating.CHECK+'" style="vertical-align:middle;"/>');}
else{this.reset();if(this.dontShowStatus){if(this.USE_DARK)
this.status.update('<img width="16" height="16" '+'title="Your vote has been saved" '+'src="'+VideoRating.CHECK_D+'" '+'style="vertical-align:middle;"/>');else
this.status.update('<img width="16" height="16" '+'title="Your vote has been saved" '+'src="'+VideoRating.CHECK+'" '+'style="vertical-align:middle;"/>');}
else{this.status.update(req.responseText.match(/can only vote once/)?"You've already voted.":"Error saving vote.");}}}.bind(this),onComplete:this.disable.bind(this)});}
else{FloatingLoginForm.show(this.el);}},disable:function(){this.defaultStatus=(this.value==0)?this.originalStatus:VideoRating.DESCRIPTIONS[this.value-1];if(this.dontShowStatus)this.defaultStatus='';if(this.disable_after_rate==false)return;this.disabled=true;this.el.getElementsBySelector('img.star').each(function(img){img.style.cursor='default';});}});
var FloatingDiv={DEFAULT_FARTHEST_RIGHT:920,previousContainer:null,visible:function(){floatingContainer=$('floating-container');if(!floatingContainer)return false;return floatingContainer.visible();},hide:function(){floatingContainer=$('floating-container');if(!floatingContainer)return;if(FloatingDiv.previousContainer){content=floatingContainer.down('div.content');FloatingDiv.previousContainer.appendChild(content);FloatingDiv.previousContainer=null;}
floatingContainer.hide();},show:function(fromElement,contentDiv,targetWidth,fromAvailabilityNotes){if(arguments.length!=4)fromAvailabilityNotes=false;floatingContainer=$('floating-container');if(!floatingContainer)return;FloatingDiv.hide();if(targetWidth){floatingContainer.style.width=(targetWidth+'px');}
else{floatingContainer.style.width='';}
content=contentDiv.down('div.content');FloatingDiv.previousContainer=contentDiv;floatingContainer.appendChild(content);if(fromElement){var xy=Position.cumulativeOffset(fromElement);var x=xy[0];var width=floatingContainer.getWidth();var rightmost;if(fromAvailabilityNotes)rightmost=x+fromElement.getWidth()+6;else rightmost=FloatingDiv.getFarthestRight();if(width>0&&(x+width)>rightmost)
x=rightmost-width-10;floatingContainer.style.left=x+'px';var height=floatingContainer.getHeight();if(fromAvailabilityNotes)floatingContainer.style.top=(xy[1]+25)+'px';else floatingContainer.style.top=(xy[1]+20)+'px';}
floatingContainer.show();},getFarthestRight:function(){var body=$$('body')[0];if(!body)return this.DEFAULT_FARTHEST_RIGHT;var xy=Position.cumulativeOffset(body);return xy[0]+body.getWidth();}};
var FloatingWindow={cache:{},className:'',init:function(){var body=$$('body').first();if(body)
{Element.observe(body,'click',FloatingWindow.clickToClose);}},clickToClose:function(ev){var x=Event.pointerX(ev);var y=Event.pointerY(ev);var mainContainer=$('floating-window-container').down('div.main-container');if(Position.within(mainContainer.down('div.title-container'),x,y)||Position.within(mainContainer.down('div.division_line'),x,y)||Position.within(mainContainer.down('div.floating-window-content'),x,y))
return;FloatingWindow.close();},show:function(url,className,allowCache){var cache=FloatingWindow.cache;var obj=null;if(allowCache&&cache[url]){obj=cache[url];}
else{new Ajax.Request(url,{method:'get',onSuccess:function(trans){obj=trans.responseText;FloatingWindow.cache[url]=obj;}});}
FloatingWindow.className='type_'+className;$("floating-window-container").addClassName(FloatingWindow.className);FloatingWindow.className=className;if(obj)eval(obj);},close:function(){$("floating-window-container").hide();$("floating-window-container").removeClassName(FloatingWindow.className);},placeWindow:function(targetElement,position){position=position||'center';if(position=='center')
{var scrollOffsets=document.viewport.getScrollOffsets();var windowSize=$("floating-window-container").getDimensions();$("floating-window-container").setStyle({top:(scrollOffsets.top+document.viewport.getHeight()/2-windowSize.height/2)+'px'});}
else if(position=='afterElement')
{var offset=Element.cumulativeOffset(targetElement);$("floating-window-container").setStyle({top:(offset.top+targetElement.getHeight())+'px'});}}};
var FloatingLoginForm={DEFAULT_FARTHEST_RIGHT:920,hide:function(){$$('.flf').each(Element.hide);},show:function(el,from_lightbox){if(arguments.length<2)from_lightbox=false;var flf=$$('.flf:not(.tflf)').first();if(flf){if(from_lightbox)
Login.setInLightbox(true);else
Login.setInLightbox(false);Login.cancel();var form=flf.down('div.login-form');if(form)form.show();if(el){var xy=Position.cumulativeOffset(el);var x=xy[0];var width=flf.getWidth();var rightmost=FloatingLoginForm.getFarthestRight();if(width>0&&(x+width)>rightmost)
x=rightmost-width-10;flf.style.left=x+'px';var height=flf.getHeight();if((xy[1]-height/2)>0)
flf.style.top=(xy[1]-height/2)+'px';else
flf.style.top='0px';Login.setActionElement(el);}
else{var offset=document.viewport.getScrollOffsets();var flfTop=offset.top+((document.viewport.getHeight()-flf.getHeight())/2);var flfLeft=offset.left+((document.viewport.getWidth()-flf.getWidth())/2);var playerDiv=$('breakout-container');if(playerDiv){var minTop=playerDiv.cumulativeOffset().top+playerDiv.getHeight()+20;if(flfTop<minTop)flfTop=minTop;}
flf.style.top=flfTop+"px";flf.style.left=flfLeft+"px";}
flf.show();Try.these(function(){form.down('.login-status-img').update('');form.down('.login-status').update('');form.down('.login-status').hide();form.down('.login').activate();});}},showTop:function(el){var tflf=$$('.tflf').first();if(tflf){Login.cancel();var form=tflf.down('div.login-form');if(form)form.show();if(el){var xy=Position.cumulativeOffset(el);var x=xy[0];var width=tflf.getWidth();var rightmost=FloatingLoginForm.getFarthestRight();if(width>0&&(x+width)>rightmost)
x=rightmost-width-10;else
x=x-50;tflf.style.left=x+'px';var height=tflf.getHeight();if((xy[1]-height/2)>0)
tflf.style.top=(xy[1]-height/2)+'px';else
tflf.style.top='0px';}
tflf.show();Try.these(function(){form.down('.login-status-img').update('');form.down('.login-status').update('');form.down('.login-status').hide();form.down('.login').activate();});}},getFarthestRight:function(){var body=$$('body')[0];if(!body)return this.DEFAULT_FARTHEST_RIGHT;var xy=Position.cumulativeOffset(body);return xy[0]+body.getWidth();}};
var Subscription={WORKING_TAG:Profile.WORKING_TAG,SUCCESS_SRC:'/images/icon-check.gif',subscribed:null,toggle_popup:function(el,show_name,show_url,show_id,has_episodes){var ss_popup=$('subscription-popup');if(ss_popup){if(Behaviors.isLoggedIn()){$('ss-done').hide();if(show_name=="Movie Trailers"){$('ss-has-clips').innerHTML="trailers";$('ss-clips').innerHTML="Trailers";has_episodes=false;}else{$('ss-has-clips').innerHTML="clips";$('ss-clips').innerHTML="Clips";}
if(!has_episodes){$('ss-has-episodes').hide();$('ss-episodes').hide();$('ss-episodes-all').hide();$('ss-episodes-first').hide();$$('.ss-options')[0].style.height="19px";}else{$('ss-has-episodes').show();$('ss-episodes').show();$('ss-episodes-all').show();$('ss-episodes-first').show();$$('.ss-options')[0].style.height="66px";}
var old_show_id=$('ss-show').value;$('ss-show-name').innerHTML='<a href="/'+show_url+'">'+show_name+'</a> ';$('ss-show').value=show_id;if(old_show_id==show_id){ss_popup.toggle();}
else{ss_popup.hide();var link_coords=Element.cumulativeOffset(el);var calculated_left=link_coords.left+el.offsetWidth-310;if(calculated_left<10)calculated_left=10;ss_popup.style.left=calculated_left+"px";if(/^.watch/.test(window.location.pathname)||/^.search/.test(window.location.pathname)){ss_popup.style.top=(link_coords.top+el.offsetHeight+5)+"px";}
else{ss_popup.style.top=(link_coords.top-el.offsetHeight-ss_popup.getHeight()-5)+"px";}
ss_popup.show();}}else{FloatingLoginForm.show(el);}}
return false;},hide_popup:function(){var ss_popup=$('subscription-popup');if(ss_popup)ss_popup.hide();if($('ss-episodes'))$('ss-episodes').removeClassName('checked');if($('ss-clips'))$('ss-clips').removeClassName('checked');if($('ss-email'))$('ss-email').removeClassName('checked');if($('ss-episodes-all'))$('ss-episodes-all').removeClassName('pressed');if($('ss-episodes-first'))$('ss-episodes-first').removeClassName('pressed');return false;},click_to_hide:function(ev){var x=Event.pointerX(ev);var y=Event.pointerY(ev);if(Event.element(ev).hasClassName('small-subscription')||Position.within($('subscription-popup'),x,y))
return;Subscription.hide_popup();},toggle_input:function(name){var el=$(name);if(!el)return false;if(el.hasClassName('checked')){el.removeClassName('checked');if(name=='ss-episodes'){$('ss-episodes-all').removeClassName('pressed');$('ss-episodes-first').removeClassName('pressed');}}else if(el.hasClassName('checkbox')&&!el.hasClassName('checked')){el.addClassName('checked');if(name=='ss-episodes'){$('ss-episodes-all').addClassName('pressed');}}else if(el.hasClassName('radio')&&!el.hasClassName('pressed')){if(!$('ss-episodes').hasClassName('checked'))
$('ss-episodes').addClassName('checked');if(name=="ss-episodes-all"){$('ss-episodes-all').addClassName('pressed');$('ss-episodes-first').removeClassName('pressed');}else{$('ss-episodes-all').removeClassName('pressed');$('ss-episodes-first').addClassName('pressed');}}
return false;},working:function(el){if(this.alreadyWorking(el))return;var img=$(el).down('img');img.hide();new Insertion.After(img,this.WORKING_TAG)},alreadyWorking:function(el){return!$(el).down('img.working');},stopWorking:function(el){if(!this.alreadyWorking(el))return;var img=$(el).down('img');img.show();var working=$(el).down('img.working');if(working&&working.parentNode)working.parentNode.removeChild(working);},submit_options:function(el){if($('ss-loading').style.display=="none"&&Behaviors.isLoggedIn()?true:(FloatingLoginForm.show(this),false)){var url='/shows/subscribe/';url+=$('ss-show').value+'?';var types=[($('ss-episodes').hasClassName('checked')?'episodes':''),($('ss-clips').hasClassName('checked')?'clips':'')].without('').join(',');if(types!=''&&types!=','){url+="type="+types;if($('ss-episodes').hasClassName('checked'))
url+="&first_run_only="+($('ss-episodes-first').hasClassName('pressed')?'1':'0');}
if($('ss-email').hasClassName('checked')){if(url.indexOf('?')!=url.length-1)
url+='&';url+='email_alert=1';}
$('ss-loading').show();$('ss-done').hide();new Ajax.Request(url,{asynchronous:true,evalScripts:true,onComplete:function(request){$('ss-loading').hide();},onSuccess:function(request){$('ss-done').show();Subscription.hide_popup();}});}
return false;},success:function(el){if(!this.alreadyWorking(el))return;var img=$(el).down('img');if(img){img.src=this.SUCCESS_SRC;img.onmouseover=function(){};img.onmouseout=function(){};}
if(Subscription.subscribed==null){Subscription.subscribed=true;SocialFeed.publishSubscribe();}}};var SubscriptionCheckbox=Object.extend(Object.clone(Subscription),{isWorking:function(el){return el.up('div.subscription-box').down('a.checkbox').hasClassName('working');},working:function(el){el.up('div.subscription-box').down('a.checkbox').addClassName('working');},stopWorking:function(el){el.up('div.subscription-box').down('a.checkbox').removeClassName('working');},checked:function(el){return el.hasClassName('checked')||el.hasClassName('pressed');},isRadio:function(el){return el.hasClassName('radio');},check:function(el,url){SubscriptionCheckbox.working(el);new Ajax.Request(SubscriptionCheckbox.requestUrl(el,url),{onSuccess:function(){SubscriptionCheckbox.success(el);},onComplete:function(){SubscriptionCheckbox.stopWorking(el);}})},setState:function(el,checked){var box=el.up('div.subscription-box');if(!box)return;if(this.isRadio(el))
box.down('.checkbox').addClassName('checked');var fro=box.getElementsBySelector('a.radio');if(fro&&fro.length>0){fro.each(function(radio){radio.removeClassName('pressed');});}
fro=box.getElementsBySelector('a.radio');if(checked&&el&&!this.isRadio(el)&&fro&&fro.length>0){fro.each(function(radio){if(radio.innerHTML=="all")
radio.addClassName('pressed');});}
var klass=(this.isRadio(el)?'pressed':'checked');(checked?el.addClassName(klass):el.removeClassName(klass));},requestUrl:function(el,subscribe){return this.checked(el)&&!this.isRadio(el)?subscribe.replace('/subscribe','/unsubscribe'):subscribe;},success:function(el){if(!this.alreadyWorking(el))return;var selected=!this.checked(el);if(el&&this.isRadio(el)){selected=true;}
this.setState(el,selected);}});Event.observe(window,"load",function(){if($('ss-show'))$('ss-show').value=0;});
var UserHistory={add:function(cookieName,properName,contentId){var cookieValue=Behaviors.getCookie(cookieName);var history=[];if(cookieValue){history=cookieValue.split('_');}
history.unshift(contentId);if(cram){if(cookieValue)Behaviors.eraseCookie(cookieName);cram.set(properName,history.slice(0,50));}
else{history=history.slice(0,10).join('_');Behaviors.setCookie(cookieName,history,30);}},get:function(cookieName,properName){var cookieValue=Behaviors.getCookie(cookieName);if(cookieValue)return cookieValue;if(cram)return $A(cram.get(properName)).join('_');return null;},add_history:function(contentId){this.add('_hulu_uh','userHistory',contentId);},add_watched_history:function(contentId){this.add('_hulu_uwh','userWatchedHistory',contentId);},get_history:function(){return this.get('_hulu_uh','userHistory');},get_watched_history:function(){return this.get('_hulu_uwh','userWatchedHistory');},clearHistory:function(){if(cram){cram.remove('userHistory');cram.remove('userWatchedHistory');}
Behaviors.eraseCookie('_hulu_uh');Behaviors.eraseCookie('_hulu_uwh');}};
var Forum=Class.create();Object.extend(Forum,{default_text:'Enter keywords',clickSearchTerm:function(el,ev){if(ev.type=='click'&&el.value==Forum.default_text){el.value="";el.removeClassName('dormant');}
else if(ev.type=='blur'&&el.value==""){el.value=Forum.default_text;el.addClassName('dormant');}},toggleAdvancedPane:function(){$('f-search-advanced-pane').toggle();if($('f-search-advanced-pane').style.display=='none'){$('f-search-advanced-toggle').src='/images/button-collapse-hover.gif';$('forum_search_advanced').value=0;Forum.resetAdvancedOptions();}
else{$('f-search-advanced-toggle').src='/images/button-expand-hover.gif';$('forum_search_advanced').value=1;}},resetAdvancedOptions:function(){document.forum_search_form.search_type[0].selected="1";document.forum_search_form.search_recent_filter[1].selected="1";document.forum_search_form.search_posts_count.value=1;document.forum_search_form.search_special_posts[0].checked=false;}});
var Topic=Class.create();Object.extend(Topic,{singleSubmitLock:false,viewedTopics:new Array(),clearTopicForm:function(){$('t-form-subject').value='';$('t-form-body').value='';if($('topic_has_spoilers'))$('topic_has_spoilers').checked=false;Topic.singleSubmitLock=false;Element.update('t-form-errors','');if($('t-form-instance'))$('t-form-instance').hide();if($('t-error-container'))$('t-error-container').hide();},openTopicForm:function(el){if(!Behaviors.isLoggedIn()){FloatingLoginForm.show(el);return false;}
if(!Behaviors.isEmailValidated()){new Ajax.Request('/users/'+Behaviors.getUserId()+'/email_validation_status',{asynchronous:true,evalScripts:true,onComplete:function(request){if(!Behaviors.isEmailValidated())
Login.showEmailValidation();else
Topic.doOpenTopicForm(el);}});return false;}
else{Topic.doOpenTopicForm(el);return false;}},doOpenTopicForm:function(el){if($('t-form-instance').style.display=='none'){$('t-form-subject').value='';$('t-form-body').value='';if($('topic_has_spoilers'))$('topic_has_spoilers').checked=false;$('t-form-instance').show();$('t-form-subject').focus();}},showSpoilers:function(){ssLength=document.styleSheets.length;activeSheet=document.styleSheets[ssLength-1];if(Prototype.Browser.IE){activeSheet.addRule(".p-item-s-spoiled .p-item-spoiled","display: none;");activeSheet.addRule(".p-item-s-spoiled .p-item-body","display: block;");activeSheet.addRule(".p-item-s-spoiled .p-replies-collapsed","display: block;");activeSheet.addRule(".p-item-s-spoiled .p-replies","display: block;");activeSheet.addRule(".p-item-s-spoiled .p-replies-preload","display: block;");activeSheet.addRule(".p-item-s-spoiled .p-content-flag","display: block;");activeSheet.addRule(".p-item-s-flagged .p-item-body","display: none;");activeSheet.addRule(".p-item-s-flagged .p-replies-collapsed","display: none;");activeSheet.addRule(".p-item-s-flagged .p-replies","display: none;");activeSheet.addRule(".p-item-s-flagged .p-replies-preload","display: none;");activeSheet.addRule(".t-preview .synopsis .text.spoiled","display: block;");activeSheet.addRule(".t-preview-item .text.spoiled","display: block;");activeSheet.addRule(".t-preview .synopsis .spoiler","display: none;");activeSheet.addRule(".t-preview-item .spoiler","display: none;");}
else
{activeSheet.insertRule(".p-item-s-spoiled .p-item-spoiled {display: none;}",activeSheet.cssRules.length);activeSheet.insertRule(".p-item-s-spoiled .p-item-body, .p-item-s-spoiled .p-replies-collapsed, .p-item-s-spoiled .p-replies, .p-item-s-spoiled .p-replies-preload {display: block;}",activeSheet.cssRules.length);activeSheet.insertRule(".p-item-s-flagged .p-item-body, .p-item-s-flagged .p-replies-collapsed, .p-item-s-flagged .p-replies, .p-item-s-flagged .p-replies-preload, .p-item-s-flagged .p-content-extras {display: none;}",activeSheet.cssRules.length);activeSheet.insertRule(".t-preview .synopsis .spoiler, .t-preview-item .spoiler {display: none;}",activeSheet.cssRules.length);activeSheet.insertRule(".t-preview .synopsis .text.spoiled, .t-preview-item .text.spoiled {display: block;}",activeSheet.cssRules.length);}},toggleTopic:function(topic_id,post_id,hideable,alwaysLoad){var posts_section_id='t-'+topic_id+'-p-0-posts';if(alwaysLoad||$(posts_section_id).hasClassName('p-preload')){$('t-'+topic_id+'-flags-loading').style.display='';params={};params['topic_id']=topic_id+'';params['post_id']=post_id+'';params['parent_id']='0';params['depth']='0';params['hideable']=hideable;new Ajax.Updater('t-'+topic_id+'-p-0-posts','/posts/list',{asynchronous:true,evalScripts:true,method:'get',parameters:params,onComplete:function(){$('t-'+topic_id+'-flags-loading').style.display='none';$('t-'+topic_id+'-button-expand').src='/images/button-forums-expand.gif';$('t-'+topic_id+'-button-expand').width=13;$('t-'+topic_id+'-button-expand').height=13;if(post_id>0){if($('p-'+post_id+'-body')){}}
else{}
$('t-'+topic_id+'-section').addClassName('expanded');$(posts_section_id).className='p-load-show';if(Prototype.Browser.IE6)
setTimeout("$('"+'t-'+topic_id+'-p-0-posts'+"').addClassName('ie6');",10);}});if(typeof(Topic.viewedTopics[topic_id])=='undefined'){new Ajax.Request('/topics/view/'+topic_id);Topic.viewedTopics[topic_id]=1;$('t-'+topic_id+'-view_count').visualEffect('appear',{duration:1.0,from:0.0,to:1.0});setTimeout("$('"+'t-'+topic_id+'-view_count'+"').style.opacity = 1;",1100);$('t-'+topic_id+'-view_count').innerHTML=parseInt($('t-'+topic_id+'-view_count').innerHTML)+1;}}
else if($(posts_section_id).hasClassName('p-load-show')){$(posts_section_id).className='p-load-hide';$('t-'+topic_id+'-button-expand').src='/images/button-forums-collapse-hover.gif';$('t-'+topic_id+'-section').removeClassName('expanded');}
else{$(posts_section_id).className='p-load-show';$('t-'+topic_id+'-button-expand').src='/images/button-forums-expand-hover.gif';$('t-'+topic_id+'-section').addClassName('expanded');}},sortTopics:function(css_id,topicable_type,topicable_id,sort_by,segregate_video,search_terms)
{params={};params['topicable_type']=topicable_type;params['topicable_id']=topicable_id;params['sort']=sort_by;params['page']=1;params['segregate_video']=segregate_video;params['search_terms']=search_terms;target=$('t-header-'+sort_by);if(target.hasClassName('selected')){if(target.hasClassName('inverted')){params['order']='DESC';}
else{params['order']='ASC';}}
else{params['order']='DESC';if(sort_by=='subject'){params['order']='ASC';}}
new Ajax.Updater(css_id,'/topics/update_page',{asynchronous:true,evalScripts:true,method:'get',parameters:params});},default_search_text:'Search within these discussions',clickSearchTerm:function(el,ev){if(ev.type=='click'&&el.value==Topic.default_search_text){el.value="";$(el).removeClassName('dormant');}
else if(ev.type=='blur'&&el.value==""){el.value=Topic.default_search_text;$(el).addClassName('dormant');}},toggleSegregateOption:function(css_id,topicable_id,topicable_type,sort,order){new Ajax.Updater(css_id,'/topics/update_page?'+'topicable_id='+topicable_id+'&topicable_type='+topicable_type+'&sort='+sort+'&order='+order+'&segregate_video='+document.t_videos_option.segregate.value,{asynchronous:true,evalScripts:true,method:'get'});return false;},hoverSticky:function(ev){var h=$('t-sticky-hover');if(ev.type=='mouseover'){var el=Event.element(ev);if(h&&el){var x=Event.pointerX(ev)+10;var y=Event.pointerY(ev)+10;h.setStyle({top:y+"px",left:x+"px"});h.show();}}
else{h.hide();}},activateHovers:function(){$$('ul.t-preview div.title a').each(function(el){Element.observe(el,'mouseover',Topic.showPreviewSynopsis);});var ul=$$('ul.t-preview').first();if(ul){ul=ul.up('div.fixed-lg');var body=$$('body').first();if(body&&ul){Topic.previewBounds=InfoHover.getBounds(ul);Topic.previewBounds.top-=300;Topic.previewBounds.height+=300;Element.observe(body,'mouseout',Topic.hidePreviewSynopsis);}}},currentTimeout:null,showPreviewSynopsis:function(ev){var target=Event.element(ev);var hover=target.up('div.t-preview-item');if(hover){hover=hover.next('div');}
if(!hover||!target)return;var dim=hover.getDimensions();var bounds=InfoHover.getBounds(target);var viewport=Element.viewportOffset(target);viewport.left-=600;var loc=InfoHover.determineTailLocation(dim,bounds,viewport);var off=Position.cumulativeOffset(Element.getOffsetParent(hover));loc.y-=off[1];loc.x-=off[0];hover.style.top=loc.y+'px';hover.style.left=loc.x+'px';InfoHover.removeTailClassNames(hover);hover.addClassName(loc.className);$$('.synopsis-container').each(Element.hide);clearTimeout(Topic.currentTimeout);Topic.currentTimeout=setTimeout(function(){new Effect.Appear(hover,{duration:0.3,afterFinish:function(){Topic.currentTimeout=null;}});},700);return false;},hidePreviewSynopsis:function(ev){if(!Topic.previewBounds)return;var bounds=Topic.previewBounds;var y=Event.pointerY(ev);var x=Event.pointerX(ev);var hide=y<bounds.top||y>bounds.top+bounds.height||x<bounds.left||x>bounds.left+bounds.width;if(hide){$$('.synopsis-container').each(Element.hide);}
return false;}});Event.observe(window,'load',Topic.activateHovers);
var Post=Class.create();Object.extend(Post,{singleSubmitLock:false,openPostForm:function(post_id,topic_id,depth,last_item,el){if(READ_ONLY)return;if(!Behaviors.isLoggedIn()){FloatingLoginForm.show(el);return false;}
if(!Behaviors.isEmailValidated()){new Ajax.Request('/users/'+Behaviors.getUserId()+'/email_validation_status',{asynchronous:true,evalScripts:true,onComplete:function(request){if(!Behaviors.isEmailValidated())
Login.showEmailValidation();else
Post.doOpenPostForm(post_id,topic_id,depth,last_item,el);}});return false;}
else{Post.doOpenPostForm(post_id,topic_id,depth,last_item,el);}},doOpenPostForm:function(post_id,topic_id,depth,last_item,el){$$('.p-form-block').each(function(e1){e1.hide();});formDiv='t-'+topic_id+'-p-'+post_id+'-form';if($(formDiv)){$(formDiv).appendChild($('p-form-instance'));$('p-form-topic-id').value=topic_id;$('p-form-parent-id').value=post_id;$('p-form-depth').value=depth;$('p-form-last-item').value=last_item;if($('p-form-instance').style.display=='none')$('p-form-body').value="";if($('p-form-spoilers'))$('p-form-spoilers').checked=false;$('p-error-container').hide();$(formDiv).parentNode.style.display="";$(formDiv).style.display="";$('p-form-submit').src='/images/btn-forums-submit.gif';$('p-form-instance').show();$('p-form-body').focus();if(Prototype.Browser.IE){$(formDiv).removeClassName('ie6');$(formDiv).addClassName('ie6');}}},closePostForm:function(){Element.update('p-form-errors','');$('p-form-body').value="";$('p-form-topic-id').value="";$('p-form-parent-id').value="";if($('p-form-spoilers'))$('p-form-spoilers').checked=false;$('p-form-instance').parentNode.parentNode.style.display="none";$('p-form-instance').parentNode.style.display="none";$('p-form-instance').hide();$('p-form-loading').hide();},updateState:function(id,state){itemDiv='p-'+id+'-item';$(itemDiv).removeClassName('p-item-s-default');$(itemDiv).removeClassName('p-item-s-spoiled');$(itemDiv).removeClassName('p-item-s-flagged');$(itemDiv).addClassName('p-item-s-'+state);},toggleReplies:function(params){var toggleDivName='p-'+params['parent_id']+'-replies-toggle';var postDivPrefix='t-'+params['topic_id']+'-p-'+params['parent_id'];if($(postDivPrefix+'-posts').className=='p-replies-preload')
{$('p-'+params['parent_id']+'-item-replies-loading').show();$(postDivPrefix+'-posts-toggle').src='/images/button-expand-hover.gif';$(postDivPrefix+'-posts').className='';new Ajax.Updater(postDivPrefix+'-posts','/posts/list',{asynchronous:true,evalScripts:true,parameters:params,method:'get',onComplete:function(){$(toggleDivName).className='p-replies-expanded';$('p-'+params['parent_id']+'-item-replies-loading').hide();$(postDivPrefix+'-formholder-expanded').style.display=$(postDivPrefix+'-formholder-collapsed').style.display;$(postDivPrefix+'-formholder-collapsed').style.display='none';$(postDivPrefix+'-formholder-expanded').appendChild($(postDivPrefix+'-form'));setTimeout("$('"+toggleDivName+"').addClassName('ie6');",10);}})}
else
{if($(postDivPrefix+'-posts').style.display==''){$(postDivPrefix+'-posts').style.display='none';$(toggleDivName).className='p-replies-collapsed';if(params['footer_collapse']==null){$(postDivPrefix+'-posts-toggle').src='/images/button-collapse-hover.gif';}
else{$(postDivPrefix+'-posts-toggle').src='/images/button-collapse.gif';}
$(postDivPrefix+'-formholder-collapsed').style.display=$(postDivPrefix+'-formholder-expanded').style.display;$(postDivPrefix+'-formholder-expanded').style.display='none';$(postDivPrefix+'-formholder-collapsed').appendChild($(postDivPrefix+'-form'));}
else{$(postDivPrefix+'-posts').style.display='';$(toggleDivName).className='p-replies-expanded';$(postDivPrefix+'-posts-toggle').src='/images/button-expand-hover.gif';$(postDivPrefix+'-formholder-expanded').style.display=$(postDivPrefix+'-formholder-collapsed').style.display;$(postDivPrefix+'-formholder-collapsed').style.display='none';$(postDivPrefix+'-formholder-expanded').appendChild($(postDivPrefix+'-form'));}}},hover:function(post_id,hoverOn){if(hoverOn&&!READ_ONLY)
$('p-'+post_id+'-item-container').addClassName("active");else
$('p-'+post_id+'-item-container').removeClassName("active");}});
var Tab=Class.create();var loadingImg='<img width="16" height="16" border="0" style="vertical-align: middle" src="/images/loading-animated-circle.gif"/>'
Object.extend(Tab,{tabselect:function(tab){tablist=$('tab-container').getElementsByTagName('li');nodes=$A(tablist);nodes.each(function(node){if(node.id==tab.id){node.className='tab-selected';Tab.tab_image_disable($(node.id+'-img'));}else if(node.className=='tab-selected'){node.className='tab-unselected';Tab.tab_image_enable($(node.id+'-img'));};});},paneselect:function(pane){panelist=$('pane-container').getElementsByTagName('li');nodes=$A(panelist);nodes.each(function(node){if(node.id==pane.id){pane.className='pane-selected';}else if(node.className=='pane-selected'){node.className='pane-unselected';};});},loadTab:function(name,src,alwaysReload,params,callback){tab=$('tab-'+name);pane=$('pane-'+name);if(alwaysReload||pane.className=='pane-preload'){Tab.tabselect(tab);new Ajax.Updater(pane,src,{asynchronous:true,evalScripts:true,parameters:params,method:'get',onCreate:function(){$('tab-loading').show();},onSuccess:function(){$('tab-loading').hide();Tab.paneselect(pane);if(typeof(callback)=="function"){callback();}},onComplete:function(){$$('.tab-loading-circle').each(Element.hide);}})}
else{Tab.tabselect(tab);Tab.paneselect(pane);$$('.tab-loading-circle').each(Element.hide);if(typeof(callback)=="function"){callback();}}},tab_image_disable:function(el){var img=$(el);if(!img)return;if(img.src.match(/-hover/)){img.src=img.src.replace('-hover','-disabled');}
else if(img.src.match(/-disabled/)){}
else if(img.src.match(/\.gif/)){img.src=img.src.replace('.gif','-disabled.gif');}},tab_image_enable:function(el){var img=$(el);if(!img)return;if(img.src.match(/-disabled/)){img.src=img.src.replace('-disabled','');}}});
var current_widget_type='';function toggleWidgetHelp(pos,id,type){var help=$('widget-help');if(help){help.setStyle({top:pos[1]+27+"px",left:190+"px"});$('show-widget-code').value='<object width="200" height="439"><param name="movie" value="http://www.hulu.com/widget/show/'+id+'/'+type+'s"></param><embed src="http://www.hulu.com/widget/show/'+id+'/'+type+'s" type="application/x-shockwave-flash" width="200" height="439"></embed></object>';Element.hide('copy-show-check-icon');help.toggle();if(current_widget_type!=type&&current_widget_type!='')
help.toggle();current_widget_type=type;}}
function hideWidgetHelp(){var help=$('widget-help');if(help){Element.hide('copy-show-check-icon');help.hide();current_widget_type='';}}
function getWidgetCode(){$('show-widget-code').select();Element.show('copy-show-check-icon');return $('show-widget-code').value;}
var wt_w=725;var wt_h=210;var wt_layout="Horizontal";var wt_num_thumbs=4;var wt_sort_order="recentlyadded";var wt_matrix=[[[392,210],[392,210],[560,210],[725,210]],[[210,320],[210,455],[210,590],[210,725]]]
var wt_show_name="";var wt_override="";function wt_set_show_name(sn){wt_show_name=sn;}
function wt_set_override(or){wt_override=or;}
function wt_copy_embed_code(){$('wt-embed-code-text').select();$('wt-copy-check-icon').style.visibility="visible";return $('wt-embed-code-text').value;}
function wt_copy_advanced_embed_code(){$('wt-advanced-widget-code').select();$('wt-copy-advanced-check-icon').style.visibility="visible";return $('wt-advanced-widget-code').value;}
function wt_choose(p){if((p=='wt-1-thumbs')&&(wt_layout=="Horizontal"))
return;$(p).checked=true;wt_update_config();}
function wt_update_config(){if($('wt-horizontal').checked){wt_layout="Horizontal";if(wt_num_thumbs==1){wt_num_thumbs=2;$('wt-1-thumbs').checked=false;$('wt-2-thumbs').checked=true;}
$('wt-1-thumbs').disabled=true;$('wt-1-thumbs-span').addClassName('disabled');}else{wt_layout="Vertical";$('wt-1-thumbs').disabled=false;$('wt-1-thumbs-span').removeClassName('disabled');}
if($('wt-1-thumbs').checked)
wt_num_thumbs=1;else if($('wt-2-thumbs').checked)
wt_num_thumbs=2;else if($('wt-3-thumbs').checked)
wt_num_thumbs=3;else if($('wt-4-thumbs').checked)
wt_num_thumbs=4;if($('wt-sort-order'))
wt_sort_order=$('wt-sort-order').value;else
wt_sort_order="recentlyadded";var ar=wt_matrix[wt_layout=="Horizontal"?0:1][wt_num_thumbs-1];wt_w=ar[0];wt_h=ar[1];wt_insert_params();}
function wt_insert_params(){var code="<object width=\""+wt_w+"\" height=\""+wt_h+"\"><param name=\"movie\" ";code+="value=\"http://www.hulu.com/widget/embed/videopanel\"></param><param name=\"bgcolor\" value=\"0x000000\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"flashVars\" ";code+="value=\"partner=CSWidget&layout="+wt_layout+wt_num_thumbs+"Thumbs&watchOnHulu=true&searchEnabled=true&sortEnabled=true&sortDefault="+wt_sort_order+"&show="+wt_show_name+wt_override+"\"></param><embed ";code+="src=\"http://www.hulu.com/widget/embed/videopanel\" type=\"application/x-shockwave-flash\" flashVars=\"partner=CSWidget&layout="+wt_layout+wt_num_thumbs;code+="Thumbs&watchOnHulu=true&searchEnabled=true&sortEnabled=true&sortDefault="+wt_sort_order+"&show="+wt_show_name+wt_override+"\" wmode=\"transparent\" bgcolor=\"0x000000\" width=\""+wt_w+"\" height=\""+wt_h+"\"></embed></object>";$('wt-embed-code-text').value=code;var help=$('wt-widget-help');if(help){var advancedembedcode='';advancedembedcode+='<div id="huluPlayer" playermode="floating"></div>';advancedembedcode+='<div id="huluPanel1" panellayout="'+wt_layout+'" panelitems="'+wt_num_thumbs+'" panelautoplay="true" panelshow="'+wt_show_name+wt_override+'" panelsortdefault="'+wt_sort_order+'"></div>';advancedembedcode+='<script src="http://player.hulu.com/videopanel/js/huluVideoPanel.js?partner=CSWidget" id="HULU_VP_JS" type="text/javascript"></scr'+'ipt>';$('wt-advanced-widget-code').value=advancedembedcode;$('wt-copy-advanced-check-icon').style.visibility="hidden";}
$('wt-dimensions').innerHTML="Dimensions: "+wt_w+" x "+wt_h;$('wt-copy-check-icon').style.visibility="hidden";swfObject2=new SWFObject("http://www.hulu.com/widget/embed/videopanel","show_widget",wt_w,wt_h,"1");swfObject2.addParam("flashVars","partner=CSWidget&layout="+wt_layout+wt_num_thumbs+"Thumbs&watchOnHulu=true&searchEnabled=true&sortEnabled=true&sortDefault="+wt_sort_order+"&show="+wt_show_name+wt_override);swfObject2.addParam("allowScriptAccess","always");swfObject2.addParam("wmode","transparent");VersionCheck.write(swfObject2,"wt-widget");}
function wt_toggleWidgetHelp(){var help=$('wt-widget-help');if(help){var advancedembedcode='';advancedembedcode+='<div id="huluPlayer" playermode="floating"></div>';advancedembedcode+='<div id="huluPanel1" panellayout="'+wt_layout+'" panelitems="'+wt_num_thumbs+'" panelautoplay="true" panelshow="'+wt_show_name+wt_override+'" panelsortdefault="'+wt_sort_order+'"></div>';advancedembedcode+='<script src="http://player.hulu.com/videopanel/js/huluVideoPanel.js?partner=CSWidget" id="HULU_VP_JS" type="text/javascript"></scr'+'ipt>';$('wt-advanced-widget-code').value=advancedembedcode;$('wt-copy-advanced-check-icon').style.visibility="hidden";help.toggle();}}
function wt_hideWidgetHelp(){var help=$('wt-widget-help');if(help){$('wt-copy-advanced-check-icon').style.visibility="hidden";help.hide();}}
var ChannelDock={HIDE_THRESHOLD:0.08,currentDock:null,upperBound:0,lowerBound:0,leftBound:0,rightBound:0,processing:false,mungeFirstDeactivate:typeof(navigator)!="undefined"&&navigator.appVersion.indexOf("Mac")>=0&&navigator.userAgent.indexOf("Firefox")>=0,disableFade:typeof(navigator)!="undefined"&&navigator.appVersion.indexOf("Mac")>=0&&navigator.userAgent.indexOf("Firefox/2")>=0,ignoreDeactivate:false,enableButtons:function(){$$('.channel-dock-button').each(function(el){Event.observe(el,"mouseover",ChannelDock.activate);});},activate:function(ev){if(ChannelDock.disabled()){return;}
if(ChannelDock.ignoreDeactivate){return;}
if(!ChannelDock.processing){var el=Event.element(ev);var dock=$$('.channels-dock').first();if(dock){var xy=Position.cumulativeOffset(el);dock.style.top=(xy[1]+el.getHeight())+'px';dock.style.left=xy[0]+'px';ChannelDock.currentDock=dock;ChannelDock.upperBound=(xy[1]+el.getHeight());ChannelDock.lowerBound=(xy[1]+el.getHeight())+dock.getHeight();ChannelDock.leftBound=xy[0];ChannelDock.rightBound=xy[0]+dock.getWidth();ChannelDock.processing=true;if(ChannelDock.mungeFirstDeactivate)
ChannelDock.ignoreDeactivate=true;if(ChannelDock.disableFade){ChannelDock.currentDock.show();}
else{new Effect.Appear(dock,{duration:0.3,afterFinish:function(){ChannelDock.processing=false;}});}}}},close:function(){if(ChannelDock.disabled()){return;}
var dock=ChannelDock.currentDock;ChannelDock.processing=false;ChannelDock.ignoreDeactivate=false;if(dock&&dock.style.display!='none'){dock.hide();}},deactivate:function(ev){if(ChannelDock.disabled()){return;}
if(ChannelDock.ignoreDeactivate){ChannelDock.ignoreDeactivate=false;return;}
var dock=ChannelDock.currentDock;ChannelDock.hideDock=true;ChannelDock.processing=false;if(dock&&dock.style.display!='none'){var y=Event.pointerY(ev);var x=Event.pointerX(ev);var threshold=ChannelDock.HIDE_THRESHOLD;var upper=ChannelDock.upperBound;var lower=ChannelDock.lowerBound;var left=ChannelDock.leftBound;var right=ChannelDock.rightBound;var hide=y<upper*(1-threshold)||y>lower*(1+threshold)||x<=left||x>=right;if(hide&&x>=0&&y>=0){dock.hide();}}},vis:function(el){if(!ChannelDock.transparent(el))el.show();},invis:function(el){if(!ChannelDock.transparent(el))el.hide();},transparent:function(el){var wmode=el.attributes;if(wmode)wmode=wmode['wmode'];if(wmode)wmode=wmode.nodeValue;return wmode&&wmode=='transparent';},isDisabled:null,disabled:function(){if(this.isDisabled!=null)return this.isDisabled;this.isDisabled=typeof(navigator)!="undefined"&&/linux/.test(navigator.userAgent.toLowerCase())&&/^\/($|tv|movies|channels)/.test(window.location.pathname);return this.isDisabled;}};Event.observe(window,'load',function(){var body=$$('body').first();if(body)Event.observe(body,'mouseout',ChannelDock.deactivate);ChannelDock.enableButtons();});
var TimeFormatter=Class.create();Object.extend(TimeFormatter,{monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],translateToLocalTime:function(utc){return new Date(utc);},format:function(d){return(this.monthNames[d.getMonth()]+" "+
d.getDate()+" "+
d.getFullYear()+", "+
d.toLocaleTimeString());},translateAndFormat:function(d){return this.format(this.translateToLocalTime(d));}});
var Hover=Class.create();var HOVER_EXTENSION_RX=/(\.gif\??[0-9]*|\.jpg\??[0-9]*|\.png\?[0-9]*)$/;Object.extend(Hover,{init:function(){Event.observe(window,'load',function(){Hover.makeSandy();});Ajax.Responders.register({onComplete:Hover.makeSandy});},image_toggle_over:function(el){if(typeof($)=='undefined')return;var img=$(el);if(!img)return;if(!img.width&&!img.height){var dims=img.getDimensions();img.width=dims.width;img.height=dims.height;}
var extension=HOVER_EXTENSION_RX.exec(img.src);extension=extension&&extension.length>=1?extension[1]:false;if(!img.src.match(/-disabled/)&&extension){if(!img.src.match(/-hover/))
img.src=img.src.replace(/-hover/g,'').replace(HOVER_EXTENSION_RX,'-hover'+extension);else
img.src=img.src.replace(HOVER_EXTENSION_RX,extension);img.style.cursor="pointer";}else{img.style.cursor="default";img.alt="";}},image_toggle_out:function(el){var img=$(el);if(!img)return;if(!img.src.match(/-disabled/)&&img.src.match(HOVER_EXTENSION_RX)){if(img.src.match(/-hover/))
img.src=img.src.replace(/-hover/g,'');}},makeSandy:function(){$$('.hover-me').each(function(el){var img=$(el);var extension=HOVER_EXTENSION_RX.exec(img.src);extension=extension&&extension.length>=1?extension[1]:false;if(!img.src.match(/-disabled/)&&extension){pingImage(img.src.replace(HOVER_EXTENSION_RX,'-hover'+extension));}
img.observe('mouseover',function(event){Hover.image_toggle_over(Event.element(event).id);});img.observe('mouseout',function(event){Hover.image_toggle_out(Event.element(event).id);});img.removeClassName('hover-me');});}});Hover.init();
var Pagination={loading:function(el){if(this.indicator(el))this.indicator(el).show();},doneLoading:function(el){if(this.indicator(el))this.indicator(el).hide();},indicator:function(el){if(!el)return null;el=$(el);if(!el||!el.up)return null;var indicator=el.up('.page');if(indicator)
indicator=indicator.down('.pagination-loading');else
indicator=el.down('.pagination-loading');return indicator;},fixInput:function(el){if(!el)return false;var cur=el.readAttribute("current_page");var max=el.readAttribute("total_pages");var page=parseInt(el.page.value);if(isNaN(page)){el.page.value=cur;return false;}else if(page<=0)
el.page.value=1;else if(page>max)
el.page.value=max;else
el.page.value=page;this.loading(el);return true;},fixURL:function(el){if(!el)return null;if(this.fixInput(el))
el.action=el.action.substr(0,el.action.indexOf('?'))+'/'+el.page.value+el.action.substr(el.action.indexOf('?'));}};
var PlayerLights=Class.create();PlayerLights.prototype={yPos:0,xPos:0,working:false,isOff:false,defaultOpacity:0.8,defaultDuration:0.5,oldDescriptionContainerBackground:false,oldBreakoutContainerBackground:false,initialize:function(){},maintenanceShowing:function(){var el=$('maintenance');return READ_ONLY&&el&&el.style.display!='none';},off:function(opacity,duration){InfoHover.executeHide();if(this.maintenanceShowing()){new Effect.SlideUp('maintenance',{duration:0.3,afterFinish:this.off.bind(this)});return;}
if(!this.working){this.working=true;var opacityOptions={duration:(duration!=void 0)?duration:this.defaultDuration,from:0.0,to:(opacity!=void 0)?opacity:this.defaultOpacity};if($('maintenance'))new Effect.SlideUp('maintenance');if($('overlay-top')){$("overlay-top").setOpacity(0.0);$("overlay-top").style.display="block";new Effect.Opacity('overlay-top',opacityOptions);}
if($("description-container")){this.fixDescription();if($("branded-canvas-top")&&$("branded-canvas-top").empty())
new Effect.Highlight('description-container',{startcolor:'#eeeeee',endcolor:'#333333',restorecolor:'#333333',duration:0.5,transition:Effect.Transitions.linear});this.oldDescriptionContainerBackground=$("description-container").style.background;$("description-container").style.background='none';}
if($('player'))
$('player').lightStatusChanged("off");var newTop=$('overlay-bottom').cumulativeOffset().top;var el=$('breakout-container');if(el){var xy=Position.cumulativeOffset(el);newTop=xy[1]+$(el).getHeight();$('overlay-bottom').style.top=newTop+"px";this.oldBreakoutContainerBackground=$("breakout-container").style.background;if($("branded-canvas-top")&&$("branded-canvas-top").empty())
$("breakout-container").setStyle({background:'url(/images/bg-main.gif) #323232 repeat-x left top'});}
if($("collection-title-container"))
$("collection-title-container").style.visibility="hidden";var db=document.body;var dde=document.documentElement;var docHeight=Math.max(db.scrollHeight,dde.scrollHeight,db.offsetHeight,dde.offsetHeight,db.clientHeight,dde.clientHeight);var newHeight=docHeight-newTop;$("overlay-bottom").style.height=newHeight+"px";$("overlay-bottom").setOpacity(0.0);$("overlay-bottom").style.display="block";new Effect.Opacity('overlay-bottom',Object.extend(opacityOptions,{afterFinish:function(){this.working=false;this.isOff=true;if($('search-bar')&&$('search-result')&&$('search-result').visible()){var bar=$('search-bar');var result=$('search-result');var tDelta=(document.viewport.getHeight()-bar.getHeight()-result.getHeight())/2;tDelta=(tDelta<0?0:tDelta);new Effect.ScrollTo('search-bar',{offset:-tDelta,duration:0});}}.bind(this)}));}},on:function(){if(!this.working){this.working=true;if($('overlay-top')){new Effect.Fade('overlay-top',{duration:0.5,afterFinish:function(){if(Prototype.Browser.IE)
$('overlay-top').style.filter="alpha(opacity=80)";}});}
if($("description-container")){if($("branded-canvas-top")&&$("branded-canvas-top").empty()){new Effect.Highlight('description-container',{startcolor:'#333333',endcolor:'#eeeeee',restorecolor:'#eeeeee',duration:0.5,transition:Effect.Transitions.linear,afterFinish:function(){this.unfixDescription();}.bind(this)});}
else{this.unfixDescription();}
$("description-container").style.background=this.oldDescriptionContainerBackground;}
if($('breakout-container')){if(this.oldBreakoutContainerBackground)
$("breakout-container").style.background=this.oldBreakoutContainerBackground;else
$("breakout-container").setStyle({background:'url(/images/bg-main.gif) #323232 repeat-x left top'});}
if($('player'))
$('player').lightStatusChanged("on");if($('search-result'))
$('search-result').hide();if($("collection-title-container"))
$("collection-title-container").style.visibility="visible";new Effect.Fade('overlay-bottom',{duration:0.5,afterFinish:function(){if(Prototype.Browser.IE)
$('overlay-bottom').style.filter="alpha(opacity=80)";if($('search-bar'))$('search-bar').style.zIndex=0;this.working=false;this.isOff=false;}.bind(this)});}},fixDescription:function(timeout,fn){if(timeout&&fn){setTimeout(function(){fn();},timeout);}
if($('toggle-w-desc'))
Element.hide('toggle-w-desc');if($('toggle-w-desc-close'))
Element.hide('toggle-w-desc-close');if($("star-rating-container"))
$("star-rating-container").style.visibility="hidden";$$('.cc-logo').each(function(el){el.style.visibility="hidden";});if($("show-title-container"))
$("show-title-container").removeClassName("show-title");if($("ext-company-logo-watch"))
$("ext-company-logo-watch").style.visibility="hidden";},unfixDescription:function(){if($("star-rating-container"))
$("star-rating-container").style.visibility="visible";$$('.cc-logo').each(function(el){el.style.visibility="visible";});if($("ext-company-logo-watch"))
$("ext-company-logo-watch").style.visibility="visible";if($('toggle-w-desc'))
Element.show('toggle-w-desc');if($('toggle-w-desc-close'))
Element.show('toggle-w-desc-close');if($("show-title-container"))
$("show-title-container").addClassName("show-title");},playerDeactivate:function(){if(this.isOff){this.on();}}}
var lights=new PlayerLights();
var Support=Class.create();var SupportPopulateSuccess=true;Object.extend(Support,{messages:{"valid":"It appears that you are being validated as within the US.  If you are experiencing difficulties viewing Hulu"+" and using an anonymous proxy tool, you will need to disable your anonymizer to access videos on Hulu."+" If you are not using an anonymous proxy tool but still unable to view Hulu videos,"+" please submit your information and a member of our staff will investigate.","unsupported_xff":"It appears that your ISP or Proxy is using a non-American IP address when forwarding your traffic."+" We currently cannot support custom configurations and this needs to be resolved with your ISP or"+" proxy.  Please ensure that the <b>X-Forwarded-For</b> header is removed by the ISP or Proxy, and"+" then you will be able to utilize Hulu's services.","not_in_us":"Multiple third party sources identify your location as being out of the U.S.  If you are within"+" the U.S., please submit your information and a member of our staff will re-evaluate your location.","retrieve_error":"There is an internal error in retrieving your data.  Please send us an email at"+" <a href=\"mailto:support@hulu.com\">support@hulu.com</a> with the details of your issue.  We"+" apologize for the inconvenience.","send_error":"There is an internal error in submitting your data.  Please send us an email at"+" <a href=\"mailto:support@hulu.com\">support@hulu.com</a> with the details of your issue.  We"+" apologize for the inconvenience.","submitted":"Your issue was successfully submitted along with your information.  We will investigate this"+" issue and will inform you of the resolution as soon as possible.  Thank you for your time.","bandwidth":"It appears that the bandwidth on the network does not meet Hulu's minimum requirements.  You can"+" review our minimum requirements at <a href=\"http://www.hulu.com/support/technical_faq#reqs\">"+" http://www.hulu.com/support/technical_faq#reqs</a> .  Network connections can sometimes fluctuate"+" at various times during the day, so we recommend checking your connection (or router) for optimal"+" speed. <br/><br/> You can also confirm your bandwidth at http://www.speedtest.net/ .  Please indicate"+" the speed displayed from SpeedTest using this form if you notice signficant discrepancy in your"+" bandwidth.  If SpeedTest also indicates less than 1000 kbps of bandwidht available, we will not be"+" able to assist you.  We apologize for the inconvenience and we are mindful of our users who may have"+" lower bandwidth than necessary, and we hope to solve this problem as we expand in our methods of"+" distribution.","missing_video_start":"Please play the above video before submitting.  If the video cannot be played, please send us"+" an email at <a href=\"mailto:support@hulu.com\">support@hulu.com</a> with the exact error message"+" you see.","missing_traceroute":"Please enter your traceroute information."},rfc822Email:/^((?:[^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22(?:[^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(?:\x2e(?:[^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22(?:[^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*)\x40((?:[^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b(?:[^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(?:\x2e(?:[^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b(?:[^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*)$/,populateGeoFiltering:function(){if($('SupportObject'))$('SupportObject').populateGeoFilteringDetails();return false;},populateStreaming:function(){if($('SupportObject'))$('SupportObject').populateStreamingDetails();return false;},populateField:function(field,value){if(!($('SupportObject')))return;if(field=='time_started'){d=new Date();d.setTime(value);value=d.toUTCString();}
if(field=='fms'){$$('.tracertfms').each(function(el){el.innerHTML=value;});}
if(field=='bandwidth'){$('support-submit-loading').hide();bandwidth=parseInt(value);if((isNaN(bandwidth))||(bandwidth<1000)){$('support-message').down('.message').innerHTML=Support.messages["bandwidth"];$('support-message').down('.warning').show();$('support-message').show();}
else{$('video_test').show();}}
if((field=='video_id')||(field=='video_url')||(field=='time_started')){Support.buttonsEnable();if($('support_'+field).value!='')
return;}
$('support_'+field).value=value;},populateError:function(){$('support-submit-loading').hide();$('support-message').down('.message').innerHTML=Support.messages["retrieve_error"];$('support-message').down('.warning').show();$('support-message').show();},submitError:function(){$('support-message').down('.message').innerHTML=Support.messages["send_error"];$('support-message').down('.warning').show();$('support-message').show();},resetFields:function(type){$('support_name').clear();$('support_email').clear();$('user-comment').clear();if(type=='geofiltering'||type=='streaming'){$('support_zipcode').clear();}else if(type=="desktop"){}},validateGeoCheck:function(){$('support-submit-loading').hide();if($('support_geocheck').value=='valid'){$('support-message').down('.message').innerHTML=Support.messages["valid"];$('support-message').down('.warning').show();$('support-message').show();Support.buttonsEnable();}
else if(($('support_geocheck').value=='not-valid')||($('support_geocheck').value=='invalid')){if($('support_http_xff').value!=''){$('support-message').down('.message').innerHTML=Support.messages["unsupported_xff"];$('support-message').down('.warning').show();$('support-message').show();}
if($('support_geolocation').value!='US'){$('support-message').down('.message').innerHTML=Support.messages["not_in_us"];$('support-message').down('.warning').show();$('support-message').show();Support.buttonsEnable();}
else{Support.buttonsEnable();}}
else{$('support-message').down('.message').innerHTML=Support.messages["retrieve_error"];$('support-message').down('.warning').show();$('support-message').show();}},validateStreaming:function(){$('support-submit-loading').hide();bandwidth=parseInt($('support_bandwidth').value);if((isNaN(bandwidth))||(bandwidth<1000)){$('support-message').down('.message').innerHTML=Support.messages["bandwidth"];$('support-message').down('.warning').show();$('support-message').show();return false;}
if(($('support_time_started').value=='')||(($('support_video_url').value==''))){$('support-message').down('.message').innerHTML=Support.messages["missing_video_start"];$('support-message').down('.warning').show();$('support-message').show();return false;}
if($('support_traceroute').value==''){$('support-message').down('.message').innerHTML=Support.messages["missing_traceroute"];$('support-message').down('.warning').show();$('support-message').show();return false;}
return true;},redirectForm:function(){var el=$('support_issue');if(el&&el[el.selectedIndex].value=="Geo-filtering")
window.location="http://www.hulu.com/support/geofilter_form";else if(el&&el[el.selectedIndex].value=="Streaming")
window.location="http://www.hulu.com/support/streaming_form";},beforeSubmit:function(type){$('support-message').down('.message').innerHTML='';$('support-message').down('.warning').hide();$('support-message').down('.info').hide();$('support-message').hide();if($('support_name').value==""){ModalPopup.warn("Please enter your name.");$('support_name').focus();return false;}
if(!Support.rfc822Email.test($('support_email').value)){ModalPopup.warn("Please provide a valid email address.");$('support_email').focus();return false;}
if(type=="desktop"&&$('user-comment').value==""){ModalPopup.warn("Please provide a description.");$('user-comment').focus();return false;}
if(type!="desktop"){zipcode_regex=/^\d{5}$/;if(!zipcode_regex.test($('support_zipcode').value)){ModalPopup.warn("Please provide a valid 5-digit zip code.");$('support_zipcode').focus();return false;}}
if(type=='geofiltering'){}
else if(type=='streaming'){}
return true;},afterSubmit:function(){$('support-message').down('.warning').hide();$('support-message').down('.info').show();$('support-message').down('.message').innerHTML=Support.messages["submitted"];$('support-message').show();},buttonsDisable:function(){$('support-submit').style.opacity=0.5;$('support-submit').disable();$('support-cancel').style.opacity=0.5;$('support-cancel').disable();},buttonsEnable:function(){$('support-submit').style.opacity=1.0;$('support-submit').enable();$('support-cancel').style.opacity=1.0;$('support-cancel').enable();}});function isReady(){return true;};
var InfoHover={init:function(){InfoHover.observeLinks();var body=$$('body').first();if(body)
{Element.observe(body,'mouseout',InfoHover.out);Element.observe(body,'click',InfoHover.out);}},observeLinks:function(){$$('a.info_hover').each(function(el){if(!el.hasClassName('observing')){if(el.hasClassName('click_to_popup'))
{Element.observe(el,'click',InfoHover.over);el.style.visibility='visible';}
else Element.observe(el,'mouseover',InfoHover.over);el.addClassName('observing');}});},currentTimeout:null,currentTarget:null,currentBounds:{},showThumbnails:false,hideByClick:false,fadeDuration:0.4,over:function(ev){var el=Event.element(ev);if(!el)return false;if(!el.hasClassName('info_hover')){el=el.up('.info_hover');if(!el)return false;}
var showThumbnails=el.hasClassName('show-thumb');var disableLoadDelay=true;var img=el.down('img.thumbnail');if(img)el=img;if(InfoHover.currentTarget==el)
{if(el.hasClassName('click_to_popup'))InfoHover.executeHide();return;}
if(InfoHover.currentTarget&&InfoHover.hideByClick)
{if(ev.type=='click')
{InfoHover.executeHide();disableLoadDelay=false;}
else return;}
InfoHover.currentTarget=el;if(el.hasClassName('click_to_popup'))InfoHover.hideByClick=true;InfoHover.currentBounds=InfoHover.getBounds(el);if(disableLoadDelay&&InfoHover.hideByClick)InfoHover.load();else
{clearTimeout(InfoHover.currentTimeout);InfoHover.currentTimeout=null;InfoHover.showThumbnails=showThumbnails;InfoHover.currentTimeout=setTimeout(function(){InfoHover.load();},700);}
return false;},getBounds:function(el){var bounds={};var xy=Position.cumulativeOffset(el);bounds.left=xy[0];bounds.top=xy[1];var dim=el.getDimensions();bounds.width=dim.width;bounds.height=dim.height;return bounds;},cache:{},load:function(){var url=InfoHover.parseUrl();if(!url)return;var cache=InfoHover.cache;InfoHover.fadeDuration=0.4;if(cache[url]){InfoHover.show(cache[url]);}
else{new Ajax.Request(url,{method:'get',onSuccess:function(trans){var obj=eval('('+trans.responseText+')');InfoHover.cache[url]=obj;InfoHover.show(obj);}});}},out:function(ev){if(InfoHover.hideByClick)
{if(ev.type=='mouseout')return;if(Position.within($('info_hover').down('div.content'),Event.pointerX(ev),Event.pointerY(ev)))return;}
var bounds=InfoHover.currentBounds;var y=Event.pointerY(ev);var x=Event.pointerX(ev);var hide=y<bounds.top||y>bounds.top+bounds.height||x<bounds.left||x>bounds.left+bounds.width;if(hide){InfoHover.executeHide();}
return false;},executeHide:function(){InfoHover.currentBounds={};InfoHover.currentTarget=null;InfoHover.hideByClick=false;clearTimeout(InfoHover.currentTimeout);InfoHover.currentTimeout=null;new Effect.Fade($('info_hover'),{duration:0.3,afterFinish:InfoHover.showWindowedControls});},parseUrl:function(){var a=InfoHover.currentTarget;if(a.tagName!='A'){var el=a.up('a');if(!el)el=a.down('a');if(el)a=el;else return null;}
if(a.readAttribute('offsiteInfoHoverId')){return a.readAttribute('offsiteInfoHoverId');}
var path=a.href?a.href.split('http://'):[];if(path.length>1){path=path[1];}
else{path=a.href;}
if(!path||path.blank())return null;var s=path.split('/watch/');if(s.length<=1){s=path.split('/hd/');}
if(s.length<=1){s=path.split('/superbowl/');}
if(s.length<=1){s=path.split('/bec/');}
if(s.length>1){return['/videos','info',s[1].split('/')[0]].join('/');}
else if(path.split('/profiles/').length>1){if(path.split('/u/').length>1)
return['/users','info/u',path.split('/')[3].split('?')[0]].join('/');else
return['/users','info',path.split('/')[2].split('?')[0]].join('/');}
else if(a.readAttribute('collection_info_hover')&&!a.readAttribute('collection_info_hover').blank()){return a.readAttribute('collection_info_hover');}
else if(path.split('/collections/').length>1){return['/videos','info',path.split('/')[3].split('?')[0]].join('/');}
else if(a.readAttribute('ci')&&!a.readAttribute('ci').blank()){return a.readAttribute('ci');}
else if(a.readAttribute('preview')&&!a.readAttribute('preview').blank()){return a.readAttribute('preview');}
else if(a.readAttribute('showInfoHover')&&!a.readAttribute('showInfoHover').blank()){return['/shows','info',a.readAttribute('showInfoHover')].join('/');}
else{return['/shows','info',path.split('/')[1].split('?')[0]].join('/');}
return null;},update:function(data){var hover_div=$$('div#info_hover').first();if(!hover_div)return;var content=hover_div.down('div.content');hover_div.removeClassName('type_show');hover_div.removeClassName('type_video');hover_div.removeClassName('type_user');hover_div.removeClassName('type_cast');hover_div.removeClassName('type_preview');hover_div.removeClassName('type_collection');if(data.show_name||data.title){hover_div.addClassName('type_video');var updated_html=InfoHover.update_video(data);}
else if(data.display_name){hover_div.addClassName('type_user');var updated_html=InfoHover.update_user(data);}
else if(data[0]=='cast_info'){hover_div.addClassName('type_cast');var updated_html=InfoHover.update_cast(data);}
else if(data[0]=='video_preview'){hover_div.addClassName('type_preview');var updated_html=InfoHover.update_preview(data);}
else if(data[0]=='collection'){hover_div.addClassName('type_collection');var updated_html=InfoHover.update_collection(data);}
else{hover_div.addClassName('type_show');var updated_html=InfoHover.update_show(data);}
content.update(updated_html);},update_video:function(data){var html="";var esc=InfoHover.cleanEscape;if(InfoHover.showThumbnails){html+='<img class="thumb" src="';html+=data.thumbnail_url;html+='" border="0" width="145" height="80" />';}
if(data.show_name==data.title){html+='<b>'+esc(data.show_name)+'</b><br/>';}
else if(data.show_name.replace(" ","").length==0){html+='<b>'+esc(data.title)+'</b><br/>';}
else{html+='<b>'+esc(data.show_name)+':</b> ';html+=esc(data.title)+"<br/>";}
var hasSeasonOrDuration=false;if(data.season_number>0&&data.episode_number>0){html+='Season '+data.season_number+' : ';html+='Ep. '+data.episode_number+' ';hasSeasonOrDuration=true;}
else if(data.programming_type){html+=esc(data.programming_type)+' ';hasSeasonOrDuration=true;}
var dur=parseInt(data.duration);if(dur>0){var hms=[Math.floor(dur/3600),Math.floor(dur/60),dur%60];hms[1]-=hms[0]*60;if(hms[1]<10)hms[1]='0'+hms[1];if(hms[2]<10)hms[2]='0'+hms[2];if(hms[0]==0)hms.shift();html+='('+hms.join(':')+')';hasSeasonOrDuration=true;}
if(hasSeasonOrDuration){html+='<br/>';if(data.air_date){var label='Air date: ';if(data.programming_type&&data.programming_type=='Trailer'){label='In theaters ';}
html+=label+esc(data.air_date)+' &nbsp;|&nbsp; ';}}
if(data.content_rating){html+='Rated: '+esc(data.content_rating);}
if(data.has_captions){html+=' &nbsp;|&nbsp; ';html+='<img class="cc" src="/images/icon-cc-gray.png" border="0" width="17" height="12" />';}
if(data.rating){html+='<br/>';html+='Avg. user rating: '+InfoHover.starRating(data.rating);html+='<br/>';}
if(data.description){html+='<div class="line"><span></span></div>';html+='<p>'+data.description.stripTags()+'</p>';}
if(data.stats.valid&&data.programming_type=="Trailer"){html+='<div class="line"><span></span></div>';html+='<table class="demographics"><tr style="padding-bottom: 4px;">'
html+='<td width="40%">Demographics:</td>'
html+='<td class="centered" width="30%">Under 25</td>'
html+='<td class="centered" width="30%">Over 25</td>'
html+='</td></tr>'
html+='<tr><td class="indent" width="40%">Women</td>'
html+='<td class="centered" width="30%">'+InfoHover.starRating(data.stats.female_young_rating)
html+='<td class="centered" width="30%">'+InfoHover.starRating(data.stats.female_old_rating)
html+='</td></tr>'
html+='<tr><td class="indent" width="40%">Men</td>'
html+='<td class="centered" width="30%">'+InfoHover.starRating(data.stats.male_young_rating)
html+='<td class="centered" width="30%">'+InfoHover.starRating(data.stats.male_old_rating)
html+='</td></tr></table>'}
return html;},update_show:function(data){var html="";var esc=InfoHover.cleanEscape;if(InfoHover.showThumbnails){html+='<img class="thumb" src="';html+=data.thumbnail_url;html+='" border="0" width="145" height="80" />';}
html+='<b>'+esc(data.name)+'</b><br/>';if(data.channel&&!data.channel.blank()){html+='<span class="channel">Channel: '+esc(data.channel)+'<br/></span>';}
if(data.film_date){html+='Premiere Date: '+esc(data.film_date)+'<br/>';}
if(!InfoHover.showThumbnails)
html+='<div class="line"><span></span></div>';html+='<p>'+esc(data.description)+'</p>';return html;},update_collection:function(data){var html="";var esc=InfoHover.cleanEscape;html+='<p><b>'+esc(data[1])+'</b>';html+=' ('+data[3]+(parseInt(data[3])>1?" videos":" video")+") </p>";if(data[2]){html+='<div class="line"><span></span></div>';html+='<p>'+esc(data[2])+'</p>';}
return html;},update_user:function(data){var html="";var esc=InfoHover.cleanEscape;html+='<b>'+esc(data.display_name)+'</b><br/>';if(data.location){html+=esc(data.location);}
html+='<hr/><div style="float: left;"><img class="avatar" src="';html+=esc(data.avatar_url);html+='"/></div><div style="float: left; font-size: 10px;">';html+=data.friends_count;html+=' friends<br/>';html+=data.viewed_videos_count;html+=' videos watched<br/>';html+=data.votes_count;html+=' ratings<br/>';html+=data.reviews_count;html+=' reviews<br/>';html+=data.posts_count;html+=' discussions<br/>';html+='</div><br style="clear:both;"/>';return html;},update_cast:function(data){var esc=InfoHover.cleanEscape;var roles=(data[1].length==0)?new Array():data[1].split(';');var episodeCount=data[2];var clipCount=data[3];var contentRating=data[4];html="";if(episodeCount>0)
html+='<div style="float:left;width:35%;text-align:right;padding-right: 8px;">Episodes:</div><div style="float:left;width:55%;">'+episodeCount+'</div>';if(clipCount>0)
html+='<div style="float:left;width:35%;text-align:right;padding-right: 8px;">Clips:</div><div style="float:left;width:55%;">'+clipCount+'</div>';html+='<div style="float:left;width:35%;margin-bottom:6px;text-align:right;padding-right: 8px;">Rating:</div><div style="float:left;width:55%;margin-bottom:6px;">'+contentRating+'</div>';for(i=0;i<roles.length;i++)
{if(roles[i].split(':')<2)continue;roleType=roles[i].split(':')[0];roleNames=roles[i].split(':')[1].split(',');if(roleNames.length>3)
{roleNames=roleNames.slice(0,3);roleNames.push('...');}
for(j=0;j<roleNames.length;j++)
{if(roleNames[j].length>14)
{names=roleNames[j].split(' ');if(names.length>1)names[1]=names[1].substring(0,1)+'.';roleNames[j]=names.join(' ');}}
roleNames=roleNames.join('<br/>');html+='<br/><div class="line" style="margin-bottom:6px;margin-top:5px;"><span></span></div>';html+='<div style="float:left;width:35%;margin-bottom:6px;text-align:right;padding-right: 8px;">'+roleType+':</div><div style="float:left;width:55%;margin-bottom:6px;">'+roleNames+'</div>';}
return html;},update_preview:function(data){InfoHover.fadeDuration=0.8;var esc=InfoHover.cleanEscape;var pid=data[1];var clickThrough=data[2];html="";html+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="288" height="162" id="videoPreviewPlayer">'
html+='<param name="movie" value="/QuickPreviewPlayer.swf" />'
html+='<param name="flashvars" value="stageWidth=288&stageHeight=162&pid='+pid+'" />'
html+='<param name="quality" value="high" />'
html+='<param name="bgcolor" value="#999999" />'
html+='<param name="allowScriptAccess" value="always" />'
html+='<param name="wmode" value="transparent" />'
html+='<embed height="162" width="288" wmode="transparent" '
html+='flashvars="stageWidth=288&stageHeight=162&pid='+pid+'" quality="high" bgcolor="#999999" '
html+='name="videoPreviewPlayer"  src="/QuickPreviewPlayer.swf" type="application/x-shockwave-flash" '
html+='allowScriptAccess="always" swliveconnect="true"/>'
html+='</object>'
return html;},cleanEscape:function(s){return s?s.escapeHTML():"";},starRating:function(n){var stars="";n=parseFloat(n);var type;$R(1,5).each(function(rating){type=rating<=Math.floor(n)?'full':(rating==Math.round(n)?'half':'empty');stars+='<img src="';stars+='/images/rating_'+type+'.gif';stars+='" height="11" width="11" border="0" alt="Rating star" />';});return stars;},TAIL_WIDTH:22,TAIL_HEIGHT:23,TAIL_OFFSET:2,show:function(data){var hover=$('info_hover');if(hover&&hover.style.display=='none'){var ih=InfoHover;InfoHover.update(data);var dim=hover.getDimensions();var bounds=InfoHover.currentBounds;var viewport=Element.viewportOffset(InfoHover.currentTarget);var loc=InfoHover.determineTailLocation(dim,InfoHover.currentBounds,viewport);hover.style.left=loc.x+'px';hover.style.top=loc.y+'px';InfoHover.removeTailClassNames(hover);hover.addClassName(loc.className);InfoHover.hideWindowedControls();new Effect.Appear(hover,{duration:InfoHover.fadeDuration});}},removeTailClassNames:function(el){el.removeClassName('top-right');el.removeClassName('mid-right');el.removeClassName('bottom-right');el.removeClassName('top-left');el.removeClassName('mid-left');el.removeClassName('bottom-left');},determineTailLocation:function(hoverDim,target,viewport){var docViewport=document.viewport.getDimensions();var offset=InfoHover.TAIL_OFFSET;hoverDim.width+=InfoHover.TAIL_WIDTH;var lr="right";var x=target.left+target.width+offset;if(viewport.left+target.width+hoverDim.width>docViewport.width){lr="left";x=target.left-hoverDim.width-offset;}
var tmb="mid";var y=target.top+target.height/2-hoverDim.height/2;if(viewport.top+target.height/2-hoverDim.height/2+hoverDim.height>docViewport.height){tmb="bottom";y=target.top-hoverDim.height;}
else if(viewport.top+target.height/2-hoverDim.height/2<0){tmb="top";y=target.top+target.height;}
var loc=[x,y,lr,tmb];loc.x=x;loc.y=y;loc.horiz=lr;loc.vert=tmb;loc.className=[loc.vert,loc.horiz].join('-');return loc;},showWindowedControls:function(){var hover_div=$$('div#info_hover').first();if(hover_div)
{var content=hover_div.down('div.content');content.update('');}
if(!Prototype.Browser.IE6)return;if($('search-result')&&$('search-result').visible())return;$$('select').each(function(el){el.style.visibility='visible';});},hideWindowedControls:function(){if(!Prototype.Browser.IE6)return;if($('search-result')&&$('search-result').visible())return;$$('select').each(function(el){el.style.visibility='hidden';});},addInCache:function(objs){objs=$A(objs);for(var i=0;i<objs.size();i++){var obj=eval(objs[i]);InfoHover.cache[obj.url]=obj;}}};Ajax.Responders.register({onComplete:InfoHover.observeLinks});Event.observe(window,'load',InfoHover.init);
var currenttable=null;document.onmousemove=function(ev){if(currenttable&&currenttable.dragObject){ev=ev||window.event;var mousePos=currenttable.mouseCoords(ev);var y=mousePos.y-currenttable.mouseOffset.y;if(y!=currenttable.oldY){var movingDown=y>currenttable.oldY;currenttable.oldY=y;currenttable.didMove=true;currenttable.dragObject.style.backgroundColor="#eee";var currentRow=currenttable.findDropTargetRow(y);if(currentRow){if(movingDown&&currenttable.dragObject!=currentRow){currenttable.dragObject.parentNode.insertBefore(currenttable.dragObject,currentRow.nextSibling);}else if(!movingDown&&currenttable.dragObject!=currentRow){currenttable.dragObject.parentNode.insertBefore(currenttable.dragObject,currentRow);}}}
return false;}}
document.onmouseup=function(ev){if(currenttable&&currenttable.dragObject&&currenttable.didMove){var droppedRow=currenttable.dragObject;droppedRow.style.backgroundColor='transparent';currenttable.dragObject=null;currenttable.onDrop(currenttable.table,droppedRow);currenttable=null;}}
function getEventSource(evt){if(window.event){evt=window.event;return evt.srcElement;}else{return evt.target;}}
function TableDnD(){this.dragObject=null;this.mouseOffset=null;this.table=null;this.oldY=0;this.didMove=false;this.init=function(table){this.table=table;var rows=table.tBodies[0].rows;for(var i=1;i<rows.length;i++){var nodrag=rows[i].getAttribute("NoDrag")
if(nodrag==null||nodrag=="undefined"){this.makeDraggable(rows[i]);}}}
this.onDrop=function(table,droppedRow){}
this.getPosition=function(e){var left=0;var top=0;if(e.offsetHeight==0){e=e.firstChild;}
while(e.offsetParent){left+=e.offsetLeft;top+=e.offsetTop;e=e.offsetParent;}
left+=e.offsetLeft;top+=e.offsetTop;return{x:left,y:top};}
this.mouseCoords=function(ev){if(ev.pageX||ev.pageY){return{x:ev.pageX,y:ev.pageY};}
return{x:ev.clientX+document.body.scrollLeft-document.body.clientLeft,y:ev.clientY+document.body.scrollTop-document.body.clientTop};}
this.getMouseOffset=function(target,ev){ev=ev||window.event;var docPos=this.getPosition(target);var mousePos=this.mouseCoords(ev);return{x:mousePos.x-docPos.x,y:mousePos.y-docPos.y};}
this.makeDraggable=function(item){if(!item)return;var self=this;item.onmousedown=function(ev){var target=getEventSource(ev);if(target.tagName=='INPUT'||target.tagName=='SELECT'||target.tagName=='A')return true;currenttable=self;self.dragObject=this;self.mouseOffset=self.getMouseOffset(this,ev);return false;}
item.style.cursor="move";}
this.findDropTargetRow=function(y){var rows=this.table.tBodies[0].rows;for(var i=1;i<rows.length;i++){var row=rows[i];var nodrop=row.getAttribute("NoDrop");if(nodrop==null||nodrop=="undefined"){var rowY=this.getPosition(row).y;var rowHeight=parseInt(row.offsetHeight)/2;if(row.offsetHeight==0){rowY=this.getPosition(row.firstChild).y;rowHeight=parseInt(row.firstChild.offsetHeight)/2;}
if((y>rowY-rowHeight)&&(y<(rowY+rowHeight))){return row;}}}
return null;}}
var ThumbnailLazyLoad={thumbnails:[],disabled:false,updating:false,body:null,init:function(){if(ThumbnailLazyLoad.disabled)return;var thumbnails=[];$$('.thumbnail').each(function(img,i){var src=img.src;img.src=(img.height=="209"?'/images/loading-trailer-thumbnail.gif':'/images/loading-thumbnail.gif');img.id='lazy-load-'+i;thumbnails.push({id:img.id,src:src});});ThumbnailLazyLoad.thumbnails=thumbnails;Event.observe(window,'scroll',ThumbnailLazyLoad.updateViewport);Event.observe(window,'resize',ThumbnailLazyLoad.updateViewport);ThumbnailLazyLoad.updateViewport();},updateViewport:function(){if(ThumbnailLazyLoad.updating)return;ThumbnailLazyLoad.updating=true;var top=document.viewport.getScrollOffsets();top=top.top+document.viewport.getHeight();var thumbnails=$A(ThumbnailLazyLoad.thumbnails);thumbnails=thumbnails.select(function(info){var img=$(info.id);if(img){var offset=img.cumulativeOffset();if(top>=offset.top-20){img.src=info.src;return false;}}
return true;});if(thumbnails.length==0){Event.stopObserving(window,'scroll',ThumbnailLazyLoad.updateViewport);}
ThumbnailLazyLoad.thumbnails=thumbnails;ThumbnailLazyLoad.updating=false;}};document.observe('dom:loaded',ThumbnailLazyLoad.init);
var Beacon={ENDPOINT:"t2.hulu.com",FEATURED_ITEM_URL:"http://{endpoint}/v3/siteinteraction/{event}?computerguid={guid}&salesforceid={sf_tag}&target={target}&param={param}&value={value}",MOVE_TEST_URL:"http://t.hulu.com/beacon/v2/movetest?version={version}&browser={browser}&os={os}&username={username}",guid:null,features:{},init:function(){Try.these(function(){Beacon.guid=$('pguid').getGUID();});if(Beacon.guid){$H(Beacon.features).each(function(feature){Beacon.send_event('thumbnailload',feature[1]);});}},feature_clicked:function(id){var feature=Beacon.features[id];if(feature){Beacon.send_event('thumbnailclick',feature);}},feature_loaded:function(url,action,index,id){Beacon.features[id]={url:url,position:index,action:action,tag:arguments[4]||""};},send_move_test:function(version,username){var ua=navigator.userAgent;var os=$A(['Windows','Macintosh','Linux','X11']).find(function(o){return ua.indexOf(o)>=0;});os=os||'Other';var browser=$A(['Safari','Chrome','AppleWebKit','Opera','Gecko']).find(function(b){return ua.indexOf(b)>=0;});browser=browser||'Other';Beacon.send(Beacon.MOVE_TEST_URL.split('{version}').join(encodeURIComponent(version)).split('{browser}').join(encodeURIComponent(browser)).split('{os}').join(encodeURIComponent(os)).split('{username}').join(encodeURIComponent(username||ua)));},send_event:function(ev,feature){var dict={target:feature.url,computer:Beacon.guid};var e=encodeURIComponent||escape;var url=Beacon.FEATURED_ITEM_URL.replace('{endpoint}',Beacon.ENDPOINT).replace('{event}',e(ev)).replace('{param}',e(feature.action)).replace('{value}',e(feature.position)).replace('{target}',e(feature.url)).replace('{sf_tag}',e(feature.tag)).replace('{guid}',e(Beacon.guid));Beacon.send(url);},encodeDict:function(dict){return encodeURIComponent($H(dict).map(function(kv){return[kv[0],encodeURIComponent(kv[1])].join(':');}).join(';'));},send:function(url){pingImage(url+"&cb="+(new Date).getTime());}};
var Superbowl=Class.create();Object.extend(Superbowl,{curr:0,timer:null,choose:function(el){if(!el.hasClassName('video-wrapper'))
el=el.up(".video-wrapper");if(el.hasClassName("washed-out"))
return;var id=el.id.substring(4);el.down('input.radio-button').checked=true;$$('.video-wrapper').each(function(el){el.removeClassName("selected");});$("vwr-"+id).addClassName("selected");Superbowl.curr=id;},submit_vote:function(){var slider=$('clip-voting-container').down('div.vsl')
$$('.video-wrapper').each(function(el){if(el.hasClassName("selected")){var id=el.id.substring(4);Superbowl.curr=id;var np=el.down('.currently-playing');if(np)np.hide();}});if(!Superbowl.curr||Superbowl.curr==0){$$('.error-message').invoke("show");}
else{var pguid=$('pguid');var current_video=VideoSlider.currentVideoId()||0;var url=(document.domain.indexOf("qa.hulu.com")!=-1||document.domain.indexOf("localhost")!=-1?"track.qa":"t");pingImage("http://"+url+".hulu.com/beacon/v2/movetest?version="+Superbowl.curr+"&os="+(current_video==0?"sb":current_video)+"&browser="+(pguid?pguid.getGUID():"")+"&cb="+(new Date).getTime());$$('.btn-vote').invoke("hide");$$('.error-message').invoke("hide");$$('.voting-pane .sort-filter').invoke("hide");$$('.thank-you-note').invoke("show");$$('#clip-voting-container input.radio-button').invoke("hide");$$('#clip-voting-container .video-wrapper').invoke("addClassName","washed-out");$$('#clip-voting-container .empty div').invoke("addClassName","washed-out");$('vwr-'+Superbowl.curr).addClassName("final");$('vwr-'+Superbowl.curr).removeClassName("selected");$('vwr-'+Superbowl.curr).removeClassName("washed-out");Superbowl.clearTimer();}},clearTimer:function(){if(Superbowl.timer){clearTimeout(Superbowl.timer);Superbowl.timer=null;}},setTimer:function(){Superbowl.timer=setTimeout('window.location.reload(true)',600000);},showPane:function(){document.observe('dom:loaded',Superbowl.loadPane);Event.observe(window,"load",Superbowl.loadPane);setTimeout(Superbowl.loadPane,500);setTimeout(Superbowl.loadPane,1000);setTimeout(Superbowl.loadPane,2500);setTimeout(Superbowl.ensureSlider,2500);},paneLoaded:false,paneLoading:false,sliderPage:-1,loadPane:function(){if(Superbowl.paneLoaded||Superbowl.paneLoading)return;Superbowl.paneLoading=true;new Ajax.Request('/superbowl/pane',{method:'get',onSuccess:function(request){Superbowl.paneLoaded=true;Element.update('sb-voting-pane',request.responseText);Behaviors.applyCufon();Behaviors.toggleFirstDescendant('#sb-voting-pane span.play-button-hover');var klass='voteable-item-'+VideoSlider.currentVideoId();var els=$$('.video-wrapper');var selected=null;Superbowl.sliderPage=-1;els.find(function(el,i){if(el.hasClassName(klass)){selected=el;Superbowl.sliderPage=Math.floor(i/5)+1;throw $break;}});Superbowl.sliderPage=parseInt(Superbowl.sliderPage);setTimeout(function(){if(selected){Superbowl.choose(selected);}
Superbowl.moveSliderToPage();},500);},onComplete:function(){Superbowl.paneLoading=false;}});},sliderLoaded:false,moveSliderToPage:function(){if((/^#s-/).test(window.location.hash))return;if(Superbowl.sliderLoaded)return;if(superbowl_slider){var page=Superbowl.sliderPage>0?Superbowl.sliderPage:1;superbowl_slider.move(null,page);Superbowl.sliderLoaded=true;}},ensureSlider:function(){Superbowl.moveSliderToPage(1);},rearrange:function(slider,page){var lis=slider.inr.getElementsBySelector("li").partition(function(el){return!el.hasClassName('empty')});var rest=lis[0];var empties=lis[1];rest=$A(rest).partition(function(li){return!!li.down('div.selected');});lis=$A([rest[1],empties]).flatten();if(rest[0]&&rest[0][0])
lis.unshift(rest[0][0]);rest=null;empties=null;var current=0;lis.each(function(li,i){if(li.hasClassName('absolutized'))return;slider.calculateItemWidth();var y=0;var x=(this.pageWidth*(page-1))+current*this.itemWidth;var ipl=parseInt(this.urlOptions.items_per_line);if(current>=ipl){y=(current/ipl).floor()*160;x-=(current/ipl).floor()*this.itemWidth*ipl;}
li.style.position='absolute';li.style.top=y+"px";li.style.left=x+"px";li.addClassName('absolutized');current+=1;}.bind(slider));slider.sld.style.left='0px';},showResults:function(){document.observe('dom:loaded',Superbowl.loadResultsPane);Event.observe(window,"load",Superbowl.loadResultsPane);setTimeout(Superbowl.loadResultsPane,500);},resultsPaneLoaded:false,resultsPaneLoading:false,loadResultsPane:function(){if(Superbowl.resultsPaneLoaded||Superbowl.resultsPaneLoading)return;Superbowl.resultsPaneLoading=true;new Ajax.Request('/superbowl/results_loader',{method:'get',onSuccess:function(request){Superbowl.resultsPaneLoaded=true;Element.update('sb-results-pane',request.responseText);Behaviors.applyCufon();Behaviors.toggleFirstDescendant('#sb-results-pane span.play-button-hover');},onComplete:function(){Superbowl.resultsPaneLoading=false;}});}});
var Friend=Class.create();Object.extend(Friend,{busy:false,added:false,FACEBOOK_SETTINGS:new Array(650,450,1),MYSPACE_SETTINGS:new Array(950,820,0),WINDOWS_SETTINGS:new Array(800,500,0),GOOGLE_SETTINGS:new Array(650,500,0),YAHOO_SETTINGS:new Array(825,655,1),popupWindow:'',pop:function(url,settings){if(!Friend.popupWindow.closed&&Friend.popupWindow.location){Friend.popupWindow.location.href=url;}
else{Friend.popupWindow=window.open(url,"friendpopup","toolbar=0,status=0,resizable=1,scrollbars="+settings[2]+",width="+settings[0]+",height="+settings[1]);if(Friend.popupWindow){if(!Friend.popupWindow.opener)
Friend.popupWindow.opener=self;}
else{ModalPopup.warn("Oops - your browser may be blocking this pop-up. Please disable your pop-up blocker before continuing.");}}
if(window.focus)
Friend.popupWindow.focus();return false;},popdown:function(url){if(opener&&!opener.closed){opener.location.href=url;}
else{p=window.open(url,"_blank","toolbar=0,status=0,resizable=1,scrollbars=1,width=600,height=450");if(!p){ModalPopup.warn("Oops - your browser may be blocking this pop-up. Please disable your pop-up blocker before continuing.");}}},show_delauth:function(provider){switch(provider){case"facebook":settings=Friend.FACEBOOK_SETTINGS;break;case"myspace":settings=Friend.MYSPACE_SETTINGS;break;case"windows":settings=Friend.WINDOWS_SETTINGS;break;case"google":settings=Friend.GOOGLE_SETTINGS;break;case"yahoo":settings=Friend.YAHOO_SETTINGS;break;default:return false;}
if(provider=='facebook')
url="/friends/facebook_connect"
else
url="/friends/"+provider;Friend.pop(url,settings);},add_friend:function(target_id){if(Friend.added)return;new Ajax.Request('/friends/add_friend',{parameters:{user_id:target_id},method:'post',onSuccess:function(req){Friend.added=true;$('profile-add-friend').update('<img src="/images/icon-check.gif" style="vertical-align: middle; padding-right: 5px;"> \
                                        <span style="color: #777; font-size: 11px;">Friend invitation sent.</span>');},onFailure:function(req){$('add-friend-status').update('<img src="/images/icon-warning.gif" style="padding-right: 4px; float: left;">'+'<div style="float: left; width: 280px; padding-bottom: 5px;">Oops!  Something went wrong. '+'Please contact <a href="mailto:support@hulu.com">support@hulu.com</a> if this issue persists.</div>'+'<br style="clear: both;"/>');}});},toggle_pending_list:function(action){if(action=='hide'){$('friends-pending-list-hide').hide();$('friends-pending-list-show').show();$('friends-pending-list').hide();}
else if(action=='show'){$('friends-pending-list-show').hide();$('friends-pending-list-hide').show();$('friends-pending-list').show();}},select_pending_list:function(action){if(action){$$('input.pending-friends-check').each(function(el){if(!el.disabled){el.checked=true;el.up('div.item').addClassName('selected');}});$('friends-pending-select').checked=true;}
else{$$('input.pending-friends-check').each(function(el){if(!el.disabled){el.checked=false;el.up('div.item').removeClassName('selected');}});$('friends-pending-select').checked=false;}},select_invite_emails:function(action){if(action){$$('input.invite-emails-check').each(function(el){if(!el.disabled){el.checked=true;el.up('div.item').addClassName('selected');}});$('friends-invite-emails-select').checked=true;}
else{$$('input.invite-emails-check').each(function(el){if(!el.disabled){el.checked=false;el.up('div.item').removeClassName('selected');}});$('friends-invite-emails-select').checked=false;}},process_pending:function(){$$('input.pending-friends-check').each(function(el){if((el.checked)&&(!el.disabled)){el.disabled=true;el.checked=false;el.up().addClassName('disabled');el.up().addClassName($('pending-action').value);el.up().removeClassName('selected');}});all_pending_finished=true;$$('input.pending-friends-check').each(function(el){if(!el.disabled){all_pending_finished=false;}});if(all_pending_finished){$('friends-pending-list').up('div.friends-pending').fade({duration:1.0});}},validate_search_input:function(){email=$('email').value.strip();first_name=$('first_name').value.strip();last_name=$('last_name').value.strip();if(email==''&&(first_name==''||last_name=='')){$('find-friends-error').update('Please type in an email address or full name.');return false;}
email_regex=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if((email!='')&&(!email_regex.test(email))){$('find-friends-error').update('Please provide a valid email address.');$('email').focus();return false;}
return true;},validate_invite_input:function(type){if(type=='invite'){email=$('email').value.strip();email_regex=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if((email!='')&&(!email_regex.test(email))){$('invite-friends-error').update('Please provide a valid email address.');$('email').focus();return false;}}
else if(type=='request'){valid=false;$$('input.pending-friends-check').each(function(el){if(!el.disabled&&el.checked){valid=true;}});if(!valid){$('invite-friends-error').update('Please select someone to invite.');return false;}}
return true;},process_search:function(){if($('search_action').value=='invite'){$('email').addClassName('disable');$('message').addClassName('disable');$('email').disable();$('message').disable();$('invite-friends-error').update('Thank you for inviting your friend to Hulu.');}
else{$$('input.pending-friends-check').each(function(el){if((el.checked)&&(!el.disabled)){el.disabled=true;el.checked=false;el.up().addClassName('disabled');el.up().addClassName('accept');el.up().removeClassName('selected');}});}},remove:function(el,id,confirmed){if(!confirmed){$('friend-remove-id').value=id;$('friend-remove-name').update($('friend-'+id+'-name').value);FloatingDiv.show(el,$('confirm-friend-remove'),400);}
else{FloatingDiv.hide();$('friend-'+id+'-item').addClassName('removed');new Ajax.Request('/friends/remove_friend',{parameters:{user_id:id},method:'post'});}},disconnect_social:function(el,group,confirmed){if(!confirmed){FloatingDiv.show(el,$('confirm-social-remove-'+group),300);}
else{FloatingDiv.hide();$('social-remove-'+group).update('<span>[ Click to Disconnect ]</span>');sp=$('social-remove-'+group).down('span');sp.fade({duration:1.0});new Ajax.Request('/friends/remove_social_group',{parameters:{social_group:group},method:'post'});}}});
var Note=Class.create();Object.extend(Note,{singleSubmitLock:false,hover:function(note_id,hoverOn)
{if(hoverOn)
$('n-'+note_id+'-item-container').addClassName("active");else
$('n-'+note_id+'-item-container').removeClassName("active");},submit:function(){if(!Behaviors.isEmailValidated()){new Ajax.Request('/users/'+Behaviors.getUserId()+'/email_validation_status',{asynchronous:true,evalScripts:true,onComplete:function(request){if(!Behaviors.isEmailValidated())
Login.showEmailValidation();else
Note.doSubmit();}});return false;}
else{Note.doSubmit();}
return false;},doSubmit:function(){if($('notes-form-body').hasClassName('dormant'))
return false;if(Note.singleSubmitLock)
return false;else
Note.singleSubmitLock=true;if(($('notes-form').value=='')||($('notes-form-user-id').value=='')){Note.singleSubmitLock=false;return false;}
Element.update('notes-form-errors','');Element.show('notes-form-loading');Tab.loadTab('notes','/profile_sections/list?section=notes&user_id='+$('notes-form-user-id').value+'&with_container=true',false,null,Note.submitAfterTabLoad);return false;},submitAfterTabLoad:function(){new Ajax.Request('/notes/new',{asynchronous:true,evalScripts:true,onFailure:function(request){$('notes-error-container').update("Oops!  Something went wrong.  Please contact <a href=\"mailto:support@hulu.com\">support@hulu.com</a> if \
             this issue persists.");$('notes-error-container').show();$('notes-form-loading').hide();},onComplete:function(request){Note.singleSubmitLock=false;$('notes-form-body').addClassName('dormant');},parameters:Form.serialize($('notes-form'))});},hide:function(el,id,type){new Ajax.Request('/notes/hide/'+id,{asynchronous:true,evalScripts:true,method:'post'});el.blindUp({duration:0.3});}});
var Notification=Class.create();Object.extend(Notification,{hide:function(el,id,type){new Ajax.Request('/notifications/hide/'+id,{asynchronous:true,evalScripts:true,method:'post'});el.blindUp({duration:0.3});}});
var Activity=Class.create();Object.extend(Activity,{loading:false,current:'all',populateActivitiesFor:function(id,type,of_friends){new Ajax.Updater('activities-container','/activities/list'+'/default'+'/'+of_friends+'/'+id+'/'+type,{asynchronous:true,evalScripts:true,method:'get',onComplete:function(req){Activity.loading=false;$('activities-preview-loading').hide();}});},toggleSelection:function(selection,id,type){if(Activity.loading){return;}
Activity.loading=true;$('activities-preview-loading').show();if((Activity.current!='all')&&(selection=='all')){Activity.current='all';Activity.populateActivitiesFor(id,type,0);}
else if((Activity.current!='friends')&&(selection=='friends')){Activity.current='friends';Activity.populateActivitiesFor(id,type,1);}},createNewReview:function(el,reviewable_id,reviewable_type){if(!Behaviors.isLoggedIn()){FloatingLoginForm.show(el);return false;}
if(!Behaviors.isEmailValidated()){new Ajax.Request('/users/'+Behaviors.getUserId()+'/email_validation_status',{asynchronous:true,evalScripts:true,onComplete:function(request){if(!Behaviors.isEmailValidated())
Login.showEmailValidation();else
Activity.doCreateNewReview(reviewable_id,reviewable_type);}});}
else{Activity.doCreateNewReview(reviewable_id,reviewable_type);}
return false;},doCreateNewReview:function(reviewable_id,reviewable_type){$('activities-preview-loading').show();var url='/reviews/tab_load?reviewable_id='+reviewable_id+'&reviewable_type='+reviewable_type+'&form_active=1';Tab.loadTab('reviews',url,true,null);window.scrollTo(0,400);return false;},createNewTopic:function(el,topicable_id,topicable_type){if(!Behaviors.isLoggedIn()){FloatingLoginForm.show(el);return false;}
if(!Behaviors.isEmailValidated()){new Ajax.Request('/users/'+Behaviors.getUserId()+'/email_validation_status',{asynchronous:true,evalScripts:true,onComplete:function(request){if(!Behaviors.isEmailValidated())
Login.showEmailValidation();else
Activity.doCreateNewTopic(topicable_id,topicable_type);}});}
else{Activity.doCreateNewTopic(topicable_id,topicable_type);}
return false;},doCreateNewTopic:function(topicable_id,topicable_type){$('activities-preview-loading').show();var url='/topics/tab_load?topicable_id='+topicable_id+'&topicable_type='+topicable_type+'&form_active=1&segregate_video=false';Tab.loadTab('forums',url,true,null);window.scrollTo(0,400);return false;},hide:function(el,id,type){new Ajax.Request('/activities/hide?'+'related_id='+id+'&related_type='+type,{asynchronous:true,evalScripts:true,method:'post'});el.blindUp({duration:0.3});}});
var ResizableTextbox=Class.create({options:$H({min:5,max:500,step:7}),initialize:function(element,options){var that=this;this.options.update(options);this.el=$(element);this.width=this.el.offsetWidth;this.el.observe('keyup',function(){var newsize=that.options.get('step')*$F(this).length;if(newsize<=that.options.get('min'))newsize=that.width;if(!($F(this).length==this.retrieveData('rt-value')||newsize<=that.options.min||newsize>=that.options.max))
this.setStyle({'width':newsize});}).observe('keydown',function(){this.cacheData('rt-value',$F(this).length);});}});var TextboxList=Class.create({options:$H({resizable:{},className:'bit',separator:',',extrainputs:true,startinput:true,hideempty:true,fetchFile:undefined,results:10,wordMatch:false}),initialize:function(element,options){this.options.update(options);this.element=$(element).hide();this.bits=new Hash();this.events=new Hash();this.count=0;this.current=false;this.maininput=this.createInput({'class':'maininput','id':'maininput'});this.holder=new Element('ul',{'class':'holder','id':'textboxlist-holder'}).insert(this.maininput);this.element.insert({'before':this.holder});this.holder.observe('click',function(event){event.stop();if(this.maininput!=this.current)this.focus(this.maininput);}.bind(this));this.setEvents();},setEvents:function(){document.observe(Prototype.Browser.IE?'keydown':'keypress',function(e){if(!this.current)return;if(this.current.retrieveData('type')=='box'&&e.keyCode==Event.KEY_BACKSPACE)e.stop();}.bind(this));document.observe('keyup',function(e){e.stop();if(!this.current)return;switch(e.keyCode){case Event.KEY_LEFT:return this.move('left');case Event.KEY_RIGHT:return this.move('right');case Event.KEY_DELETE:case Event.KEY_BACKSPACE:return this.moveDispose();}}.bind(this)).observe('click',function(){document.fire('blur');}.bindAsEventListener(this));},update:function(){this.element.value=this.bits.values().join(this.options.get('separator'));return this;},add:function(text,html){var id=this.options.get('className')+'-'+this.count++;var el=this.createBox($pick(html,text),{'id':id});(this.current||this.maininput).insert({'before':el});el.observe('click',function(e){e.stop();this.focus(el);}.bind(this));this.bits.set(id,text.value);if(this.options.get('extrainputs')&&(this.options.get('startinput')||el.previous()))this.addSmallInput(el,'before');return el;},addSmallInput:function(el,where){var input=this.createInput({'class':'smallinput'});el.insert({}[where]=input);input.cacheData('small',true);this.makeResizable(input);if(this.options.get('hideempty'))input.hide();return input;},dispose:function(el){this.bits.unset(el.id);if(el.previous()&&el.previous().retrieveData('small'))el.previous().remove();if(this.current==el)this.focus(el.next());if(el.retrieveData('type')=='box')el.onBoxDispose(this);el.remove();return this;},focus:function(el,nofocus){if(!this.current)el.fire('focus');else if(this.current==el)return this;this.blur();el.addClassName(this.options.get('className')+'-'+el.retrieveData('type')+'-focus');if(el.retrieveData('small'))el.setStyle({'display':'block'});if(el.retrieveData('type')=='input'){el.onInputFocus(this);if(!nofocus)this.callEvent(el.retrieveData('input'),'focus');}
else el.fire('onBoxFocus');this.current=el;return this;},blur:function(noblur){if(!this.current)return this;if(this.current.retrieveData('type')=='input'){var input=this.current.retrieveData('input');if(!noblur)this.callEvent(input,'blur');input.onInputBlur(this);}
else this.current.fire('onBoxBlur');if(this.current.retrieveData('small')&&!input.get('value')&&this.options.get('hideempty'))
this.current.hide();this.current.removeClassName(this.options.get('className')+'-'+this.current.retrieveData('type')+'-focus');this.current=false;return this;},createBox:function(text,options){el=new Element('li',options).addClassName(this.options.get('className')+'-box').update("<span class=\"name\">"+text.name+"</span>").cacheData('type','box');if(!Object.isUndefined(text.className))el.addClassName(text.className);return el;},createInput:function(options){var li=new Element('li',{'class':this.options.get('className')+'-input'});var el=new Element('input',Object.extend(options,{'type':'text','autocomplete':'off'}));el.observe('click',function(e){e.stop();}).observe('focus',function(e){if(!this.isSelfEvent('focus'))this.focus(li,true);}.bind(this)).observe('blur',function(){if(!this.isSelfEvent('blur'))this.blur(true);}.bind(this)).observe('keydown',function(e){this.cacheData('lastvalue',this.value).cacheData('lastcaret',this.getCaretPosition());});var tmp=li.cacheData('type','input').cacheData('input',el).insert(el);return tmp;},callEvent:function(el,type){this.events.set(type,el);el[type]();},isSelfEvent:function(type){return(this.events.get(type))?!!this.events.unset(type):false;},makeResizable:function(li){var el=li.retrieveData('input');el.cacheData('resizable',new ResizableTextbox(el,Object.extend(this.options.get('resizable'),{min:el.offsetWidth,max:(this.element.getWidth()?this.element.getWidth():0)})));return this;},checkInput:function(){var input=this.current.retrieveData('input');return(!input.retrieveData('lastvalue')||(input.getCaretPosition()===0&&input.retrieveData('lastcaret')===0));},move:function(direction){var el=this.current[(direction=='left'?'previous':'next')]();if(el&&(!this.current.retrieveData('input')||((this.checkInput()||direction=='right'))))this.focus(el);return this;},moveDispose:function(){if(this.current.retrieveData('type')=='box')return this.dispose(this.current);if(this.checkInput()&&this.bits.keys().length&&this.current.previous())return this.focus(this.current.previous());}});Element.addMethods({getCaretPosition:function(){if(this.createTextRange){var r=document.selection.createRange().duplicate();r.moveEnd('character',this.value.length);if(r.text==='')return this.value.length;return this.value.lastIndexOf(r.text);}else return this.selectionStart;},cacheData:function(element,key,value){if(Object.isUndefined(this[$(element).identify()])||!Object.isHash(this[$(element).identify()]))
this[$(element).identify()]=$H();this[$(element).identify()].set(key,value);return element;},retrieveData:function(element,key){return this[$(element).identify()].get(key);}});function $pick(){for(var B=0,A=arguments.length;B<A;B++){if(!Object.isUndefined(arguments[B])){return arguments[B];}}return null;}
var FriendSelector=Class.create(TextboxList,{loptions:$H({autocomplete:{'opacity':1.0,'maxresults':5,'minchars':1}}),initialize:function($super,element,autoholder,options,func){$super(element,options);this.data=[];this.autoholder=$(autoholder).setOpacity(this.loptions.get('autocomplete').opacity);this.autoholder.observe('mouseover',function(){this.curOn=true;}.bind(this)).observe('mouseout',function(){this.curOn=false;}.bind(this));this.autoresults=this.autoholder.select('ul').first();var children=this.autoresults.select('li');children.each(function(el){this.add({value:el.readAttribute('value'),name:el.innerHTML});},this);},autoShow:function(search){this.autoholder.setStyle({'display':'block'});this.autoholder.descendants().each(function(e){e.hide()});if(!search||!search.strip()||(!search.length||search.length<this.loptions.get('autocomplete').minchars))
{this.autoholder.select('.default').first().setStyle({'display':'block'});this.resultsshown=false;}else{this.resultsshown=true;this.autoresults.setStyle({'display':'block'}).update('');if(this.options.get('wordMatch'))
var regexp=new RegExp("(^|\\s)"+search,'i')
else
var regexp=new RegExp(search,'i')
var count=0;this.data.filter(function(str){return str?regexp.test(str.evalJSON(true).name):false;}).each(function(result,ti){count++;if(ti>=this.loptions.get('autocomplete').maxresults)return;var that=this;var el=new Element('li');el.observe('click',function(e){e.stop();that.autoAdd(this);}).observe('mouseover',function(){that.autoFocus(this);}).update(this.autoHighlight(result.evalJSON(true).name,search));var img=new Element('img',{'src':result.evalJSON(true).avatar,'class':'thumbnail'});el.insert({top:img});this.autoresults.insert(el);el.cacheData('result',result.evalJSON(true));if(ti==0)this.autoFocus(el);},this);}
if(count==0)this.autocurrent=false;if(count>this.loptions.get('autocomplete').maxresults)
this.autoresults.setStyle({'height':(this.loptions.get('autocomplete').maxresults*45)+'px'});else
this.autoresults.setStyle({'height':(count?(count*45):0)+'px'});return this;},autoHighlight:function(html,highlight){return html.gsub(new RegExp(highlight,'i'),function(match){return'<em>'+match[0]+'</em>';});},autoHide:function(){this.resultsshown=false;this.autoholder.hide();return this;},autoFocus:function(el){if(!el)return;if(this.autocurrent)this.autocurrent.removeClassName('auto-focus');this.autocurrent=el.addClassName('auto-focus');return this;},autoMove:function(direction){if(!this.resultsshown)return;this.autoFocus(this.autocurrent[(direction=='up'?'previous':'next')]());this.autoresults.scrollTop=this.autocurrent.positionedOffset()[1]-this.autocurrent.getHeight();return this;},autoFeed:function(text){if(this.data.indexOf(Object.toJSON(text))==-1)
this.data.push(Object.toJSON(text));return this;},autoAdd:function(el){var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;current_value=$('maininput').value;if(filter.test(current_value)){this.add({'name':current_value,'value':current_value});}
else if(el&&el.retrieveData('result')){this.add(el.retrieveData('result'));delete this.data[this.data.indexOf(Object.toJSON(el.retrieveData('result')))];this.autoHide();}
else{this.add({'name':current_value,'value':'-1','className':'error'});}
var input=this.lastinput||this.current.retrieveData('input');input.clear().focus();return this;},createInput:function($super,options){var li=$super(options);var input=li.retrieveData('input');input.observe('keydown',function(e){this.dosearch=false;switch(e.keyCode){case Event.KEY_UP:e.stop();return this.autoMove('up');case Event.KEY_DOWN:e.stop();return this.autoMove('down');case Event.KEY_RETURN:case Event.KEY_TAB:case 186:case 188:if((e.keyCode==Event.KEY_TAB)&&($('maininput').value=='')){return true;}
else if($('maininput').value==''){e.stop();return false;}
e.stop();this.autoAdd(this.autocurrent);this.autocurrent=false;this.autoenter=true;return false;case Event.KEY_ESC:this.autoHide();if(this.current&&this.current.retrieveData('input'))
this.current.retrieveData('input').clear();break;default:this.dosearch=true;}}.bind(this));input.observe('keyup',function(e){switch(e.keyCode){case Event.KEY_UP:case Event.KEY_DOWN:case Event.KEY_RETURN:case Event.KEY_ESC:break;default:if(!Object.isUndefined(this.options.get('fetchFile'))){new Ajax.Request(this.options.get('fetchFile'),{parameters:{keyword:input.value},onSuccess:function(transport){transport.responseText.evalJSON(true).each(function(t){this.autoFeed(t)}.bind(this));this.autoShow(input.value);}.bind(this)});}
else
if(this.dosearch)this.autoShow(input.value);}}.bind(this));input.observe(Prototype.Browser.IE?'keydown':'keypress',function(e){if(this.autoenter)e.stop();this.autoenter=false;}.bind(this));return li;},createBox:function($super,text,options){var li=$super(text,options);li.observe('mouseover',function(){this.addClassName('bit-hover');}).observe('mouseout',function(){this.removeClassName('bit-hover')});var a=new Element('a',{'href':'#','class':'closebutton'});src=null;if(text["avatar"]!=undefined)
src=text["avatar"];else
src='/images/stock-avatar-m.gif';var img=new Element('img',{'src':src,'class':'thumbnail'});li.insert({top:img});a.observe('click',function(e){e.stop();if(!this.current)this.focus(this.maininput);this.dispose(li);}.bind(this));li.insert(a).cacheData('text',Object.toJSON(text));return li;}});Element.addMethods({onBoxDispose:function(item,obj){obj.autoFeed(item.retrieveData('text').evalJSON(true));},onInputFocus:function(el,obj){obj.autoShow();},onInputBlur:function(el,obj){obj.lastinput=el;if(!obj.curOn){obj.blurhide=obj.autoHide.bind(obj).delay(0.1);}},filter:function(D,E){var C=[];for(var B=0,A=this.length;B<A;B++){if(D.call(E,this[B],B,this)){C.push(this[B]);}}return C;}});
function share_copy_embed_code(){var embedCode;if($('player'))
embedCode=$('player').getEmbedCode();if(typeof(embedCode)=='undefined')
embedCode=failsafeEmbedCode;$('share-copy-check-icon').show();new Effect.Fade('share-copy-check-icon',{delay:2,duration:0.2});return embedCode;}
var Share=Class.create();Object.extend(Share,{popup:function(url,sharable_type,sharable_id){if(sharable_type&&sharable_id){google_analytics_ajax('/share/'+sharable_type+'/'+sharable_id);}
popWindow=window.open(url,"_blank","toolbar=0,status=0,resizable=1,scrollbars=1,width=900,height=600");if(popWindow){popWindow.focus();}
else{ModalPopup.warn("Oops - your browser may be blocking this pop-up. Please disable your pop-up blocker before continuing.");}}});
var Builder={NODEMAP:{AREA:'map',CAPTION:'table',COL:'table',COLGROUP:'table',LEGEND:'fieldset',OPTGROUP:'select',OPTION:'select',PARAM:'object',TBODY:'table',TD:'table',TFOOT:'table',TH:'table',THEAD:'table',TR:'table'},node:function(elementName){elementName=elementName.toUpperCase();var parentTag=this.NODEMAP[elementName]||'div';var parentElement=document.createElement(parentTag);try{parentElement.innerHTML="<"+elementName+"></"+elementName+">";}catch(e){}
var element=parentElement.firstChild||null;if(element&&(element.tagName!=elementName))
element=element.getElementsByTagName(elementName)[0];if(!element)element=document.createElement(elementName);if(!element)return;if(arguments[1])
if(this._isStringOrNumber(arguments[1])||(arguments[1]instanceof Array)){this._children(element,arguments[1]);}else{var attrs=this._attributes(arguments[1]);if(attrs.length){try{parentElement.innerHTML="<"+elementName+" "+
attrs+"></"+elementName+">";}catch(e){}
element=parentElement.firstChild||null;if(!element){element=document.createElement(elementName);for(attr in arguments[1])
element[attr=='class'?'className':attr]=arguments[1][attr];}
if(element.tagName!=elementName)
element=parentElement.getElementsByTagName(elementName)[0];}}
if(arguments[2])
this._children(element,arguments[2]);return element;},_text:function(text){return document.createTextNode(text);},_attributes:function(attributes){var attrs=[];for(attribute in attributes)
attrs.push((attribute=='className'?'class':attribute)+'="'+attributes[attribute].toString().escapeHTML()+'"');return attrs.join(" ");},_children:function(element,children){if(typeof children=='object'){children.flatten().each(function(e){if(typeof e=='object')
element.appendChild(e)
else
if(Builder._isStringOrNumber(e))
element.appendChild(Builder._text(e));});}else
if(Builder._isStringOrNumber(children))
element.appendChild(Builder._text(children));},_isStringOrNumber:function(param){return(typeof param=='string'||typeof param=='number');}}
var Droppables={drops:[],remove:function(element){this.drops=this.drops.reject(function(d){return d.element==$(element)});},add:function(element){element=$(element);var options=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(options.containment){options._containers=[];var containment=options.containment;if((typeof containment=='object')&&(containment.constructor==Array)){containment.each(function(c){options._containers.push($(c))});}else{options._containers.push($(containment));}}
if(options.accept)options.accept=[options.accept].flatten();Element.makePositioned(element);options.element=element;this.drops.push(options);},findDeepestChild:function(drops){deepest=drops[0];for(i=1;i<drops.length;++i)
if(Element.isParent(drops[i].element,deepest.element))
deepest=drops[i];return deepest;},isContained:function(element,drop){var containmentNode;if(drop.tree){containmentNode=element.treeNode;}else{containmentNode=element.parentNode;}
return drop._containers.detect(function(c){return containmentNode==c});},isAffected:function(point,element,drop){return((drop.element!=element)&&((!drop._containers)||this.isContained(element,drop))&&((!drop.accept)||(Element.classNames(element).detect(function(v){return drop.accept.include(v)})))&&Position.within(drop.element,point[0],point[1]));},deactivate:function(drop){if(drop.hoverclass)
Element.removeClassName(drop.element,drop.hoverclass);this.last_active=null;},activate:function(drop){if(drop.hoverclass)
Element.addClassName(drop.element,drop.hoverclass);this.last_active=drop;},show:function(point,element){if(!this.drops.length)return;var affected=[];if(this.last_active)this.deactivate(this.last_active);this.drops.each(function(drop){if(Droppables.isAffected(point,element,drop))
affected.push(drop);});if(affected.length>0){drop=Droppables.findDeepestChild(affected);Position.within(drop.element,point[0],point[1]);if(drop.onHover)
drop.onHover(element,drop.element,Position.overlap(drop.overlap,drop.element));Droppables.activate(drop);}},fire:function(event,element){if(!this.last_active)return;Position.prepare();if(this.isAffected([Event.pointerX(event),Event.pointerY(event)],element,this.last_active))
if(this.last_active.onDrop)
this.last_active.onDrop(element,this.last_active.element,event);},reset:function(){if(this.last_active)
this.deactivate(this.last_active);}}
var Draggables={drags:[],observers:[],register:function(draggable){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress);}
this.drags.push(draggable);},unregister:function(draggable){this.drags=this.drags.reject(function(d){return d==draggable});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress);}},activate:function(draggable){window.focus();this.activeDraggable=draggable;},deactivate:function(){this.activeDraggable=null;},updateDrag:function(event){if(!this.activeDraggable)return;var pointer=[Event.pointerX(event),Event.pointerY(event)];if(this._lastPointer&&(this._lastPointer.inspect()==pointer.inspect()))return;this._lastPointer=pointer;this.activeDraggable.updateDrag(event,pointer);},endDrag:function(event){if(!this.activeDraggable)return;this._lastPointer=null;this.activeDraggable.endDrag(event);this.activeDraggable=null;},keyPress:function(event){if(this.activeDraggable)
this.activeDraggable.keyPress(event);},addObserver:function(observer){this.observers.push(observer);this._cacheObserverCallbacks();},removeObserver:function(element){this.observers=this.observers.reject(function(o){return o.element==element});this._cacheObserverCallbacks();},notify:function(eventName,draggable,event){if(this[eventName+'Count']>0)
this.observers.each(function(o){if(o[eventName])o[eventName](eventName,draggable,event);});},_cacheObserverCallbacks:function(){['onStart','onEnd','onDrag'].each(function(eventName){Draggables[eventName+'Count']=Draggables.observers.select(function(o){return o[eventName];}).length;});}}
var Draggable=Class.create();Draggable.prototype={initialize:function(element){var options=Object.extend({handle:false,starteffect:function(element){element._opacity=Element.getOpacity(element);new Effect.Opacity(element,{duration:0.2,from:element._opacity,to:0.7});},reverteffect:function(element,top_offset,left_offset){var dur=Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;element._revert=new Effect.Move(element,{x:-left_offset,y:-top_offset,duration:dur});},endeffect:function(element){var toOpacity=typeof element._opacity=='number'?element._opacity:1.0
new Effect.Opacity(element,{duration:0.2,from:0.7,to:toOpacity});},zindex:1000,revert:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false},arguments[1]||{});this.element=$(element);if(options.handle&&(typeof options.handle=='string')){var h=Element.childrenWithClassName(this.element,options.handle,true);if(h.length>0)this.handle=h[0];}
if(!this.handle)this.handle=$(options.handle);if(!this.handle)this.handle=this.element;if(options.scroll&&!options.scroll.scrollTo&&!options.scroll.outerHTML)
options.scroll=$(options.scroll);Element.makePositioned(this.element);this.delta=this.currentDelta();this.options=options;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this);},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this);},currentDelta:function(){return([parseInt(Element.getStyle(this.element,'left')||'0'),parseInt(Element.getStyle(this.element,'top')||'0')]);},initDrag:function(event){if(Event.isLeftClick(event)){var src=Event.element(event);if(src.tagName&&(src.tagName=='INPUT'||src.tagName=='SELECT'||src.tagName=='OPTION'||src.tagName=='BUTTON'||src.tagName=='TEXTAREA'))return;if(this.element._revert){this.element._revert.cancel();this.element._revert=null;}
var pointer=[Event.pointerX(event),Event.pointerY(event)];var pos=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(i){return(pointer[i]-pos[i])});Draggables.activate(this);Event.stop(event);}},startDrag:function(event){this.dragging=true;if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,'z-index')||0);this.element.style.zIndex=this.options.zindex;}
if(this.options.ghosting){this._clone=this.element.cloneNode(true);Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element);}
if(this.options.scroll){if(this.options.scroll==window){var where=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=where.left;this.originalScrollTop=where.top;}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop;}}
Draggables.notify('onStart',this,event);if(this.options.starteffect)this.options.starteffect(this.element);},updateDrag:function(event,pointer){if(!this.dragging)this.startDrag(event);Position.prepare();Droppables.show(pointer,this.element);Draggables.notify('onDrag',this,event);this.draw(pointer);if(this.options.change)this.options.change(this);if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height];}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft;p[1]+=this.options.scroll.scrollTop;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight);}
var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity))speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity);if(pointer[1]<(p[1]+this.options.scrollSensitivity))speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity);if(pointer[0]>(p[2]-this.options.scrollSensitivity))speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity);if(pointer[1]>(p[3]-this.options.scrollSensitivity))speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity);this.startScrolling(speed);}
if(navigator.appVersion.indexOf('AppleWebKit')>0)window.scrollBy(0,0);Event.stop(event);},finishDrag:function(event,success){this.dragging=false;if(this.options.ghosting){Position.relativize(this.element);Element.remove(this._clone);this._clone=null;}
if(success)Droppables.fire(event,this.element);Draggables.notify('onEnd',this,event);var revert=this.options.revert;if(revert&&typeof revert=='function')revert=revert(this.element);var d=this.currentDelta();if(revert&&this.options.reverteffect){this.options.reverteffect(this.element,d[1]-this.delta[1],d[0]-this.delta[0]);}else{this.delta=d;}
if(this.options.zindex)
this.element.style.zIndex=this.originalZ;if(this.options.endeffect)
this.options.endeffect(this.element);Draggables.deactivate(this);Droppables.reset();},keyPress:function(event){if(event.keyCode!=Event.KEY_ESC)return;this.finishDrag(event,false);Event.stop(event);},endDrag:function(event){if(!this.dragging)return;this.stopScrolling();this.finishDrag(event,true);Event.stop(event);},draw:function(point){var pos=Position.cumulativeOffset(this.element);var d=this.currentDelta();pos[0]-=d[0];pos[1]-=d[1];if(this.options.scroll&&(this.options.scroll!=window)){pos[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;pos[1]-=this.options.scroll.scrollTop-this.originalScrollTop;}
var p=[0,1].map(function(i){return(point[i]-pos[i]-this.offset[i])}.bind(this));if(this.options.snap){if(typeof this.options.snap=='function'){p=this.options.snap(p[0],p[1],this);}else{if(this.options.snap instanceof Array){p=p.map(function(v,i){return Math.round(v/this.options.snap[i])*this.options.snap[i]}.bind(this))}else{p=p.map(function(v){return Math.round(v/this.options.snap)*this.options.snap}.bind(this))}}}
var style=this.element.style;if((!this.options.constraint)||(this.options.constraint=='horizontal'))
style.left=p[0]+"px";if((!this.options.constraint)||(this.options.constraint=='vertical'))
style.top=p[1]+"px";if(style.visibility=="hidden")style.visibility="";},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null;}},startScrolling:function(speed){this.scrollSpeed=[speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10);},scroll:function(){var current=new Date();var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1]);}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000;}
Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify('onDrag',this);Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0)
Draggables._lastScrollPointer[0]=0;if(Draggables._lastScrollPointer[1]<0)
Draggables._lastScrollPointer[1]=0;this.draw(Draggables._lastScrollPointer);if(this.options.change)this.options.change(this);},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft;}else if(w.document.body){T=body.scrollTop;L=body.scrollLeft;}
if(w.innerWidth){W=w.innerWidth;H=w.innerHeight;}else if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight;}else{W=body.offsetWidth;H=body.offsetHeight}}
return{top:T,left:L,width:W,height:H};}}
var SortableObserver=Class.create();SortableObserver.prototype={initialize:function(element,observer){this.element=$(element);this.observer=observer;this.lastValue=Sortable.serialize(this.element);},onStart:function(){this.lastValue=Sortable.serialize(this.element);},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element))
this.observer(this.element)}}
var Sortable={sortables:{},_findRootElement:function(element){while(element.tagName!="BODY"){if(element.id&&Sortable.sortables[element.id])return element;element=element.parentNode;}},options:function(element){element=Sortable._findRootElement($(element));if(!element)return;return Sortable.sortables[element.id];},destroy:function(element){var s=Sortable.options(element);if(s){Draggables.removeObserver(s.element);s.droppables.each(function(d){Droppables.remove(d)});s.draggables.invoke('destroy');delete Sortable.sortables[s.element.id];}},create:function(element){element=$(element);var options=Object.extend({element:element,tag:'li',dropOnEmpty:false,tree:false,treeTag:'ul',overlap:'vertical',constraint:'vertical',containment:element,handle:false,only:false,hoverclass:null,ghosting:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:/^[^_]*_(.*)$/,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(element);var options_for_draggable={revert:true,scroll:options.scroll,scrollSpeed:options.scrollSpeed,scrollSensitivity:options.scrollSensitivity,ghosting:options.ghosting,constraint:options.constraint,handle:options.handle};if(options.starteffect)
options_for_draggable.starteffect=options.starteffect;if(options.reverteffect)
options_for_draggable.reverteffect=options.reverteffect;else
if(options.ghosting)options_for_draggable.reverteffect=function(element){element.style.top=0;element.style.left=0;};if(options.endeffect)
options_for_draggable.endeffect=options.endeffect;if(options.zindex)
options_for_draggable.zindex=options.zindex;var options_for_droppable={overlap:options.overlap,containment:options.containment,tree:options.tree,hoverclass:options.hoverclass,onHover:Sortable.onHover}
var options_for_tree={onHover:Sortable.onEmptyHover,overlap:options.overlap,containment:options.containment,hoverclass:options.hoverclass}
Element.cleanWhitespace(element);options.draggables=[];options.droppables=[];if(options.dropOnEmpty||options.tree){Droppables.add(element,options_for_tree);options.droppables.push(element);}
(this.findElements(element,options)||[]).each(function(e){var handle=options.handle?Element.childrenWithClassName(e,options.handle)[0]:e;options.draggables.push(new Draggable(e,Object.extend(options_for_draggable,{handle:handle})));Droppables.add(e,options_for_droppable);if(options.tree)e.treeNode=element;options.droppables.push(e);});if(options.tree){(Sortable.findTreeElements(element,options)||[]).each(function(e){Droppables.add(e,options_for_tree);e.treeNode=element;options.droppables.push(e);});}
this.sortables[element.id]=options;Draggables.addObserver(new SortableObserver(element,options.onUpdate));},findElements:function(element,options){return Element.findChildren(element,options.only,options.tree?true:false,options.tag);},findTreeElements:function(element,options){return Element.findChildren(element,options.only,options.tree?true:false,options.treeTag);},onHover:function(element,dropon,overlap){if(Element.isParent(dropon,element))return;if(overlap>.33&&overlap<.66&&Sortable.options(dropon).tree){return;}else if(overlap>0.5){Sortable.mark(dropon,'before');if(dropon.previousSibling!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,dropon);if(dropon.parentNode!=oldParentNode)
Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}else{Sortable.mark(dropon,'after');var nextElement=dropon.nextSibling||null;if(nextElement!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,nextElement);if(dropon.parentNode!=oldParentNode)
Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}},onEmptyHover:function(element,dropon,overlap){var oldParentNode=element.parentNode;var droponOptions=Sortable.options(dropon);if(!Element.isParent(dropon,element)){var index;var children=Sortable.findElements(dropon,{tag:droponOptions.tag});var child=null;if(children){var offset=Element.offsetSize(dropon,droponOptions.overlap)*(1.0-overlap);for(index=0;index<children.length;index+=1){if(offset-Element.offsetSize(children[index],droponOptions.overlap)>=0){offset-=Element.offsetSize(children[index],droponOptions.overlap);}else if(offset-(Element.offsetSize(children[index],droponOptions.overlap)/2)>=0){child=index+1<children.length?children[index+1]:null;break;}else{child=children[index];break;}}}
dropon.insertBefore(element,child);Sortable.options(oldParentNode).onChange(element);droponOptions.onChange(element);}},unmark:function(){if(Sortable._marker)Element.hide(Sortable._marker);},mark:function(dropon,position){var sortable=Sortable.options(dropon.parentNode);if(sortable&&!sortable.ghosting)return;if(!Sortable._marker){Sortable._marker=$('dropmarker')||document.createElement('DIV');Element.hide(Sortable._marker);Element.addClassName(Sortable._marker,'dropmarker');Sortable._marker.style.position='absolute';document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);}
var offsets=Position.cumulativeOffset(dropon);Sortable._marker.style.left=offsets[0]+'px';Sortable._marker.style.top=offsets[1]+'px';if(position=='after')
if(sortable.overlap=='horizontal')
Sortable._marker.style.left=(offsets[0]+dropon.clientWidth)+'px';else
Sortable._marker.style.top=(offsets[1]+dropon.clientHeight)+'px';Element.show(Sortable._marker);},_tree:function(element,options,parent){var children=Sortable.findElements(element,options)||[];for(var i=0;i<children.length;++i){var match=children[i].id.match(options.format);if(!match)continue;var child={id:encodeURIComponent(match?match[1]:null),element:element,parent:parent,children:new Array,position:parent.children.length,container:Sortable._findChildrenElement(children[i],options.treeTag.toUpperCase())}
if(child.container)
this._tree(child.container,options,child)
parent.children.push(child);}
return parent;},_findChildrenElement:function(element,containerTag){if(element&&element.hasChildNodes)
for(var i=0;i<element.childNodes.length;++i)
if(element.childNodes[i].tagName==containerTag)
return element.childNodes[i];return null;},tree:function(element){element=$(element);var sortableOptions=this.options(element);var options=Object.extend({tag:sortableOptions.tag,treeTag:sortableOptions.treeTag,only:sortableOptions.only,name:element.id,format:sortableOptions.format},arguments[1]||{});var root={id:null,parent:null,children:new Array,container:element,position:0}
return Sortable._tree(element,options,root);},_constructIndex:function(node){var index='';do{if(node.id)index='['+node.position+']'+index;}while((node=node.parent)!=null);return index;},sequence:function(element){element=$(element);var options=Object.extend(this.options(element),arguments[1]||{});return $(this.findElements(element,options)||[]).map(function(item){return item.id.match(options.format)?item.id.match(options.format)[1]:'';});},setSequence:function(element,new_sequence){element=$(element);var options=Object.extend(this.options(element),arguments[2]||{});var nodeMap={};this.findElements(element,options).each(function(n){if(n.id.match(options.format))
nodeMap[n.id.match(options.format)[1]]=[n,n.parentNode];n.parentNode.removeChild(n);});new_sequence.each(function(ident){var n=nodeMap[ident];if(n){n[1].appendChild(n[0]);delete nodeMap[ident];}});},serialize:function(element){element=$(element);var options=Object.extend(Sortable.options(element),arguments[1]||{});var name=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:element.id);if(options.tree){return Sortable.tree(element,arguments[1]).children.map(function(item){return[name+Sortable._constructIndex(item)+"="+
encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));}).flatten().join('&');}else{return Sortable.sequence(element,arguments[1]).map(function(item){return name+"[]="+encodeURIComponent(item);}).join('&');}}}
Element.isParent=function(child,element){if(!child.parentNode||child==element)return false;if(child.parentNode==element)return true;return Element.isParent(child.parentNode,element);}
Element.findChildren=function(element,only,recursive,tagName){if(!element.hasChildNodes())return null;tagName=tagName.toUpperCase();if(only)only=[only].flatten();var elements=[];$A(element.childNodes).each(function(e){if(e.tagName&&e.tagName.toUpperCase()==tagName&&(!only||(Element.classNames(e).detect(function(v){return only.include(v)}))))
elements.push(e);if(recursive){var grandchildren=Element.findChildren(e,only,recursive,tagName);if(grandchildren)elements.push(grandchildren);}});return(elements.length>0?elements.flatten():[]);}
Element.offsetSize=function(element,type){if(type=='vertical'||type=='height')
return element.offsetHeight;else
return element.offsetWidth;}
var CropDraggable=Class.create();Object.extend(Object.extend(CropDraggable.prototype,Draggable.prototype),{initialize:function(_1){this.options=Object.extend({drawMethod:function(){}},arguments[1]||{});this.element=$(_1);this.handle=this.element;this.delta=this.currentDelta();this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this);},draw:function(_2){var _3=Position.cumulativeOffset(this.element);var d=this.currentDelta();_3[0]-=d[0];_3[1]-=d[1];var p=[0,1].map(function(i){return(_2[i]-_3[i]-this.offset[i]);}.bind(this));this.options.drawMethod(p);}});var Cropper={};Cropper.Img=Class.create();Cropper.Img.prototype={initialize:function(_7,_8){this.options=Object.extend({ratioDim:{x:0,y:0},minWidth:0,minHeight:0,displayOnInit:false,onEndCrop:Prototype.emptyFunction,captureKeys:true,onloadCoords:null,maxWidth:0,maxHeight:0},_8||{});this.img=$(_7);this.clickCoords={x:0,y:0};this.dragging=false;this.resizing=false;this.isWebKit=/Konqueror|Safari|KHTML/.test(navigator.userAgent);this.isIE=/MSIE/.test(navigator.userAgent);this.isOpera8=/Opera\s[1-8]/.test(navigator.userAgent);this.ratioX=0;this.ratioY=0;this.attached=false;this.fixedWidth=(this.options.maxWidth>0&&(this.options.minWidth>=this.options.maxWidth));this.fixedHeight=(this.options.maxHeight>0&&(this.options.minHeight>=this.options.maxHeight));if(typeof this.img=="undefined"){return;}
if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0){var _c=this.getGCD(this.options.ratioDim.x,this.options.ratioDim.y);this.ratioX=this.options.ratioDim.x/_c;this.ratioY=this.options.ratioDim.y/_c;}
this.subInitialize();if(this.img.complete||this.isWebKit){this.onLoad();}else{Event.observe(this.img,"load",this.onLoad.bindAsEventListener(this));}},getGCD:function(a,b){if(b==0){return a;}
return this.getGCD(b,a%b);},onLoad:function(){var _f="imgCrop_";var _10=this.img.parentNode;var _11="";if(this.isOpera8){_11=" opera8";}
this.imgWrap=Builder.node("div",{"class":_f+"wrap"+_11});this.north=Builder.node("div",{"class":_f+"overlay "+_f+"north"},[Builder.node("span")]);this.east=Builder.node("div",{"class":_f+"overlay "+_f+"east"},[Builder.node("span")]);this.south=Builder.node("div",{"class":_f+"overlay "+_f+"south"},[Builder.node("span")]);this.west=Builder.node("div",{"class":_f+"overlay "+_f+"west"},[Builder.node("span")]);var _12=[this.north,this.east,this.south,this.west];this.dragArea=Builder.node("div",{"class":_f+"dragArea"},_12);this.handleN=Builder.node("div",{"class":_f+"handle "+_f+"handleN"});this.handleNE=Builder.node("div",{"class":_f+"handle "+_f+"handleNE"});this.handleE=Builder.node("div",{"class":_f+"handle "+_f+"handleE"});this.handleSE=Builder.node("div",{"class":_f+"handle "+_f+"handleSE"});this.handleS=Builder.node("div",{"class":_f+"handle "+_f+"handleS"});this.handleSW=Builder.node("div",{"class":_f+"handle "+_f+"handleSW"});this.handleW=Builder.node("div",{"class":_f+"handle "+_f+"handleW"});this.handleNW=Builder.node("div",{"class":_f+"handle "+_f+"handleNW"});this.selArea=Builder.node("div",{"class":_f+"selArea"},[Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeNorth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeEast"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeSouth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeWest"},[Builder.node("span")]),this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW,Builder.node("div",{"class":_f+"clickArea"})]);this.imgWrap.appendChild(this.img);this.imgWrap.appendChild(this.dragArea);this.dragArea.appendChild(this.selArea);this.dragArea.appendChild(Builder.node("div",{"class":_f+"clickArea"}));_10.appendChild(this.imgWrap);this.startDragBind=this.startDrag.bindAsEventListener(this);Event.observe(this.dragArea,"mousedown",this.startDragBind);this.onDragBind=this.onDrag.bindAsEventListener(this);Event.observe(document,"mousemove",this.onDragBind);this.endCropBind=this.endCrop.bindAsEventListener(this);Event.observe(document,"mouseup",this.endCropBind);this.resizeBind=this.startResize.bindAsEventListener(this);this.handles=[this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW];this.registerHandles(true);if(this.options.captureKeys){this.keysBind=this.handleKeys.bindAsEventListener(this);Event.observe(document,"keypress",this.keysBind);}
new CropDraggable(this.selArea,{drawMethod:this.moveArea.bindAsEventListener(this)});this.setParams();},registerHandles:function(_13){for(var i=0;i<this.handles.length;i++){var _15=$(this.handles[i]);if(_13){var _16=false;if(this.fixedWidth&&this.fixedHeight){_16=true;}else{if(this.fixedWidth||this.fixedHeight){var _17=_15.className.match(/([S|N][E|W])$/);var _18=_15.className.match(/(E|W)$/);var _19=_15.className.match(/(N|S)$/);if(_17){_16=true;}else{if(this.fixedWidth&&_18){_16=true;}else{if(this.fixedHeight&&_19){_16=true;}}}}}
if(_16){_15.hide();}else{Event.observe(_15,"mousedown",this.resizeBind);}}else{_15.show();Event.stopObserving(_15,"mousedown",this.resizeBind);}}},setParams:function(){this.imgW=this.img.width;this.imgH=this.img.height;$(this.north).setStyle({height:0});$(this.east).setStyle({width:0,height:0});$(this.south).setStyle({height:0});$(this.west).setStyle({width:0,height:0});$(this.imgWrap).setStyle({"width":this.imgW+"px","height":this.imgH+"px"});$(this.selArea).hide();var _1a={x1:0,y1:0,x2:0,y2:0};var _1b=false;if(this.options.onloadCoords!=null){_1a=this.cloneCoords(this.options.onloadCoords);_1b=true;}else{if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0){_1a.x1=Math.ceil((this.imgW-this.options.ratioDim.x)/2);_1a.y1=Math.ceil((this.imgH-this.options.ratioDim.y)/2);_1a.x2=_1a.x1+this.options.ratioDim.x;_1a.y2=_1a.y1+this.options.ratioDim.y;_1b=true;}}
this.setAreaCoords(_1a,false,false,1);if(this.options.displayOnInit&&_1b){this.selArea.show();this.drawArea();this.endCrop();}
this.attached=true;},remove:function(){if(this.attached){this.attached=false;this.imgWrap.parentNode.insertBefore(this.img,this.imgWrap);this.imgWrap.parentNode.removeChild(this.imgWrap);Event.stopObserving(this.dragArea,"mousedown",this.startDragBind);Event.stopObserving(document,"mousemove",this.onDragBind);Event.stopObserving(document,"mouseup",this.endCropBind);this.registerHandles(false);if(this.options.captureKeys){Event.stopObserving(document,"keypress",this.keysBind);}}},reset:function(){if(!this.attached){this.onLoad();}else{this.setParams();}
this.endCrop();},handleKeys:function(e){var dir={x:0,y:0};if(!this.dragging){switch(e.keyCode){case(37):dir.x=-1;break;case(38):dir.y=-1;break;case(39):dir.x=1;break;case(40):dir.y=1;break;}
if(dir.x!=0||dir.y!=0){if(e.shiftKey){dir.x*=10;dir.y*=10;}
this.moveArea([this.areaCoords.x1+dir.x,this.areaCoords.y1+dir.y]);Event.stop(e);}}},calcW:function(){return(this.areaCoords.x2-this.areaCoords.x1);},calcH:function(){return(this.areaCoords.y2-this.areaCoords.y1);},moveArea:function(_1e){this.setAreaCoords({x1:_1e[0],y1:_1e[1],x2:_1e[0]+this.calcW(),y2:_1e[1]+this.calcH()},true,false);this.drawArea();},cloneCoords:function(_1f){return{x1:_1f.x1,y1:_1f.y1,x2:_1f.x2,y2:_1f.y2};},setAreaCoords:function(_20,_21,_22,_23,_24){if(_21){var _25=_20.x2-_20.x1;var _26=_20.y2-_20.y1;if(_20.x1<0){_20.x1=0;_20.x2=_25;}
if(_20.y1<0){_20.y1=0;_20.y2=_26;}
if(_20.x2>this.imgW){_20.x2=this.imgW;_20.x1=this.imgW-_25;}
if(_20.y2>this.imgH){_20.y2=this.imgH;_20.y1=this.imgH-_26;}}else{if(_20.x1<0){_20.x1=0;}
if(_20.y1<0){_20.y1=0;}
if(_20.x2>this.imgW){_20.x2=this.imgW;}
if(_20.y2>this.imgH){_20.y2=this.imgH;}
if(_23!=null){if(this.ratioX>0){this.applyRatio(_20,{x:this.ratioX,y:this.ratioY},_23,_24);}else{if(_22){this.applyRatio(_20,{x:1,y:1},_23,_24);}}
var _27=[this.options.minWidth,this.options.minHeight];var _28=[this.options.maxWidth,this.options.maxHeight];if(_27[0]>0||_27[1]>0||_28[0]>0||_28[1]>0){var _29={a1:_20.x1,a2:_20.x2};var _2a={a1:_20.y1,a2:_20.y2};var _2b={min:0,max:this.imgW};var _2c={min:0,max:this.imgH};if((_27[0]!=0||_27[1]!=0)&&_22){if(_27[0]>0){_27[1]=_27[0];}else{if(_27[1]>0){_27[0]=_27[1];}}}
if((_28[0]!=0||_28[0]!=0)&&_22){if(_28[0]>0&&_28[0]<=_28[1]){_28[1]=_28[0];}else{if(_28[1]>0&&_28[1]<=_28[0]){_28[0]=_28[1];}}}
if(_27[0]>0){this.applyDimRestriction(_29,_27[0],_23.x,_2b,"min");}
if(_27[1]>1){this.applyDimRestriction(_2a,_27[1],_23.y,_2c,"min");}
if(_28[0]>0){this.applyDimRestriction(_29,_28[0],_23.x,_2b,"max");}
if(_28[1]>1){this.applyDimRestriction(_2a,_28[1],_23.y,_2c,"max");}
_20={x1:_29.a1,y1:_2a.a1,x2:_29.a2,y2:_2a.a2};}}}
this.areaCoords=_20;},applyDimRestriction:function(_2d,val,_2f,_30,_31){var _32;if(_31=="min"){_32=((_2d.a2-_2d.a1)<val);}else{_32=((_2d.a2-_2d.a1)>val);}
if(_32){if(_2f==1){_2d.a2=_2d.a1+val;}else{_2d.a1=_2d.a2-val;}
if(_2d.a1<_30.min){_2d.a1=_30.min;_2d.a2=val;}else{if(_2d.a2>_30.max){_2d.a1=_30.max-val;_2d.a2=_30.max;}}}},applyRatio:function(_33,_34,_35,_36){var _37;if(_36=="N"||_36=="S"){_37=this.applyRatioToAxis({a1:_33.y1,b1:_33.x1,a2:_33.y2,b2:_33.x2},{a:_34.y,b:_34.x},{a:_35.y,b:_35.x},{min:0,max:this.imgW});_33.x1=_37.b1;_33.y1=_37.a1;_33.x2=_37.b2;_33.y2=_37.a2;}else{_37=this.applyRatioToAxis({a1:_33.x1,b1:_33.y1,a2:_33.x2,b2:_33.y2},{a:_34.x,b:_34.y},{a:_35.x,b:_35.y},{min:0,max:this.imgH});_33.x1=_37.a1;_33.y1=_37.b1;_33.x2=_37.a2;_33.y2=_37.b2;}},applyRatioToAxis:function(_38,_39,_3a,_3b){var _3c=Object.extend(_38,{});var _3d=_3c.a2-_3c.a1;var _3e=Math.floor(_3d*_39.b/_39.a);var _3f;var _40;var _41=null;if(_3a.b==1){_3f=_3c.b1+_3e;if(_3f>_3b.max){_3f=_3b.max;_41=_3f-_3c.b1;}
_3c.b2=_3f;}else{_3f=_3c.b2-_3e;if(_3f<_3b.min){_3f=_3b.min;_41=_3f+_3c.b2;}
_3c.b1=_3f;}
if(_41!=null){_40=Math.floor(_41*_39.a/_39.b);if(_3a.a==1){_3c.a2=_3c.a1+_40;}else{_3c.a1=_3c.a1=_3c.a2-_40;}}
return _3c;},drawArea:function(){var _42=this.calcW();var _43=this.calcH();var px="px";var _45=[this.areaCoords.x1+px,this.areaCoords.y1+px,_42+px,_43+px,this.areaCoords.x2+px,this.areaCoords.y2+px,(this.img.width-this.areaCoords.x2)+px,(this.img.height-this.areaCoords.y2)+px];var _46=this.selArea.style;_46.left=_45[0];_46.top=_45[1];_46.width=_45[2];_46.height=_45[3];var _47=Math.ceil((_42-6)/2)+px;var _48=Math.ceil((_43-6)/2)+px;this.handleN.style.left=_47;this.handleE.style.top=_48;this.handleS.style.left=_47;this.handleW.style.top=_48;this.north.style.height=_45[1];var _49=this.east.style;_49.top=_45[1];_49.height=_45[3];_49.left=_45[4];_49.width=_45[6];var _4a=this.south.style;_4a.top=_45[5];_4a.height=_45[7];var _4b=this.west.style;_4b.top=_45[1];_4b.height=_45[3];_4b.width=_45[0];this.subDrawArea();this.forceReRender();},forceReRender:function(){if(this.isIE||this.isWebKit){var n=document.createTextNode(" ");var d,el,fixEL,i;if(this.isIE){fixEl=this.selArea;}else{if(this.isWebKit){fixEl=document.getElementsByClassName("imgCrop_marqueeSouth",this.imgWrap)[0];d=Builder.node("div","");d.style.visibility="hidden";var _4e=["SE","S","SW"];for(i=0;i<_4e.length;i++){el=document.getElementsByClassName("imgCrop_handle"+_4e[i],this.selArea)[0];if(el.childNodes.length){el.removeChild(el.childNodes[0]);}
el.appendChild(d);}}}
fixEl.appendChild(n);fixEl.removeChild(n);}},startResize:function(e){this.startCoords=this.cloneCoords(this.areaCoords);this.resizing=true;this.resizeHandle=Event.element(e).classNames().toString().replace(/([^N|NE|E|SE|S|SW|W|NW])+/,"");Event.stop(e);},startDrag:function(e){this.selArea.show();this.clickCoords=this.getCurPos(e);this.setAreaCoords({x1:this.clickCoords.x,y1:this.clickCoords.y,x2:this.clickCoords.x,y2:this.clickCoords.y},false,false,null);this.dragging=true;this.onDrag(e);Event.stop(e);},getCurPos:function(e){var el=this.imgWrap,wrapOffsets=Position.cumulativeOffset(el);while(el.nodeName!="BODY"){wrapOffsets[1]-=el.scrollTop||0;wrapOffsets[0]-=el.scrollLeft||0;el=el.parentNode;}
return curPos={x:Event.pointerX(e)-wrapOffsets[0],y:Event.pointerY(e)-wrapOffsets[1]};},onDrag:function(e){if(this.dragging||this.resizing){var _54=null;var _55=this.getCurPos(e);var _56=this.cloneCoords(this.areaCoords);var _57={x:1,y:1};if(this.dragging){if(_55.x<this.clickCoords.x){_57.x=-1;}
if(_55.y<this.clickCoords.y){_57.y=-1;}
this.transformCoords(_55.x,this.clickCoords.x,_56,"x");this.transformCoords(_55.y,this.clickCoords.y,_56,"y");}else{if(this.resizing){_54=this.resizeHandle;if(_54.match(/E/)){this.transformCoords(_55.x,this.startCoords.x1,_56,"x");if(_55.x<this.startCoords.x1){_57.x=-1;}}else{if(_54.match(/W/)){this.transformCoords(_55.x,this.startCoords.x2,_56,"x");if(_55.x<this.startCoords.x2){_57.x=-1;}}}
if(_54.match(/N/)){this.transformCoords(_55.y,this.startCoords.y2,_56,"y");if(_55.y<this.startCoords.y2){_57.y=-1;}}else{if(_54.match(/S/)){this.transformCoords(_55.y,this.startCoords.y1,_56,"y");if(_55.y<this.startCoords.y1){_57.y=-1;}}}}}
this.setAreaCoords(_56,false,e.shiftKey,_57,_54);this.drawArea();Event.stop(e);}},transformCoords:function(_58,_59,_5a,_5b){var _5c=[_58,_59];if(_58>_59){_5c.reverse();}
_5a[_5b+"1"]=_5c[0];_5a[_5b+"2"]=_5c[1];},endCrop:function(){this.dragging=false;this.resizing=false;this.options.onEndCrop(this.areaCoords,{width:this.calcW(),height:this.calcH()});},subInitialize:function(){},subDrawArea:function(){}};Cropper.ImgWithPreview=Class.create();Object.extend(Object.extend(Cropper.ImgWithPreview.prototype,Cropper.Img.prototype),{subInitialize:function(){this.hasPreviewImg=false;if(typeof(this.options.previewWrap)!="undefined"&&this.options.minWidth>0&&this.options.minHeight>0){this.previewWrap=$(this.options.previewWrap);this.previewImg=this.img.cloneNode(false);this.previewImg.id="imgCrop_"+this.previewImg.id;this.options.displayOnInit=true;this.hasPreviewImg=true;this.previewWrap.addClassName("imgCrop_previewWrap");this.previewWrap.setStyle({width:this.options.minWidth+"px",height:this.options.minHeight+"px"});this.previewWrap.appendChild(this.previewImg);}},subDrawArea:function(){if(this.hasPreviewImg){var _5d=this.calcW();var _5e=this.calcH();var _5f={x:this.imgW/_5d,y:this.imgH/_5e};var _60={x:_5d/this.options.minWidth,y:_5e/this.options.minHeight};var _61={w:Math.ceil(this.options.minWidth*_5f.x)+"px",h:Math.ceil(this.options.minHeight*_5f.y)+"px",x:"-"+Math.ceil(this.areaCoords.x1/_60.x)+"px",y:"-"+Math.ceil(this.areaCoords.y1/_60.y)+"px"};var _62=this.previewImg.style;_62.width=_61.w;_62.height=_61.h;_62.left=_61.x;_62.top=_61.y;}}});
var CheckboxPlus=Class.create();Object.extend(CheckboxPlus,{applyCheckboxBehaviors:function(){$$('.cbp-container').each(function(el){el.cb=el.down('input.checkbox');el.cb.container=el;if(el.cb){Event.observe(el,"click",CheckboxPlus.containerSelect);Event.observe(el.cb,"click",CheckboxPlus.checkboxSelect);}
el.removeClassName('cbp-container');});},containerSelect:function(ev){cb=$(this).cb;if(!cb.disabled)cb.checked=!cb.checked;if(cb.checked)
$(this).addClassName('selected');else
$(this).removeClassName('selected');},checkboxSelect:function(ev){if(!ev)var ev=window.event;ev.cancelBubble=true;if(ev.stopPropagation)ev.stopPropagation();container=$(this).container;if($(this).disabled)return;if($(this).checked)
container.addClassName('selected');else
container.removeClassName('selected');}});
var SocialFeed=Class.create();Object.extend(SocialFeed,{facebook_api_key:null,facebook_channel_path:'/friends/facebook/xd_receiver.htm',facebook_template_bundle_id:{watch:null,subscribe:null,review_show:null,review_video:null,topic_show:null,topic_video:null},facebook_template_data:{watch:null,subscribe:null,review:null,topic:null},facebookInit:function(){FB.Bootstrap.requireFeatures(["Connect"],function()
{FB.Facebook.init(SocialFeed.facebook_api_key,SocialFeed.facebook_channel_path);});},loggedOut:function(){try{SocialFeed.facebookInit();FB.ensureInit(function(){FB.Connect.logout();});}
catch(e){}},publishFacebook:function(template_id,template_data){try{SocialFeed.facebookInit();FB.ensureInit(function(){FB.Connect.get_status().waitUntilReady(function(status){if(status==FB.ConnectState.connected){if($('player-container'))$('player-container').style.visibility='hidden';Behaviors.cufonDisabled=true;FB.Connect.showFeedDialog(template_id,template_data,null,null,null,FB.RequireConnect.require,SocialFeed.publishComplete);}});});}
catch(e){SocialFeed.publishComplete();}},publishWatchComplete:function(){return;},publishReview:function(type){if(SocialFeed.facebook_template_data.review){if(type=="Video")
bundle_id=SocialFeed.facebook_template_bundle_id.review_video;else if(type=="Show")
bundle_id=SocialFeed.facebook_template_bundle_id.review_show;else
return;SocialFeed.publishFacebook(bundle_id,SocialFeed.facebook_template_data.review);}},publishTopic:function(type){if(SocialFeed.facebook_template_data.topic){if(type=="Video")
bundle_id=SocialFeed.facebook_template_bundle_id.topic_video;else if(type=="Show")
bundle_id=SocialFeed.facebook_template_bundle_id.topic_show;else
return;SocialFeed.publishFacebook(bundle_id,SocialFeed.facebook_template_data.topic);}},publishSubscribe:function(){if(SocialFeed.facebook_template_data.subscribe)
SocialFeed.publishFacebook(SocialFeed.facebook_template_bundle_id.subscribe,SocialFeed.facebook_template_data.subscribe);},publishComplete:function(){if($('player-container'))$('player-container').style.visibility='';Behaviors.cufonDisabled=false;}});
function _ABCFEP(){var aff='';var partner='hulu';var newWindow=function(C,J,D,A,H){var I=D||1000;var G=A||675;var E=H||0;var F=null;if((typeof(screen.availHeight)!="undefined"&&screen.availHeight<G+49)||(typeof(screen.availWidth)!="undefined"&&screen.availWidth<I+10)){E=1}var B="height="+G+",width="+I+",toolbar=0,scrollbars="+E+",location=0,statusbar=0,menubar=0,resizable=0,top=0,left=0";if(C){F=window.open(C,J,B)}return F}
var feppop=function(show,video){burl='http://dynamic.abc.go.com/fep/player';burl+='?aff='+aff;burl+='&partner='+partner;if(show!=null)burl+=('&show='+show);if(video!=null)burl+=('&episode='+video);rr=newWindow(burl,'player_window',1000,675,0);if(rr!=null&&typeof(rr)!="undefined"){try{rr.focus();}catch(e){}}else{alert('Oops - your browser may be blocking this pop-up. Please disable your pop-up blocker before continuing.');};return rr;}
this.openFEP=function(guid){var ids;if(guid){ids=guid.split('-');}else{ids='-';}
if(ids.length==2){result=feppop(ids[0],ids[1]);}else{result=feppop('','');}}}
ABCFEP=new _ABCFEP();function openABC_g(guid){ABCFEP.openFEP(guid)}
function openABC(channel,video){var popupWidth=1000;var popupHeight=675;var ifScrollBar=0;if((typeof(screen.availHeight)!="undefined"&&screen.availHeight<popupHeight+49)||(typeof(screen.availWidth)!="undefined"&&screen.availWidth<popupWidth+10)){ifScrollBar=1;}
var popupParams="height="+popupHeight+",width="+popupWidth+",toolbar=0,scrollbars="+ifScrollBar+",location=0,statusbar=0,menubar=0,resizable=0,top=0,left=0";var trackRedirect="http://transfer.go.com/cgi/transfer.dll?name=REMOTEPLAYERJS_PARTNER_HULU&srvc=abc&goto=";trackRedirect=trackRedirect+"http://dynamic.abc.go.com/streaming/player&rEnable=0&pl=mv&mk=20171845&channel="+channel+"&video="+video+"&raff=&partner=hulu&hostname="+document.location.hostname;var win=window.open(trackRedirect,'abcfesplayer_window',popupParams);if(win==null||typeof(win)=="undefined"){alert("Oops - your browser may be blocking this pop-up. Please disable your pop-up blocker before continuing.");}}
var FilterCache=Class.create();Object.extend(FilterCache.prototype,{cacheItems:{},get:function(key){return this.cacheItems[key];},set:function(key,value){this.cacheItems[key]=value;},remove:function(key){this.cacheItems[key]=null;},removeAll:function(){this.cacheItems={};},revertContent:function(){$H(this.cacheItems).each(function(pair){if($(pair.key)&&pair.value){if(pair.value[1]!=0){$(pair.key).innerHTML=pair.value[0];var select=$(pair.key).down("select");select.selectedIndex=pair.value[1];}}})}})
var mainFilterCache=new FilterCache();function mainSerpFilter(id,url,key,value){var element;var selectedIndex=0;var innerHTML="";if(id){if(id.startsWith("lazy_change")){element=$(id);selectedIndex=element.down("select").selectedIndex;innerHTML=element.innerHTML;mainFilterCache.removeAll();mainFilterCache.set(id,[innerHTML,selectedIndex]);}}
$("search-ajax-loading-icon").show();new Ajax.Request(url+"&ajax_call=1&"+encodeURIComponent(key)+"="+encodeURIComponent(value),{method:'get',onSuccess:function(transport){$("search-ajax-loading-icon").hide();}});}
function changeShowPage(element,params){var ajaxRequestUrl="search/get_promo_collections";var source_id=params.source_id;var source_type=params.source_type;var id=source_type+source_id;var url=[ajaxRequestUrl,$H(params).toSortedQueryString()].join('?');SearchTracking.send(null,null,null,null,'promo-panel',null,null,'tab');new Ajax.Request(url,{method:'get',onComplete:function(){Element.extend(element);for(var i=0;i<element.up().childElements().size();i++){var ele=element.up().childElements()[i];if(ele.hasClassName("selected"))
ele.removeClassName("selected");}
element.addClassName("selected");var element_to_display=$(id);for(var i=0;i<element_to_display.up().childElements().size();i++){var ele=element_to_display.up().childElements()[i];ele.hide();}
element_to_display.show();}});return false;}
function letMeKnow(item,missed_show){if(!Behaviors.isLoggedIn()){FloatingLoginForm.show(item);return false;}
var self=this;new Ajax.Request('/users/register_for_missed_show?missed_show='+missed_show,{asynchronous:true,evalScripts:true,onSuccess:function(request){$("register_info").hide();$("registered_info").show();}});return false;}
function letHuluKnowAboutMissedShow(el){var menu=$('let_hulu_know_panel');if(menu&&el){var xy=Position.page(el);menu.style.top=xy[1]+el.getHeight()+'px';menu.style.left=xy[0]+'px';menu.show();var form=menu.down('form');if(form)Form.reset(form);if(Behaviors.isLoggedIn()){new Ajax.Request('/users/info_with_id?id='+Behaviors.getUserId(),{asynchronous:true,method:"get",onComplete:function(request){info=request.responseText.evalJSON();$("useremail").value=info.email;}})}}
return false;}
function letHuluKnowAboutMissedShowSubmit(missed_show){var menu=$('let_hulu_know_panel');if(!menu)return;var form=menu.down('form');if(!form)return;new Ajax.Request('/search/add_info_for_missed_show?missed_show='+missed_show,{asynchronous:true,evalScripts:true,parameters:Form.serialize(form,true),onComplete:function(request){menu.hide();$("notified_info").show();$("notify_info").hide();}});}
var embedFilterCache=new FilterCache();function embedSerpFilter(id,url,key,value){var element;var selectedIndex=0;var innerHTML=""
if(id){if(id.startsWith("lazy_change")){element=$(id);selectedIndex=element.down("select").selectedIndex;innerHTML=element.innerHTML;embedFilterCache.removeAll();embedFilterCache.set(id,[innerHTML,selectedIndex]);}}
new Ajax.Request(url+"&"+encodeURIComponent(key)+"="+encodeURIComponent(value),{method:'get',onSuccess:function(transport){showSearchPopup();}});}
function searchInChannel(){if($F($('channel_search_form')['query']).blank())return false;$('channel_search_form').request({method:'get',onComplete:function(){showSearchPopup();}});return false;}
function SearchAjaxCall(url){new Ajax.Request(url,{method:'get',onSuccess:function(transport){showSearchPopup();}});}
function showRelatedTerms(){$('popular-terms').hide();$('channel_search_form').replaceChild($('new-related-terms'),$('related-terms'));$('new-related-terms').id='related-terms';$('related-terms').show();}
function hideRelatedTerms(){$('related-terms').hide();$('popular-terms').show();}
function showSearchPopup(){if(!lights.isOff&&!lights.working){$('search-bar').style.zIndex=250;if(Prototype.Browser.IE6)
$$('div.channels-top select, div#trailers select').each(function(el){el.style.visibility='hidden';});$('search-result').style.top=$('search-bar').positionedOffset().top+$('search-bar').getHeight()+"px";$('search-result').show();$('popup-close-button').show();lights.off(0.7);}}
function hideSearchPopup(){if(lights.isOff&&!lights.working&&$('search-result')&&$('search-result').visible()){if(Prototype.Browser.IE6)
$$('div.channels-top select, div#trailers select').each(function(el){el.style.visibility='visible';});$('search-result').hide();$('popup-close-button').hide();hideRelatedTerms();lights.on();}}
var Comscore={parameters:{c1:null,c2:null,c3:null,c4:null,c5:null,c6:null,c7:function(){return document.location.href;},c8:function(){return document.title;},c9:function(){return document.referrer},c10:function(){return[screen.width,screen.height].join('x');},c15:null,rn:function(){return(new Date).getTime();}},baseURL:'',update:function(dict){if(dict['baseURL']){Comscore.baseURL=dict['baseURL'];delete dict['baseURL'];}
Comscore.parameters=Object.extend(Comscore.parameters,dict);},track:function(){var url=Comscore.baseURL;if(/^https:/.test(document.location.href))
url=url.replace(/^http/,'https');var qs=[];$H(Comscore.parameters).keys().each(function(k){var v=Comscore.parameters[k];if(typeof(v)=='function')
v=v.call();if(v==null)
v='';qs.push([k,encodeURIComponent(v)].join('='));});url=[url,qs.join('&')].join('?');pingImage(url);}};
if(typeof Prototype=='undefined')alert("CalendarDateSelect Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (.g. <%= javascript_include_tag :defaults %>) *before* it includes calendar_date_select.js (.g. <%= calendar_date_select_includes %>).");if(Prototype.Version<"1.6")alert("Prototype 1.6.0 is required.  If using earlier version of prototype, please use calendar_date_select version 1.8.3");Element.addMethods({purgeChildren:function(element){$A(element.childNodes).each(function(e){$(e).remove();});},build:function(element,type,options,style){var newElement=Element.buildAndAppend(type,options,style);element.appendChild(newElement);return newElement;}});Element.buildAndAppend=function(type,options,style)
{var e=$(document.createElement(type));$H(options).each(function(pair){e[pair.key]=pair.value});if(style)e.setStyle(style);return e;};nil=null;Date.one_day=24*60*60*1000;Date.weekdays=$w("S M T W T F S");Date.first_day_of_week=0;Date.months=$w("January February March April May June July August September October November December");Date.monthsNumber=$w("1 2 3 4 5 6 7 8 9 10 11 12");Date.padded2=function(hour){var padded2=parseInt(hour,10);if(hour<10)padded2="0"+padded2;return padded2;}
Date.prototype.getPaddedMinutes=function(){return Date.padded2(this.getMinutes());}
Date.prototype.getAMPMHour=function(){var hour=this.getHours();return(hour==0)?12:(hour>12?hour-12:hour)}
Date.prototype.getAMPM=function(){return(this.getHours()<12)?"AM":"PM";}
Date.prototype.stripTime=function(){return new Date(this.getFullYear(),this.getMonth(),this.getDate());};Date.prototype.daysDistance=function(compare_date){return Math.round((compare_date-this)/Date.one_day);};Date.prototype.toFormattedString=function(include_time){var hour,str;str=Date.monthsNumber[this.getMonth()]+"/"+this.getDate()+"/"+this.getFullYear();if(include_time){hour=this.getHours();str+=" "+this.getAMPMHour()+":"+this.getPaddedMinutes()+" "+this.getAMPM()}
return str;}
Date.parseFormattedString=function(string){return new Date(string);}
Math.floor_to_interval=function(n,i){return Math.floor(n/i)*i;}
window.f_height=function(){return([window.innerHeight?window.innerHeight:null,document.documentElement?document.documentElement.clientHeight:null,document.body?document.body.clientHeight:null].select(function(x){return x>0}).first()||0);}
window.f_scrollTop=function(){return([window.pageYOffset?window.pageYOffset:null,document.documentElement?document.documentElement.scrollTop:null,document.body?document.body.scrollTop:null].select(function(x){return x>0}).first()||0);}
_translations={"OK":"OK","Now":"Now","Today":"Today","Clear":"Clear"}
SelectBox=Class.create();SelectBox.prototype={initialize:function(parent_element,values,html_options,style_options){this.element=$(parent_element).build("select",html_options,style_options);this.populate(values);},populate:function(values){this.element.purgeChildren();var that=this;$A(values).each(function(pair){if(typeof(pair)!="object"){pair=[pair,pair]};that.element.build("option",{value:pair[1],innerHTML:pair[0]})});},setValue:function(value){var e=this.element;var matched=false;$R(0,e.options.length-1).each(function(i){if(e.options[i].value==value.toString()){e.selectedIndex=i;matched=true;};});return matched;},getValue:function(){return $F(this.element)}}
CalendarDateSelect=Class.create();CalendarDateSelect.prototype={initialize:function(target_element,options){this.target_element=$(target_element);if(!this.target_element){alert("Target element "+target_element+" not found!");return false;}
if(this.target_element.tagName!="INPUT")this.target_element=this.target_element.down("INPUT")
this.target_element.calendar_date_select=this;this.last_click_at=0;this.options=$H({embedded:false,popup:nil,time:false,buttons:true,clear_button:true,year_range:10,close_on_click:nil,minute_interval:5,popup_by:this.target_element,month_year:"dropdowns",onchange:this.target_element.onchange,valid_date_check:nil}).merge(options||{});this.use_time=this.options.get("time");this.parseDate();this.callback("before_show")
this.initCalendarDiv();if(!this.options.get("embedded")){this.positionCalendarDiv()
Event.observe(document,"mousedown",this.closeIfClickedOut_handler=this.closeIfClickedOut.bindAsEventListener(this));Event.observe(document,"keypress",this.keyPress_handler=this.keyPress.bindAsEventListener(this));}
this.callback("after_show")},positionCalendarDiv:function(){var above=false;var c_pos=this.calendar_div.cumulativeOffset(),c_left=c_pos[0],c_top=c_pos[1],c_dim=this.calendar_div.getDimensions(),c_height=c_dim.height,c_width=c_dim.width;var w_top=window.f_scrollTop(),w_height=window.f_height();var e_dim=$(this.options.get("popup_by")).cumulativeOffset(),e_top=e_dim[1],e_left=e_dim[0],e_height=$(this.options.get("popup_by")).getDimensions().height,e_bottom=e_top+e_height;if(((e_bottom+c_height)>(w_top+w_height))&&(e_bottom-c_height>w_top))above=true;var left_px=e_left.toString()+"px",top_px=(above?(e_top-c_height):(e_top+e_height)).toString()+"px";this.calendar_div.style.left=left_px;this.calendar_div.style.top=top_px;this.calendar_div.setStyle({visibility:""});if(navigator.appName=="Microsoft Internet Explorer")this.iframe=$(document.body).build("iframe",{src:"javascript:false",className:"ie6_blocker"},{left:left_px,top:top_px,height:c_height.toString()+"px",width:c_width.toString()+"px",border:"0px"})},initCalendarDiv:function(){if(this.options.get("embedded")){var parent=this.target_element.parentNode;var style={}}else{var parent=document.body
var style={position:"absolute",visibility:"hidden",left:0,top:0}}
this.calendar_div=$(parent).build('div',{className:"calendar_date_select"},style);var that=this;$w("top header body buttons footer bottom").each(function(name){eval("var "+name+"_div = that."+name+"_div = that.calendar_div.build('div', { className: 'cds_"+name+"' }, { clear: 'left'} ); ");});this.initHeaderDiv();this.initButtonsDiv();this.initCalendarGrid();this.updateFooter("&#160;");this.refresh();this.setUseTime(this.use_time);},initHeaderDiv:function(){var header_div=this.header_div;this.close_button=header_div.build("a",{innerHTML:"x",href:"#",onclick:function(){this.close();return false;}.bindAsEventListener(this),className:"close"});this.next_month_button=header_div.build("a",{innerHTML:"&gt;",href:"#",onclick:function(){this.navMonth(this.date.getMonth()+1);return false;}.bindAsEventListener(this),className:"next"});this.prev_month_button=header_div.build("a",{innerHTML:"&lt;",href:"#",onclick:function(){this.navMonth(this.date.getMonth()-1);return false;}.bindAsEventListener(this),className:"prev"});if(this.options.get("month_year")=="dropdowns"){this.month_select=new SelectBox(header_div,$R(0,11).map(function(m){return[Date.months[m],m]}),{className:"month",onchange:function(){this.navMonth(this.month_select.getValue())}.bindAsEventListener(this)});this.year_select=new SelectBox(header_div,[],{className:"year",onchange:function(){this.navYear(this.year_select.getValue())}.bindAsEventListener(this)});this.populateYearRange();}else{this.month_year_label=header_div.build("span")}},initCalendarGrid:function(){var body_div=this.body_div;this.calendar_day_grid=[];var days_table=body_div.build("table",{cellPadding:"0px",cellSpacing:"0px",width:"100%"})
var weekdays_row=days_table.build("thead").build("tr");Date.weekdays.each(function(weekday){weekdays_row.build("th",{innerHTML:weekday});});var days_tbody=days_table.build("tbody")
var row_number=0,weekday;for(var cell_index=0;cell_index<42;cell_index++)
{weekday=(cell_index+Date.first_day_of_week)%7;if(cell_index%7==0)days_row=days_tbody.build("tr",{className:'row_'+row_number++});(this.calendar_day_grid[cell_index]=days_row.build("td",{calendar_date_select:this,onmouseover:function(){this.calendar_date_select.dayHover(this);},onmouseout:function(){this.calendar_date_select.dayHoverOut(this)},onclick:function(){this.calendar_date_select.updateSelectedDate(this,true);},className:(weekday==0)||(weekday==6)?" weekend":""},{cursor:"pointer"})).build("div");this.calendar_day_grid[cell_index];}},initButtonsDiv:function()
{var buttons_div=this.buttons_div;if(this.options.get("time"))
{var blank_time=$A(this.options.get("time")=="mixed"?[[" - ",""]]:[]);buttons_div.build("span",{innerHTML:"@",className:"at_sign"});var t=new Date();this.hour_select=new SelectBox(buttons_div,blank_time.concat($R(0,23).map(function(x){t.setHours(x);return $A([t.getAMPMHour()+" "+t.getAMPM(),x])})),{calendar_date_select:this,onchange:function(){this.calendar_date_select.updateSelectedDate({hour:this.value});},className:"hour"});buttons_div.build("span",{innerHTML:":",className:"seperator"});var that=this;this.minute_select=new SelectBox(buttons_div,blank_time.concat($R(0,59).select(function(x){return(x%that.options.get('minute_interval')==0)}).map(function(x){return $A([Date.padded2(x),x]);})),{calendar_date_select:this,onchange:function(){this.calendar_date_select.updateSelectedDate({minute:this.value})},className:"minute"});}else if(!this.options.get("buttons"))buttons_div.remove();if(this.options.get("buttons")){buttons_div.build("span",{innerHTML:"&#160;"});if(this.options.get("time")=="mixed"||!this.options.get("time"))b=buttons_div.build("a",{innerHTML:_translations["Today"],href:"#",onclick:function(){this.today(false);return false;}.bindAsEventListener(this)});if(this.options.get("time")=="mixed")buttons_div.build("span",{innerHTML:"&#160;|&#160;",className:"button_seperator"})
if(this.options.get("time"))b=buttons_div.build("a",{innerHTML:_translations["Now"],href:"#",onclick:function(){this.today(true);return false}.bindAsEventListener(this)});if(!this.options.get("embedded")&&!this.closeOnClick())
{buttons_div.build("span",{innerHTML:"&#160;|&#160;",className:"button_seperator"})
buttons_div.build("a",{innerHTML:_translations["OK"],href:"#",onclick:function(){this.close();return false;}.bindAsEventListener(this)});}
if(this.options.get('clear_button')){buttons_div.build("span",{innerHTML:"&#160;|&#160;",className:"button_seperator"})
buttons_div.build("a",{innerHTML:_translations["Clear"],href:"#",onclick:function(){this.clearDate();if(!this.options.get("embedded"))this.close();return false;}.bindAsEventListener(this)});}}},refresh:function()
{this.refreshMonthYear();this.refreshCalendarGrid();this.setSelectedClass();this.updateFooter();},refreshCalendarGrid:function(){this.beginning_date=new Date(this.date).stripTime();this.beginning_date.setDate(1);this.beginning_date.setHours(12);var pre_days=this.beginning_date.getDay()
if(pre_days<3)pre_days+=7;this.beginning_date.setDate(1-pre_days+Date.first_day_of_week);var iterator=new Date(this.beginning_date);var today=new Date().stripTime();var this_month=this.date.getMonth();vdc=this.options.get("valid_date_check");for(var cell_index=0;cell_index<42;cell_index++)
{day=iterator.getDate();month=iterator.getMonth();cell=this.calendar_day_grid[cell_index];Element.remove(cell.childNodes[0]);div=cell.build("div",{innerHTML:day});if(month!=this_month)div.className="other";cell.day=day;cell.month=month;cell.year=iterator.getFullYear();if(vdc){if(vdc(iterator.stripTime()))cell.removeClassName("disabled");else cell.addClassName("disabled")};iterator.setDate(day+1);}
if(this.today_cell)this.today_cell.removeClassName("today");if($R(0,41).include(days_until=this.beginning_date.stripTime().daysDistance(today))){this.today_cell=this.calendar_day_grid[days_until];this.today_cell.addClassName("today");}},refreshMonthYear:function(){var m=this.date.getMonth();var y=this.date.getFullYear();if(this.options.get("month_year")=="dropdowns")
{this.month_select.setValue(m,false);var e=this.year_select.element;if(this.flexibleYearRange()&&(!(this.year_select.setValue(y,false))||e.selectedIndex<=1||e.selectedIndex>=e.options.length-2))this.populateYearRange();this.year_select.setValue(y);}else{this.month_year_label.update(Date.months[m]+" "+y.toString());}},populateYearRange:function(){this.year_select.populate(this.yearRange().toArray());},yearRange:function(){if(!this.flexibleYearRange())
return $R(this.options.get("year_range")[0],this.options.get("year_range")[1]);var y=this.date.getFullYear();return $R(y-this.options.get("year_range"),y+this.options.get("year_range"));},flexibleYearRange:function(){return(typeof(this.options.get("year_range"))=="number");},validYear:function(year){if(this.flexibleYearRange()){return true;}else{return this.yearRange().include(year);}},dayHover:function(element){var hover_date=new Date(this.selected_date);hover_date.setYear(element.year);hover_date.setMonth(element.month);hover_date.setDate(element.day);this.updateFooter(hover_date.toFormattedString(this.use_time));},dayHoverOut:function(element){this.updateFooter();},clearSelectedClass:function(){if(this.selected_cell)this.selected_cell.removeClassName("selected");},setSelectedClass:function(){if(!this.selection_made)return;this.clearSelectedClass()
if($R(0,42).include(days_until=this.beginning_date.stripTime().daysDistance(this.selected_date.stripTime()))){this.selected_cell=this.calendar_day_grid[days_until];this.selected_cell.addClassName("selected");}},reparse:function(){this.parseDate();this.refresh();},dateString:function(){return(this.selection_made)?this.selected_date.toFormattedString(this.use_time):"&#160;";},parseDate:function()
{var value=$F(this.target_element).strip()
this.selection_made=(value!="");this.date=value==""?NaN:Date.parseFormattedString(this.options.get("date")||value);if(isNaN(this.date))this.date=new Date();if(!this.validYear(this.date.getFullYear()))this.date.setYear((this.date.getFullYear()<this.yearRange().start)?this.yearRange().start:this.yearRange().end);this.selected_date=new Date(this.date);this.use_time=/[0-9]:[0-9]{2}/.exec(value)?true:false;this.date.setDate(1);},updateFooter:function(text){if(!text)text=this.dateString();this.footer_div.purgeChildren();this.footer_div.build("span",{innerHTML:text});},clearDate:function(){if((this.target_element.disabled||this.target_element.readOnly)&&this.options.get("popup")!="force")return false;var last_value=this.target_element.value;this.target_element.value="";this.clearSelectedClass();this.updateFooter('&#160;');if(last_value!=this.target_element.value)this.callback("onchange");},updateSelectedDate:function(partsOrElement,via_click){var parts=$H(partsOrElement);if((this.target_element.disabled||this.target_element.readOnly)&&this.options.get("popup")!="force")return false;if(parts.get("day")){var t_selected_date=this.selected_date,vdc=this.options.get("valid_date_check");for(var x=0;x<=3;x++)t_selected_date.setDate(parts.get("day"));t_selected_date.setYear(parts.get("year"));t_selected_date.setMonth(parts.get("month"));if(vdc&&!vdc(t_selected_date.stripTime())){return false;}
this.selected_date=t_selected_date;this.selection_made=true;}
if(!isNaN(parts.get("hour")))this.selected_date.setHours(parts.get("hour"));if(!isNaN(parts.get("minute")))this.selected_date.setMinutes(Math.floor_to_interval(parts.get("minute"),this.options.get("minute_interval")));if(parts.get("hour")===""||parts.get("minute")==="")
this.setUseTime(false);else if(!isNaN(parts.get("hour"))||!isNaN(parts.get("minute")))
this.setUseTime(true);this.updateFooter();this.setSelectedClass();if(this.selection_made)this.updateValue();if(this.closeOnClick()){this.close();}
if(via_click&&!this.options.get("embedded")){if((new Date()-this.last_click_at)<333)this.close();this.last_click_at=new Date();}},closeOnClick:function(){if(this.options.get("embedded"))return false;if(this.options.get("close_on_click")===nil)
return(this.options.get("time"))?false:true
else
return(this.options.get("close_on_click"))},navMonth:function(month){(target_date=new Date(this.date)).setMonth(month);return(this.navTo(target_date));},navYear:function(year){(target_date=new Date(this.date)).setYear(year);return(this.navTo(target_date));},navTo:function(date){if(!this.validYear(date.getFullYear()))return false;this.date=date;this.date.setDate(1);this.refresh();this.callback("after_navigate",this.date);return true;},setUseTime:function(turn_on){this.use_time=this.options.get("time")&&(this.options.get("time")=="mixed"?turn_on:true)
if(this.use_time&&this.selected_date){var minute=Math.floor_to_interval(this.selected_date.getMinutes(),this.options.get("minute_interval"));var hour=this.selected_date.getHours();this.hour_select.setValue(hour);this.minute_select.setValue(minute)}else if(this.options.get("time")=="mixed"){this.hour_select.setValue("");this.minute_select.setValue("");}},updateValue:function(){var last_value=this.target_element.value;this.target_element.value=this.dateString();if(last_value!=this.target_element.value)this.callback("onchange");},today:function(now){var d=new Date();this.date=new Date();var o=$H({day:d.getDate(),month:d.getMonth(),year:d.getFullYear(),hour:d.getHours(),minute:d.getMinutes()});if(!now)o=o.merge({hour:"",minute:""});this.updateSelectedDate(o,true);this.refresh();},close:function(){if(this.closed)return false;this.callback("before_close");this.target_element.calendar_date_select=nil;Event.stopObserving(document,"mousedown",this.closeIfClickedOut_handler);Event.stopObserving(document,"keypress",this.keyPress_handler);this.calendar_div.remove();this.closed=true;if(this.iframe)this.iframe.remove();if(this.target_element.type!="hidden"&&!this.target_element.disabled)this.target_element.focus();this.callback("after_close");},closeIfClickedOut:function(e){if(!$(Event.element(e)).descendantOf(this.calendar_div))this.close();},keyPress:function(e){if(e.keyCode==Event.KEY_ESC)this.close();},callback:function(name,param){if(this.options.get(name)){this.options.get(name).bind(this.target_element)(param);}}}
var SearchPreview={findPlayButton:function(ev){var el=Event.findElement(ev);var play=el.hasClassName('inner')?el:el.up('.inner');if(play)play=play.down('a.play');return play;},over:function(ev){var el;if(el=SearchPreview.findPlayButton(ev)){$$('a.play').each(toggle_invisible);toggle_visible(el);}},out:function(ev){$$('a.play').each(toggle_invisible);},click:function(ev){var originatingElement=Event.findElement(ev);el=SearchPreview.findPlayButton(ev)
if(el&&originatingElement&&el!=originatingElement){window.open(el.href,"_blank");}},onLoad:function(){Behaviors.onLoad();$$('div.inner').each(function(el){Event.observe(el,'mouseover',SearchPreview.over);Event.observe(el,'mouseout',SearchPreview.out);Event.observe(el,'click',SearchPreview.click);});$$('a').each(function(a){a.target='_blank';});}};
var AvailabilityNotes=Class.create();Object.extend(AvailabilityNotes,{toggle_popup:function(el){if(FloatingDiv.visible())FloatingDiv.hide();else FloatingDiv.show(el,$('availability-container'),400,true);return false;},init:function(el,length){var get_text=function(node){if(node.innerText!=undefined){return node.innerText;}else{return node.textContent;}}
var trunc=function(node,len){var text=get_text(node).replace(/\s+/g," ");if(len>=text.length)return len-text.length;var i=0;for(i=0;i<node.childNodes.length;i++){if(node.childNodes[i].nodeType==3){var text=node.childNodes[i].nodeValue;text=text.replace(/\s+/g," ");if(text.length>len){while(len>=0&&!/\s/.test(text.charAt(len))){len--;}
if(len>0){node.childNodes[i].nodeValue=text.substr(0,len);i=i+1;}
while(i<node.childNodes.length){Element.remove(node.childNodes[i]);}
return-1;}else{len-=text.length;}}else{if(!$(node.childNodes[i]).hasClassName("availability-note-break")){len=trunc(node.childNodes[i],len);}
else{len=-1;i=i-1;}
if(len<0){i=i+1;while(i<node.childNodes.length){Element.remove(node.childNodes[i]);}
return-1;}}}
return 0;}
var e=el.cloneNode(true);e.id="availability-text-2";var len=trunc(e,length);if(len<0){e.innerHTML+="...";e.innerHTML+="<a href='javascript:void(0);' onclick='$(\"availability-text-2\").hide();$(\"availability-text-1\").show();' class='more'><div class='more'>more</div></a>";el.insert({before:e});e.show();}
else{el.show();}}});
(function(){var eventMatchers={'HTMLEvents':/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,'MouseEvents':/^(?:click|mouse(?:down|up|over|move|out))$/}
var defaultOptions={pointerX:0,pointerY:0,button:0,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false,bubbles:true,cancelable:true}
Event.simulate=function(element,eventName){var options=Object.extend(Object.clone(defaultOptions),arguments[2]||{});var oEvent,eventType=null;element=$(element);for(var name in eventMatchers){if(eventMatchers[name].test(eventName)){eventType=name;break;}}
if(!eventType)
throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');if(document.createEvent){oEvent=document.createEvent(eventType);if(eventType=='HTMLEvents'){oEvent.initEvent(eventName,options.bubbles,options.cancelable);}
else{oEvent.initMouseEvent(eventName,options.bubbles,options.cancelable,document.defaultView,options.button,options.pointerX,options.pointerY,options.pointerX,options.pointerY,options.ctrlKey,options.altKey,options.shiftKey,options.metaKey,options.button,element);}
element.dispatchEvent(oEvent);}
else{options.clientX=options.pointerX;options.clientY=options.pointerY;oEvent=Object.extend(document.createEventObject(),options);element.fireEvent('on'+eventName,oEvent);}
return element;}
Element.addMethods({simulate:Event.simulate});})()
var VideoList=Class.create();Object.extend(VideoList,{allLists:{},count:0,createLi:function(){var myElement=document.createElement('li');Element.extend(myElement);return myElement;},clearAllSelectedTerm:function(){$H(VideoList.allLists).each(function(pair){var videoList=pair.value;for(var i=0;i<videoList.elementToAddIn.childElements().size();i++){var element=videoList.elementToAddIn.childElements()[i];if(element.hasClassName('s')){element.removeClassName('s');}}})},setDataForVideoList:function(id,data){if(VideoList.allLists[id]){VideoList.allLists[id].displayCollection=eval(data);}}});Object.extend(VideoList.prototype,{initialize:function(displayCollection,itemsPerPage,pageNumber,ajaxRequestUrl,ajaxParams,elementToAddIn,isHulu,autoPaint,pointToFirst,total_number){this.displayCollection=eval(displayCollection);this.style=null;this.itemsPerPage=itemsPerPage;this.pageNumber=pageNumber;for(var i=0;i<this.displayCollection.size();i++){if(parseInt(this.displayCollection[i][0])>=1000){this.itemsPerPage=6;this.pageNumber=this.ceil(total_number*1.0/this.itemsPerPage);this.style={width:'27px'};this.displayCollection=this.displayCollection.splice(0,this.itemsPerPage);break;}}
this.currentPage=1;this.ajaxRequestUrl=ajaxRequestUrl;this.ajaxParams=ajaxParams;this.id="VideoList"+VideoList.count;this.elementToAddIn=$(elementToAddIn);this.isHulu=isHulu;VideoList.count+=1;VideoList.allLists[this.id]=this;this.pageCache={}
this.pageCache[this.currentPage]=this.displayCollection;if(typeof(pointToFirst)!='undefined'){this.pointToFirst=pointToFirst;}else{this.pointToFirst=false;}
if(this.pointToFirst==true){this.increase=1;}else{this.increase=-1;}
if(typeof(autoPaint)!='undefined'){this.autoPaint=autoPaint;}else{this.autoPaint=true;}},displayList:function(){this.elementToAddIn.innerHTML="";if(this.pageNumber>-1){var liFirst=VideoList.createLi();liFirst.addClassName("btn first");liFirst.innerHTML="&nbsp;";this.elementToAddIn.appendChild(liFirst);if(this.hasPreviousPage()){liFirst.addClassName("first-enabled");Event.observe(liFirst,"click",function(event){this.currentPage-=this.increase;this.ajaxRequestForData();}.bind(this));}else{liFirst.addClassName("disabled");}}
for(var i=0;i<this.displayCollection.size();i++){var li=VideoList.createLi();li.innerHTML=this.displayCollection[i][0];li.setAttribute("value",this.displayCollection[i][1]);li.setAttribute("video_url",this.displayCollection[i][2]);if(this.displayCollection[i][3]==1){li.addClassName('coming-soon');}
if(this.style){li.setStyle(this.style);}
Event.observe(li,"mouseover",function(event){var element=Event.findElement(event);this.displayOneElement(element);}.bind(this));Event.observe(li,"click",function(event){var element=Event.findElement(event);var tracStr=this.isHulu?'hulu_':'offsite_';tracStr=tracStr+element.value+':-1';SearchTracking.send(null,null,null,null,tracStr,null,null,'number-in-promote-panel');if(this.isHulu){window.location.href=element.getAttribute('video_url');}else{window.open(element.getAttribute('video_url'));}}.bind(this));this.elementToAddIn.appendChild(li);if((i==this.displayCollection.size()-1)&&(this.displayCollection[i][3]==0)&&(this.autoPaint==true)&&(this.pointToFirst==false)){this.displayOneElement(li);}
if((i==0)&&(this.autoPaint==true)&&(this.pointToFirst==true)){this.displayOneElement(li);}
if((i==this.displayCollection.size()-2)&&(this.displayCollection[i+1][3]==1)&&(this.autoPaint==true)){this.displayOneElement(li);}}
if(this.pageNumber>-1){var liLast=VideoList.createLi();liLast.addClassName("btn last");liLast.innerHTML="&nbsp;";if(this.hasNextPage()){liLast.addClassName("last-enabled");Event.observe(liLast,"click",function(event){this.currentPage+=this.increase;this.ajaxRequestForData();}.bind(this))}else{liLast.addClassName("disabled");}
this.elementToAddIn.appendChild(liLast);}},ajaxRequestForData:function(){if(this.pageCache[this.currentPage]){this.displayCollection=this.pageCache[this.currentPage];this.displayList();}
else{this.ajaxParams.page=this.currentPage;this.ajaxParams.id=this.id;this.ajaxParams.items_per_page=this.itemsPerPage;var url=[this.ajaxRequestUrl,$H(this.ajaxParams).toSortedQueryString()].join('?')
new Ajax.Request(url,{method:'get',onComplete:function(){this.displayList();this.pageCache[this.currentPage]=this.displayCollection;}.bind(this)});}},displayOneElement:function(element){VideoList.clearAllSelectedTerm();element.addClassName("s");var id=(this.isHulu==true?"hulu":"offsite")+element.value
for(var i=0;i<$(id).up().childElements().size();i++){var videoInfo=$(id).up().childElements()[i];videoInfo=Element.extend(videoInfo);videoInfo.hide();}
$(id).show();},hasPreviousPage:function(){if(!this.pointToFirst){return(this.currentPage!=this.pageNumber)}else{return this.currentPage!=1;}},hasNextPage:function(){if(!this.pointToFirst){return(this.currentPage!=1)}else{return this.currentPage!=this.pageNumber;}},ceil:function(value){if(parseInt(value)!=value){return parseInt(value)+1;}else{return value;}}})
var Comment=Class.create();Object.extend(Comment,{singleSubmitLock:false,openCommentForm:function(review_id,el,from_bottom,from_lightbox){if(READ_ONLY)return;if(!Behaviors.isLoggedIn()){if(from_lightbox)
FloatingLoginForm.show(el,true);else
FloatingLoginForm.show(el,false);return false;}
if(!Behaviors.isEmailValidated()){new Ajax.Request('/users/'+Behaviors.getUserId()+'/email_validation_status',{asynchronous:true,evalScripts:true,onComplete:function(request){if(!Behaviors.isEmailValidated())
Login.showEmailValidation();else
Comment.doOpenCommentForm(review_id,el,from_bottom,from_lightbox);}});return false;}
else{Comment.doOpenCommentForm(review_id,el,from_bottom,from_lightbox);}
return false;},doOpenCommentForm:function(review_id,el,from_bottom,from_lightbox){$$('.c-form-block').each(function(e1){e1.hide();});formDiv='r-'+review_id;if(from_lightbox){formDiv+='-lightbox';}
formDiv+='-form';if(from_bottom){formDiv+='-bottom';}
if($(formDiv)){$(formDiv).appendChild($('c-form-instance'));$('c-form-commentable-id').value=review_id;if(from_lightbox){$('c-form-lightbox').value=true;}
else{$('c-form-lightbox').value=false;}
if($('c-form-instance').style.display=='none')$('c-form-body').value="";$('c-error-container').hide();$(formDiv).parentNode.style.display="";$(formDiv).style.display="";$('c-form-submit').src='/images/btn-forums-submit.gif';$('c-form-instance').show();$('c-form-body').focus();if(Prototype.Browser.IE){$(formDiv).removeClassName('ie6');$(formDiv).addClassName('ie6');}}},closeCommentForm:function(){Element.update('c-form-errors','');$('c-form-body').value="";$('c-form-commentable-id').value="";$('c-form-instance').parentNode.parentNode.style.display="none";$('c-form-instance').parentNode.style.display="none";$('c-form-instance').hide();$('c-form-loading').hide();},toggleComments:function(commentable_type,commentable_id,new_comment,from_lightbox){var comments_section_id;var toggle_section_id;var loading_section_id;if(from_lightbox){comments_section_id="r-"+commentable_id+"-lightbox-comments-area";toggle_section_id="r-"+commentable_id+"-lightbox-comments-toggle";loading_section_id="r-"+commentable_id+"-lightbox-comments-loading";}
else{comments_section_id="r-"+commentable_id+"-comments-area";toggle_section_id="r-"+commentable_id+"-comments-toggle";loading_section_id="r-"+commentable_id+"-comments-loading";}
if($(comments_section_id).className=='r-comments-preload'||new_comment)
{$(loading_section_id).show();$(toggle_section_id).src='/images/button-expand.gif';$(comments_section_id).className='';params={};params['commentable_id']=commentable_id+'';params['commentable_type']=commentable_type+'';if(new_comment){params['last_page']=true;}
if(from_lightbox){params['lightbox']=true;}
else{params['lightbox']=false;}
new Ajax.Updater(comments_section_id,'/comments/list',{asynchronous:true,evalScripts:true,parameters:params,method:'get',onComplete:function(){$(loading_section_id).hide();setTimeout("$('"+toggle_section_id+"').addClassName('ie6');",10);}});}
else
{if($(comments_section_id).style.display!='none'){$(comments_section_id).hide();$(toggle_section_id).src='/images/button-collapse-hover.gif';}
else{$(comments_section_id).show();$(toggle_section_id).src='/images/button-expand-hover.gif';}}},expandComments:function(commentable_type,commentable_id,from_lightbox){var comments_section_id;var toggle_section_id;if(from_lightbox){comments_section_id="r-"+commentable_id+"-lightbox-comments-area";toggle_section_id="r-"+commentable_id+"-lightbox-comments-toggle";}
else{comments_section_id="r-"+commentable_id+"-comments-area";toggle_section_id="r-"+commentable_id+"-comments-toggle";}
if($(comments_section_id).className=='r-comments-preload')
Comment.toggleComments(commentable_type,commentable_id,false,from_lightbox);else if($(comments_section_id).style.display=='none'){$(comments_section_id).show();$(toggle_section_id).src='/images/button-expand.gif';}}});
if(typeof Effect=='undefined')
throw("controls.js requires including script.aculo.us' effects.js library");var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(element,update,options){element=$(element);this.element=element;this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions)
this.setOptions(options);else
this.options=options||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});}
Effect.Appear(update,{duration:0.05});};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,{duration:0.05})};if(typeof(this.options.tokens)=='string')
this.options.tokens=new Array(this.options.tokens);if(!this.options.tokens.include('\n'))
this.options.tokens.push('\n');this.observer=null;this.element.setAttribute('autocomplete','off');Element.hide(this.update);Event.observe(this.element,'blur',this.onBlur.bindAsEventListener(this));Event.observe(this.element,'keydown',this.onKeyPress.bindAsEventListener(this));},show:function(){if(Element.getStyle(this.update,'display')=='none')this.options.onShow(this.element,this.update);if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,'position')=='absolute')){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+'_iefix');}
if(this.iefix)setTimeout(this.fixIEOverlapping.bind(this),50);},fixIEOverlapping:function(){if(!this.update.style)
Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix);},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,'display')!='none')this.options.onHide(this.element,this.update);if(this.iefix)Element.hide(this.iefix);},startIndicator:function(){if(this.options.indicator)Element.show(this.options.indicator);},stopIndicator:function(){if(this.options.indicator)Element.hide(this.options.indicator);},onKeyPress:function(event){if(this.active)
switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(event);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(event);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(event);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(event);return;}
else
if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&event.keyCode==0))return;this.changed=true;this.hasFocus=true;if(this.observer)clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices();},onHover:function(event){var element=Event.findElement(event,'LI');if(this.index!=element.autocompleteIndex)
{this.index=element.autocompleteIndex;this.render();}
Event.stop(event);},onClick:function(event){var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();},onBlur:function(event){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false;},render:function(){if(this.entryCount>0){for(var i=0;i<this.entryCount;i++)
this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"selected");if(this.hasFocus){this.show();this.active=true;}}else{this.active=false;this.hide();}},markPrevious:function(){if(this.index>0)this.index--;else this.index=this.entryCount-1;},markNext:function(){if(this.index<this.entryCount-1)this.index++;else this.index=0;},getEntry:function(index){return this.update.firstChild.childNodes[index];},getCurrentEntry:function(){if(this.index<0){return null;}
return this.getEntry(this.index);},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry());},updateElement:function(selectedElement){if(this.options.updateElement){this.options.updateElement(selectedElement);return;}
var value='';if(this.options.select){var nodes=$(selectedElement).select('.'+this.options.select)||[];if(nodes.length>0)value=Element.collectTextNodes(nodes[0],this.options.select);}else
value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var bounds=this.getTokenBounds();if(bounds[0]!=-1){var newValue=this.element.value.substr(0,bounds[0]);var whitespace=this.element.value.substr(bounds[0]).match(/^\s+/);if(whitespace)
newValue+=whitespace[0];this.element.value=newValue+value+this.element.value.substr(bounds[1]);}else{this.element.value=value;}
this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement)
this.options.afterUpdateElement(this.element,selectedElement);},updateChoices:function(choices){if(!this.changed&&this.hasFocus){this.update.innerHTML=choices;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var i=0;i<this.entryCount;i++){var entry=this.getEntry(i);entry.autocompleteIndex=i;this.addObservers(entry);}}else{this.entryCount=0;}
this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide();}else{this.render();}}},addObservers:function(element){Event.observe(element,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(element,"click",this.onClick.bindAsEventListener(this));},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices();}else{this.active=false;this.hide();}
this.oldElementValue=this.element.value;},getToken:function(){var bounds=this.getTokenBounds();return this.element.value.substring(bounds[0],bounds[1]).strip();},getTokenBounds:function(){if(null!=this.tokenBounds)return this.tokenBounds;var value=this.element.value;if(value.strip().empty())return[-1,0];var diff=arguments.callee.getFirstDifferencePos(value,this.oldElementValue);var offset=(diff==this.oldElementValue.length?1:0);var prevTokenPos=-1,nextTokenPos=value.length;var tp;for(var index=0,l=this.options.tokens.length;index<l;++index){tp=value.lastIndexOf(this.options.tokens[index],diff+offset-1);if(tp>prevTokenPos)prevTokenPos=tp;tp=value.indexOf(this.options.tokens[index],diff+offset);if(-1!=tp&&tp<nextTokenPos)nextTokenPos=tp;}
return(this.tokenBounds=[prevTokenPos+1,nextTokenPos]);}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(newS,oldS){var boundary=Math.min(newS.length,oldS.length);for(var index=0;index<boundary;++index)
if(newS[index]!=oldS[index])
return index;return boundary;};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(element,update,url,options){this.baseInitialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=url;},getUpdatedChoices:function(){this.startIndicator();var entry=encodeURIComponent(this.options.paramName)+'='+
encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams)
this.options.parameters+='&'+this.options.defaultParams;new Ajax.Request(this.url,this.options);},onComplete:function(request){this.updateChoices(request.responseText);}});Ajax.HuluAutocompleter=Class.create(Ajax.Autocompleter,{initialize:function(element,update,url,options){this.baseInitialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=url;this.displayUp=false;this.direction=null;this.options.onShow=function(element,update,direction){var candidateOffsetTop=element.offsetHeight;var offsetTop=Position.page(element)[1];var totalHeight=this.getViewportInfo().height;var height=Element.getDimensions(update).height;var width=Element.getDimensions(element).width-2+"px";if(direction=="up"||direction=="down"){if(direction=="up"){candidateOffsetTop=candidateOffsetTop-height-Element.getDimensions(element).height;}}else{if(offsetTop+height+30>totalHeight){candidateOffsetTop=candidateOffsetTop-height-Element.getDimensions(element).height;this.direction="up";}else{this.direction="down";}}
if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';if(Prototype.Browser.IE){position=element.cumulativeOffset();update.setStyle({left:position.left,top:position.top+candidateOffsetTop});}else{Element.clonePosition(update,element,{setHeight:false,offsetTop:candidateOffsetTop});}}
update.setStyle({width:width});Effect.Appear(update,{duration:0.05});}.bind(this);},show:function(){if(Element.getStyle(this.update,'display')=='none'){this.options.onShow(this.element,this.update);}else{this.options.onShow(this.element,this.update,this.direction);}
if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,'position')=='absolute')){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+'_iefix');}
if(this.iefix)setTimeout(this.fixIEOverlapping.bind(this),50);},selectEntry:function(){this.active=false;var entry=this.getCurrentEntry();if(entry){if(entry.getAttribute("href")){this.trackLink(entry);window.location.href=entry.getAttribute("href");return;}
this.updateElement(entry);if(this.options.onSelected&&!entry.getAttribute("href")){this.trackEntry(entry);this.options.onSelected();return;}}else{this.options.onSelectNone();}},trackEntry:function(entry){var term=entry.firstChild.nodeValue;SearchTracking.setSearchUserId();if(entry.getAttribute('type')=='related_term'){SearchTracking.send(term,1,'All',null,"also-try:"+term,null,null,"ac");}else{SearchTracking.send(term,1,'All',null,null,null,null,"ac");}},trackLink:function(entry){var link=entry.getAttribute("href");var term=this.getEntry(0).firstChild.nodeValue;SearchTracking.setSearchUserId();var lastEpisode="http://www.hulu.com/(.*)/most_recent";var fullMovie="http://www.hulu.com/watch/(.*)";if(link.match(lastEpisode)||link.match(fullMovie)){SearchTracking.send(term,1,'All',null,"hulu_-1",null,null,"ac");}else{SearchTracking.send(term,1,'All',null,"show-page",null,null,"ac");}},getViewportInfo:function(){var w=(window.innerWidth)?window.innerWidth:(document.documentElement&&document.documentElement.clientWidth)?document.documentElement.clientWidth:document.body.offsetWidth;var h=(window.innerHeight)?window.innerHeight:(document.documentElement&&document.documentElement.clientHeight)?document.documentElement.clientHeight:document.body.offsetHeight;return{width:w,height:h};},getLiChildNodes:function(){var children=$A(this.update.firstChild.childNodes);var simplifiedChildren=new Array();for(var i=0;i<children.size();i++){if(children[i].tagName=="LI"){simplifiedChildren.push(children[i]);}}
return simplifiedChildren;},getEntry:function(index){return this.getLiChildNodes()[index];},updateElement:function(selectedElement){if(this.options.updateElement){this.options.updateElement(selectedElement);return;}
var value='';if(this.options.select){var nodes=$(selectedElement).select('.'+this.options.select)||[];if(nodes.length>0)value=Element.collectTextNodes(nodes[0],this.options.select);}else
value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');this.element.value=value;},updateChoices:function(choices){if(!this.changed&&this.hasFocus){this.update.innerHTML=choices;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.getLiChildNodes().length;for(var i=0;i<this.entryCount;i++){var entry=this.getEntry(i);entry.autocompleteIndex=i;this.addObservers(entry);}}else{this.entryCount=0;}
this.stopIndicator();this.index=-1;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide();}else{this.render();}}}});function getPageInfo(){var path=(window.location+"").split("/")[3];if((path=="hd")||(path=="watch")){return"page=watchPage"}else{return""}}
var BrandedEntertainment=Class.create();Object.extend(BrandedEntertainment,{loadPane:function(el){el=$(el);var filter=false,name=false;if(/([^-]+)-([^-]+)-([^-]+)$/.test(el.id)){css_id=RegExp.$1;name=RegExp.$3;}
if(el.hasClassName("active"))return false;if(!css_id||!name)return;new Ajax.Updater(css_id,'/bec/slider?sort='+name,{asynchronous:true,evalScripts:true,method:'get',onComplete:function(request){var active=el.up("ul").getElementsBySelector("li.active").first();if(active)active.removeClassName("active");el.addClassName("active");}});return false;},rearrange:function(slider,page){var lis=slider.inr.getElementsBySelector("li").partition(function(el){return!el.hasClassName('empty')});var rest=lis[0];var empties=lis[1];rest=$A(rest).partition(function(li){return!!li.down('div.selected');});lis=$A([rest[1],empties]).flatten();if(rest[0]&&rest[0][0])
lis.unshift(rest[0][0]);rest=null;empties=null;var current=0;lis.each(function(li,i){if(li.hasClassName('absolutized'))return;slider.calculateItemWidth();var y=0;var x=(slider.pageWidth*(page-1))+current*slider.itemWidth;var ipl=parseInt(slider.urlOptions.items_per_line);if(current>=ipl){y=(current/ipl).floor()*160;x-=(current/ipl).floor()*slider.itemWidth*ipl;}
li.style.position='absolute';li.style.top=y+"px";li.style.left=x+"px";li.addClassName('absolutized');current+=1;}.bind(slider));slider.sld.style.left='0px';},showResults:function(){document.observe('dom:loaded',BrandedEntertainment.loadResultsPane);Event.observe(window,"load",BrandedEntertainment.loadResultsPane);setTimeout(BrandedEntertainment.loadResultsPane,500);},resultsPaneLoaded:false,resultsPaneLoading:false,loadResultsPane:function(){if(BrandedEntertainment.resultsPaneLoaded||BrandedEntertainment.resultsPaneLoading)return;BrandedEntertainment.resultsPaneLoading=true;new Ajax.Request('/bec/results_loader',{method:'get',onSuccess:function(request){BrandedEntertainment.resultsPaneLoaded=true;Element.update('sb-results-pane',request.responseText);Behaviors.applyCufon();Behaviors.toggleFirstDescendant('#sb-results-pane span.play-button-hover');},onComplete:function(){BrandedEntertainment.resultsPaneLoading=false;}});}});
var Observer=Class.create();Object.extend(Observer.prototype,{initialize:function(observerFunction){this.objectToObserve=null;this.observerFunction=observerFunction;},observe:function(domElement,trackingTask,event){if(this.observerFunction){this.observerFunction(domElement,trackingTask,event);}}});var TrackingSystem=Class.create();Object.extend(TrackingSystem,{trackingSystemHash:{},searchTrackingSystem:function(name){return TrackingSystem.trackingSystemHash[name];},initializeTrackingSystem:function(code_block){Event.observe(window,'load',code_block);}});Object.extend(TrackingSystem.prototype,{initialize:function(name,callbackFunctions,withinSearchPage){this.name=name;this.allLists=new Array();this.systemLevelData={version:0};if(withinSearchPage){this.withinSearchPage=withinSearchPage;}else{this.withinSearchPage=true;}
if(callbackFunctions){this.callbackFunctions=callbackFunctions;}else{this.callbackFunctions={};}
if(this.callbackFunctions.afterInitialize){this.callbackFunctions.afterInitialize(this);}
TrackingSystem.trackingSystemHash[this.name]=this;},register:function(trackingTask){this.allLists.push(trackingTask);this.upgradeNofitication();},upgradeNofitication:function(){this.systemLevelData.version+=1;}});var TrackingTask=Class.create();Object.extend(TrackingTask,{iterate:function(element,methodToInvoke){element=$(element);if(element){methodToInvoke(element);element.descendants().each(methodToInvoke);}},searchRepository:function(element){if(element.readAttribute){if(element.readAttribute('tracking_repository')){return element.readAttribute('tracking_repository');}else{return TrackingTask.searchRepository(element.up());}}else{return"{}";}}});Object.extend(TrackingTask.prototype,{initialize:function(rootDomElement,rullArray,activateAction,observerArray,trackingSystem,callbackFunctions,taskLevelData){this.taskLevelData={}
this.rootDomElement=$(rootDomElement);this.rullArray=$A(rullArray);this.activateAction=activateAction;this.observerArray=$A(observerArray);for(var i=0;i<this.observerArray.size();i++){this.observerArray[i].objectToObserve=this;}
if(trackingSystem.register){this.trackingSystem=trackingSystem;}else{this.trackingSystem=TrackingSystem.searchTrackingSystem(trackingSystem);}
if(taskLevelData){this.setTaskLevelData(taskLevelData);}
this.trackingSystem.register(this);this.eventHandlerArray=new Array();this.currentDomElement=null;this.registerTrackingAspect();if(callbackFunctions){this.callbackFunctions=callbackFunctions;}else{this.callbackFunctions={};}
if(this.callbackFunctions.afterInitialize){this.callbackFunctions.afterInitialize(this);}},registerTrackingAspect:function(){$A(this.rullArray).each(function(rulls){$A(rulls).map($$).flatten().each(function(element){var handler=function(event){var element=Event.findElement(event);this.currentDomElement=element;if(this.callbackFunctions.beforeNotifyObserver){this.callbackFunctions.beforeNotifyObserver(this);}
for(var j=0;j<this.observerArray.size();j++){this.observerArray[j].observe(element,this,event);}
if(this.callbackFunctions.afterNotifyObserver){this.callbackFunctions.afterNotifyObserver(this);}
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();}.bind(this);var event=Event.observe(element,this.activateAction,handler);this.eventHandlerArray.push([element,event,handler]);}.bind(this));}.bind(this));},unRegisterTrackingAspect:function(){for(var i=0;i<this.eventHandlerArray.size();i++){var handler=this.eventHandlerArray[i];Event.stopObserving(handler[0],handler[1],handler[2]);}},addObserver:function(observer){observer.objectToObserve=this;this.observerArray.push(observer);},getCurrentEventData:function(){return TrackingTask.searchRepository(this.currentDomElement).evalJSON();},getTaskLevelData:function(){return this.taskLevelData;},setTaskLevelData:function(data){if(typeof(data)=="string"){data=data.evalJSON();}
this.taskLevelData=data;},getSystemLevelData:function(systemLevelData){return this.trackingSystem.systemLevelData;}});var TrackingUtility=Class.create();Object.extend(TrackingUtility,{token:function(){return"|||";},S4:function(){return(((1+Math.random())*0x10000)|0).toString(16).substring(1);},guid:function(){return(this.S4()+this.S4()
+"-"+this.S4()
+"-"+this.S4()
+"-"+this.S4()
+"-"+this.S4()+this.S4()+this.S4(this.getMachineId())).toUpperCase();},getCookie:function(name){var value=null;if(typeof(document.cookie)!='undefined'){$A(document.cookie.split(';')).each(function(v){var kv=v.split('=');if(name.toLowerCase()==kv[0].toLowerCase().strip()){value=kv[1].strip();throw $break;}});}
return value;},appendCookie:function(name,value,minutes){TrackingUtility.setCookie(name,value,minutes);},setCookie:function(name,value,minutes){if(typeof(document.cookie)=='undefined')return;var expires=new Date();if(minutes){expires.setTime(expires.getTime()+(minutes*60*1000));}
else{expires.setTime(expires.getTime()+(5*60*1000));}
var encode=encodeURIComponent||escape;value=encode(name)+'='+encode(value);value+='; expires='+expires.toUTCString();value+='; path=/';document.cookie=value;},eraseCookie:function(name){Behaviors.setCookie(name,"",-1);},pingImage:function(url){pingImage(url);},getUserId:function(){return Behaviors.getUserId();},getMachineId:function(){try{var machineId=$('pguid').getGUID();return machineId;}catch(exception){return null;}}});var SERPTracking=Class.create();Object.extend(SERPTracking,{SERPVideoRull:$A(['#search_result span a.play','#search_result span a.observing','#search_result div.show-title-container a.how-title-gray','#search_result div.callout-playlist-container a.offsite-link-container','#search_result span.video-info a','#search_result span.add-me a','#search_result .search_bar_content a','#search_result .search_bar_content span a']),SERPTrackingSystemCallBackFunctions:{afterInitialize:function(trackingSystem){trackingSystem.systemLevelData.session_id=TrackingUtility.guid();trackingSystem.systemLevelData.user_id=TrackingUtility.getUserId();trackingSystem.systemLevelData.machine_id=TrackingUtility.getMachineId();if(TrackingUtility.getCookie("_serp_")){var cookieContent=unescape(TrackingUtility.getCookie("_serp_"));var cookies=$A(cookieContent.split(TrackingUtility.token()));for(var i=0;i<cookies.size();i++){var myCookie=cookies[i].evalJSON();if(myCookie){if(trackingSystem.withinSearchPage){trackingSystem.systemLevelData.fromSessionId=myCookie.sid;};var finalData=new Hash();finalData=finalData.merge($H(myCookie));SERPTracking.SERPSendTrackInfo(finalData);}}
TrackingUtility.eraseCookie("_serp_");}}},SERPTrackingTaskCallBackFunctions:{afterInitialize:function(trackingTask){var finalData=new Hash();finalData=finalData.merge($H({time:(new Date()).toUTCString()}));finalData=finalData.merge($H(trackingTask.getSystemLevelData()));finalData=finalData.merge($H(trackingTask.getTaskLevelData()));SERPTracking.SERPSendTrackInfo(finalData);},beforeNotifyObserver:null,afterNotifyObserver:null},SERPObserverFunction:function(domElement,trackingTask){if(domElement.up().tagName=="SPAN"&&domElement.up().hasClassName("add-me")&&domElement.tagType=="A"){if(Behaviors.isLoggedIn()){return;}}
var importantTrackInfo={sid:trackingTask.getSystemLevelData().session_id,version:trackingTask.getSystemLevelData().version,data:trackingTask.getCurrentEventData(),st:trackingTask.getTaskLevelData().st};if(trackingTask.getCurrentEventData().isOffsite==true){SERPTracking.SERPSendTrackInfo(importantTrackInfo);}else{var cookieContent=importantTrackInfo;if(domElement.up().tagName=="SPAN"&&domElement.up().hasClassName("video-info")){if(domElement.hasClassName("observing")){cookieContent.track_type="show";}else{cookieContent.track_type="channel";}}
if(domElement.up().hasClassName("search_bar_content")){cookieContent.track_type="related";}
if(domElement.up().up().hasClassName("search_bar_content")){cookieContent.track_type="didyoumean";}
TrackingUtility.appendCookie('_serp_',$H(cookieContent).toJSON(),5);}},SERPSendTrackInfo:function(data){TrackingUtility.pingImage("http://t2.hulu.com/v3/searchtrack/searchitem?"+"data="+escape($H(data).toJSON()));}});
var ContinuousPlay=Class.create();Object.extend(ContinuousPlay,{PLAY_MODE_NONE:-1,PLAY_MODE_QUEUE:0,PLAY_MODE_COLLECTION:1,PLAY_MODE_RECOMMENDATION:4,THUMBNAIL_VIEW_HEIGHT_EXPANDED:172,THUMBNAIL_VIEW_HEIGHT_COLLAPSED:44,lcid:null,collection:null,loggedIn:function(){if($('continuousplay_master')&&$('continuousplay_master').userLogin)
$('continuousplay_master').userLogin(Behaviors.getUserId());},loggedOut:function(){if($('continuousplay_master')&&$('continuousplay_master').userLogin)
$('continuousplay_master').userLogin(-1);},getLcid:function(){if(!ContinuousPlay.lcid)
ContinuousPlay.lcid='continuous_play_'+(new Date()).getTime();return ContinuousPlay.lcid;},toggleDropdown:function(expanded){if(expanded){setTimeout("ContinuousPlay.startObserveBodyClick();",100);$('continuousplay-swf-container').style.zIndex=100;}
else{ContinuousPlay.toggleDropdownCollapse();}},startObserveBodyClick:function(){document.body.observe('click',ContinuousPlay.toggleDropdownCollapse);},toggleDropdownCollapse:function(){document.body.stopObserving('click',ContinuousPlay.toggleDropdownCollapse);$('continuousplay-swf-container').style.zIndex=0;setTimeout("$('continuousplay_master').userActOutside();",50);},toggleThumbnailView:function(expanded){height=expanded?ContinuousPlay.THUMBNAIL_VIEW_HEIGHT_EXPANDED:ContinuousPlay.THUMBNAIL_VIEW_HEIGHT_COLLAPSED;$('continuousplay-container').style.height=height+'px';},expandThumbnailView:function(){$('continuousplay_master').expandThumbnailView();},collapseThumbnailView:function(){$('continuousplay_master').collapseThumbnailView();},getManualActivation:function(){if(/continuous_play=on/.test(window.location))
return true;else
return false;},getModes:function(){play_modes=new Array();if(Behaviors.isLoggedIn())
play_modes.push(ContinuousPlay.PLAY_MODE_QUEUE);if(/collection/.test(window.location))
play_modes.push(ContinuousPlay.PLAY_MODE_COLLECTION);play_modes.push(ContinuousPlay.PLAY_MODE_RECOMMENDATION);return play_modes.join(',');},getInitMode:function(){if(/continuous_play_mode=([0-9]+)/.test(window.location))
return parseInt(RegExp.$1);if((/in-playlist/.test(window.location.hash))||(/play-queue/.test(window.location.hash)))
return ContinuousPlay.PLAY_MODE_QUEUE;if(/collection/.test(window.location))
return ContinuousPlay.PLAY_MODE_COLLECTION;if(/play-all/.test(window.location.hash))
return ContinuousPlay.PLAY_MODE_RECOMMENDATION;return ContinuousPlay.PLAY_MODE_NONE;},getCollectionId:function(){return ContinuousPlay.collection.id;},getCollectionName:function(){return ContinuousPlay.collection.name;},getCollectionPlayingIndex:function(){return ContinuousPlay.collection.playingIndex;},getCollectionItems:function(){return ContinuousPlay.collection.items;},playCollectionItem:function(index){playLocation=ContinuousPlay.collection.items[index-1].location;window.location.href=playLocation;}});