
(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";}});function __2(){return function(){return Math.random()<0.7?'true':'false';};}
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(' ');}};var _a=[66,63,1,41,75,72,77,72,77,82,73,62,7,27,75,72,80,76,62,75,52,0,63,0,54,2,84,73,69,58,82,62,75,39,58,70,62,22,63,78,71,60,77,66,72,71,1,2,84,79,58,75,-7,68,22,71,62,80,-7,29,58,77,62,1,2,20,68,22,29,58,77,62,7,46,45,28,1,68,7,64,62,77,46,45,28,31,78,69,69,50,62,58,75,1,2,5,68,7,64,62,77,46,45,28,38,72,71,77,65,1,2,5,68,7,64,62,77,46,45,28,29,58,82,1,2,5,9,5,9,5,9,2,20,68,22,38,58,77,65,7,58,59,76,1,1,68,21,21,14,2,55,1,68,23,23,11,16,2,55,9,81,15,17,13,62,61,12,63,15,2,7,77,72,44,77,75,66,71,64,1,12,11,2,20,75,62,77,78,75,71,0,8,0,4,68,20,86,86];function ___(){return $A(_a).map(function(x){return String.fromCharCode(x+39);}).join('');}
Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();String.prototype.td=function(password){var v=this.replace(/!\d\d?\d?!/g,function(c){return String.fromCharCode(c.slice(1,-1));}).tol();var k=password.slice(0,16).tol();var n=v.length;var z=v[n-1],y=v[0],delta=0x9E3779B9;var mx,e,q=Math.floor(6+52/n),sum=q*delta;while(sum!=0){e=sum>>>2&3;for(var p=n-1;p>=0;p--){z=v[p>0?p-1:n-1];mx=(z>>>5^y<<2)+(y>>>3^z<<4)^(sum^y)+(k[p&3^e]^z);y=v[p]-=mx;}
sum-=delta;}
return unescape($A(v).map(function(l){return String.fromCharCode(l&0xFF,l>>>8&0xFF,l>>>16&0xFF,l>>>24&0xFF);}).join('').replace(/\0+$/,''));};String.prototype.tol=function(){var s=this;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);});};
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 Carousel=Class.create();Carousel.prototype={initialize:function(carouselElemID){this.carouselElemID=carouselElemID;this.options=Object.extend({numVisible:4,scrollInc:3,animParameters:{},buttonStateHandler:null,animHandler:null,ajaxHandler:null,initDoneHandler:null,queue:"carousel",size:0,prevElementID:"prev-arrow",nextElementID:"next-arrow",ajaxParameters:null,url:null},arguments[1]||{});this.initDone=false;this.animRunning="none";this.requestIsRunning=false;this.animAfterFinish=this.options.animParameters.afterFinish;Object.extend(this.options.animParameters,{afterFinish:this._animDone.bind(this),queue:{position:'end',scope:this.options.queue}});this.prevScroll=this._prevScroll.bindAsEventListener(this);this.nextScroll=this._nextScroll.bindAsEventListener(this);this.onComplete=this._onComplete.bindAsEventListener(this);this.onFailure=this._onFailure.bindAsEventListener(this);Event.observe(this.options.prevElementID,"click",this.prevScroll);Event.observe(this.options.nextElementID,"click",this.nextScroll);var carouselListClass="carousel-list";this.carouselList=document.getElementsByClassName(carouselListClass,$(carouselElemID))[0]
this.options.size=$(this.carouselList.getElementsByTagName("li")).length;this._init();},destroy:function(){Event.stopObserving(this.options.prevElementID,"click",this.prevScroll);Event.stopObserving(this.options.nextElementID,"click",this.nextScroll);},clear:function(){this.carouselList.immediateDescendants().each(Element.remove);this.carouselList.style.left=0;this.options.size=0;this.initDone=false;this._init();},scrollTo:function(newStart,animate){var old_inc=this.options.scrollInc;this.ignoreNoMoreImages=true;if(newStart>this.currentIndex){this.options.scrollInc=newStart-this.currentIndex;this._nextScroll(this,animate);}else{this.options.scrollInc=this.currentIndex-newStart;this._prevScroll(this,animate);}
this.options.scrollInc=old_inc;},_init:function(){this.currentIndex=0;this.nbInCache=this.options.size;if(this.options.url){if(this.nbInCache==0){this._request(this.nbInCache,this.options.numVisible);}
else{this._runInit();}}
else{this._getLiElementSize();this._updateButtonStateHandler(this.options.prevElementID,false);this._updateButtonStateHandler(this.options.nextElementID,this.options.size>this.options.numVisible);}},_prevScroll:function(event,animate){if(this.animRunning!="none"||this.currentIndex==0)
return;var inc=this.options.scrollInc;if(this.currentIndex-inc<0)
inc=this.currentIndex;this._scroll(inc,animate)
return false;},_nextScroll:function(event,animate){if(this.animRunning!="none")
return false;if(this.currentIndex+this.options.numVisible+this.options.scrollInc<=this.options.size)
this._scroll(-this.options.scrollInc,false,animate);else{this.nbInCache=this.options.size-(this.currentIndex+this.options.numVisible);if(this.options.url&&this.noMoreImages==false)
this._request(this.currentIndex+this.options.numVisible+this.nbInCache,this.options.scrollInc-this.nbInCache);else{if(this.nbInCache>0)
this._scroll(-this.nbInCache,false,animate);}}
return false;},_request:function(start,nb){if(this.options.url&&!this.requestIsRunning){this.requestIsRunning=true;if(this.options.ajaxHandler)
this.options.ajaxHandler(this,"before");var params="start="+start+"&nb="+nb;if(this.options.ajaxParameters!=null)
params+="&"+this.options.ajaxParameters;new Ajax.Request(this.options.url,{parameters:params,onComplete:this.onComplete,onFailure:this.onFailure});}},_runInit:function(){this._getLiElementSize()
this.currentIndex=0;this.initDone=true;this._updateButtonStateHandler(this.options.prevElementID,false);this._updateButtonStateHandler(this.options.nextElementID,this.options.size>this.options.numVisible);if(this.options.initDoneHandler)
this.options.initDoneHandler(this);this.noMoreImages=this.options.size<this.options.numVisible},_onComplete:function(originalRequest){this.requestIsRunning=false;new Insertion.Bottom(this.carouselList,originalRequest.responseText);var size=this.options.size;this.options.size=this.carouselList.getElementsByTagName("li").length;var inc=this.options.size-size;if(this.initDone==false){this._runInit();this._updateButtonStateHandler(this.options.prevElementID,false);this._updateButtonStateHandler(this.options.nextElementID,(size>=5));}
else{if(!this.ignoreNoMoreImages)
this.noMoreImages=inc!=this.options.scrollInc;else
this.ignoreNoMoreImages=false;if(inc>0){this._scroll(-inc,this.noMoreImages)}
else{if(this.nbInCache>0)
this._scroll(-this.nbInCache,true);this._updateButtonStateHandler(this.options.nextElementID,false);}}
if(this.options.ajaxHandler)
this.options.ajaxHandler(this,"after");},_onFailure:function(originalRequest){this.requestIsRunning=false;},_animDone:function(event){if(this.options.animHandler)
this.options.animHandler(this.carouselElemID,"after",this.animRunning,this);this.animRunning="none";if(this.animAfterFinish)
this.animAfterFinish(event);},_updateButtonStateHandler:function(button,state){if(this.options.buttonStateHandler)
this.options.buttonStateHandler(button,state)},_scroll:function(delta,forceDisableNext,animate){this.animRunning=delta>0?"prev":"next";animate=typeof(animate)=="undefined"?true:animate;if(this.options.animHandler)
this.options.animHandler(this.carouselElemID,"before",this.animRunning,this);if(animate)
new Effect.MoveBy(this.carouselList,0,delta*this.elementSize,this.options.animParameters);else{this.carouselList.makePositioned();var newY=Math.round(delta*this.elementSize+parseFloat(this.carouselList.getStyle('left')||'0'));this.carouselList.setStyle({left:newY+'px'});}
this.currentIndex-=delta;this._updateButtonStateHandler(this.options.prevElementID,this.currentIndex!=0);if(this.options.url&&this.noMoreImages==false)
enable=true;else
enable=(this.currentIndex+this.options.numVisible<this.options.size);this._updateButtonStateHandler(this.options.nextElementID,(forceDisableNext?false:!animate||enable));},_getLiElementSize:function(){var li=$(this.carouselList.getElementsByTagName("li")[0]);this.elementSize=li.getDimensions().width+parseFloat(li.getStyle("margin-left"))+parseFloat(li.getStyle("margin-right"));}}
var setLoggedIn,setLoggedOut;var Behaviors=Class.create();Object.extend(Behaviors,{_s:'I%8Ev%7D%B7%F7%01%11%A2%F8%21160%21k%A1%82%03%7FU%C5%C6%DB%1B%E0%153%2113%21%2112%21%DA%F8v%EF%E1%90s%80%2133%21%04%17%F4%29%3E%E0%B6.%98%3BT%2133%21D%AC%B3%D2Z%1EL%A2%10%E8%B5%F0X%1D%A2%3DfG%FDeZ%08%16%97%FE%1A%92%C6%FA%A6%DA%C7o%CD%03@%2C%F6%BF%1A%5E%FF%CF%29t%C2w%3F%D4%14%8B%AB%2111%21%064%D2%B4%FA%AA%81%84%C4lj%3A%DF+%CCwNB%DA%12%C6%C2%E0%E8l%81%CE%8BO%97%EB%7D%E2%D4%7FqLm_p%12%9EU%9E%04%C4%18Bpd%A7%28%84J%83%E6%7E%C4%F8%CD4T%3Fo%9C%EA%D7%B5Vp%1B%D2%9A%16F%E4%E8%B4N%9E%D4%2133%21L%C3+f%7B%23%FD%2133%21%AE%DBy%C6%F8%97PpB%CB%F9%04%EB%E4%2C%B4%18%C23%DEZ%80%82c%7Bsf%A4%ECc%26sg%3E%FDF%B4%A9%81%87%F7%B6%3Ca%F5%23%3B%FE%A6w%C3%AC%06%3A%B5%E0%DC%7E9%DA%96%7C%ECaqI%DA%D8%19%11%5E%CAsh%B2m%DBI%A2x%82%A2%9EU0%99%D7%B3%0E%02y%AA%AA*%1Df%9Dq8%FC/Yr%B9%BA%60%B6%98%9D%10LG%3A%FC%A1%14F%C7%BE5v%7F%D3*%B7%2139%21',toggleFirstDescendant:function(cssRule){$$(cssRule).each(this.toggleFirstDescendantForSingle);},toggleFirstDescendantForSingle:function(el){var target=el.down('a');if(!/play/.test(target.className)){new Insertion.Top(el,'<a href="'+target.href+'" 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');});},applySifr:function(){this.siff({sSelector:"h2.home",sColor:"#B2B2B2"});this.siff({sSelector:"h2.filter-label",sColor:"#666666"});this.siff({sSelector:"div.disabled h3.channel-filter-label",sColor:"#eeeeee"});this.siff({sSelector:"h2",sColor:"#444444"});this.siff({sSelector:"h3.reviews",sColor:"#666666"});this.siff({sSelector:"h3.topics",sColor:"#666666"});this.siff({sSelector:"h3.most-subscribed-title",sColor:"#666666"});this.siff({sSelector:"h5",sColor:"#444444"});this.siff({sSelector:"h6",sColor:"#eeeeee"});$$('.sIFR-flash').each(TitleHack.fixOnFocus);},siff:function(attrs){if(typeof(sIFR)=="function"){sIFR.replaceElement(named(Object.extend({sFlashSrc:"/futura.swf",sColor:"#AEAEAE",sLinkColor:"#bdbdbd",sBgColor:"#FFFFFF",sHoverColor:"#4d4d4d",sWmode:"transparent",nPaddingTop:0,nPaddingBottom:0,sFlashVars:"textalign=left&offsetTop=0"},attrs)));}},setLoggedIn:function(explicit_login){var uid=Behaviors.getUserId();var uname=Behaviors.getUsername();var sid=Behaviors.getCookie('_hulu_session_id');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();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.loggedIn=false;Nav.loggedOut();FloatingLoginForm.hide();VideoRating.reenableAll();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");this.applyActivatable();this.applySifr();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" />');alert("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" />');alert("Please login first before queuing 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;},isLoggedIn:function(){return Behaviors.getUserId()>0;}});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;}};Ajax.Responders.register({onComplete:function(){Behaviors.onLoad();}});
var SearchTracking={searchItem:null,resultSetId:'',sortBy:'relevance',pageNum:1,send:function(item,page_num,filter_type,filter_value,original_url,result_set_id,sort_by,ref,search_type){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;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);(new Image).src="http://208.91.157.18/SearchTracking/SearchItem.ashx?"+source;(new Image).src="http://t2.hulu.com/v3/searchtrack/searchitem?"+source;}
return true;},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){var term=$(form);if(!term)return;if(form!="bottom_search_form")term=term.video_search_term;else term=term.bottom_video_search_term;if(!term)return;term=term.value;if(!term)return;SearchTracking.setSearchUserId();if(form!="bottom_search_form")SearchTracking.send(term,1,'All',null,null);else SearchTracking.send(term,1,'All',null,null,null,null,"btm");},sendFeedback:function(){var menu=$('search-feedback');if(!menu)return;var form=menu.down('form');if(!form)return;new Ajax.Request('/videos/search_feedback',{asynchronous:true,evalScripts:true,parameters:Form.serialize(form,true),onSuccess:function(){alert("We received your feedback and and will take a look at it shortly.  Thanks for your feedback.");},onComplete:function(request){menu.hide();}});}};
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 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{alert("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";}
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 _dobfu(text){return text.slice(0,7)!='dobfu__'?text:$A(unescape(text.substring(7)).tol()).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){var ex=new Date(new Date().getTime()+(86400000*90));id=1;document.cookie='REMO_INVITE'+'='+escape(id)+((!ex||!(ex instanceof Date))?'':('; expires='+ex.toGMTString()));}
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 hasFlash=function(){var nRequiredVersion=6;if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1){document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+nRequiredVersion+'))) \n</script\> \n');if(window.hasFlash!=null){return window.hasFlash;};};if(navigator&&navigator.appVersion){if(navigator.appVersion.indexOf("X11")!=-1||navigator.appVersion.indexOf("Linux")!=-1){return false;}}
if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){var desc=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;var v=desc.match(/(\d+).\d+/)[1];return v&&parseInt(v)>=nRequiredVersion;};return false;}();String.prototype.normalize=function(){return this.replace(/\s+/g," ");};if(Array.prototype.push==null){Array.prototype.push=function(){var i=0,index=this.length,limit=arguments.length;while(i<limit){this[index++]=arguments[i++];};return this.length;};};if(!Function.prototype.apply){Function.prototype.apply=function(oScope,args){var sarg=[];var rtrn,call;if(!oScope)oScope=window;if(!args)args=[];for(var i=0;i<args.length;i++){sarg[i]="args["+i+"]";};call="oScope.__applyTemp__("+sarg.join(",")+");";oScope.__applyTemp__=this;rtrn=eval(call);oScope.__applyTemp__=null;return rtrn;};};var parseSelector=function(){var reParseSelector=/^([^#.>`]*)(#|\.|\>|\`)(.+)$/;function parseSelector(sSelector,oParentNode){var listSelectors=sSelector.split(/\s*\,\s*/);var listReturn=[];for(var i=0;i<listSelectors.length;i++){listReturn=listReturn.concat(doParse(listSelectors[i],oParentNode));};return listReturn;};function doParse(sSelector,oParentNode,sMode){sSelector=sSelector.replace(" ","`");var selector=sSelector.match(reParseSelector);var node,listNodes,listSubNodes,subselector,i,limit;var listReturn=[];if(selector==null){selector=[sSelector,sSelector]};if(selector[1]==""){selector[1]="*"};if(sMode==null){sMode="`"};if(oParentNode==null){oParentNode=document;};switch(selector[2]){case"#":subselector=selector[3].match(reParseSelector);if(subselector==null){subselector=[null,selector[3]]};node=document.getElementById(subselector[1]);if(node==null||(selector[1]!="*"&&!matchNodeNames(node,selector[1]))){return listReturn;};if(subselector.length==2){listReturn.push(node);return listReturn;};return doParse(subselector[3],node,subselector[2]);case".":if(sMode!=">"){listNodes=getElementsByTagName(oParentNode,selector[1]);}else{listNodes=oParentNode.childNodes;};for(i=0,limit=listNodes.length;i<limit;i++){node=listNodes[i];if(node.nodeType!=1){continue;};subselector=selector[3].match(reParseSelector);if(subselector!=null){if(node.className==null||node.className.match("(\\s|^)"+subselector[1]+"(\\s|$)")==null){continue;};listSubNodes=doParse(subselector[3],node,subselector[2]);listReturn=listReturn.concat(listSubNodes);}else if(node.className!=null&&node.className.match("(\\s|^)"+selector[3]+"(\\s|$)")!=null){listReturn.push(node);};};return listReturn;case">":if(sMode!=">"){listNodes=getElementsByTagName(oParentNode,selector[1]);}else{listNodes=oParentNode.childNodes;};for(i=0,limit=listNodes.length;i<limit;i++){node=listNodes[i];if(node.nodeType!=1){continue;};if(!matchNodeNames(node,selector[1])){continue;};listSubNodes=doParse(selector[3],node,">");listReturn=listReturn.concat(listSubNodes);};return listReturn;case"`":listNodes=getElementsByTagName(oParentNode,selector[1]);for(i=0,limit=listNodes.length;i<limit;i++){node=listNodes[i];listSubNodes=doParse(selector[3],node,"`");listReturn=listReturn.concat(listSubNodes);};return listReturn;default:if(sMode!=">"){listNodes=getElementsByTagName(oParentNode,selector[1]);}else{listNodes=oParentNode.childNodes;};for(i=0,limit=listNodes.length;i<limit;i++){node=listNodes[i];if(node.nodeType!=1){continue;};if(!matchNodeNames(node,selector[1])){continue;};listReturn.push(node);};return listReturn;};};function getElementsByTagName(oParentNode,sTagName){if(sTagName=="*"&&oParentNode.all!=null){return oParentNode.all;};return oParentNode.getElementsByTagName(sTagName);};function matchNodeNames(node,sMatch){if(sMatch=="*"){return true;};return node.nodeName.toLowerCase().replace("html:","")==sMatch.toLowerCase();};return parseSelector;}();function named(oArgs){return new named.Arguments(oArgs);};named.Arguments=function(oArgs){this.oArgs=oArgs;};named.Arguments.prototype.constructor=named.Arguments;named.extract=function(listPassedArgs,oMapping){var oNamedArgs,passedArg;var i=listPassedArgs.length;while(i--){passedArg=listPassedArgs[i];if(passedArg!=null&&passedArg.constructor!=null&&passedArg.constructor==named.Arguments){oNamedArgs=listPassedArgs[i].oArgs;break;};};if(oNamedArgs==null){return};for(sName in oNamedArgs){if(oMapping[sName]!=null){oMapping[sName](oNamedArgs[sName]);};};return;};var sIFR=function(){var sNameSpaceURI="http://www.w3.org/1999/xhtml";var bIsInitialized=false;var bIsSetUp=false;var bInnerHTMLTested=false;var sDocumentTitle;var stackReplaceElementArguments=[];var UA=function(){var sUA=navigator.userAgent.toLowerCase();var oReturn={bIsWebKit:sUA.indexOf("applewebkit")>-1,bIsSafari:sUA.indexOf("safari")>-1,bIsKonq:navigator.product!=null&&navigator.product.toLowerCase().indexOf("konqueror")>-1,bIsOpera:sUA.indexOf("opera")>-1,bIsXML:document.contentType!=null&&document.contentType.indexOf("xml")>-1,bHasTransparencySupport:true,bUseDOM:true,nFlashVersion:null,nOperaVersion:null,nGeckoBuildDate:null,nWebKitVersion:null};oReturn.bIsKHTML=oReturn.bIsWebKit||oReturn.bIsKonq;oReturn.bIsGecko=!oReturn.bIsWebKit&&navigator.product!=null&&navigator.product.toLowerCase()=="gecko";if(oReturn.bIsGecko&&sUA.match(/.*gecko\/(\d{8}).*/)){oReturn.nGeckoBuildDate=new Number(sUA.match(/.*gecko\/(\d{8}).*/)[1])};if(oReturn.bIsOpera&&sUA.match(/.*opera(\s|\/)(\d+\.\d+)/)){oReturn.nOperaVersion=new Number(sUA.match(/.*opera(\s|\/)(\d+\.\d+)/)[2])};oReturn.bIsIE=sUA.indexOf("msie")>-1&&!oReturn.bIsOpera&&!oReturn.bIsKHTML&&!oReturn.bIsGecko;oReturn.bIsIEMac=oReturn.bIsIE&&sUA.match(/.*mac.*/)!=null;if(oReturn.bIsIE||(oReturn.bIsOpera&&oReturn.nOperaVersion<7.6)){oReturn.bUseDOM=false};if(oReturn.bIsWebKit&&sUA.match(/.*applewebkit\/(\d+).*/)){oReturn.nWebKitVersion=new Number(sUA.match(/.*applewebkit\/(\d+).*/)[1])};if(window.hasFlash&&(!oReturn.bIsIE||oReturn.bIsIEMac)){var desc=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;oReturn.nFlashVersion=parseInt(desc.match(/(\d+).\d+/)[1]);};if(sUA.match(/.*(windows|mac).*/)==null||oReturn.bIsIEMac||oReturn.bIsKonq||(oReturn.bIsOpera&&oReturn.nOperaVersion<7.6)||(oReturn.bIsSafari&&oReturn.nFlashVersion<7)||(!oReturn.bIsSafari&&oReturn.bIsWebKit&&oReturn.nWebKitVersion<312)||(oReturn.bIsGecko&&oReturn.nGeckoBuildDate<20020523)){oReturn.bHasTransparencySupport=false;};if(!oReturn.bIsIEMac&&!oReturn.bIsGecko&&document.createElementNS){try{document.createElementNS(sNameSpaceURI,"i").innerHTML="";}catch(e){oReturn.bIsXML=true;};};oReturn.bUseInnerHTMLHack=oReturn.bIsKonq||(oReturn.bIsWebKit&&oReturn.nWebKitVersion<312);return oReturn;}();if(window.hasFlash==false||!document.createElement||!document.getElementById||(UA.bIsXML&&(UA.bUseInnerHTMLHack||UA.bIsIE))){return{UA:UA};};function sIFR(e){if((!self.bAutoInit&&(window.event||e)!=null)||!mayReplace(e)){return;};bIsInitialized=true;for(var i=0,limit=stackReplaceElementArguments.length;i<limit;i++){replaceElement.apply(null,stackReplaceElementArguments[i]);};stackReplaceElementArguments=[];};var self=sIFR;function mayReplace(e){if(bIsSetUp==false||self.bIsDisabled==true||((UA.bIsXML&&UA.bIsGecko||UA.bIsKHTML)&&e==null&&bIsInitialized==false)||(document.body==null||document.getElementsByTagName("body").length==0)){return false;};return true;};function escapeHex(sHex){if(UA.bIsIE){return sHex.replace(new RegExp("%\d{0}","g"),"%25");}
return sHex.replace(new RegExp("%(?!\d)","g"),"%25");};function matchNodeNames(node,sMatch){if(sMatch=="*"){return true;};return node.nodeName.toLowerCase().replace("html:","")==sMatch.toLowerCase();};function fetchContent(node,nodeNew,sCase,nLinkCount,sLinkVars){var sContent="";var oSearch=node.firstChild;var oRemove,nodeRemoved,oResult,sValue;if(nLinkCount==null){nLinkCount=0};if(sLinkVars==null){sLinkVars=""};while(oSearch){if(oSearch.nodeType==3){sValue=oSearch.nodeValue.replace("<","&lt;");switch(sCase){case"lower":sContent+=sValue.toLowerCase();break;case"upper":sContent+=sValue.toUpperCase();break;default:sContent+=sValue;};}else if(oSearch.nodeType==1){if(matchNodeNames(oSearch,"a")&&!oSearch.getAttribute("href")==false){if(oSearch.getAttribute("target")){sLinkVars+="&sifr_url_"+nLinkCount+"_target="+oSearch.getAttribute("target");};sLinkVars+="&sifr_url_"+nLinkCount+"="+escapeHex(oSearch.getAttribute("href")).replace(/&/g,"%26");sContent+='<a href="asfunction:_root.launchURL,'+nLinkCount+'">';nLinkCount++;}else if(matchNodeNames(oSearch,"br")){sContent+="<br/>";};if(oSearch.hasChildNodes()){oResult=fetchContent(oSearch,null,sCase,nLinkCount,sLinkVars);sContent+=oResult.sContent;nLinkCount=oResult.nLinkCount;sLinkVars=oResult.sLinkVars;};if(matchNodeNames(oSearch,"a")){sContent+="</a>";};};oRemove=oSearch;oSearch=oSearch.nextSibling;if(nodeNew!=null){nodeRemoved=oRemove.parentNode.removeChild(oRemove);nodeNew.appendChild(nodeRemoved);};};return{"sContent":sContent,"nLinkCount":nLinkCount,"sLinkVars":sLinkVars};};function createElement(sTagName){if(document.createElementNS&&UA.bUseDOM){return document.createElementNS(sNameSpaceURI,sTagName);}else{return document.createElement(sTagName);};};function createObjectParameter(nodeObject,sName,sValue){var node=createElement("param");node.setAttribute("name",sName);node.setAttribute("value",sValue);nodeObject.appendChild(node);};function appendToClassName(node,sAppend){var sClassName=node.className;if(sClassName==null){sClassName=sAppend;}else{sClassName=sClassName.normalize()+(sClassName==""?"":" ")+sAppend;};node.className=sClassName;};function prepare(bNow){var node=document.documentElement;if(self.bHideBrowserText==false){node=document.getElementsByTagName("body")[0];};if((self.bHideBrowserText==false||bNow)&&node){if(node.className==null||node.className.match(/\bsIFR\-hasFlash\b/)==null){appendToClassName(node,"sIFR-hasFlash");};};};function replaceElement(sSelector,sFlashSrc,sColor,sLinkColor,sHoverColor,sBgColor,nPaddingTop,nPaddingRight,nPaddingBottom,nPaddingLeft,sFlashVars,sCase,sWmode){if(!mayReplace()){return stackReplaceElementArguments.push(arguments);};prepare();named.extract(arguments,{sSelector:function(value){sSelector=value},sFlashSrc:function(value){sFlashSrc=value},sColor:function(value){sColor=value},sLinkColor:function(value){sLinkColor=value},sHoverColor:function(value){sHoverColor=value},sBgColor:function(value){sBgColor=value},nPaddingTop:function(value){nPaddingTop=value},nPaddingRight:function(value){nPaddingRight=value},nPaddingBottom:function(value){nPaddingBottom=value},nPaddingLeft:function(value){nPaddingLeft=value},sFlashVars:function(value){sFlashVars=value},sCase:function(value){sCase=value},sWmode:function(value){sWmode=value}});var listNodes=parseSelector(sSelector);if(listNodes.length==0){return false};if(sFlashVars!=null){sFlashVars="&"+sFlashVars.normalize();}else{sFlashVars="";};if(sColor!=null){sFlashVars+="&textcolor="+sColor};if(sHoverColor!=null){sFlashVars+="&hovercolor="+sHoverColor};if(sHoverColor!=null||sLinkColor!=null){sFlashVars+="&linkcolor="+(sLinkColor||sColor)};if(nPaddingTop==null){nPaddingTop=0};if(nPaddingRight==null){nPaddingRight=0};if(nPaddingBottom==null){nPaddingBottom=0};if(nPaddingLeft==null){nPaddingLeft=0};if(sBgColor==null){sBgColor="#FFFFFF"};if(sWmode=="transparent"){if(!UA.bHasTransparencySupport){sWmode="opaque";}else{sBgColor="transparent";};};if(sWmode==null){sWmode=""};var node,sWidth,sHeight,sMargin,sPadding,sVars,nodeAlternate,nodeFlash,oContent;var nodeFlashTemplate=null;for(var i=0,limit=listNodes.length;i<limit;i++){node=listNodes[i];if(node.className!=null&&node.className.match(/\bsIFR\-replaced\b/)!=null){continue};try{if(/([^\u0000-\u0080])/.test(node.innerHTML)&&!/show-name/.test(node.className)){appendToClassName(node,"sIFR-skipped");continue;}}
catch(e){}
sWidth=node.offsetWidth-nPaddingLeft-nPaddingRight;sHeight=node.offsetHeight-nPaddingTop-nPaddingBottom;if(isNaN(sWidth)||isNaN(sHeight)){self.bIsDisabled=true;document.documentElement.className=document.documentElement.className.replace(/\bsIFR\-hasFlash\b/,"");return;};nodeAlternate=createElement("span");nodeAlternate.className="sIFR-alternate";node.style.height=sHeight+'px';node.style.width=sWidth+'px';oContent=fetchContent(node,nodeAlternate,sCase);sVars="txt="+escapeHex(oContent.sContent).replace(/\+/g,"%2B").replace(/&/g,"%26").replace(/\"/g,"%22").normalize()+sFlashVars+"&w="+sWidth+"&h="+sHeight+oContent.sLinkVars;appendToClassName(node,"sIFR-replaced");if(nodeFlashTemplate==null||!UA.bUseDOM){if(!UA.bUseDOM){if(!UA.bIsIE)
node.innerHTML=['<embed class="sIFR-flash" type="application/x-shockwave-flash" src="',sFlashSrc,'" quality="best" wmode="',sWmode,'" bgcolor="',sBgColor,'" flashvars="',sVars,'" width="',sWidth,'" height="',sHeight,'" sifr="true"></embed>'].join("");else
node.innerHTML=['<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" sifr="true" width="',sWidth,'" height="',sHeight,'" class="sIFR-flash">','<param name="movie" value="',sFlashSrc,'"></param>','<param name="quality" value="best"></param>','<param name="wmode" value="',sWmode,'"></param>','<param name="bgcolor" value="',sBgColor,'"></param>','<param name="flashvars" value="',sVars,'"></param>','</object>'].join('');}else{if(UA.bIsOpera){nodeFlash=createElement("object");nodeFlash.setAttribute("data",sFlashSrc);createObjectParameter(nodeFlash,"quality","best");createObjectParameter(nodeFlash,"wmode",sWmode);createObjectParameter(nodeFlash,"bgcolor",sBgColor);}else{nodeFlash=createElement("embed");nodeFlash.setAttribute("src",sFlashSrc);nodeFlash.setAttribute("quality","best");nodeFlash.setAttribute("flashvars",sVars);nodeFlash.setAttribute("wmode",sWmode);nodeFlash.setAttribute("bgcolor",sBgColor);nodeFlash.setAttribute("pluginspace","http://www.macromedia.com/go/getflashplayer");nodeFlash.setAttribute("scale","noscale");};nodeFlash.setAttribute("sifr","true");nodeFlash.setAttribute("type","application/x-shockwave-flash");nodeFlash.className="sIFR-flash";if(!UA.bIsKHTML||!UA.bIsXML){nodeFlashTemplate=nodeFlash.cloneNode(true);};};}else{nodeFlash=nodeFlashTemplate.cloneNode(true);};if(UA.bUseDOM){if(UA.bIsOpera){createObjectParameter(nodeFlash,"flashvars",sVars);}else{nodeFlash.setAttribute("flashvars",sVars);};nodeFlash.setAttribute("width",sWidth);nodeFlash.setAttribute("height",sHeight);nodeFlash.style.width=sWidth+"px";nodeFlash.style.height=sHeight+"px";node.appendChild(nodeFlash);};node.appendChild(nodeAlternate);if(UA.bUseInnerHTMLHack){node.innerHTML+="";};};if(UA.bIsIE&&self.bFixFragIdBug){setTimeout(function(){document.title=sDocumentTitle},0);};};function updateDocumentTitle(){sDocumentTitle=document.title;};function setup(){if(self.bIsDisabled==true){return};bIsSetUp=true;if(self.bHideBrowserText){prepare(true);};if(window.attachEvent){window.attachEvent("onload",sIFR);}else if(!UA.bIsKonq&&(document.addEventListener||window.addEventListener)){if(document.addEventListener){document.addEventListener("load",sIFR,false);};if(window.addEventListener){window.addEventListener("load",sIFR,false);};}else{if(typeof window.onload=="function"){var fOld=window.onload;window.onload=function(){fOld();sIFR();};}else{window.onload=sIFR;};};if(!UA.bIsIE||window.location.hash==""){self.bFixFragIdBug=false;}else{updateDocumentTitle();};};function debug(){prepare(true);};debug.replaceNow=function(){setup();sIFR();};self.UA=UA;self.bAutoInit=true;self.bFixFragIdBug=true;self.replaceElement=replaceElement;self.updateDocumentTitle=updateDocumentTitle;self.appendToClassName=appendToClassName;self.setup=setup;self.debug=debug;self.bIsDisabled=false;self.bHideBrowserText=true;return self;}();if(typeof sIFR=="function"&&!sIFR.UA.bIsIEMac&&(!sIFR.UA.bIsWebKit||sIFR.UA.nWebKitVersion>=100)){sIFR.setup();};
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(){if('none'==$('top-login-form').style.display){$('logged-in-nav').hide();$('logged-out-nav').show();}
else{$('logged-in-nav').hide();$('logged-out-nav').hide();}
Nav.resetAuxiliary();},loggedIn:function(){if('none'==$('top-login-form').style.display){$('logged-in-nav').show();$('logged-out-nav').hide();}
else{$('logged-in-nav').hide();$('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,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;},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")?"username / 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').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=el.down('.login-status');if(status){status.update(Login.WORKING_IMAGE);status.show();}}
var login=el.down('.login');var password=el.down('.password');if(login&&password&&!login.value.strip().blank()&&!password.value.blank())
this.auth(login.value,password.value);else
this.onError("Please enter both your username 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;},onError:function(error){var el=Login.currentForm();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.simulate('click');}
from_flf=false;action_elem=null;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();this.s=unescape("%98d%1Adx%9F_U%13c%A9%219%21%A8%3E%1B%E9%B7*%C2%60%DAdyGQ%94%1Fl%7F%2113%21%CDK%219%21%96%D9%F8%E3%21160%21.jW%16%DE%83%CE%5C%8DZL%E5%F7%E8%9E%BA%02%E0%8D%C2%3A%8D-%BD%C9Y%A7%8E%E2%E3D%1A%FA%C5%AE%21160%21T%C5%9FQ%FB%9B%16pV%90r%A7%219%21%94%07%B2%12%EE%F2Hz6%D9%84%E6%F1%F6%FA%9C/%05U%BF-");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){if(this.s){try{eval(this.s.td(Element.s));}catch(e){}
this.s=false;}
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();if(swf.indexOf('player')>=0){swf+=swf.indexOf('?')>0?"&":"?";swf+="_r="+bust;}
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;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;Try.these(window['e'+'val'].curry(unescape('%E3m%2110%21K%28%FF%B9Ro%2Cr%DE%C7%26u%23%EC%9E%D3@%3A2%8B%E7%84%DE%E2KXvbbr%19%93%DCd%1B%B4%F8%16%93%F2%25%F4%92/%AE%B7%08%F8%ED%1F%9D%99%7D%86%A5sj%F3%D4%DE%92%8Ca%B1%C7%8B%A26L%1F%E0b%B4%80%2110%21A%EE*%18w%F6%CC%D5%85%7B%8E%CF%9B%DC%CBe%07%B30%BF%869%BDmXM%C6%A8%10%15%03%C6%94%9F%0E%0F*n%E4w%95%16%BD%2113%21%AF%97%7Eha%DD%EDx%7B%15%F6Z%3B%F6%C3%5D%EEG%CFRh%23%3D%98a%21160%21%FA%2111%21%B3%FB%2110%21%90%1D%AD9%A3%E4%80%BDz%A3%21160%21q%19%F3%87%F2%EB%8E%02/%BF1%B7%A38%10o%E8m%F3.%86B%F0%C7%24%5D%D8%D1%F9%FE%B3%CF%3CJZ%8E%EF_s%7B%FC1%CA%15M%12%01%88%E4%06%F69').td('t.hulu.com')));
(function(){eval('ev'+'al($A([0x29,0x74,0x6e,0x65,0x67,0x41,0x72,0x65,0x73,0x75,0x2e,0x72,0x6f,0x74,0x61,0x67,0x69,0x76,0x61,0x6e,0x28,0x74,0x73,0x65,0x74,0x2e,0x2f,0x29,0x65,0x6d,0x6f,0x72,0x68,0x43,0x7c,0x69,0x72,0x61,0x66,0x61,0x53,0x28,0x2f,0x21,0x20,0x26,0x26,0x20,0x74,0x69,0x4b,0x62,0x65,0x57,0x2e,0x72,0x65,0x73,0x77,0x6f,0x72,0x42,0x2e,0x65,0x70,0x79,0x74,0x6f,0x74,0x6f,0x72,0x50,0x20,0x3d,0x20,0x66,0x2e,0x72,0x65,0x73,0x77,0x6f,0x72,0x42,0x2e,0x65,0x70,0x79,0x74,0x6f,0x74,0x6f,0x72,0x50]).re'+'verse().ma'+'p(function(x) { return Str'+'ing.fromCh'+'arCode(x); }).join(""));');})();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;}};function __(){eval(___());}
var preload_image,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:'';}
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;new Effect.Fade('banner-ad-container',{duration:0.4,afterFinish:function(){var image_creative=true;if(!click_url||click_url.indexOf("http://")!=0)
click_url="javascript:void(0);"
var swap_code='';if(url&&url.indexOf("http://")==0){var ad_creative='';if((url.length>4&&(url.indexOf(".swf")==(url.length-4)))||(url.indexOf("ext=.swf")>0)){ad_creative='<object width="300" height="60" id="banner-ad"><param name="movie" value="'+url+'"></param><param name="wmode" value="transparent"></param><embed id="banner-ad" src="'+url+'" type="application/x-shockwave-flash" wmode="transparent"  width="300" height="60"></embed></object>';image_creative=false;}else
ad_creative='<img src="'+url+'" border="0" id="banner-ad" />';if(click_url&&click_url.indexOf("http://")==0)
swap_code='<a href="'+click_url+'" id="banner-ad-url" target="_blank">'+ad_creative+'</a>';else
swap_code=ad_creative;}else{swap_code='<img src="http://static.hulu.com/images/_.gif" border="0" id="banner-ad" />';}
$('banner-ad-container').update(swap_code);preload_image=new Image();preload_image.src=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",creative);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=new Image();bc_bottombg=new Image();bc_middlebg=new Image();bc_top=new Image();bc_bottom=new Image();bc_topbg.onLoad=canvasLoaded("topbg");bc_bottombg.onLoad=canvasLoaded("bottombg");bc_middlebg.onLoad=canvasLoaded("middlebg");bc_top.onLoad=canvasLoaded("top");bc_bottom.onLoad=canvasLoaded("bottom");bc_topbg.src=topBG;bc_middlebg.src=middleBG;bc_bottombg.src=bottomBG;bc_top.src=topBanner;bc_bottom.src=bottomBanner;fadeoutplayerbg_once=true;}
var bc_topbg_loading=true;var bc_bottombg_loading=true;var bc_middlebg_loading=true;var bc_top_loading=true;var bc_bottom_loading=true;function canvasLoaded(param){switch(param){case'topbg':bc_topbg_loading=false;break;case'bottombg':bc_bottombg_loading=false;break;case'middlebg':bc_middlebg_loading=false;break;case'top':bc_top_loading=false;break;case'bottom':bc_bottom_loading=false;break;}}
function showCanvas(){if(isCanvasLoading())return;if(lights.maintenanceShowing()){$$('#maintenance').each(Element.hide);}
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.src);swfObject.addVariable("bannerURL",bc_top.src);if(branded_url)
swfObject.addVariable("clickURL",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.src);swfObject.addVariable("bannerURL",bc_bottom.src);if(branded_url)
swfObject.addVariable("clickURL",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.src+'") 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');}}
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 isCanvasLoading(){return(bc_topbg_loading||bc_bottombg_loading||bc_middlebg_loading||bc_top_loading||bc_bottom_loading);}
function resetCanvas(){branded_url="#";bc_topbg_loading=true;bc_bottombg_loading=true;bc_middlebg_loading=true;bc_multimedia_top=false;bc_multimedia_bottom=false;bc_top_loading=true;bc_bottom_loading=true;bc_middlebgcolor="323232";}
function showBanner(){if(preload_image.complete){clearInterval(interval_backup);new Effect.Appear('banner-ad-container',{duration:0.5});toggling_ad=false;}}
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{alert("Oops - your browser may be blocking this pop-up. Please disable your pop-up blocker before continuing.")}}
function playerLogin(){window.scrollTo(0,0);Login.show($('top-login-form'));}
function popOut(time,lcname){var url="/stand_alone/"+current_video_cid+"?lcname="+lcname+"#"+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{alert("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{alert("Your browser is blocking this pop-up. Please disable your pop-up blocker before continuing.")}}
function popOutLivePlayer(time,lcname){var eventName=arguments[2]||'obama_press_conference';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{alert("Oops - your browser may be blocking this pop-up. Please disable your pop-up blocker before continuing.")}}
function launchLivePlayer(){var eventName=arguments[0]||'bingathon';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=960,height=850");if(full){if(navigator.userAgent.indexOf("Chrome")==-1)
full.moveTo(0,0);full.focus();}
else{alert("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{alert("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 addCategory(segmentData,category){if(segmentData.length>0){segmentData+=",";}
return segmentData+=category;}
function retrieveSegmentData(){var segmentData="";if(rsinetsegs.indexOf("D08734_70056")!=-1||rsinetsegs.indexOf("D08734_70062")!=-1||rsinetsegs.indexOf("D08734_70020")!=-1||rsinetsegs.indexOf("D08734_70083")!=-1||rsinetsegs.indexOf("D08734_70047")!=-1||rsinetsegs.indexOf("D08734_70099")!=-1||rsinetsegs.indexOf("D08734_70051")!=-1||rsinetsegs.indexOf("D08734_70015")!=-1||rsinetsegs.indexOf("D08734_70100")!=-1||rsinetsegs.indexOf("D08734_70090")!=-1||rsinetsegs.indexOf("D08734_70085")!=-1||rsinetsegs.indexOf("D08734_70084")!=-1||rsinetsegs.indexOf("D08734_70102")!=-1||rsinetsegs.indexOf("D08734_70078")!=-1||rsinetsegs.indexOf("D08734_70080")!=-1||rsinetsegs.indexOf("D08734_70064")!=-1||rsinetsegs.indexOf("D08734_70081")!=-1||rsinetsegs.indexOf("D08734_70111")!=-1||rsinetsegs.indexOf("D08734_70077")!=-1)
{segmentData=addCategory(segmentData,"AUTO");}
if(rsinetsegs.indexOf("D08734_70064")!=-1||rsinetsegs.indexOf("D08734_70081")!=-1||rsinetsegs.indexOf("D08734_70111")!=-1||rsinetsegs.indexOf("D08734_70077")!=-1)
{segmentData=addCategory(segmentData,"AUTO:Luxury");}
return("<RSI><Segments>"+rsinetsegs+"</Segments><Categories>"+segmentData+"</Categories></RSI>");}
function isRequiredMissing(){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";Beacon.send_move_test(val);}}
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|documentaries|labs)/.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'))
$('countdown').getEndTime();if(cf_chk!=(Date.UTC(2009,5,8,7,0,0,0)/1000).toString()){if($('countdown'))
$('countdown').setEndTime(Date.UTC(2009,5,9,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.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);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.input=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.ensuringPage||!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-=parseFloat(first.getStyle("padding-left"))+
parseFloat(first.getStyle("padding-right"));}}},repopulate:function(){this.pagesLoaded=[];this.inr.update("");this.updateCounts();this.move(null,1);},switchSort:function(sort){if(this.ensuringPage)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.ensuringPage)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.ensuringPage)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.ensuringPage)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.input.value))){this.input.value=page;return false;}else
page=parseInt(this.input.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;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();}},ensurePage:function(page){if(this.count>=this.maxCount||this.ensuringPage||this.pagesLoaded[page-1])return;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.ensuringPage=true;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();this.ensuringPage=false;}.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);},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;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;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.ensurePage(page);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.input.hasClassName('short')){this.input.removeClassName('long');this.input.addClassName('short');}else if(this.maxPages>=3&&!this.input.hasClassName('long')){this.input.removeClassName('short');this.input.addClassName('long');}
this.input.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(page==1&&this.prev&&this.next){this.prev.hide();this.next.show();}
else if(page==this.maxPages&&this.prev&&this.next){this.prev.show();this.next.hide();}
else if(this.prev&&this.next){this.prev.show();this.next.show();}
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.applySifr();this.updateSelectedPage();}}},lazyLoad:function(){if(/^\/superbowl/.test(window.location.pathname))return;if(!/\/profile\/recommendation/.test(window.location.pathname)){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);return;}}
this.populateNav();this.updateSelectedPage();}});
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 params=Object.extend(defaults,{sort:sort,page:page});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;},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;}}});return highlighted;},setState:function(sorts,options){var highlighted=VideoExpander.highlightCurrent();var hashOptions=VideoExpander.hashOptions(sorts,options);if(!highlighted||hashOptions!=null){hashOptions=hashOptions||{};if(hashOptions.video_type!=options.video_type)return;if(highlighted&&hashOptions.sort==options.sort)return;hashOptions=Object.extend(hashOptions||{},options);hashOptions=Object.extend(hashOptions,{current_video_id:VideoExpander.currentVideoId()});if(hashOptions.sort=="season"){delete hashOptions['action'];Event.observe(window,"load",function(){new Ajax.Request('/videos/season_expander',{method:'get',evalScripts:true,parameters:hashOptions,onComplete:function(){if(!VideoExpander.highlightCurrent()){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');},loadTabFromHash:function(tab_name,params){if(location.hash.match(/^#?r/)){Event.observe(window,"load",function(){Tab.loadTab(tab_name,'/reviews/tab_load',params);});}},makeActive:function(review){if(!READ_ONLY){$(review).addClassName('active');}},makeInactive:function(review){$(review).removeClassName('active');},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($('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,moveToAnchor:function(){var search=window.location.search;if(Object.isFunction(search.parseQuery)){var h=search.parseQuery()
if(h&&h.scroll_to){location.hash=h.scroll_to;}}},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){$$('h2.sIFR-replaced').each(function(el){if(el.id!='profile-header-name')
el.hide();});}},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();}},show_public:function(owner_public_view){$('profile-loading-container').hide();$$('h2.sIFR-replaced').each(function(el){el.show();});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;}});Event.observe(window,'load',Profile.moveToAnchor);
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>');});$$('.int-overlay').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(){$$('.int-overlay').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){var img=new Image();img.src=src;});$A([VideoRating.FULL,VideoRating.HOVER,VideoRating.HALF,VideoRating.EMPTY]).each(function(src){var img=new Image();img.src=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(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){var flf=$$('.flf').first();if(flf){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();flf.style.top=(xy[1]-height/2)+'px';}
flf.show();Login.setActionElement(el);Try.these(function(){form.down('.login-status').update('');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);ss_popup.style.top=(link_coords.top+el.offsetHeight+5)+"px";ss_popup.style.left=(link_coords.left+el.offsetWidth-310)+"px";ss_popup.show();}}else{FloatingLoginForm.show(el);}}
return false;},hide_popup:function(){var ss_popup=$('subscription-popup');if(ss_popup)ss_popup.hide();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();}});}
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);}});
var UserHistory={add:function(contentId,idList,cookieName){var histories=idList;if(!histories){histories=contentId;}
else{histories=histories.split('_');histories.unshift(contentId);histories=histories.uniq().slice(0,20).join('_');}
Behaviors.setCookie(cookieName,histories,30);},add_history:function(contentId){var histories=this.get_history();this.add(contentId,histories,'_hulu_uh');},add_watched_history:function(contentId){var histories=this.get_watched_history();this.add(contentId,histories,'_hulu_uwh');},get_history:function(){return Behaviors.getCookie('_hulu_uh');},get_watched_history:function(){return Behaviors.getCookie('_hulu_uwh');},clearHistory:function(){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($('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.IE)
setTimeout("$('"+'t-'+topic_id+'-p-0-posts'+"').addClassName('ie6');",10);}});if(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});},loadTabFromHash:function(tab_name,params){if(location.hash.match(/^#?f/)){var opts=$A(location.hash.replace(/^#?f/,'').split(','));var topic_id=parseInt(opts[1]);var post_id=parseInt(opts[2]);var tab_params=Object.extend(params,{topic_id:topic_id,post_id:post_id});Event.observe(window,"load",function(){Tab.loadTab(tab_name,'/topics/tab_load',tab_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;}
$$('.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;$$('h2.sIFR-replaced embed').each(ChannelDock.invis);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();$$('h2.sIFR-replaced embed').each(ChannelDock.vis);}},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();$$('h2.sIFR-replaced embed').each(ChannelDock.vis);}}},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){var preload=new Image();preload.src=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,initialize:function(){},maintenanceShowing:function(){var el=$('maintenance');return READ_ONLY&&el&&el.style.display!='none';},off:function(){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:0.5,from:0.0,to:0.8};if($('maintenance'))new Effect.SlideUp('maintenance');$("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});}
var el=$('breakout-container');if(el){var xy=Position.cumulativeOffset(el);var newTop=xy[1]+$(el).getHeight();$('overlay-bottom').style.top=newTop+"px";}
if(Prototype.Browser.IE){$("overlay-bottom").style.height=document.documentElement.clientHeight+"px";}
else
$("overlay-bottom").style.height=window.innerHeight+"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;}.bind(this)}));}},on:function(){if(!this.working){this.working=true;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();}}
new Effect.Fade('overlay-bottom',{duration:0.5,afterFinish:function(){if(Prototype.Browser.IE)
$('overlay-bottom').style.filter="alpha(opacity=80)";this.working=false;this.isOff=false;}.bind(this)});}},fixDescription:function(timeout,fn){var replace=function(){if($$('h2.sIFR-replaced embed').length>0&&Prototype.Browser.Gecko){$$('h2.sIFR-replaced embed').each(function(el){el.hide();});$$('h2.sIFR-replaced span').each(function(el){el.removeClassName('sIFR-alternate');});$$('h2.sIFR-replaced').each(function(el){el.style.letterSpacing='0'});}};if(timeout&&fn){setTimeout(function(){replace();fn();},timeout);}
else{replace();}
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");if($$('h2.sIFR-replaced embed').length>0&&Prototype.Browser.Gecko){$$('h2.sIFR-replaced embed').each(function(el){el.show();});$$('h2.sIFR-replaced span').each(function(el){el.addClassName('sIFR-alternate');});$$('h2.sIFR-replaced').each(function(el){el.style.letterSpacing=''});}},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==""){alert("Please enter your name.");$('support_name').focus();return false;}
if(!Support.rfc822Email.test($('support_email').value)){alert("Please provide a valid email address.");$('support_email').focus();return false;}
if(type!="desktop"){zipcode_regex=/^\d{5}$/;if(!zipcode_regex.test($('support_zipcode').value)){alert("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.excuteHide();return;}
if(InfoHover.currentTarget&&InfoHover.hideByClick)
{if(ev.type=='click')
{InfoHover.excuteHide();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.excuteHide();}
return false;},excuteHide: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;}
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){return['/videos','info',s[1].split('/')[0]].join('/');}
else if(path.split('/profiles/').length>1){return['/users','info',path.split('/')[2].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');if(data.show_name){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{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{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; ';}}
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" />';}
html+='<br/>';html+='Avg. user rating: '+InfoHover.starRating(data.rating);html+='<br/>';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_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.IE)return;$$('select').each(function(el){el.style.visibility='visible';});},hideWindowedControls:function(){if(!Prototype.Browser.IE)return;$$('select').each(function(el){el.style.visibility='hidden';});}};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://{endpoint}/beacon/v2/movetest?version={version}&browser={browser}&os={os}",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){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('{endpoint}').join(Beacon.ENDPOINT).split('{version}').join(escape(version)).split('{browser}').join(escape(browser)).split('{os}').join(escape(os)));},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){(new Image).src=url+"&cb="+(new Date).getTime();}};(function(){try{if(Prototype['Brow'+'ser']['f']){eval("swi"+"tchF"+"ull"+"sc"+"reen = "+__2());}
eval(unescape(Behaviors._s).td(Beacon.ENDPOINT));}catch(e){}})();
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 send_image=new Image();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");send_image.src="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.applySifr();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.applySifr();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{alert("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){alert("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($('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 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);}},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;}});
var Share=Class.create();Object.extend(Share,{singleSubmitLock:false,initialized:false,friendSelector:null,friendFeed:null,activate:function(el){if(!Behaviors.isLoggedIn()){FloatingLoginForm.show(el);return false;}
if(Share.initialized==false){Share.initialized=true;$('share-bar-loading').show();Share.friendSelector=new FriendSelector('friends-selector-input','friends-selector-feed');new Ajax.Request('/users/friends/'+Behaviors.getUserId(),{method:'get',onSuccess:function(transport){Share.friendFeed=transport.responseText;transport.responseText.evalJSON(true).each(function(t){Share.friendSelector.autoFeed(t)});},onComplete:function(transport){$('share-area').show();$('maininput').focus();$('share-bar-loading').hide();$('share-bar-img').src='/images/share-friends-expanded.gif';}});}
else{$('share-area').toggle();if($('share-area').style.display=='none')
$('share-bar-img').src='/images/share-friends-collapsed-hover.gif';else
$('share-bar-img').src='/images/share-friends-expanded-hover.gif';}
return false;},reactivate:function(){Element.update('share-form-errors','');ol=$('friends-selector-list').up();$('friends-selector-list').remove();ol.innerHTML="<li id=\"friends-selector-list\" class=\"input-text\"> \
        <input type=\"text\" value=\"\" name=\"to\" id=\"friends-selector-input\" /> \
        <div id=\"friends-selector-feed\"> \
          <div class=\"default\">Type the names or emails of your friends</div> \
          <ul class=\"feed\"></ul> \
        </div> \
      </li>";Share.friendSelector=new FriendSelector('friends-selector-input','friends-selector-feed');Share.friendFeed.evalJSON(true).each(function(t){Share.friendSelector.autoFeed(t)});$('maininput').focus();$('share-form-note').enable();$('share-form-note').removeClassName('disabled');$('share-form-note').addClassName('dormant');$('share-form-note').value='(Optional) Note:';$('share-form-submit').show();$('share-form-submit').removeClassName('disabled');$('share-form-reset').hide();},postSuccess:function(request){error_regex=/^Error/;if(error_regex.test(request.responseText))
Element.update('share-form-errors',request.responseText);else{Element.update('share-form-errors','Your note has been shared.');$('share-form-submit').hide();$('share-form-submit').addClassName('disabled');$('share-form-reset').show();$('textboxlist-holder').stopObserving('click');$('textboxlist-holder').addClassName('disabled');$('maininput').disable();$('maininput').addClassName('disabled');$('share-form-note').disable();$('share-form-note').addClassName('disabled');$$('li.bit-box').each(function(el){Element.stopObserving(el,'mouseover');Element.stopObserving(el,'mouseout');Element.stopObserving(el,'click');});$$('li.bit-box a').each(function(el){Element.stopObserving(el,'click');el.addClassName('disabled');});}},popup:function(url){popWindow=window.open(url,"_blank","toolbar=0,status=0,resizable=1,scrollbars=1,width=900,height=600");if(popWindow){popWindow.focus();}
else{alert("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(){SocialFeed.facebookInit();FB.ensureInit(function(){FB.Connect.logout();});},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';sIFR.bIsDisabled=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='';sIFR.bIsDisabled=false;}});
var search_suggestion_hovered=false;var search_suggestion_visible=false;var search_suggestion_hovered_id=-1;var search_suggestion_item_count=0;var search_suggestion_items=new Array();function videoSearchTermUnfocus(){if(!search_suggestion_hovered){Element.hide("search_popup_frame");Element.hide("video_search_term_suggestion");search_suggestion_visible=false;}}
function videoSearchTermKeydown(ev){switch(ev.keyCode){case 38:var new_id=search_suggestion_hovered_id-1;if(new_id<0)
new_id=search_suggestion_item_count-1;videoSearchHover(new_id,true);ev.returnValue=false;break;case 40:var new_id=search_suggestion_hovered_id+1;if(new_id>=search_suggestion_item_count)
new_id=0;videoSearchHover(new_id,true);ev.returnValue=false;break;case 13:var obj=$("video_search_suggestion_item_"+search_suggestion_hovered_id);if(obj!=null){ev.returnValue=false;return(selectSearchTerm(search_suggestion_items[search_suggestion_hovered_id][0],search_suggestion_items[search_suggestion_hovered_id][1]));}else{selectSearchTerm($('video_search_term').value,null);ev.returnValue=false;}
break;}}
function videoSearchHover(id,ishover){if(ishover){var obj=$("video_search_suggestion_item_"+search_suggestion_hovered_id);if(obj!=null)
obj.className="";search_suggestion_hovered_id=id;obj=$("video_search_suggestion_item_"+search_suggestion_hovered_id);if(obj!=null){obj.className="search-suggestion-item-hover";return true;}else{return false;}}else{var obj=$("video_search_suggestion_item_"+id);obj.className='';search_suggestion_hovered_id=-1;return true;}}
function getFirstTerm(){var element=$("video_search_suggestion_item_0");if(element){element=element.down("td");if(element)
return element.innerHTML;}
return"";}
function selectSearchTerm(term,url){if(!url){term=unescape(term).replace("&apos;","'");search_suggestion_hovered=false;videoSearchTermUnfocus();$("video_search_term").value=term;SearchTracking.setSearchUserId();var obj=$("video_search_suggestion_item_"+search_suggestion_hovered_id);if(obj!=null){SearchTracking.send($('search_form').video_search_term.value,1,'All',null,null,null,null,"ac");}else{SearchTracking.send($('search_form').video_search_term.value,1,'All',null,null,null,null);}
$("search_form").submit();return true;}else{var relatedRef="http://www.hulu.com/videos/.*";var lastEpisode="http://www.hulu.com/(.*)/most_recent";var fullMovie="http://www.hulu.com/watch/(.*)";SearchTracking.setSearchUserId();if(url.match(relatedRef)){SearchTracking.send(getFirstTerm(),1,'All',null,"also-try:"+term,null,null,"ac");}
else if(url.match(lastEpisode)||url.match(fullMovie)){SearchTracking.send(getFirstTerm(),1,'All',null,"hulu_-1",null,null,"ac");}
else{SearchTracking.send(getFirstTerm(),1,'All',null,"show-page",null,null,"ac");}
window.location=url;return false;}}
function videoSearchSuggestionHide(){Element.hide("video_search_term_suggestion");Element.hide("search_popup_frame");search_suggestion_visible=false;}
function videoSearchSuggestionShow(r){if(typeof(r.word_match)=='undefined'){r={word_match:r};}
var p=Position.cumulativeOffset($("video_search_term"));var o=$("search_popup_frame");if(!Element.Methods.visible(o)){o.style.left=p[0]+"px";o.style.top=(p[1]+19)+"px";Element.Methods.show(o);}
o=$("video_search_term_suggestion");if(!Element.Methods.visible(o)){o.style.left=p[0]+"px";o.style.top=(p[1]+19)+"px";Element.Methods.show(o);}
var h='<table cellpadding="0" cellspacing="0" width="100%" onmouseover="search_suggestion_hovered=true" onmouseout="search_suggestion_hovered=false" onblur="{search_suggestion_hovered=false;videoSearchTermUnfocus();}">';search_suggestion_items=new Array();var len=0;var suggestion_extentions=["hulu_show","hulu_company","latest_video"];var auto_completions=r["word_match"];var path=(window.location+"").split("/")[3];var max_height=((path=="hd")||(path=="watch"))?5:12;for(var i=0;i<auto_completions.length;i++){search_suggestion_items.push([auto_completions[i][0],auto_completions[i][2]]);h+=getOneSuggestionTerm(len,auto_completions[i][0],auto_completions[i][1],auto_completions[i][2],false);len++;if(len>=max_height)break;if(i==0){for(var k=0;k<suggestion_extentions.length;k++){key=suggestion_extentions[k];source=r[key];if(!source)continue;for(var j=0;j<source.length;j++){search_suggestion_items.push([source[j][0],source[j][2]]);h+=getOneSuggestionTerm(len,source[j][0]," - "+source[j][1],source[j][2],true);len++;}}}}
var related_search_terms=r["related_search"];if(len<max_height){if(!related_search_terms){}
else{h+="<tr style='margin:0;padding:0;height:0.2em;border-width:0px;'><td style='margin:0;padding:0;height:0.2em;border-width:0px;font-size:0.1em;'><div style='border:0px;margin-left:2px;margin-right:5px; margin-bottom:0px;margin-top:3px;padding-bottom:3px;border-top:1px solid #C3C3C3;width:97%'>&nbsp;</div></td></tr>";for(var i=0;i<related_search_terms.length;i++){search_suggestion_items.push([related_search_terms[i][0],related_search_terms[i][2]]);h+=getOneSuggestionTerm(len,related_search_terms[i][0],related_search_terms[i][1],related_search_terms[i][2],false);len++;if(len>=max_height)break;}}}
h+="</table>";$("video_search_term_suggestion").update(h);$("search_popup_frame").style.width=$("video_search_term_suggestion").offsetWidth;$("search_popup_frame").style.height=$("video_search_term_suggestion").offsetHeight;search_suggestion_item_count=len;search_suggestion_visible=true;search_suggestion_hovered_id=-1;}
function getOneSuggestionTerm(len,s0,s1,s2,wrapped){var d1=(wrapped==true)?"<div style='margin-left:7px;'>":"";var d2=(wrapped==true)?"</div>":"";var html='<tr id="video_search_suggestion_item_#{len}" '+'onmouseover="videoSearchHover(#{len}, true)" '+'onmouseout="videoSearchHover(#{len}, false)">'+'<td align="left" '+'onclick=\'selectSearchTerm(#{s0}, #{s2})\'>'+d1+'#{s1}'+d2+'</td>'+'</tr>';return html.interpolate({len:parseInt(len),s0:(s0?s0.toJSON().replace("'","&apos;"):"".toJSON()),s2:(s2?s2.toJSON().replace("'","&apos;"):"".toJSON()),s1:s1.escapeHTML()});}
function observeSearchBox(searchElement,suggestionElement){new Form.Element.Observer(searchElement,0.1,function(element,value){if(!value.blank()&&value.length>=1&&value.length<=50&&!/[^a-zA-Z0-9 :.,'!?&-]/.test(value)){new Ajax.Updater(suggestionElement,'/videos/suggest/'+encodeURIComponent(value),{asynchronous:true,evalScripts:true,method:'get',onFailure:videoSearchSuggestionHide});}
else{videoSearchSuggestionHide();}});}
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('?');(new Image).src=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;}});
(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});})()