
var MooTools={'version':'1.2.1','build':'0d4845aab3d9a4fdee2f0d4a6dd59210e4b697cf'};var Native=function(options){options=options||{};var name=options.name;var legacy=options.legacy;var protect=options.protect;var methods=options.implement;var generics=options.generics;var initialize=options.initialize;var afterImplement=options.afterImplement||function(){};var object=initialize||legacy;generics=generics!==false;object.constructor=Native;object.$family={name:'native'};if(legacy&&initialize)object.prototype=legacy.prototype;object.prototype.constructor=object;if(name){var family=name.toLowerCase();object.prototype.$family={name:family};Native.typize(object,family);}
var add=function(obj,name,method,force){if(!protect||force||!obj.prototype[name])obj.prototype[name]=method;if(generics)Native.genericize(obj,name,protect);afterImplement.call(obj,name,method);return obj;};object.alias=function(a1,a2,a3){if(typeof a1=='string'){if((a1=this.prototype[a1]))return add(this,a2,a1,a3);}
for(var a in a1)this.alias(a,a1[a],a2);return this;};object.implement=function(a1,a2,a3){if(typeof a1=='string')return add(this,a1,a2,a3);for(var p in a1)add(this,p,a1[p],a2);return this;};if(methods)object.implement(methods);return object;};Native.genericize=function(object,property,check){if((!check||!object[property])&&typeof object.prototype[property]=='function')object[property]=function(){var args=Array.prototype.slice.call(arguments);return object.prototype[property].apply(args.shift(),args);};};Native.implement=function(objects,properties){for(var i=0,l=objects.length;i<l;i++)objects[i].implement(properties);};Native.typize=function(object,family){if(!object.type)object.type=function(item){return($type(item)===family);};};(function(){var natives={'Array':Array,'Date':Date,'Function':Function,'Number':Number,'RegExp':RegExp,'String':String};for(var n in natives)new Native({name:n,initialize:natives[n],protect:true});var types={'boolean':Boolean,'native':Native,'object':Object};for(var t in types)Native.typize(types[t],t);var generics={'Array':["concat","indexOf","join","lastIndexOf","pop","push","reverse","shift","slice","sort","splice","toString","unshift","valueOf"],'String':["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]};for(var g in generics){for(var i=generics[g].length;i--;)Native.genericize(window[g],generics[g][i],true);};})();var Hash=new Native({name:'Hash',initialize:function(object){if($type(object)=='hash')object=$unlink(object.getClean());for(var key in object)this[key]=object[key];return this;}});Hash.implement({forEach:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key))fn.call(bind,this[key],key,this);}},getClean:function(){var clean={};for(var key in this){if(this.hasOwnProperty(key))clean[key]=this[key];}
return clean;},getLength:function(){var length=0;for(var key in this){if(this.hasOwnProperty(key))length++;}
return length;}});Hash.alias('forEach','each');Array.implement({forEach:function(fn,bind){for(var i=0,l=this.length;i<l;i++)fn.call(bind,this[i],i,this);}});Array.alias('forEach','each');function $A(iterable){if(iterable.item){var array=[];for(var i=0,l=iterable.length;i<l;i++)array[i]=iterable[i];return array;}
return Array.prototype.slice.call(iterable);};function $arguments(i){return function(){return arguments[i];};};function $chk(obj){return!!(obj||obj===0);};function $clear(timer){clearTimeout(timer);clearInterval(timer);return null;};function $defined(obj){return(obj!=undefined);};function $each(iterable,fn,bind){var type=$type(iterable);((type=='arguments'||type=='collection'||type=='array')?Array:Hash).each(iterable,fn,bind);};function $empty(){};function $extend(original,extended){for(var key in(extended||{}))original[key]=extended[key];return original;};function $H(object){return new Hash(object);};function $lambda(value){return(typeof value=='function')?value:function(){return value;};};function $merge(){var mix={};for(var i=0,l=arguments.length;i<l;i++){var object=arguments[i];if($type(object)!='object')continue;for(var key in object){var op=object[key],mp=mix[key];mix[key]=(mp&&$type(op)=='object'&&$type(mp)=='object')?$merge(mp,op):$unlink(op);}}
return mix;};function $pick(){for(var i=0,l=arguments.length;i<l;i++){if(arguments[i]!=undefined)return arguments[i];}
return null;};function $random(min,max){return Math.floor(Math.random()*(max-min+1)+min);};function $splat(obj){var type=$type(obj);return(type)?((type!='array'&&type!='arguments')?[obj]:obj):[];};var $time=Date.now||function(){return+new Date;};function $try(){for(var i=0,l=arguments.length;i<l;i++){try{return arguments[i]();}catch(e){}}
return null;};function $type(obj){if(obj==undefined)return false;if(obj.$family)return(obj.$family.name=='number'&&!isFinite(obj))?false:obj.$family.name;if(obj.nodeName){switch(obj.nodeType){case 1:return'element';case 3:return(/\S/).test(obj.nodeValue)?'textnode':'whitespace';}}else if(typeof obj.length=='number'){if(obj.callee)return'arguments';else if(obj.item)return'collection';}
return typeof obj;};function $unlink(object){var unlinked;switch($type(object)){case'object':unlinked={};for(var p in object)unlinked[p]=$unlink(object[p]);break;case'hash':unlinked=new Hash(object);break;case'array':unlinked=[];for(var i=0,l=object.length;i<l;i++)unlinked[i]=$unlink(object[i]);break;default:return object;}
return unlinked;};var Browser=$merge({Engine:{name:'unknown',version:0},Platform:{name:(window.orientation!=undefined)?'ipod':(navigator.platform.match(/mac|win|linux/i)||['other'])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.querySelector)},Plugins:{},Engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getElementsByClassName)?950:925));},trident:function(){return(!window.ActiveXObject)?false:((window.XMLHttpRequest)?5:4);},webkit:function(){return(navigator.taintEnabled)?false:((Browser.Features.xpath)?((Browser.Features.query)?525:420):419);},gecko:function(){return(document.getBoxObjectFor==undefined)?false:((document.getElementsByClassName)?19:18);}}},Browser||{});Browser.Platform[Browser.Platform.name]=true;Browser.detect=function(){for(var engine in this.Engines){var version=this.Engines[engine]();if(version){this.Engine={name:engine,version:version};this.Engine[engine]=this.Engine[engine+version]=true;break;}}
return{name:engine,version:version};};Browser.detect();Browser.Request=function(){return $try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject('MSXML2.XMLHTTP');});};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var version=($try(function(){return navigator.plugins['Shockwave Flash'].description;},function(){return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');})||'0 r0').match(/\d+/g);return{version:parseInt(version[0]||0+'.'+version[1]||0),build:parseInt(version[2]||0)};})();function $exec(text){if(!text)return text;if(window.execScript){window.execScript(text);}else{var script=document.createElement('script');script.setAttribute('type','text/javascript');script[(Browser.Engine.webkit&&Browser.Engine.version<420)?'innerText':'text']=text;document.head.appendChild(script);document.head.removeChild(script);}
return text;};Native.UID=1;var $uid=(Browser.Engine.trident)?function(item){return(item.uid||(item.uid=[Native.UID++]))[0];}:function(item){return item.uid||(item.uid=Native.UID++);};var Window=new Native({name:'Window',legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(win){$uid(win);if(!win.Element){win.Element=$empty;if(Browser.Engine.webkit)win.document.createElement("iframe");win.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{};}
win.document.window=win;return $extend(win,Window.Prototype);},afterImplement:function(property,value){window[property]=Window.Prototype[property]=value;}});Window.Prototype={$family:{name:'window'}};new Window(window);var Document=new Native({name:'Document',legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(doc){$uid(doc);doc.head=doc.getElementsByTagName('head')[0];doc.html=doc.getElementsByTagName('html')[0];if(Browser.Engine.trident&&Browser.Engine.version<=4)$try(function(){doc.execCommand("BackgroundImageCache",false,true);});if(Browser.Engine.trident)doc.window.attachEvent('onunload',function(){doc.window.detachEvent('onunload',arguments.callee);doc.head=doc.html=doc.window=null;});return $extend(doc,Document.Prototype);},afterImplement:function(property,value){document[property]=Document.Prototype[property]=value;}});Document.Prototype={$family:{name:'document'}};new Document(document);Array.implement({every:function(fn,bind){for(var i=0,l=this.length;i<l;i++){if(!fn.call(bind,this[i],i,this))return false;}
return true;},filter:function(fn,bind){var results=[];for(var i=0,l=this.length;i<l;i++){if(fn.call(bind,this[i],i,this))results.push(this[i]);}
return results;},clean:function(){return this.filter($defined);},indexOf:function(item,from){var len=this.length;for(var i=(from<0)?Math.max(0,len+from):from||0;i<len;i++){if(this[i]===item)return i;}
return-1;},map:function(fn,bind){var results=[];for(var i=0,l=this.length;i<l;i++)results[i]=fn.call(bind,this[i],i,this);return results;},some:function(fn,bind){for(var i=0,l=this.length;i<l;i++){if(fn.call(bind,this[i],i,this))return true;}
return false;},associate:function(keys){var obj={},length=Math.min(this.length,keys.length);for(var i=0;i<length;i++)obj[keys[i]]=this[i];return obj;},link:function(object){var result={};for(var i=0,l=this.length;i<l;i++){for(var key in object){if(object[key](this[i])){result[key]=this[i];delete object[key];break;}}}
return result;},contains:function(item,from){return this.indexOf(item,from)!=-1;},extend:function(array){for(var i=0,j=array.length;i<j;i++)this.push(array[i]);return this;},getLast:function(){return(this.length)?this[this.length-1]:null;},getRandom:function(){return(this.length)?this[$random(0,this.length-1)]:null;},include:function(item){if(!this.contains(item))this.push(item);return this;},combine:function(array){for(var i=0,l=array.length;i<l;i++)this.include(array[i]);return this;},erase:function(item){for(var i=this.length;i--;i){if(this[i]===item)this.splice(i,1);}
return this;},empty:function(){this.length=0;return this;},flatten:function(){var array=[];for(var i=0,l=this.length;i<l;i++){var type=$type(this[i]);if(!type)continue;array=array.concat((type=='array'||type=='collection'||type=='arguments')?Array.flatten(this[i]):this[i]);}
return array;},hexToRgb:function(array){if(this.length!=3)return null;var rgb=this.map(function(value){if(value.length==1)value+=value;return value.toInt(16);});return(array)?rgb:'rgb('+rgb+')';},rgbToHex:function(array){if(this.length<3)return null;if(this.length==4&&this[3]==0&&!array)return'transparent';var hex=[];for(var i=0;i<3;i++){var bit=(this[i]-0).toString(16);hex.push((bit.length==1)?'0'+bit:bit);}
return(array)?hex:'#'+hex.join('');}});Function.implement({extend:function(properties){for(var property in properties)this[property]=properties[property];return this;},create:function(options){var self=this;options=options||{};return function(event){var args=options.arguments;args=(args!=undefined)?$splat(args):Array.slice(arguments,(options.event)?1:0);if(options.event)args=[event||window.event].extend(args);var returns=function(){return self.apply(options.bind||null,args);};if(options.delay)return setTimeout(returns,options.delay);if(options.periodical)return setInterval(returns,options.periodical);if(options.attempt)return $try(returns);return returns();};},run:function(args,bind){return this.apply(bind,$splat(args));},pass:function(args,bind){return this.create({bind:bind,arguments:args});},bind:function(bind,args){return this.create({bind:bind,arguments:args});},bindWithEvent:function(bind,args){return this.create({bind:bind,arguments:args,event:true});},attempt:function(args,bind){return this.create({bind:bind,arguments:args,attempt:true})();},delay:function(delay,bind,args){return this.create({bind:bind,arguments:args,delay:delay})();},periodical:function(periodical,bind,args){return this.create({bind:bind,arguments:args,periodical:periodical})();}});Number.implement({limit:function(min,max){return Math.min(max,Math.max(min,this));},round:function(precision){precision=Math.pow(10,precision||0);return Math.round(this*precision)/precision;},times:function(fn,bind){for(var i=0;i<this;i++)fn.call(bind,i,this);},toFloat:function(){return parseFloat(this);},toInt:function(base){return parseInt(this,base||10);}});Number.alias('times','each');(function(math){var methods={};math.each(function(name){if(!Number[name])methods[name]=function(){return Math[name].apply(null,[this].concat($A(arguments)));};});Number.implement(methods);})(['abs','acos','asin','atan','atan2','ceil','cos','exp','floor','log','max','min','pow','sin','sqrt','tan']);String.implement({test:function(regex,params){return((typeof regex=='string')?new RegExp(regex,params):regex).test(this);},contains:function(string,separator){return(separator)?(separator+this+separator).indexOf(separator+string+separator)>-1:this.indexOf(string)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,'');},clean:function(){return this.replace(/\s+/g,' ').trim();},camelCase:function(){return this.replace(/-\D/g,function(match){return match.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(match){return('-'+match.charAt(0).toLowerCase());});},capitalize:function(){return this.replace(/\b[a-z]/g,function(match){return match.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,'\\$1');},toInt:function(base){return parseInt(this,base||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(array){var hex=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(hex)?hex.slice(1).hexToRgb(array):null;},rgbToHex:function(array){var rgb=this.match(/\d{1,3}/g);return(rgb)?rgb.rgbToHex(array):null;},stripScripts:function(option){var scripts='';var text=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){scripts+=arguments[1]+'\n';return'';});if(option===true)$exec(scripts);else if($type(option)=='function')option(scripts,text);return text;},substitute:function(object,regexp){return this.replace(regexp||(/\\?\{([^{}]+)\}/g),function(match,name){if(match.charAt(0)=='\\')return match.slice(1);return(object[name]!=undefined)?object[name]:'';});}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(value){for(var key in this){if(this.hasOwnProperty(key)&&this[key]===value)return key;}
return null;},hasValue:function(value){return(Hash.keyOf(this,value)!==null);},extend:function(properties){Hash.each(properties,function(value,key){Hash.set(this,key,value);},this);return this;},combine:function(properties){Hash.each(properties,function(value,key){Hash.include(this,key,value);},this);return this;},erase:function(key){if(this.hasOwnProperty(key))delete this[key];return this;},get:function(key){return(this.hasOwnProperty(key))?this[key]:null;},set:function(key,value){if(!this[key]||this.hasOwnProperty(key))this[key]=value;return this;},empty:function(){Hash.each(this,function(value,key){delete this[key];},this);return this;},include:function(key,value){var k=this[key];if(k==undefined)this[key]=value;return this;},map:function(fn,bind){var results=new Hash;Hash.each(this,function(value,key){results.set(key,fn.call(bind,value,key,this));},this);return results;},filter:function(fn,bind){var results=new Hash;Hash.each(this,function(value,key){if(fn.call(bind,value,key,this))results.set(key,value);},this);return results;},every:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key)&&!fn.call(bind,this[key],key))return false;}
return true;},some:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key)&&fn.call(bind,this[key],key))return true;}
return false;},getKeys:function(){var keys=[];Hash.each(this,function(value,key){keys.push(key);});return keys;},getValues:function(){var values=[];Hash.each(this,function(value){values.push(value);});return values;},toQueryString:function(base){var queryString=[];Hash.each(this,function(value,key){if(base)key=base+'['+key+']';var result;switch($type(value)){case'object':result=Hash.toQueryString(value,key);break;case'array':var qs={};value.each(function(val,i){qs[i]=val;});result=Hash.toQueryString(qs,key);break;default:result=key+'='+encodeURIComponent(value);}
if(value!=undefined)queryString.push(result);});return queryString.join('&');}});Hash.alias({keyOf:'indexOf',hasValue:'contains'});var Event=new Native({name:'Event',initialize:function(event,win){win=win||window;var doc=win.document;event=event||win.event;if(event.$extended)return event;this.$extended=true;var type=event.type;var target=event.target||event.srcElement;while(target&&target.nodeType==3)target=target.parentNode;if(type.test(/key/)){var code=event.which||event.keyCode;var key=Event.Keys.keyOf(code);if(type=='keydown'){var fKey=code-111;if(fKey>0&&fKey<13)key='f'+fKey;}
key=key||String.fromCharCode(code).toLowerCase();}else if(type.match(/(click|mouse|menu)/i)){doc=(!doc.compatMode||doc.compatMode=='CSS1Compat')?doc.html:doc.body;var page={x:event.pageX||event.clientX+doc.scrollLeft,y:event.pageY||event.clientY+doc.scrollTop};var client={x:(event.pageX)?event.pageX-win.pageXOffset:event.clientX,y:(event.pageY)?event.pageY-win.pageYOffset:event.clientY};if(type.match(/DOMMouseScroll|mousewheel/)){var wheel=(event.wheelDelta)?event.wheelDelta/120:-(event.detail||0)/3;}
var rightClick=(event.which==3)||(event.button==2);var related=null;if(type.match(/over|out/)){switch(type){case'mouseover':related=event.relatedTarget||event.fromElement;break;case'mouseout':related=event.relatedTarget||event.toElement;}
if(!(function(){while(related&&related.nodeType==3)related=related.parentNode;return true;}).create({attempt:Browser.Engine.gecko})())related=false;}}
return $extend(this,{event:event,type:type,page:page,client:client,rightClick:rightClick,wheel:wheel,relatedTarget:related,target:target,code:code,key:key,shift:event.shiftKey,control:event.ctrlKey,alt:event.altKey,meta:event.metaKey});}});Event.Keys=new Hash({'enter':13,'up':38,'down':40,'left':37,'right':39,'esc':27,'space':32,'backspace':8,'tab':9,'delete':46});Event.implement({stop:function(){return this.stopPropagation().preventDefault();},stopPropagation:function(){if(this.event.stopPropagation)this.event.stopPropagation();else this.event.cancelBubble=true;return this;},preventDefault:function(){if(this.event.preventDefault)this.event.preventDefault();else this.event.returnValue=false;return this;}});var Class=new Native({name:'Class',initialize:function(properties){properties=properties||{};var klass=function(){for(var key in this){if($type(this[key])!='function')this[key]=$unlink(this[key]);}
this.constructor=klass;if(Class.prototyping)return this;var instance=(this.initialize)?this.initialize.apply(this,arguments):this;if(this.options&&this.options.initialize)this.options.initialize.call(this);return instance;};for(var mutator in Class.Mutators){if(!properties[mutator])continue;properties=Class.Mutators[mutator](properties,properties[mutator]);delete properties[mutator];}
$extend(klass,this);klass.constructor=Class;klass.prototype=properties;return klass;}});Class.Mutators={Extends:function(self,klass){Class.prototyping=klass.prototype;var subclass=new klass;delete subclass.parent;subclass=Class.inherit(subclass,self);delete Class.prototyping;return subclass;},Implements:function(self,klasses){$splat(klasses).each(function(klass){Class.prototying=klass;$extend(self,($type(klass)=='class')?new klass:klass);delete Class.prototyping;});return self;}};Class.extend({inherit:function(object,properties){var caller=arguments.callee.caller;for(var key in properties){var override=properties[key];var previous=object[key];var type=$type(override);if(previous&&type=='function'){if(override!=previous){if(caller){override.__parent=previous;object[key]=override;}else{Class.override(object,key,override);}}}else if(type=='object'){object[key]=$merge(previous,override);}else{object[key]=override;}}
if(caller)object.parent=function(){return arguments.callee.caller.__parent.apply(this,arguments);};return object;},override:function(object,name,method){var parent=Class.prototyping;if(parent&&object[name]!=parent[name])parent=null;var override=function(){var previous=this.parent;this.parent=parent?parent[name]:object[name];var value=method.apply(this,arguments);this.parent=previous;return value;};object[name]=override;}});Class.implement({implement:function(){var proto=this.prototype;$each(arguments,function(properties){Class.inherit(proto,properties);});return this;}});var Chain=new Class({$chain:[],chain:function(){this.$chain.extend(Array.flatten(arguments));return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false;},clearChain:function(){this.$chain.empty();return this;}});var Events=new Class({$events:{},addEvent:function(type,fn,internal){type=Events.removeOn(type);if(fn!=$empty){this.$events[type]=this.$events[type]||[];this.$events[type].include(fn);if(internal)fn.internal=true;}
return this;},addEvents:function(events){for(var type in events)this.addEvent(type,events[type]);return this;},fireEvent:function(type,args,delay){type=Events.removeOn(type);if(!this.$events||!this.$events[type])return this;this.$events[type].each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);return this;},removeEvent:function(type,fn){type=Events.removeOn(type);if(!this.$events[type])return this;if(!fn.internal)this.$events[type].erase(fn);return this;},removeEvents:function(events){if($type(events)=='object'){for(var type in events)this.removeEvent(type,events[type]);return this;}
if(events)events=Events.removeOn(events);for(var type in this.$events){if(events&&events!=type)continue;var fns=this.$events[type];for(var i=fns.length;i--;i)this.removeEvent(type,fns[i]);}
return this;}});Events.removeOn=function(string){return string.replace(/^on([A-Z])/,function(full,first){return first.toLowerCase();});};var Options=new Class({setOptions:function(){this.options=$merge.run([this.options].extend(arguments));if(!this.addEvent)return this;for(var option in this.options){if($type(this.options[option])!='function'||!(/^on[A-Z]/).test(option))continue;this.addEvent(option,this.options[option]);delete this.options[option];}
return this;}});var Element=new Native({name:'Element',legacy:window.Element,initialize:function(tag,props){var konstructor=Element.Constructors.get(tag);if(konstructor)return konstructor(props);if(typeof tag=='string')return document.newElement(tag,props);return $(tag).set(props);},afterImplement:function(key,value){Element.Prototype[key]=value;if(Array[key])return;Elements.implement(key,function(){var items=[],elements=true;for(var i=0,j=this.length;i<j;i++){var returns=this[i][key].apply(this[i],arguments);items.push(returns);if(elements)elements=($type(returns)=='element');}
return(elements)?new Elements(items):items;});}});Element.Prototype={$family:{name:'element'}};Element.Constructors=new Hash;var IFrame=new Native({name:'IFrame',generics:false,initialize:function(){var params=Array.link(arguments,{properties:Object.type,iframe:$defined});var props=params.properties||{};var iframe=$(params.iframe)||false;var onload=props.onload||$empty;delete props.onload;props.id=props.name=$pick(props.id,props.name,iframe.id,iframe.name,'IFrame_'+$time());iframe=new Element(iframe||'iframe',props);var onFrameLoad=function(){var host=$try(function(){return iframe.contentWindow.location.host;});if(host&&host==window.location.host){var win=new Window(iframe.contentWindow);new Document(iframe.contentWindow.document);$extend(win.Element.prototype,Element.Prototype);}
onload.call(iframe.contentWindow,iframe.contentWindow.document);};(window.frames[props.id])?onFrameLoad():iframe.addListener('load',onFrameLoad);return iframe;}});var Elements=new Native({initialize:function(elements,options){options=$extend({ddup:true,cash:true},options);elements=elements||[];if(options.ddup||options.cash){var uniques={},returned=[];for(var i=0,l=elements.length;i<l;i++){var el=$.element(elements[i],!options.cash);if(options.ddup){if(uniques[el.uid])continue;uniques[el.uid]=true;}
returned.push(el);}
elements=returned;}
return(options.cash)?$extend(elements,this):elements;}});Elements.implement({filter:function(filter,bind){if(!filter)return this;return new Elements(Array.filter(this,(typeof filter=='string')?function(item){return item.match(filter);}:filter,bind));}});Document.implement({newElement:function(tag,props){if(Browser.Engine.trident&&props){['name','type','checked'].each(function(attribute){if(!props[attribute])return;tag+=' '+attribute+'="'+props[attribute]+'"';if(attribute!='checked')delete props[attribute];});tag='<'+tag+'>';}
return $.element(this.createElement(tag)).set(props);},newTextNode:function(text){return this.createTextNode(text);},getDocument:function(){return this;},getWindow:function(){return this.window;}});Window.implement({$:function(el,nocash){if(el&&el.$family&&el.uid)return el;var type=$type(el);return($[type])?$[type](el,nocash,this.document):null;},$$:function(selector){if(arguments.length==1&&typeof selector=='string')return this.document.getElements(selector);var elements=[];var args=Array.flatten(arguments);for(var i=0,l=args.length;i<l;i++){var item=args[i];switch($type(item)){case'element':elements.push(item);break;case'string':elements.extend(this.document.getElements(item,true));}}
return new Elements(elements);},getDocument:function(){return this.document;},getWindow:function(){return this;}});$.string=function(id,nocash,doc){id=doc.getElementById(id);return(id)?$.element(id,nocash):null;};$.element=function(el,nocash){$uid(el);if(!nocash&&!el.$family&&!(/^object|embed$/i).test(el.tagName)){var proto=Element.Prototype;for(var p in proto)el[p]=proto[p];};return el;};$.object=function(obj,nocash,doc){if(obj.toElement)return $.element(obj.toElement(doc),nocash);return null;};$.textnode=$.whitespace=$.window=$.document=$arguments(0);Native.implement([Element,Document],{getElement:function(selector,nocash){return $(this.getElements(selector,true)[0]||null,nocash);},getElements:function(tags,nocash){tags=tags.split(',');var elements=[];var ddup=(tags.length>1);tags.each(function(tag){var partial=this.getElementsByTagName(tag.trim());(ddup)?elements.extend(partial):elements=partial;},this);return new Elements(elements,{ddup:ddup,cash:!nocash});}});(function(){var collected={},storage={};var props={input:'checked',option:'selected',textarea:(Browser.Engine.webkit&&Browser.Engine.version<420)?'innerHTML':'value'};var get=function(uid){if(storage==null)storage={};return(storage[uid]||(storage[uid]={}));};var clean=function(item,retain){if(!item)return;var uid=item.uid;if(Browser.Engine.trident){if(item.clearAttributes){var clone=retain&&item.cloneNode(false);item.clearAttributes();if(clone)item.mergeAttributes(clone);}else if(item.removeEvents){item.removeEvents();}
if((/object/i).test(item.tagName)){for(var p in item){if(typeof item[p]=='function')item[p]=$empty;}
Element.dispose(item);}}
if(!uid)return;collected[uid]=storage[uid]=null;};var purge=function(){Hash.each(collected,clean);if(Browser.Engine.trident)$A(document.getElementsByTagName('object')).each(clean);if(window.CollectGarbage)CollectGarbage();collected=storage=null;};var walk=function(element,walk,start,match,all,nocash){var el=element[start||walk];var elements=[];while(el){if(el.nodeType==1&&(!match||Element.match(el,match))){if(!all)return $(el,nocash);elements.push(el);}
el=el[walk];}
return(all)?new Elements(elements,{ddup:false,cash:!nocash}):null;};var attributes={'html':'innerHTML','class':'className','for':'htmlFor','text':(Browser.Engine.trident||(Browser.Engine.webkit&&Browser.Engine.version<420))?'innerText':'textContent'};var bools=['compact','nowrap','ismap','declare','noshade','checked','disabled','readonly','multiple','selected','noresize','defer'];var camels=['value','accessKey','cellPadding','cellSpacing','colSpan','frameBorder','maxLength','readOnly','rowSpan','tabIndex','useMap'];Hash.extend(attributes,bools.associate(bools));Hash.extend(attributes,camels.associate(camels.map(String.toLowerCase)));var inserters={before:function(context,element){if(element.parentNode)element.parentNode.insertBefore(context,element);},after:function(context,element){if(!element.parentNode)return;var next=element.nextSibling;(next)?element.parentNode.insertBefore(context,next):element.parentNode.appendChild(context);},bottom:function(context,element){element.appendChild(context);},top:function(context,element){var first=element.firstChild;(first)?element.insertBefore(context,first):element.appendChild(context);}};inserters.inside=inserters.bottom;Hash.each(inserters,function(inserter,where){where=where.capitalize();Element.implement('inject'+where,function(el){inserter(this,$(el,true));return this;});Element.implement('grab'+where,function(el){inserter($(el,true),this);return this;});});Element.implement({set:function(prop,value){switch($type(prop)){case'object':for(var p in prop)this.set(p,prop[p]);break;case'string':var property=Element.Properties.get(prop);(property&&property.set)?property.set.apply(this,Array.slice(arguments,1)):this.setProperty(prop,value);}
return this;},get:function(prop){var property=Element.Properties.get(prop);return(property&&property.get)?property.get.apply(this,Array.slice(arguments,1)):this.getProperty(prop);},erase:function(prop){var property=Element.Properties.get(prop);(property&&property.erase)?property.erase.apply(this):this.removeProperty(prop);return this;},setProperty:function(attribute,value){var key=attributes[attribute];if(value==undefined)return this.removeProperty(attribute);if(key&&bools[attribute])value=!!value;(key)?this[key]=value:this.setAttribute(attribute,''+value);return this;},setProperties:function(attributes){for(var attribute in attributes)this.setProperty(attribute,attributes[attribute]);return this;},getProperty:function(attribute){var key=attributes[attribute];var value=(key)?this[key]:this.getAttribute(attribute,2);return(bools[attribute])?!!value:(key)?value:value||null;},getProperties:function(){var args=$A(arguments);return args.map(this.getProperty,this).associate(args);},removeProperty:function(attribute){var key=attributes[attribute];(key)?this[key]=(key&&bools[attribute])?false:'':this.removeAttribute(attribute);return this;},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this;},hasClass:function(className){return this.className.contains(className,' ');},addClass:function(className){if(!this.hasClass(className))this.className=(this.className+' '+className).clean();return this;},removeClass:function(className){this.className=this.className.replace(new RegExp('(^|\\s)'+className+'(?:\\s|$)'),'$1');return this;},toggleClass:function(className){return this.hasClass(className)?this.removeClass(className):this.addClass(className);},adopt:function(){Array.flatten(arguments).each(function(element){element=$(element,true);if(element)this.appendChild(element);},this);return this;},appendText:function(text,where){return this.grab(this.getDocument().newTextNode(text),where);},grab:function(el,where){inserters[where||'bottom']($(el,true),this);return this;},inject:function(el,where){inserters[where||'bottom'](this,$(el,true));return this;},replaces:function(el){el=$(el,true);el.parentNode.replaceChild(this,el);return this;},wraps:function(el,where){el=$(el,true);return this.replaces(el).grab(el,where);},getPrevious:function(match,nocash){return walk(this,'previousSibling',null,match,false,nocash);},getAllPrevious:function(match,nocash){return walk(this,'previousSibling',null,match,true,nocash);},getNext:function(match,nocash){return walk(this,'nextSibling',null,match,false,nocash);},getAllNext:function(match,nocash){return walk(this,'nextSibling',null,match,true,nocash);},getFirst:function(match,nocash){return walk(this,'nextSibling','firstChild',match,false,nocash);},getLast:function(match,nocash){return walk(this,'previousSibling','lastChild',match,false,nocash);},getParent:function(match,nocash){return walk(this,'parentNode',null,match,false,nocash);},getParents:function(match,nocash){return walk(this,'parentNode',null,match,true,nocash);},getChildren:function(match,nocash){return walk(this,'nextSibling','firstChild',match,true,nocash);},getWindow:function(){return this.ownerDocument.window;},getDocument:function(){return this.ownerDocument;},getElementById:function(id,nocash){var el=this.ownerDocument.getElementById(id);if(!el)return null;for(var parent=el.parentNode;parent!=this;parent=parent.parentNode){if(!parent)return null;}
return $.element(el,nocash);},getSelected:function(){return new Elements($A(this.options).filter(function(option){return option.selected;}));},getComputedStyle:function(property){if(this.currentStyle)return this.currentStyle[property.camelCase()];var computed=this.getDocument().defaultView.getComputedStyle(this,null);return(computed)?computed.getPropertyValue([property.hyphenate()]):null;},toQueryString:function(){var queryString=[];this.getElements('input, select, textarea',true).each(function(el){if(!el.name||el.disabled)return;var value=(el.tagName.toLowerCase()=='select')?Element.getSelected(el).map(function(opt){return opt.value;}):((el.type=='radio'||el.type=='checkbox')&&!el.checked)?null:el.value;$splat(value).each(function(val){if(typeof val!='undefined')queryString.push(el.name+'='+encodeURIComponent(val));});});return queryString.join('&');},clone:function(contents,keepid){contents=contents!==false;var clone=this.cloneNode(contents);var clean=function(node,element){if(!keepid)node.removeAttribute('id');if(Browser.Engine.trident){node.clearAttributes();node.mergeAttributes(element);node.removeAttribute('uid');if(node.options){var no=node.options,eo=element.options;for(var j=no.length;j--;)no[j].selected=eo[j].selected;}}
var prop=props[element.tagName.toLowerCase()];if(prop&&element[prop])node[prop]=element[prop];};if(contents){var ce=clone.getElementsByTagName('*'),te=this.getElementsByTagName('*');for(var i=ce.length;i--;)clean(ce[i],te[i]);}
clean(clone,this);return $(clone);},destroy:function(){Element.empty(this);Element.dispose(this);clean(this,true);return null;},empty:function(){$A(this.childNodes).each(function(node){Element.destroy(node);});return this;},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this;},hasChild:function(el){el=$(el,true);if(!el)return false;if(Browser.Engine.webkit&&Browser.Engine.version<420)return $A(this.getElementsByTagName(el.tagName)).contains(el);return(this.contains)?(this!=el&&this.contains(el)):!!(this.compareDocumentPosition(el)&16);},match:function(tag){return(!tag||(tag==this)||(Element.get(this,'tag')==tag));}});Native.implement([Element,Window,Document],{addListener:function(type,fn){if(type=='unload'){var old=fn,self=this;fn=function(){self.removeListener('unload',fn);old();};}else{collected[this.uid]=this;}
if(this.addEventListener)this.addEventListener(type,fn,false);else this.attachEvent('on'+type,fn);return this;},removeListener:function(type,fn){if(this.removeEventListener)this.removeEventListener(type,fn,false);else this.detachEvent('on'+type,fn);return this;},retrieve:function(property,dflt){var storage=get(this.uid),prop=storage[property];if(dflt!=undefined&&prop==undefined)prop=storage[property]=dflt;return $pick(prop);},store:function(property,value){var storage=get(this.uid);storage[property]=value;return this;},eliminate:function(property){var storage=get(this.uid);delete storage[property];return this;}});window.addListener('unload',purge);})();Element.Properties=new Hash;Element.Properties.style={set:function(style){this.style.cssText=style;},get:function(){return this.style.cssText;},erase:function(){this.style.cssText='';}};Element.Properties.tag={get:function(){return this.tagName.toLowerCase();}};Element.Properties.html=(function(){var wrapper=document.createElement('div');var translations={table:[1,'<table>','</table>'],select:[1,'<select>','</select>'],tbody:[2,'<table><tbody>','</tbody></table>'],tr:[3,'<table><tbody><tr>','</tr></tbody></table>']};translations.thead=translations.tfoot=translations.tbody;var html={set:function(){var html=Array.flatten(arguments).join('');var wrap=Browser.Engine.trident&&translations[this.get('tag')];if(wrap){var first=wrapper;first.innerHTML=wrap[1]+html+wrap[2];for(var i=wrap[0];i--;)first=first.firstChild;this.empty().adopt(first.childNodes);}else{this.innerHTML=html;}}};html.erase=html.set;return html;})();if(Browser.Engine.webkit&&Browser.Engine.version<420)Element.Properties.text={get:function(){if(this.innerText)return this.innerText;var temp=this.ownerDocument.newElement('div',{html:this.innerHTML}).inject(this.ownerDocument.body);var text=temp.innerText;temp.destroy();return text;}};Element.Properties.events={set:function(events){this.addEvents(events);}};Native.implement([Element,Window,Document],{addEvent:function(type,fn){var events=this.retrieve('events',{});events[type]=events[type]||{'keys':[],'values':[]};if(events[type].keys.contains(fn))return this;events[type].keys.push(fn);var realType=type,custom=Element.Events.get(type),condition=fn,self=this;if(custom){if(custom.onAdd)custom.onAdd.call(this,fn);if(custom.condition){condition=function(event){if(custom.condition.call(this,event))return fn.call(this,event);return true;};}
realType=custom.base||realType;}
var defn=function(){return fn.call(self);};var nativeEvent=Element.NativeEvents[realType];if(nativeEvent){if(nativeEvent==2){defn=function(event){event=new Event(event,self.getWindow());if(condition.call(self,event)===false)event.stop();};}
this.addListener(realType,defn);}
events[type].values.push(defn);return this;},removeEvent:function(type,fn){var events=this.retrieve('events');if(!events||!events[type])return this;var pos=events[type].keys.indexOf(fn);if(pos==-1)return this;events[type].keys.splice(pos,1);var value=events[type].values.splice(pos,1)[0];var custom=Element.Events.get(type);if(custom){if(custom.onRemove)custom.onRemove.call(this,fn);type=custom.base||type;}
return(Element.NativeEvents[type])?this.removeListener(type,value):this;},addEvents:function(events){for(var event in events)this.addEvent(event,events[event]);return this;},removeEvents:function(events){if($type(events)=='object'){for(var type in events)this.removeEvent(type,events[type]);return this;}
var attached=this.retrieve('events');if(!attached)return this;if(!events){for(var type in attached)this.removeEvents(type);this.eliminate('events');}else if(attached[events]){while(attached[events].keys[0])this.removeEvent(events,attached[events].keys[0]);attached[events]=null;}
return this;},fireEvent:function(type,args,delay){var events=this.retrieve('events');if(!events||!events[type])return this;events[type].keys.each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);return this;},cloneEvents:function(from,type){from=$(from);var fevents=from.retrieve('events');if(!fevents)return this;if(!type){for(var evType in fevents)this.cloneEvents(from,evType);}else if(fevents[type]){fevents[type].keys.each(function(fn){this.addEvent(type,fn);},this);}
return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};(function(){var $check=function(event){var related=event.relatedTarget;if(related==undefined)return true;if(related===false)return false;return($type(this)!='document'&&related!=this&&related.prefix!='xul'&&!this.hasChild(related));};Element.Events=new Hash({mouseenter:{base:'mouseover',condition:$check},mouseleave:{base:'mouseout',condition:$check},mousewheel:{base:(Browser.Engine.gecko)?'DOMMouseScroll':'mousewheel'}});})();Element.Properties.styles={set:function(styles){this.setStyles(styles);}};Element.Properties.opacity={set:function(opacity,novisibility){if(!novisibility){if(opacity==0){if(this.style.visibility!='hidden')this.style.visibility='hidden';}else{if(this.style.visibility!='visible')this.style.visibility='visible';}}
if(!this.currentStyle||!this.currentStyle.hasLayout)this.style.zoom=1;if(Browser.Engine.trident)this.style.filter=(opacity==1)?'':'alpha(opacity='+opacity*100+')';this.style.opacity=opacity;this.store('opacity',opacity);},get:function(){return this.retrieve('opacity',1);}};Element.implement({setOpacity:function(value){return this.set('opacity',value,true);},getOpacity:function(){return this.get('opacity');},setStyle:function(property,value){switch(property){case'opacity':return this.set('opacity',parseFloat(value));case'float':property=(Browser.Engine.trident)?'styleFloat':'cssFloat';}
property=property.camelCase();if($type(value)!='string'){var map=(Element.Styles.get(property)||'@').split(' ');value=$splat(value).map(function(val,i){if(!map[i])return'';return($type(val)=='number')?map[i].replace('@',Math.round(val)):val;}).join(' ');}else if(value==String(Number(value))){value=Math.round(value);}
this.style[property]=value;return this;},getStyle:function(property){switch(property){case'opacity':return this.get('opacity');case'float':property=(Browser.Engine.trident)?'styleFloat':'cssFloat';}
property=property.camelCase();var result=this.style[property];if(!$chk(result)){result=[];for(var style in Element.ShortStyles){if(property!=style)continue;for(var s in Element.ShortStyles[style])result.push(this.getStyle(s));return result.join(' ');}
result=this.getComputedStyle(property);}
if(result){result=String(result);var color=result.match(/rgba?\([\d\s,]+\)/);if(color)result=result.replace(color[0],color[0].rgbToHex());}
if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(result)))){if(property.test(/^(height|width)$/)){var values=(property=='width')?['left','right']:['top','bottom'],size=0;values.each(function(value){size+=this.getStyle('border-'+value+'-width').toInt()+this.getStyle('padding-'+value).toInt();},this);return this['offset'+property.capitalize()]-size+'px';}
if((Browser.Engine.presto)&&String(result).test('px'))return result;if(property.test(/(border(.+)Width|margin|padding)/))return'0px';}
return result;},setStyles:function(styles){for(var style in styles)this.setStyle(style,styles[style]);return this;},getStyles:function(){var result={};Array.each(arguments,function(key){result[key]=this.getStyle(key);},this);return result;}});Element.Styles=new Hash({left:'@px',top:'@px',bottom:'@px',right:'@px',width:'@px',height:'@px',maxWidth:'@px',maxHeight:'@px',minWidth:'@px',minHeight:'@px',backgroundColor:'rgb(@, @, @)',backgroundPosition:'@px @px',color:'rgb(@, @, @)',fontSize:'@px',letterSpacing:'@px',lineHeight:'@px',clip:'rect(@px @px @px @px)',margin:'@px @px @px @px',padding:'@px @px @px @px',border:'@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',borderWidth:'@px @px @px @px',borderStyle:'@ @ @ @',borderColor:'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',zIndex:'@','zoom':'@',fontWeight:'@',textIndent:'@px',opacity:'@'});Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};['Top','Right','Bottom','Left'].each(function(direction){var Short=Element.ShortStyles;var All=Element.Styles;['margin','padding'].each(function(style){var sd=style+direction;Short[style][sd]=All[sd]='@px';});var bd='border'+direction;Short.border[bd]=All[bd]='@px @ rgb(@, @, @)';var bdw=bd+'Width',bds=bd+'Style',bdc=bd+'Color';Short[bd]={};Short.borderWidth[bdw]=Short[bd][bdw]=All[bdw]='@px';Short.borderStyle[bds]=Short[bd][bds]=All[bds]='@';Short.borderColor[bdc]=Short[bd][bdc]=All[bdc]='rgb(@, @, @)';});(function(){Element.implement({scrollTo:function(x,y){if(isBody(this)){this.getWindow().scrollTo(x,y);}else{this.scrollLeft=x;this.scrollTop=y;}
return this;},getSize:function(){if(isBody(this))return this.getWindow().getSize();return{x:this.offsetWidth,y:this.offsetHeight};},getScrollSize:function(){if(isBody(this))return this.getWindow().getScrollSize();return{x:this.scrollWidth,y:this.scrollHeight};},getScroll:function(){if(isBody(this))return this.getWindow().getScroll();return{x:this.scrollLeft,y:this.scrollTop};},getScrolls:function(){var element=this,position={x:0,y:0};while(element&&!isBody(element)){position.x+=element.scrollLeft;position.y+=element.scrollTop;element=element.parentNode;}
return position;},getOffsetParent:function(){var element=this;if(isBody(element))return null;if(!Browser.Engine.trident)return element.offsetParent;while((element=element.parentNode)&&!isBody(element)){if(styleString(element,'position')!='static')return element;}
return null;},getOffsets:function(){if(Browser.Engine.trident){var bound=this.getBoundingClientRect(),html=this.getDocument().documentElement;return{x:bound.left+html.scrollLeft-html.clientLeft,y:bound.top+html.scrollTop-html.clientTop};}
var element=this,position={x:0,y:0};if(isBody(this))return position;while(element&&!isBody(element)){position.x+=element.offsetLeft;position.y+=element.offsetTop;if(Browser.Engine.gecko){if(!borderBox(element)){position.x+=leftBorder(element);position.y+=topBorder(element);}
var parent=element.parentNode;if(parent&&styleString(parent,'overflow')!='visible'){position.x+=leftBorder(parent);position.y+=topBorder(parent);}}else if(element!=this&&Browser.Engine.webkit){position.x+=leftBorder(element);position.y+=topBorder(element);}
element=element.offsetParent;}
if(Browser.Engine.gecko&&!borderBox(this)){position.x-=leftBorder(this);position.y-=topBorder(this);}
return position;},getPosition:function(relative){if(isBody(this))return{x:0,y:0};var offset=this.getOffsets(),scroll=this.getScrolls();var position={x:offset.x-scroll.x,y:offset.y-scroll.y};var relativePosition=(relative&&(relative=$(relative)))?relative.getPosition():{x:0,y:0};return{x:position.x-relativePosition.x,y:position.y-relativePosition.y};},getCoordinates:function(element){if(isBody(this))return this.getWindow().getCoordinates();var position=this.getPosition(element),size=this.getSize();var obj={left:position.x,top:position.y,width:size.x,height:size.y};obj.right=obj.left+obj.width;obj.bottom=obj.top+obj.height;return obj;},computePosition:function(obj){return{left:obj.x-styleNumber(this,'margin-left'),top:obj.y-styleNumber(this,'margin-top')};},position:function(obj){return this.setStyles(this.computePosition(obj));}});Native.implement([Document,Window],{getSize:function(){var win=this.getWindow();if(Browser.Engine.presto||Browser.Engine.webkit)return{x:win.innerWidth,y:win.innerHeight};var doc=getCompatElement(this);return{x:doc.clientWidth,y:doc.clientHeight};},getScroll:function(){var win=this.getWindow();var doc=getCompatElement(this);return{x:win.pageXOffset||doc.scrollLeft,y:win.pageYOffset||doc.scrollTop};},getScrollSize:function(){var doc=getCompatElement(this);var min=this.getSize();return{x:Math.max(doc.scrollWidth,min.x),y:Math.max(doc.scrollHeight,min.y)};},getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var size=this.getSize();return{top:0,left:0,bottom:size.y,right:size.x,height:size.y,width:size.x};}});var styleString=Element.getComputedStyle;function styleNumber(element,style){return styleString(element,style).toInt()||0;};function borderBox(element){return styleString(element,'-moz-box-sizing')=='border-box';};function topBorder(element){return styleNumber(element,'border-top-width');};function leftBorder(element){return styleNumber(element,'border-left-width');};function isBody(element){return(/^(?:body|html)$/i).test(element.tagName);};function getCompatElement(element){var doc=element.getDocument();return(!doc.compatMode||doc.compatMode=='CSS1Compat')?doc.html:doc.body;};})();Native.implement([Window,Document,Element],{getHeight:function(){return this.getSize().y;},getWidth:function(){return this.getSize().x;},getScrollTop:function(){return this.getScroll().y;},getScrollLeft:function(){return this.getScroll().x;},getScrollHeight:function(){return this.getScrollSize().y;},getScrollWidth:function(){return this.getScrollSize().x;},getTop:function(){return this.getPosition().y;},getLeft:function(){return this.getPosition().x;}});Native.implement([Document,Element],{getElements:function(expression,nocash){expression=expression.split(',');var items,local={};for(var i=0,l=expression.length;i<l;i++){var selector=expression[i],elements=Selectors.Utils.search(this,selector,local);if(i!=0&&elements.item)elements=$A(elements);items=(i==0)?elements:(items.item)?$A(items).concat(elements):items.concat(elements);}
return new Elements(items,{ddup:(expression.length>1),cash:!nocash});}});Element.implement({match:function(selector){if(!selector||(selector==this))return true;var tagid=Selectors.Utils.parseTagAndID(selector);var tag=tagid[0],id=tagid[1];if(!Selectors.Filters.byID(this,id)||!Selectors.Filters.byTag(this,tag))return false;var parsed=Selectors.Utils.parseSelector(selector);return(parsed)?Selectors.Utils.filter(this,parsed,{}):true;}});var Selectors={Cache:{nth:{},parsed:{}}};Selectors.RegExps={id:(/#([\w-]+)/),tag:(/^(\w+|\*)/),quick:(/^(\w+|\*)$/),splitter:(/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),combined:(/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)};Selectors.Utils={chk:function(item,uniques){if(!uniques)return true;var uid=$uid(item);if(!uniques[uid])return uniques[uid]=true;return false;},parseNthArgument:function(argument){if(Selectors.Cache.nth[argument])return Selectors.Cache.nth[argument];var parsed=argument.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!parsed)return false;var inta=parseInt(parsed[1]);var a=(inta||inta===0)?inta:1;var special=parsed[2]||false;var b=parseInt(parsed[3])||0;if(a!=0){b--;while(b<1)b+=a;while(b>=a)b-=a;}else{a=b;special='index';}
switch(special){case'n':parsed={a:a,b:b,special:'n'};break;case'odd':parsed={a:2,b:0,special:'n'};break;case'even':parsed={a:2,b:1,special:'n'};break;case'first':parsed={a:0,special:'index'};break;case'last':parsed={special:'last-child'};break;case'only':parsed={special:'only-child'};break;default:parsed={a:(a-1),special:'index'};}
return Selectors.Cache.nth[argument]=parsed;},parseSelector:function(selector){if(Selectors.Cache.parsed[selector])return Selectors.Cache.parsed[selector];var m,parsed={classes:[],pseudos:[],attributes:[]};while((m=Selectors.RegExps.combined.exec(selector))){var cn=m[1],an=m[2],ao=m[3],av=m[5],pn=m[6],pa=m[7];if(cn){parsed.classes.push(cn);}else if(pn){var parser=Selectors.Pseudo.get(pn);if(parser)parsed.pseudos.push({parser:parser,argument:pa});else parsed.attributes.push({name:pn,operator:'=',value:pa});}else if(an){parsed.attributes.push({name:an,operator:ao,value:av});}}
if(!parsed.classes.length)delete parsed.classes;if(!parsed.attributes.length)delete parsed.attributes;if(!parsed.pseudos.length)delete parsed.pseudos;if(!parsed.classes&&!parsed.attributes&&!parsed.pseudos)parsed=null;return Selectors.Cache.parsed[selector]=parsed;},parseTagAndID:function(selector){var tag=selector.match(Selectors.RegExps.tag);var id=selector.match(Selectors.RegExps.id);return[(tag)?tag[1]:'*',(id)?id[1]:false];},filter:function(item,parsed,local){var i;if(parsed.classes){for(i=parsed.classes.length;i--;i){var cn=parsed.classes[i];if(!Selectors.Filters.byClass(item,cn))return false;}}
if(parsed.attributes){for(i=parsed.attributes.length;i--;i){var att=parsed.attributes[i];if(!Selectors.Filters.byAttribute(item,att.name,att.operator,att.value))return false;}}
if(parsed.pseudos){for(i=parsed.pseudos.length;i--;i){var psd=parsed.pseudos[i];if(!Selectors.Filters.byPseudo(item,psd.parser,psd.argument,local))return false;}}
return true;},getByTagAndID:function(ctx,tag,id){if(id){var item=(ctx.getElementById)?ctx.getElementById(id,true):Element.getElementById(ctx,id,true);return(item&&Selectors.Filters.byTag(item,tag))?[item]:[];}else{return ctx.getElementsByTagName(tag);}},search:function(self,expression,local){var splitters=[];var selectors=expression.trim().replace(Selectors.RegExps.splitter,function(m0,m1,m2){splitters.push(m1);return':)'+m2;}).split(':)');var items,filtered,item;for(var i=0,l=selectors.length;i<l;i++){var selector=selectors[i];if(i==0&&Selectors.RegExps.quick.test(selector)){items=self.getElementsByTagName(selector);continue;}
var splitter=splitters[i-1];var tagid=Selectors.Utils.parseTagAndID(selector);var tag=tagid[0],id=tagid[1];if(i==0){items=Selectors.Utils.getByTagAndID(self,tag,id);}else{var uniques={},found=[];for(var j=0,k=items.length;j<k;j++)found=Selectors.Getters[splitter](found,items[j],tag,id,uniques);items=found;}
var parsed=Selectors.Utils.parseSelector(selector);if(parsed){filtered=[];for(var m=0,n=items.length;m<n;m++){item=items[m];if(Selectors.Utils.filter(item,parsed,local))filtered.push(item);}
items=filtered;}}
return items;}};Selectors.Getters={' ':function(found,self,tag,id,uniques){var items=Selectors.Utils.getByTagAndID(self,tag,id);for(var i=0,l=items.length;i<l;i++){var item=items[i];if(Selectors.Utils.chk(item,uniques))found.push(item);}
return found;},'>':function(found,self,tag,id,uniques){var children=Selectors.Utils.getByTagAndID(self,tag,id);for(var i=0,l=children.length;i<l;i++){var child=children[i];if(child.parentNode==self&&Selectors.Utils.chk(child,uniques))found.push(child);}
return found;},'+':function(found,self,tag,id,uniques){while((self=self.nextSibling)){if(self.nodeType==1){if(Selectors.Utils.chk(self,uniques)&&Selectors.Filters.byTag(self,tag)&&Selectors.Filters.byID(self,id))found.push(self);break;}}
return found;},'~':function(found,self,tag,id,uniques){while((self=self.nextSibling)){if(self.nodeType==1){if(!Selectors.Utils.chk(self,uniques))break;if(Selectors.Filters.byTag(self,tag)&&Selectors.Filters.byID(self,id))found.push(self);}}
return found;}};Selectors.Filters={byTag:function(self,tag){return(tag=='*'||(self.tagName&&self.tagName.toLowerCase()==tag));},byID:function(self,id){return(!id||(self.id&&self.id==id));},byClass:function(self,klass){return(self.className&&self.className.contains(klass,' '));},byPseudo:function(self,parser,argument,local){return parser.call(self,argument,local);},byAttribute:function(self,name,operator,value){var result=Element.prototype.getProperty.call(self,name);if(!result)return(operator=='!=');if(!operator||value==undefined)return true;switch(operator){case'=':return(result==value);case'*=':return(result.contains(value));case'^=':return(result.substr(0,value.length)==value);case'$=':return(result.substr(result.length-value.length)==value);case'!=':return(result!=value);case'~=':return result.contains(value,' ');case'|=':return result.contains(value,'-');}
return false;}};Selectors.Pseudo=new Hash({checked:function(){return this.checked;},empty:function(){return!(this.innerText||this.textContent||'').length;},not:function(selector){return!Element.match(this,selector);},contains:function(text){return(this.innerText||this.textContent||'').contains(text);},'first-child':function(){return Selectors.Pseudo.index.call(this,0);},'last-child':function(){var element=this;while((element=element.nextSibling)){if(element.nodeType==1)return false;}
return true;},'only-child':function(){var prev=this;while((prev=prev.previousSibling)){if(prev.nodeType==1)return false;}
var next=this;while((next=next.nextSibling)){if(next.nodeType==1)return false;}
return true;},'nth-child':function(argument,local){argument=(argument==undefined)?'n':argument;var parsed=Selectors.Utils.parseNthArgument(argument);if(parsed.special!='n')return Selectors.Pseudo[parsed.special].call(this,parsed.a,local);var count=0;local.positions=local.positions||{};var uid=$uid(this);if(!local.positions[uid]){var self=this;while((self=self.previousSibling)){if(self.nodeType!=1)continue;count++;var position=local.positions[$uid(self)];if(position!=undefined){count=position+count;break;}}
local.positions[uid]=count;}
return(local.positions[uid]%parsed.a==parsed.b);},index:function(index){var element=this,count=0;while((element=element.previousSibling)){if(element.nodeType==1&&++count>index)return false;}
return(count==index);},even:function(argument,local){return Selectors.Pseudo['nth-child'].call(this,'2n+1',local);},odd:function(argument,local){return Selectors.Pseudo['nth-child'].call(this,'2n',local);}});Element.Events.domready={onAdd:function(fn){if(Browser.loaded)fn.call(this);}};(function(){var domready=function(){if(Browser.loaded)return;Browser.loaded=true;window.fireEvent('domready');document.fireEvent('domready');};if(Browser.Engine.trident){var temp=document.createElement('div');(function(){($try(function(){temp.doScroll('left');return $(temp).inject(document.body).set('html','temp').dispose();}))?domready():arguments.callee.delay(50);})();}else if(Browser.Engine.webkit&&Browser.Engine.version<525){(function(){(['loaded','complete'].contains(document.readyState))?domready():arguments.callee.delay(50);})();}else{window.addEvent('load',domready);document.addEvent('DOMContentLoaded',domready);}})();var JSON=new Hash({$specialChars:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},$replaceChars:function(chr){return JSON.$specialChars[chr]||'\\u00'+Math.floor(chr.charCodeAt()/16).toString(16)+(chr.charCodeAt()%16).toString(16);},encode:function(obj){switch($type(obj)){case'string':return'"'+obj.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case'array':return'['+String(obj.map(JSON.encode).filter($defined))+']';case'object':case'hash':var string=[];Hash.each(obj,function(value,key){var json=JSON.encode(value);if(json)string.push(JSON.encode(key)+':'+json);});return'{'+string+'}';case'number':case'boolean':return String(obj);case false:return'null';}
return null;},decode:function(string,secure){if($type(string)!='string'||!string.length)return null;if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'')))return null;return eval('('+string+')');}});Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this);}});var Cookie=new Class({Implements:Options,options:{path:false,domain:false,duration:false,secure:false,document:document},initialize:function(key,options){this.key=key;this.setOptions(options);},write:function(value){value=encodeURIComponent(value);if(this.options.domain)value+='; domain='+this.options.domain;if(this.options.path)value+='; path='+this.options.path;if(this.options.duration){var date=new Date();date.setTime(date.getTime()+this.options.duration*24*60*60*1000);value+='; expires='+date.toGMTString();}
if(this.options.secure)value+='; secure';this.options.document.cookie=this.key+'='+value;return this;},read:function(){var value=this.options.document.cookie.match('(?:^|;)\\s*'+this.key.escapeRegExp()+'=([^;]*)');return(value)?decodeURIComponent(value[1]):null;},dispose:function(){new Cookie(this.key,$merge(this.options,{duration:-1})).write('');return this;}});Cookie.write=function(key,value,options){return new Cookie(key,options).write(value);};Cookie.read=function(key){return new Cookie(key).read();};Cookie.dispose=function(key,options){return new Cookie(key,options).dispose();};var Swiff=new Class({Implements:[Options],options:{id:null,height:1,width:1,container:null,properties:{},params:{quality:'high',allowScriptAccess:'always',wMode:'transparent',swLiveConnect:true},callBacks:{},vars:{}},toElement:function(){return this.object;},initialize:function(path,options){this.instance='Swiff_'+$time();this.setOptions(options);options=this.options;var id=this.id=options.id||this.instance;var container=$(options.container);Swiff.CallBacks[this.instance]={};var params=options.params,vars=options.vars,callBacks=options.callBacks;var properties=$extend({height:options.height,width:options.width},options.properties);var self=this;for(var callBack in callBacks){Swiff.CallBacks[this.instance][callBack]=(function(option){return function(){return option.apply(self.object,arguments);};})(callBacks[callBack]);vars[callBack]='Swiff.CallBacks.'+this.instance+'.'+callBack;}
params.flashVars=Hash.toQueryString(vars);if(Browser.Engine.trident){properties.classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';params.movie=path;}else{properties.type='application/x-shockwave-flash';properties.data=path;}
var build='<object id="'+id+'"';for(var property in properties)build+=' '+property+'="'+properties[property]+'"';build+='>';for(var param in params){if(params[param])build+='<param name="'+param+'" value="'+params[param]+'" />';}
build+='</object>';this.object=((container)?container.empty():new Element('div')).set('html',build).firstChild;},replaces:function(element){element=$(element,true);element.parentNode.replaceChild(this.toElement(),element);return this;},inject:function(element){$(element,true).appendChild(this.toElement());return this;},remote:function(){return Swiff.remote.apply(Swiff,[this.toElement()].extend(arguments));}});Swiff.CallBacks={};Swiff.remote=function(obj,fn){var rs=obj.CallFunction('<invoke name="'+fn+'" returntype="javascript">'+__flash__argumentsToXML(arguments,2)+'</invoke>');return eval(rs);};var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:'ignore'},initialize:function(options){this.subject=this.subject||this;this.setOptions(options);this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();var wait=this.options.wait;if(wait===false)this.options.link='cancel';},getTransition:function(){return function(p){return-(Math.cos(Math.PI*p)-1)/2;};},step:function(){var time=$time();if(time<this.time+this.options.duration){var delta=this.transition((time-this.time)/this.options.duration);this.set(this.compute(this.from,this.to,delta));}else{this.set(this.compute(this.from,this.to,1));this.complete();}},set:function(now){return now;},compute:function(from,to,delta){return Fx.compute(from,to,delta);},check:function(caller){if(!this.timer)return true;switch(this.options.link){case'cancel':this.cancel();return true;case'chain':this.chain(caller.bind(this,Array.slice(arguments,1)));return false;}
return false;},start:function(from,to){if(!this.check(arguments.callee,from,to))return this;this.from=from;this.to=to;this.time=0;this.transition=this.getTransition();this.startTimer();this.onStart();return this;},complete:function(){if(this.stopTimer())this.onComplete();return this;},cancel:function(){if(this.stopTimer())this.onCancel();return this;},onStart:function(){this.fireEvent('start',this.subject);},onComplete:function(){this.fireEvent('complete',this.subject);if(!this.callChain())this.fireEvent('chainComplete',this.subject);},onCancel:function(){this.fireEvent('cancel',this.subject).clearChain();},pause:function(){this.stopTimer();return this;},resume:function(){this.startTimer();return this;},stopTimer:function(){if(!this.timer)return false;this.time=$time()-this.time;this.timer=$clear(this.timer);return true;},startTimer:function(){if(this.timer)return false;this.time=$time()-this.time;this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);return true;}});Fx.compute=function(from,to,delta){return(to-from)*delta+from;};Fx.Durations={'short':250,'normal':500,'long':1000};Fx.CSS=new Class({Extends:Fx,prepare:function(element,property,values){values=$splat(values);var values1=values[1];if(!$chk(values1)){values[1]=values[0];values[0]=element.getStyle(property);}
var parsed=values.map(this.parse);return{from:parsed[0],to:parsed[1]};},parse:function(value){value=$lambda(value)();value=(typeof value=='string')?value.split(' '):$splat(value);return value.map(function(val){val=String(val);var found=false;Fx.CSS.Parsers.each(function(parser,key){if(found)return;var parsed=parser.parse(val);if($chk(parsed))found={value:parsed,parser:parser};});found=found||{value:val,parser:Fx.CSS.Parsers.String};return found;});},compute:function(from,to,delta){var computed=[];(Math.min(from.length,to.length)).times(function(i){computed.push({value:from[i].parser.compute(from[i].value,to[i].value,delta),parser:from[i].parser});});computed.$family={name:'fx:css:value'};return computed;},serve:function(value,unit){if($type(value)!='fx:css:value')value=this.parse(value);var returned=[];value.each(function(bit){returned=returned.concat(bit.parser.serve(bit.value,unit));});return returned;},render:function(element,property,value,unit){element.setStyle(property,this.serve(value,unit));},search:function(selector){if(Fx.CSS.Cache[selector])return Fx.CSS.Cache[selector];var to={};Array.each(document.styleSheets,function(sheet,j){var href=sheet.href;if(href&&href.contains('://')&&!href.contains(document.domain))return;var rules=sheet.rules||sheet.cssRules;Array.each(rules,function(rule,i){if(!rule.style)return;var selectorText=(rule.selectorText)?rule.selectorText.replace(/^\w+/,function(m){return m.toLowerCase();}):null;if(!selectorText||!selectorText.test('^'+selector+'$'))return;Element.Styles.each(function(value,style){if(!rule.style[style]||Element.ShortStyles[style])return;value=String(rule.style[style]);to[style]=(value.test(/^rgb/))?value.rgbToHex():value;});});});return Fx.CSS.Cache[selector]=to;}});Fx.CSS.Cache={};Fx.CSS.Parsers=new Hash({Color:{parse:function(value){if(value.match(/^#[0-9a-f]{3,6}$/i))return value.hexToRgb(true);return((value=value.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[value[1],value[2],value[3]]:false;},compute:function(from,to,delta){return from.map(function(value,i){return Math.round(Fx.compute(from[i],to[i],delta));});},serve:function(value){return value.map(Number);}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(value,unit){return(unit)?value+unit:value;}},String:{parse:$lambda(false),compute:$arguments(1),serve:$arguments(0)}});Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(element,options){this.element=this.subject=$(element);this.parent(options);},set:function(property,now){if(arguments.length==1){now=property;property=this.property||this.options.property;}
this.render(this.element,property,now,this.options.unit);return this;},start:function(property,from,to){if(!this.check(arguments.callee,property,from,to))return this;var args=Array.flatten(arguments);this.property=this.options.property||args.shift();var parsed=this.prepare(this.element,this.property,args);return this.parent(parsed.from,parsed.to);}});Element.Properties.tween={set:function(options){var tween=this.retrieve('tween');if(tween)tween.cancel();return this.eliminate('tween').store('tween:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('tween')){if(options||!this.retrieve('tween:options'))this.set('tween',options);this.store('tween',new Fx.Tween(this,this.retrieve('tween:options')));}
return this.retrieve('tween');}};Element.implement({tween:function(property,from,to){this.get('tween').start(arguments);return this;},fade:function(how){var fade=this.get('tween'),o='opacity',toggle;how=$pick(how,'toggle');switch(how){case'in':fade.start(o,1);break;case'out':fade.start(o,0);break;case'show':fade.set(o,1);break;case'hide':fade.set(o,0);break;case'toggle':var flag=this.retrieve('fade:flag',this.get('opacity')==1);fade.start(o,(flag)?0:1);this.store('fade:flag',!flag);toggle=true;break;default:fade.start(o,arguments);}
if(!toggle)this.eliminate('fade:flag');return this;},highlight:function(start,end){if(!end){end=this.retrieve('highlight:original',this.getStyle('background-color'));end=(end=='transparent')?'#fff':end;}
var tween=this.get('tween');tween.start('background-color',start||'#ffff88',end).chain(function(){this.setStyle('background-color',this.retrieve('highlight:original'));tween.callChain();}.bind(this));return this;}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(element,options){this.element=this.subject=$(element);this.parent(options);},set:function(now){if(typeof now=='string')now=this.search(now);for(var p in now)this.render(this.element,p,now[p],this.options.unit);return this;},compute:function(from,to,delta){var now={};for(var p in from)now[p]=this.parent(from[p],to[p],delta);return now;},start:function(properties){if(!this.check(arguments.callee,properties))return this;if(typeof properties=='string')properties=this.search(properties);var from={},to={};for(var p in properties){var parsed=this.prepare(this.element,p,properties[p]);from[p]=parsed.from;to[p]=parsed.to;}
return this.parent(from,to);}});Element.Properties.morph={set:function(options){var morph=this.retrieve('morph');if(morph)morph.cancel();return this.eliminate('morph').store('morph:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('morph')){if(options||!this.retrieve('morph:options'))this.set('morph',options);this.store('morph',new Fx.Morph(this,this.retrieve('morph:options')));}
return this.retrieve('morph');}};Element.implement({morph:function(props){this.get('morph').start(props);return this;}});Fx.implement({getTransition:function(){var trans=this.options.transition||Fx.Transitions.Sine.easeInOut;if(typeof trans=='string'){var data=trans.split(':');trans=Fx.Transitions;trans=trans[data[0]]||trans[data[0].capitalize()];if(data[1])trans=trans['ease'+data[1].capitalize()+(data[2]?data[2].capitalize():'')];}
return trans;}});Fx.Transition=function(transition,params){params=$splat(params);return $extend(transition,{easeIn:function(pos){return transition(pos,params);},easeOut:function(pos){return 1-transition(1-pos,params);},easeInOut:function(pos){return(pos<=0.5)?transition(2*pos,params)/2:(2-transition(2*(1-pos),params))/2;}});};Fx.Transitions=new Hash({linear:$arguments(0)});Fx.Transitions.extend=function(transitions){for(var transition in transitions)Fx.Transitions[transition]=new Fx.Transition(transitions[transition]);};Fx.Transitions.extend({Pow:function(p,x){return Math.pow(p,x[0]||6);},Expo:function(p){return Math.pow(2,8*(p-1));},Circ:function(p){return 1-Math.sin(Math.acos(p));},Sine:function(p){return 1-Math.sin((1-p)*Math.PI/2);},Back:function(p,x){x=x[0]||1.618;return Math.pow(p,2)*((x+1)*p-x);},Bounce:function(p){var value;for(var a=0,b=1;1;a+=b,b/=2){if(p>=(7-4*a)/11){value=b*b-Math.pow((11-6*a-11*p)/4,2);break;}}
return value;},Elastic:function(p,x){return Math.pow(2,10*--p)*Math.cos(20*p*Math.PI*(x[0]||1)/3);}});['Quad','Cubic','Quart','Quint'].each(function(transition,i){Fx.Transitions[transition]=new Fx.Transition(function(p){return Math.pow(p,[i+2]);});});var Request=new Class({Implements:[Chain,Events,Options],options:{url:'',data:'',headers:{'X-Requested-With':'XMLHttpRequest','Accept':'text/javascript, text/html, application/xml, text/xml, */*'},async:true,format:false,method:'post',link:'ignore',isSuccess:null,emulation:true,urlEncoded:true,encoding:'utf-8',evalScripts:false,evalResponse:false},initialize:function(options){this.xhr=new Browser.Request();this.setOptions(options);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers=new Hash(this.options.headers);},onStateChange:function(){if(this.xhr.readyState!=4||!this.running)return;this.running=false;this.status=0;$try(function(){this.status=this.xhr.status;}.bind(this));if(this.options.isSuccess.call(this,this.status)){this.response={text:this.xhr.responseText,xml:this.xhr.responseXML};this.success(this.response.text,this.response.xml);}else{this.response={text:null,xml:null};this.failure();}
this.xhr.onreadystatechange=$empty;},isSuccess:function(){return((this.status>=200)&&(this.status<300));},processScripts:function(text){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader('Content-type')))return $exec(text);return text.stripScripts(this.options.evalScripts);},success:function(text,xml){this.onSuccess(this.processScripts(text),xml);},onSuccess:function(){this.fireEvent('complete',arguments).fireEvent('success',arguments).callChain();},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent('complete').fireEvent('failure',this.xhr);},setHeader:function(name,value){this.headers.set(name,value);return this;},getHeader:function(name){return $try(function(){return this.xhr.getResponseHeader(name);}.bind(this));},check:function(caller){if(!this.running)return true;switch(this.options.link){case'cancel':this.cancel();return true;case'chain':this.chain(caller.bind(this,Array.slice(arguments,1)));return false;}
return false;},send:function(options){if(!this.check(arguments.callee,options))return this;this.running=true;var type=$type(options);if(type=='string'||type=='element')options={data:options};var old=this.options;options=$extend({data:old.data,url:old.url,method:old.method},options);var data=options.data,url=options.url,method=options.method;switch($type(data)){case'element':data=$(data).toQueryString();break;case'object':case'hash':data=Hash.toQueryString(data);}
if(this.options.format){var format='format='+this.options.format;data=(data)?format+'&'+data:format;}
if(this.options.emulation&&['put','delete'].contains(method)){var _method='_method='+method;data=(data)?_method+'&'+data:_method;method='post';}
if(this.options.urlEncoded&&method=='post'){var encoding=(this.options.encoding)?'; charset='+this.options.encoding:'';this.headers.set('Content-type','application/x-www-form-urlencoded'+encoding);}
if(data&&method=='get'){url=url+(url.contains('?')?'&':'?')+data;data=null;}
this.xhr.open(method.toUpperCase(),url,this.options.async);this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(value,key){try{this.xhr.setRequestHeader(key,value);}catch(e){this.fireEvent('exception',[key,value]);}},this);this.fireEvent('request');this.xhr.send(data);if(!this.options.async)this.onStateChange();return this;},cancel:function(){if(!this.running)return this;this.running=false;this.xhr.abort();this.xhr.onreadystatechange=$empty;this.xhr=new Browser.Request();this.fireEvent('cancel');return this;}});(function(){var methods={};['get','post','put','delete','GET','POST','PUT','DELETE'].each(function(method){methods[method]=function(){var params=Array.link(arguments,{url:String.type,data:$defined});return this.send($extend(params,{method:method.toLowerCase()}));};});Request.implement(methods);})();Element.Properties.send={set:function(options){var send=this.retrieve('send');if(send)send.cancel();return this.eliminate('send').store('send:options',$extend({data:this,link:'cancel',method:this.get('method')||'post',url:this.get('action')},options));},get:function(options){if(options||!this.retrieve('send')){if(options||!this.retrieve('send:options'))this.set('send',options);this.store('send',new Request(this.retrieve('send:options')));}
return this.retrieve('send');}};Element.implement({send:function(url){var sender=this.get('send');sender.send({data:this,url:url||sender.options.url});return this;}});Request.HTML=new Class({Extends:Request,options:{update:false,evalScripts:true,filter:false},processHTML:function(text){var match=text.match(/<body[^>]*>([\s\S]*?)<\/body>/i);text=(match)?match[1]:text;var container=new Element('div');return $try(function(){var root='<root>'+text+'</root>',doc;if(Browser.Engine.trident){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async=false;doc.loadXML(root);}else{doc=new DOMParser().parseFromString(root,'text/xml');}
root=doc.getElementsByTagName('root')[0];for(var i=0,k=root.childNodes.length;i<k;i++){var child=Element.clone(root.childNodes[i],true,true);if(child)container.grab(child);}
return container;})||container.set('html',text);},success:function(text){var options=this.options,response=this.response;response.html=text.stripScripts(function(script){response.javascript=script;});var temp=this.processHTML(response.html);response.tree=temp.childNodes;response.elements=temp.getElements('*');if(options.filter)response.tree=response.elements.filter(options.filter);if(options.update){if(Browser.Engine.trident)
$(options.update).set('html',response.html);else
$(options.update).empty().grab(temp);}
if(options.evalScripts)$exec(response.javascript);this.onSuccess(response.tree,response.elements,response.html,response.javascript);}});Element.Properties.load={set:function(options){var load=this.retrieve('load');if(load)load.cancel();return this.eliminate('load').store('load:options',$extend({data:this,link:'cancel',update:this,method:'get'},options));},get:function(options){if(options||!this.retrieve('load')){if(options||!this.retrieve('load:options'))this.set('load',options);this.store('load',new Request.HTML(this.retrieve('load:options')));}
return this.retrieve('load');}};Element.implement({load:function(){this.get('load').send(Array.link(arguments,{data:Object.type,url:String.type}));return this;}});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(options){this.parent(options);this.headers.extend({'Accept':'application/json','X-Request':'JSON'});},success:function(text){this.response.json=JSON.decode(text,this.options.secure);this.onSuccess(this.response.json,text);}});Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical"},initialize:function(B,A){this.addEvent("complete",function(){this.open=(this.wrapper["offset"+this.layout.capitalize()]!=0);if(this.open&&Browser.Engine.webkit419){this.element.dispose().inject(this.wrapper);}},true);this.element=this.subject=$(B);this.parent(A);var C=this.element.retrieve("wrapper");this.wrapper=C||new Element("div",{styles:$extend(this.element.getStyles("margin","position"),{overflow:"hidden"})}).wraps(this.element);this.element.store("wrapper",this.wrapper).setStyle("margin",0);this.now=[];this.open=true;},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight;},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth;},set:function(A){this.element.setStyle(this.margin,A[0]);this.wrapper.setStyle(this.layout,A[1]);return this;},compute:function(E,D,C){var B=[];var A=2;A.times(function(F){B[F]=Fx.compute(E[F],D[F],C);});return B;},start:function(B,E){if(!this.check(arguments.callee,B,E)){return this;}this[E||this.options.mode]();var D=this.element.getStyle(this.margin).toInt();var C=this.wrapper.getStyle(this.layout).toInt();var A=[[D,C],[0,this.offset]];var G=[[D,C],[-this.offset,0]];var F;switch(B){case"in":F=A;break;case"out":F=G;break;case"toggle":F=(this.wrapper["offset"+this.layout.capitalize()]==0)?A:G;}return this.parent(F[0],F[1]);},slideIn:function(A){return this.start("in",A);},slideOut:function(A){return this.start("out",A);},hide:function(A){this[A||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(A){this[A||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(A){return this.start("toggle",A);}});Element.Properties.slide={set:function(B){var A=this.retrieve("slide");if(A){A.cancel();}return this.eliminate("slide").store("slide:options",$extend({link:"cancel"},B));},get:function(A){if(A||!this.retrieve("slide")){if(A||!this.retrieve("slide:options")){this.set("slide",A);}this.store("slide",new Fx.Slide(this,this.retrieve("slide:options")));}return this.retrieve("slide");}};Element.implement({slide:function(D,E){D=D||"toggle";var B=this.get("slide"),A;switch(D){case"hide":B.hide(E);break;case"show":B.show(E);break;case"toggle":var C=this.retrieve("slide:flag",B.open);B[(C)?"slideOut":"slideIn"](E);this.store("slide:flag",!C);A=true;break;default:B.start(D,E);}if(!A){this.eliminate("slide:flag");}return this;}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(B,A){this.element=this.subject=$(B);this.parent(A);var D=this.cancel.bind(this,false);if($type(this.element)!="element"){this.element=$(this.element.getDocument().body);}var C=this.element;if(this.options.wheelStops){this.addEvent("start",function(){C.addEvent("mousewheel",D);},true);this.addEvent("complete",function(){C.removeEvent("mousewheel",D);},true);}},set:function(){var A=Array.flatten(arguments);this.element.scrollTo(A[0],A[1]);},compute:function(E,D,C){var B=[];var A=2;A.times(function(F){B.push(Fx.compute(E[F],D[F],C));});return B;},start:function(C,H){if(!this.check(arguments.callee,C,H)){return this;}var E=this.element.getSize(),F=this.element.getScrollSize();var B=this.element.getScroll(),D={x:C,y:H};for(var G in D){var A=F[G]-E[G];if($chk(D[G])){D[G]=($type(D[G])=="number")?D[G].limit(0,A):A;}else{D[G]=B[G];}D[G]+=this.options.offset[G];}return this.parent([B.x,B.y],[D.x,D.y]);},toTop:function(){return this.start(false,0);},toLeft:function(){return this.start(0,false);},toRight:function(){return this.start("right",false);},toBottom:function(){return this.start(false,"bottom");},toElement:function(B){var A=$(B).getPosition(this.element);return this.start(A.x,A.y);}});Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(B,A){this.elements=this.subject=$$(B);this.parent(A);},compute:function(G,H,I){var C={};for(var D in G){var A=G[D],E=H[D],F=C[D]={};for(var B in A){F[B]=this.parent(A[B],E[B],I);}}return C;},set:function(B){for(var C in B){var A=B[C];for(var D in A){this.render(this.elements[C],D,A[D],this.options.unit);}}return this;},start:function(C){if(!this.check(arguments.callee,C)){return this;}var H={},I={};for(var D in C){var F=C[D],A=H[D]={},G=I[D]={};for(var B in F){var E=this.prepare(this.elements[D],B,F[B]);A[B]=E.from;G[B]=E.to;}}return this.parent(H,I);}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,modifiers:{x:"left",y:"top"}},initialize:function(){var B=Array.link(arguments,{options:Object.type,element:$defined});this.element=$(B.element);this.document=this.element.getDocument();this.setOptions(B.options||{});var A=$type(this.options.handle);this.handles=(A=="array"||A=="collection")?$$(this.options.handle):$(this.options.handle)||this.element;this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.Engine.trident)?"selectstart":"mousedown";this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);return this;},start:function(C){if(this.options.preventDefault){C.preventDefault();}this.fireEvent("beforeStart",this.element);this.mouse.start=C.page;var A=this.options.limit;this.limit={x:[],y:[]};for(var D in this.options.modifiers){if(!this.options.modifiers[D]){continue;}if(this.options.style){this.value.now[D]=this.element.getStyle(this.options.modifiers[D]).toInt();}else{this.value.now[D]=this.element[this.options.modifiers[D]];}if(this.options.invert){this.value.now[D]*=-1;}this.mouse.pos[D]=C.page[D]-this.value.now[D];if(A&&A[D]){for(var B=2;B--;B){if($chk(A[D][B])){this.limit[D][B]=$lambda(A[D][B])();}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid};}this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});this.document.addEvent(this.selection,this.bound.eventStop);},check:function(A){if(this.options.preventDefault){A.preventDefault();}var B=Math.round(Math.sqrt(Math.pow(A.page.x-this.mouse.start.x,2)+Math.pow(A.page.y-this.mouse.start.y,2)));if(B>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent("start",this.element).fireEvent("snap",this.element);}},drag:function(A){if(this.options.preventDefault){A.preventDefault();}this.mouse.now=A.page;for(var B in this.options.modifiers){if(!this.options.modifiers[B]){continue;}this.value.now[B]=this.mouse.now[B]-this.mouse.pos[B];if(this.options.invert){this.value.now[B]*=-1;}if(this.options.limit&&this.limit[B]){if($chk(this.limit[B][1])&&(this.value.now[B]>this.limit[B][1])){this.value.now[B]=this.limit[B][1];}else{if($chk(this.limit[B][0])&&(this.value.now[B]<this.limit[B][0])){this.value.now[B]=this.limit[B][0];}}}if(this.options.grid[B]){this.value.now[B]-=(this.value.now[B]%this.options.grid[B]);}if(this.options.style){this.element.setStyle(this.options.modifiers[B],this.value.now[B]+this.options.unit);}else{this.element[this.options.modifiers[B]]=this.value.now[B];}}this.fireEvent("drag",this.element);},cancel:function(A){this.document.removeEvent("mousemove",this.bound.check);this.document.removeEvent("mouseup",this.bound.cancel);if(A){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element);}},stop:function(A){this.document.removeEvent(this.selection,this.bound.eventStop);this.document.removeEvent("mousemove",this.bound.drag);this.document.removeEvent("mouseup",this.bound.stop);if(A){this.fireEvent("complete",this.element);}}});Element.implement({makeResizable:function(A){return new Drag(this,$merge({modifiers:{x:"width",y:"height"}},A));}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false},initialize:function(C,B){this.parent(C,B);this.droppables=$$(this.options.droppables);this.container=$(this.options.container);if(this.container&&$type(this.container)!="element"){this.container=$(this.container.getDocument().body);}C=this.element;var D=C.getStyle("position");var A=(D!="static")?D:"absolute";if(C.getStyle("left")=="auto"||C.getStyle("top")=="auto"){C.position(C.getPosition(C.offsetParent));}C.setStyle("position",A);this.addEvent("start",function(){this.checkDroppables();},true);},start:function(B){if(this.container){var D=this.element,J=this.container,E=J.getCoordinates(D.offsetParent),F={},A={};["top","right","bottom","left"].each(function(K){F[K]=J.getStyle("padding-"+K).toInt();A[K]=D.getStyle("margin-"+K).toInt();},this);var C=D.offsetWidth+A.left+A.right,I=D.offsetHeight+A.top+A.bottom;var H=[E.left+F.left,E.right-F.right-C];var G=[E.top+F.top,E.bottom-F.bottom-I];this.options.limit={x:H,y:G};}this.parent(B);},checkAgainst:function(B){B=B.getCoordinates();var A=this.mouse.now;return(A.x>B.left&&A.x<B.right&&A.y<B.bottom&&A.y>B.top);},checkDroppables:function(){var A=this.droppables.filter(this.checkAgainst,this).getLast();if(this.overed!=A){if(this.overed){this.fireEvent("leave",[this.element,this.overed]);}if(A){this.overed=A;this.fireEvent("enter",[this.element,A]);}else{this.overed=null;}}},drag:function(A){this.parent(A);if(this.droppables.length){this.checkDroppables();}},stop:function(A){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed]);this.overed=null;return this.parent(A);}});Element.implement({makeDraggable:function(A){return new Drag.Move(this,A);}});Hash.Cookie=new Class({Extends:Cookie,options:{autoSave:true},initialize:function(B,A){this.parent(B,A);this.load();},save:function(){var A=JSON.encode(this.hash);if(!A||A.length>4096){return false;}if(A=="{}"){this.dispose();}else{this.write(A);}return true;},load:function(){this.hash=new Hash(JSON.decode(this.read(),true));return this;}});Hash.Cookie.implement((function(){var A={};Hash.each(Hash.prototype,function(C,B){A[B]=function(){var D=C.apply(this.hash,arguments);if(this.options.autoSave){this.save();}return D;};});return A;})());var Color=new Native({initialize:function(B,C){if(arguments.length>=3){C="rgb";B=Array.slice(arguments,0,3);}else{if(typeof B=="string"){if(B.match(/rgb/)){B=B.rgbToHex().hexToRgb(true);}else{if(B.match(/hsb/)){B=B.hsbToRgb();}else{B=B.hexToRgb(true);}}}}C=C||"rgb";switch(C){case"hsb":var A=B;B=B.hsbToRgb();B.hsb=A;break;case"hex":B=B.hexToRgb(true);break;}B.rgb=B.slice(0,3);B.hsb=B.hsb||B.rgbToHsb();B.hex=B.rgbToHex();return $extend(B,this);}});Color.implement({mix:function(){var A=Array.slice(arguments);var C=($type(A.getLast())=="number")?A.pop():50;var B=this.slice();A.each(function(D){D=new Color(D);for(var E=0;E<3;E++){B[E]=Math.round((B[E]/100*(100-C))+(D[E]/100*C));}});return new Color(B,"rgb");},invert:function(){return new Color(this.map(function(A){return 255-A;}));},setHue:function(A){return new Color([A,this.hsb[1],this.hsb[2]],"hsb");},setSaturation:function(A){return new Color([this.hsb[0],A,this.hsb[2]],"hsb");},setBrightness:function(A){return new Color([this.hsb[0],this.hsb[1],A],"hsb");}});function $RGB(C,B,A){return new Color([C,B,A],"rgb");}function $HSB(C,B,A){return new Color([C,B,A],"hsb");}function $HEX(A){return new Color(A,"hex");}Array.implement({rgbToHsb:function(){var B=this[0],C=this[1],J=this[2];var G,F,H;var I=Math.max(B,C,J),E=Math.min(B,C,J);var K=I-E;H=I/255;F=(I!=0)?K/I:0;if(F==0){G=0;}else{var D=(I-B)/K;var A=(I-C)/K;var L=(I-J)/K;if(B==I){G=L-A;}else{if(C==I){G=2+D-L;}else{G=4+A-D;}}G/=6;if(G<0){G++;}}return[Math.round(G*360),Math.round(F*100),Math.round(H*100)];},hsbToRgb:function(){var C=Math.round(this[2]/100*255);if(this[1]==0){return[C,C,C];}else{var A=this[0]%360;var E=A%60;var F=Math.round((this[2]*(100-this[1]))/10000*255);var D=Math.round((this[2]*(6000-this[1]*E))/600000*255);var B=Math.round((this[2]*(6000-this[1]*(60-E)))/600000*255);switch(Math.floor(A/60)){case 0:return[C,B,F];case 1:return[D,C,F];case 2:return[F,C,B];case 3:return[F,D,C];case 4:return[B,F,C];case 5:return[C,F,D];}}return false;}});String.implement({rgbToHsb:function(){var A=this.match(/\d{1,3}/g);return(A)?hsb.rgbToHsb():null;},hsbToRgb:function(){var A=this.match(/\d{1,3}/g);return(A)?A.hsbToRgb():null;}});var Group=new Class({initialize:function(){this.instances=Array.flatten(arguments);this.events={};this.checker={};},addEvent:function(B,A){this.checker[B]=this.checker[B]||{};this.events[B]=this.events[B]||[];if(this.events[B].contains(A)){return false;}else{this.events[B].push(A);}this.instances.each(function(C,D){C.addEvent(B,this.check.bind(this,[B,C,D]));},this);return this;},check:function(C,A,B){this.checker[C][B]=true;var D=this.instances.every(function(F,E){return this.checker[C][E]||false;},this);if(!D){return;}this.checker[C]={};this.events[C].each(function(E){E.call(this,this.instances,A);},this);}});var Asset=new Hash({javascript:function(F,D){D=$extend({onload:$empty,document:document,check:$lambda(true)},D);var B=new Element("script",{src:F,type:"text/javascript"});var E=D.onload.bind(B),A=D.check,G=D.document;delete D.onload;delete D.check;delete D.document;B.addEvents({load:E,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){E();}}}).setProperties(D);if(Browser.Engine.webkit419){var C=(function(){if(!$try(A)){return;}$clear(C);E();}).periodical(50);}return B.inject(G.head);},css:function(B,A){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:B},A)).inject(document.head);},image:function(C,B){B=$merge({onload:$empty,onabort:$empty,onerror:$empty},B);var D=new Image();var A=$(D)||new Element("img");["load","abort","error"].each(function(E){var F="on"+E;var G=B[F];delete B[F];D[F]=function(){if(!D){return;}if(!A.parentNode){A.width=D.width;A.height=D.height;}D=D.onload=D.onabort=D.onerror=null;G.delay(1,A,A);A.fireEvent(E,A,1);};});D.src=A.src=C;if(D&&D.complete){D.onload.delay(1);}return A.setProperties(B);},images:function(D,C){C=$merge({onComplete:$empty,onProgress:$empty},C);if(!D.push){D=[D];}var A=[];var B=0;D.each(function(F){var E=new Asset.image(F,{onload:function(){C.onProgress.call(this,B,D.indexOf(F));B++;if(B==D.length){C.onComplete();}}});A.push(E);});return new Elements(A);}});var Sortables=new Class({Implements:[Events,Options],options:{snap:4,opacity:1,clone:false,revert:false,handle:false,constrain:false},initialize:function(A,B){this.setOptions(B);this.elements=[];this.lists=[];this.idle=true;this.addLists($$($(A)||A));if(!this.options.clone){this.options.revert=false;}if(this.options.revert){this.effect=new Fx.Morph(null,$merge({duration:250,link:"cancel"},this.options.revert));}},attach:function(){this.addLists(this.lists);return this;},detach:function(){this.lists=this.removeLists(this.lists);return this;},addItems:function(){Array.flatten(arguments).each(function(A){this.elements.push(A);var B=A.retrieve("sortables:start",this.start.bindWithEvent(this,A));(this.options.handle?A.getElement(this.options.handle)||A:A).addEvent("mousedown",B);},this);return this;},addLists:function(){Array.flatten(arguments).each(function(A){this.lists.push(A);this.addItems(A.getChildren());},this);return this;},removeItems:function(){var A=[];Array.flatten(arguments).each(function(B){A.push(B);this.elements.erase(B);var C=B.retrieve("sortables:start");(this.options.handle?B.getElement(this.options.handle)||B:B).removeEvent("mousedown",C);},this);return $$(A);},removeLists:function(){var A=[];Array.flatten(arguments).each(function(B){A.push(B);this.lists.erase(B);this.removeItems(B.getChildren());},this);return $$(A);},getClone:function(B,A){if(!this.options.clone){return new Element("div").inject(document.body);}if($type(this.options.clone)=="function"){return this.options.clone.call(this,B,A,this.list);}return A.clone(true).setStyles({margin:"0px",position:"absolute",visibility:"hidden",width:A.getStyle("width")}).inject(this.list).position(A.getPosition(A.getOffsetParent()));},getDroppables:function(){var A=this.list.getChildren();if(!this.options.constrain){A=this.lists.concat(A).erase(this.list);}return A.erase(this.clone).erase(this.element);},insert:function(C,B){var A="inside";if(this.lists.contains(B)){this.list=B;this.drag.droppables=this.getDroppables();}else{A=this.element.getAllPrevious().contains(B)?"before":"after";}this.element.inject(B,A);this.fireEvent("sort",[this.element,this.clone]);},start:function(B,A){if(!this.idle){return;}this.idle=false;this.element=A;this.opacity=A.get("opacity");this.list=A.getParent();this.clone=this.getClone(B,A);this.drag=new Drag.Move(this.clone,{snap:this.options.snap,container:this.options.constrain&&this.element.getParent(),droppables:this.getDroppables(),onSnap:function(){B.stop();this.clone.setStyle("visibility","visible");this.element.set("opacity",this.options.opacity||0);this.fireEvent("start",[this.element,this.clone]);}.bind(this),onEnter:this.insert.bind(this),onCancel:this.reset.bind(this),onComplete:this.end.bind(this)});this.clone.inject(this.element,"before");this.drag.start(B);},end:function(){this.drag.detach();this.element.set("opacity",this.opacity);if(this.effect){var A=this.element.getStyles("width","height");var B=this.clone.computePosition(this.element.getPosition(this.clone.offsetParent));this.effect.element=this.clone;this.effect.start({top:B.top,left:B.left,width:A.width,height:A.height,opacity:0.25}).chain(this.reset.bind(this));}else{this.reset();}},reset:function(){this.idle=true;this.clone.destroy();this.fireEvent("complete",this.element);},serialize:function(){var C=Array.link(arguments,{modifier:Function.type,index:$defined});var B=this.lists.map(function(D){return D.getChildren().map(C.modifier||function(E){return E.get("id");},this);},this);var A=C.index;if(this.lists.length==1){A=0;}return $chk(A)&&A>=0&&A<this.lists.length?B[A]:B;}});var Tips=new Class({Implements:[Events,Options],options:{onShow:function(A){A.setStyle("visibility","visible");},onHide:function(A){A.setStyle("visibility","hidden");},showDelay:100,hideDelay:100,className:null,offsets:{x:16,y:16},fixed:false},initialize:function(){var C=Array.link(arguments,{options:Object.type,elements:$defined});this.setOptions(C.options||null);this.tip=new Element("div").inject(document.body);if(this.options.className){this.tip.addClass(this.options.className);}var B=new Element("div",{"class":"tip-top"}).inject(this.tip);this.container=new Element("div",{"class":"tip"}).inject(this.tip);var A=new Element("div",{"class":"tip-bottom"}).inject(this.tip);this.tip.setStyles({position:"absolute",top:0,left:0,visibility:"hidden"});if(C.elements){this.attach(C.elements);}},attach:function(A){$$(A).each(function(D){var G=D.retrieve("tip:title",D.get("title"));var F=D.retrieve("tip:text",D.get("rel")||D.get("href"));var E=D.retrieve("tip:enter",this.elementEnter.bindWithEvent(this,D));var C=D.retrieve("tip:leave",this.elementLeave.bindWithEvent(this,D));D.addEvents({mouseenter:E,mouseleave:C});if(!this.options.fixed){var B=D.retrieve("tip:move",this.elementMove.bindWithEvent(this,D));D.addEvent("mousemove",B);}D.store("tip:native",D.get("title"));D.erase("title");},this);return this;},detach:function(A){$$(A).each(function(C){C.removeEvent("mouseenter",C.retrieve("tip:enter")||$empty);C.removeEvent("mouseleave",C.retrieve("tip:leave")||$empty);C.removeEvent("mousemove",C.retrieve("tip:move")||$empty);C.eliminate("tip:enter").eliminate("tip:leave").eliminate("tip:move");var B=C.retrieve("tip:native");if(B){C.set("title",B);}});return this;},elementEnter:function(B,A){$A(this.container.childNodes).each(Element.dispose);var D=A.retrieve("tip:title");if(D){this.titleElement=new Element("div",{"class":"tip-title"}).inject(this.container);this.fill(this.titleElement,D);}var C=A.retrieve("tip:text");if(C){this.textElement=new Element("div",{"class":"tip-text"}).inject(this.container);this.fill(this.textElement,C);}this.timer=$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);this.position((!this.options.fixed)?B:{page:A.getPosition()});},elementLeave:function(A){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this);},elementMove:function(A){this.position(A);},position:function(D){var B=window.getSize(),A=window.getScroll();var E={x:this.tip.offsetWidth,y:this.tip.offsetHeight};var C={x:"left",y:"top"};for(var F in C){var G=D.page[F]+this.options.offsets[F];if((G+E[F]-A[F])>B[F]){G=D.page[F]-this.options.offsets[F]-E[F];}this.tip.setStyle(C[F],G);}},fill:function(A,B){(typeof B=="string")?A.set("html",B):A.adopt(B);},show:function(){this.fireEvent("show",this.tip);},hide:function(){this.fireEvent("hide",this.tip);}});var SmoothScroll=new Class({Extends:Fx.Scroll,initialize:function(B,C){C=C||document;var E=C.getDocument(),D=C.getWindow();this.parent(E,B);this.links=(this.options.links)?$$(this.options.links):$$(E.links);var A=D.location.href.match(/^[^#]*/)[0]+"#";this.links.each(function(G){if(G.href.indexOf(A)!=0){return;}var F=G.href.substr(A.length);if(F&&$(F)){this.useLink(G,F);}},this);if(!Browser.Engine.webkit419){this.addEvent("complete",function(){D.location.hash=this.anchor;},true);}},useLink:function(B,A){B.addEvent("click",function(C){this.anchor=A;this.toElement(A);C.stop();}.bind(this));}});var Slider=new Class({Implements:[Events,Options],options:{onTick:function(A){if(this.options.snap){A=this.toPosition(this.step);}this.knob.setStyle(this.property,A);},snap:false,offset:0,range:false,wheel:false,steps:100,mode:"horizontal"},initialize:function(E,A,D){this.setOptions(D);this.element=$(E);this.knob=$(A);this.previousChange=this.previousEnd=this.step=-1;this.element.addEvent("mousedown",this.clickedElement.bind(this));if(this.options.wheel){this.element.addEvent("mousewheel",this.scrolledElement.bindWithEvent(this));}var F,B={},C={x:false,y:false};switch(this.options.mode){case"vertical":this.axis="y";this.property="top";F="offsetHeight";break;case"horizontal":this.axis="x";this.property="left";F="offsetWidth";}this.half=this.knob[F]/2;this.full=this.element[F]-this.knob[F]+(this.options.offset*2);this.min=$chk(this.options.range[0])?this.options.range[0]:0;this.max=$chk(this.options.range[1])?this.options.range[1]:this.options.steps;this.range=this.max-this.min;this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;this.stepWidth=this.stepSize*this.full/Math.abs(this.range);this.knob.setStyle("position","relative").setStyle(this.property,-this.options.offset);C[this.axis]=this.property;B[this.axis]=[-this.options.offset,this.full-this.options.offset];this.drag=new Drag(this.knob,{snap:0,limit:B,modifiers:C,onDrag:this.draggedKnob.bind(this),onStart:this.draggedKnob.bind(this),onComplete:function(){this.draggedKnob();this.end();}.bind(this)});if(this.options.snap){this.drag.options.grid=Math.ceil(this.stepWidth);this.drag.options.limit[this.axis][1]=this.full;}},set:function(A){if(!((this.range>0)^(A<this.min))){A=this.min;}if(!((this.range>0)^(A>this.max))){A=this.max;}this.step=Math.round(A);this.checkStep();this.end();this.fireEvent("tick",this.toPosition(this.step));return this;},clickedElement:function(C){var B=this.range<0?-1:1;var A=C.page[this.axis]-this.element.getPosition()[this.axis]-this.half;A=A.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+B*this.toStep(A));this.checkStep();this.end();this.fireEvent("tick",A);},scrolledElement:function(A){var B=(this.options.mode=="horizontal")?(A.wheel<0):(A.wheel>0);this.set(B?this.step-this.stepSize:this.step+this.stepSize);A.stop();},draggedKnob:function(){var B=this.range<0?-1:1;var A=this.drag.value.now[this.axis];A=A.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+B*this.toStep(A));this.checkStep();},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;this.fireEvent("change",this.step);}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent("complete",this.step+"");}},toStep:function(A){var B=(A+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(B-=B%this.stepSize):B;},toPosition:function(A){return(this.full*Math.abs(this.min-A))/(this.steps*this.stepSize)-this.options.offset;}});var Scroller=new Class({Implements:[Events,Options],options:{area:20,velocity:1,onChange:function(A,B){this.element.scrollTo(A,B);}},initialize:function(B,A){this.setOptions(A);this.element=$(B);this.listener=($type(this.element)!="element")?$(this.element.getDocument().body):this.element;this.timer=null;this.coord=this.getCoords.bind(this);},start:function(){this.listener.addEvent("mousemove",this.coord);},stop:function(){this.listener.removeEvent("mousemove",this.coord);this.timer=$clear(this.timer);},getCoords:function(A){this.page=(this.listener.get("tag")=="body")?A.client:A.page;if(!this.timer){this.timer=this.scroll.periodical(50,this);}},scroll:function(){var B=this.element.getSize(),A=this.element.getScroll(),E=this.element.getPosition(),D={x:0,y:0};for(var C in this.page){if(this.page[C]<(this.options.area+E[C])&&A[C]!=0){D[C]=(this.page[C]-this.options.area-E[C])*this.options.velocity;}else{if(this.page[C]+this.options.area>(B[C]+E[C])&&B[C]+B[C]!=A[C]){D[C]=(this.page[C]-B[C]+this.options.area-E[C])*this.options.velocity;}}}if(D.y||D.x){this.fireEvent("change",[A.x+D.x,A.y+D.y]);}}});var Accordion=new Class({Extends:Fx.Elements,options:{display:0,show:false,height:true,width:false,opacity:true,fixedHeight:false,fixedWidth:false,wait:false,alwaysHide:false},initialize:function(){var C=Array.link(arguments,{container:Element.type,options:Object.type,togglers:$defined,elements:$defined});this.parent(C.elements,C.options);this.togglers=$$(C.togglers);this.container=$(C.container);this.previous=-1;if(this.options.alwaysHide){this.options.wait=true;}if($chk(this.options.show)){this.options.display=false;this.previous=this.options.show;}if(this.options.start){this.options.display=false;this.options.show=false;}this.effects={};if(this.options.opacity){this.effects.opacity="fullOpacity";}if(this.options.width){this.effects.width=this.options.fixedWidth?"fullWidth":"offsetWidth";}if(this.options.height){this.effects.height=this.options.fixedHeight?"fullHeight":"scrollHeight";}for(var B=0,A=this.togglers.length;B<A;B++){this.addSection(this.togglers[B],this.elements[B]);}this.elements.each(function(E,D){if(this.options.show===D){this.fireEvent("active",[this.togglers[D],E]);}else{for(var F in this.effects){E.setStyle(F,0);}}},this);if($chk(this.options.display)){this.display(this.options.display);}},addSection:function(E,C,G){E=$(E);C=$(C);var F=this.togglers.contains(E);var B=this.togglers.length;this.togglers.include(E);this.elements.include(C);if(B&&(!F||G)){G=$pick(G,B-1);E.inject(this.togglers[G],"before");C.inject(E,"after");}else{if(this.container&&!F){E.inject(this.container);C.inject(this.container);}}var A=this.togglers.indexOf(E);E.addEvent("click",this.display.bind(this,A));if(this.options.height){C.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"});}if(this.options.width){C.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"});}C.fullOpacity=1;if(this.options.fixedWidth){C.fullWidth=this.options.fixedWidth;}if(this.options.fixedHeight){C.fullHeight=this.options.fixedHeight;}C.setStyle("overflow","hidden");if(!F){for(var D in this.effects){C.setStyle(D,0);}}return this;},display:function(A){A=($type(A)=="element")?this.elements.indexOf(A):A;if((this.timer&&this.options.wait)||(A===this.previous&&!this.options.alwaysHide)){return this;}this.previous=A;var B={};this.elements.each(function(E,D){B[D]={};var C=(D!=A)||(this.options.alwaysHide&&(E.offsetHeight>0));this.fireEvent(C?"background":"active",[this.togglers[D],E]);for(var F in this.effects){B[D][F]=C?0:E[this.effects[F]];}},this);return this.start(B);}});Request.HTML.implement({processHTML:function(text){var match=text.match(/<body[^>]*>([\s\S]*?)<\/body>/i);text=(match)?match[1]:text;var container=new Element('div');return $try(function(){var root='<root>'+text+'</root>',doc;if(Browser.Engine.trident){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async=false;doc.loadXML(root);}else{doc=new DOMParser().parseFromString(root,'text/html');}
root=doc.getElementsByTagName('root')[0];for(var i=0,k=root.childNodes.length;i<k;i++){var child=Element.clone(root.childNodes[i],true,true);if(child)container.grab(child);}
return container;})||container.set('html',text);}});var Constants={BROWSE_MIN_WIDTH:500,WATCH_START_WIDTH:480,WATCH_MAX_WIDTH:970,PLAYER_MAX_WIDTH:608,RELATED_HEIGHT:73,ABC_EXT_JS_PATH:'http://ll.static.abc.go.com/s/syn/remoteplayer?partner=veoh',ABC_JS_ID:'abcScript',DOWNLOAD_GUID_COMMAND:'49347A0A-C783-4e92-ADCE-ED7C93207E58',AUTH_COOKIE_NAME:"VEOH_GUIDE_AUTH"};var VeohUtils={rpcRoot:"/",cdnRoot:"/",iniVersion:"",staticRoot:"/",basePageTitle:'',pageTitleSuffix:"Veoh Video Network",customEmbedParams:'',disable3rdParty:false,inIframe:false,requestEvents:new Events(),enableQuantcast:function(){if(!this.disable3rdParty){_qacct='p-aasG6JkxVvmNA';var quantcastScript=Asset.javascript('http://edge.quantserve.com/quant.js',{id:'quantcastScript'});}},showEl:function(el){if($(el))
$(el).setStyle('display','block');},hideEl:function(el,animate){if($(el)){if(animate){$(el).tween('height',0);}
else{$(el).setStyle('display','none');}}},toggleEl:function(el,linkObj,closedClass,openClass){if($defined(linkObj)){var spanIcon=$(linkObj).getChildren('span.icon');}
if($(el).getStyle('display')=='none'){this.showEl(el);if($defined(linkObj)&&$defined(openClass)){if(spanIcon&&spanIcon[0]){$(spanIcon[0]).removeClass(closedClass);$(spanIcon[0]).addClass(openClass);}}}
else{this.hideEl(el);if($defined(linkObj)&&$defined(closedClass)){if(spanIcon&&spanIcon[0]){$(spanIcon[0]).removeClass(openClass);$(spanIcon[0]).addClass(closedClass);}}}},swap:function(linkObj,linkStates,toggledObj,toggledClass){linkObj=$(linkObj);var key='swapState';if(linkObj.retrieve(key)==null){if(!$defined(linkStates.initialState)){linkStates.initialState='on';}
linkObj.store(key,linkStates.initialState);linkObj.removeProperty('onclick');linkObj.addEvent('click',function(){$(toggledObj).toggleClass(toggledClass);var state=linkObj.retrieve(key);if(state=='on'){linkObj.innerHTML=linkStates.off;linkObj.store(key,'off');}
else{linkObj.innerHTML=linkStates.on;linkObj.store(key,'on');}
return false;});linkObj.fireEvent('click');if(Browser.Engine.trident){linkObj.fireEvent('click');}}
return false;},setCookie:function(key,value,domain,path,duration,secure){var options={'domain':$chk(domain)?domain:false,'path':$chk(path)?path:false,'duration':$chk(duration)?duration:false,'secure':$chk(secure)?secure:false};var cookie=Cookie.write(key,value,options);return cookie;},setRawCookie:function(key,value,domain,path,expires,secure){if(typeof expires=='number'){var date=new Date();date.setTime(date.getTime()+(expires*24*60*60*1000));expires=date.toUTCString();}
var options={key:key,value:value.replace(/"/,''),domain:domain?'; domain='+domain:'',path:path?'; path='+path:'',expires:expires?'; expires='+expires:'',secure:secure?'; secure':''};var cookieValue='{key}=\"{value}\"{domain}{path}{expires}{secure}';document.cookie=cookieValue.substitute(options);},getCookie:function(name){return Cookie.read(name);},getRawCookie:function(name){var cookie=VeohUtils.getCookie(name);return cookie?cookie.replace(/"/,''):cookie;},deleteCookie:function(name){Cookie.dispose(name);},isVeohWebPlayerInstalled:function(){var installed=false;var mozName='VeohTV Plugin';var mozProtocol='application/x-veohtvplugin';var activeXName='VeohTV2Version.VeohTV2Version';if(mozName=='java'){if(navigator.javaEnabled()){installed=true;}}
else if(navigator.plugins&&navigator.plugins.length){for(var i=0;i<navigator.plugins.length;i++){var plugin=navigator.plugins[i];var pluginName=plugin.name.toLowerCase();if(pluginName.indexOf(mozName.toLowerCase())>-1){installed=true;}}}
else{var qtObj=false;try{qtObj=new ActiveXObject(activeXName);if(qtObj){installed=true;}}
catch(e){installed=false;}}
return installed;},makeRequest:function(url,result,onsuccess,loadingIcon,params,isPost,contentType){var fromHyperlink=false;if(typeof url=="object"&&url["href"]){fromHyperlink=true;url=url.href;}
params=params!=null?params:{};if(!$defined(params.ajax)){params.ajax='true';}
if(result&&result["nodeName"]&&$(result)["set"]){try{if(loadingIcon){if(loadingIcon=='standard'){result.set('html',VeohUtils.ajaxBusyHtml);}else if($type(loadingIcon)=='string'){result.set('html',loadingIcon);}else if($type(loadingIcon)=='element'){result.grab(loadingIcon);}}
else if(VeohUtils["ajaxBusyHtml"]&&(result.id=="contentHolder"||result.id=="contentInner")){result.set('html',VeohUtils.ajaxBusyHtml);}
else{result.set('html','loading...');}
if(Browser.Engine.trident&&(result.id=="contentHolder"||result.id=="contentInner"||result.id=="browse")){result.style.minHeight="800px";if(Browser.Engine.trident4)
result.style.height="800px";}}
catch(e){}}
var baseOnSuccess=function(responseTree,responseElements,responseHTML,responseJavaScript){if(this.$events["successCustom"]){this.$events["successCustom"][0].apply(this,arguments);this.$events["successCustom"]=null;}};var options={url:url,update:result,onSuccess:baseOnSuccess,onSuccessCustom:onsuccess,method:(isPost!=null&&isPost)?'post':'get',data:params,headers:{'X-Requested-For-Target':(result&&result["id"]?result.id:"")}};var ret=new Request.HTML(options);if(contentType){ret.setHeader('Content-Type',contentType);}
VeohUtils.requestEvents.fireEvent('beforeSend',url);try{ret.send();}catch(e){}
VeohUtils.requestEvents.fireEvent('afterSend',url);return fromHyperlink?false:ret;},makePost:function(formToPost,result,onsuccess,loadingIcon,contentType){formToPost=$(formToPost);return VeohUtils.makeRequest(formToPost.action,result,onsuccess,loadingIcon,formToPost,true,contentType);},login:function(){if($('balloon')){try{var postUrl=$('loginForm').get('action');var onsuccess=null;var updateId=Balloon.balloonId+Balloon.contentsId;VeohUtils.makeRequest(postUrl,updateId,onsuccess,null,$('loginForm'),true);}
catch(e){if(console){console.log(e);}}
return false;}
else{return true;}},getAuthToken:function()
{return VeohUtils.getCookie(Constants.AUTH_COOKIE_NAME);},getBaseUrl:function()
{return this.rpcRoot;},getPageParameters:function()
{var result={};var pageParams=$('pageParametersJson');if($defined(pageParams)){result=JSON.decode(pageParams.value);}
return result;},getContextParameters:function()
{var result={};var contextParams=$('pageContextJson');if($defined(contextParams)){result=JSON.decode(contextParams.value);}
return result;},setContextParameters:function(paramObj)
{var contextParams=$('pageContextJson');if($defined(contextParams)){$('pageContextJson').value=JSON.encode(paramObj);}},collectParameters:function()
{var collected={adData:{},contextData:{},miscData:{},userData:{},videoData:{}};var pageParams=this.getPageParameters();var contextParams=this.getContextParameters();var videoParams=Metadata.jsonObj;if($defined(pageParams)){if($defined(pageParams.adData)){collected.adData=pageParams.adData;}
if($defined(pageParams.userData)){collected.userData=pageParams.userData;}
if($defined(pageParams.miscData)){collected.miscData=pageParams.miscData;}}
if($defined(contextParams)){collected.contextData=contextParams;}
if($defined(videoParams)){collected.videoData=videoParams;}
return collected;},lastMouse:[0,0],startTrackingMouse:function(){VeohUtils.lastMouse=[0,0];document.addEvents({"mouseover":function(evt){if(Browser.Engine.trident){VeohUtils.lastMouse[0]=event.clientX+document.body.scrollLeft;VeohUtils.lastMouse[1]=event.clientY+document.body.scrollTop;}else{VeohUtils.lastMouse[0]=evt.page.x;VeohUtils.lastMouse[1]=evt.page.y;}}});},stopTrackingMouse:function(){document.removeEvents("mouseover");}};VeohUtils.log=function(message,level){if(!level)
var level="notice";if(!message)
return;try{if(console&&console.log)
console.log(level+": "+message);}catch(e){}};VeohUtils.setLocale=function(newLocale){VeohUtils.setCookie("lassieLocale",newLocale,false,"/",1000);location.reload();};VeohUtils.getIdFromPermalinkId=function(id)
{if(id==null)
return"";if(id.substring(0,1)=="v")
{if(id.length>=15)
return id.substring(1,id.length-8);}
else if(id.substring(0,1)=="e")
{if(id.length>=15)
return id.substring(1,id.length-8);else if(id.length<15)
return id.substring(1);}
return"";};VeohUtils.backWithIframe=function(nodeToShow){if(!$("backerIframe")){bif=document.createElement("iframe");bif.src="about:";bif.marginWidth="0";bif.scrolling="no";bif.id="backerIframe";bif.width="401";document.body.appendChild(bif);}
nodeXY=nodeToShow.getPosition();$('backerIframe').setStyles({'height':nodeToShow.getHeight(),'width':nodeToShow.getWidth(),'left':nodeXY.x,'top':nodeXY.y,'display':'block','background-color':nodeToShow.getStyle("background-color")});};VeohUtils.hideBackerIframe=function(){if($("backerIframe"))$("backerIframe").style.display="none";};VeohUtils.startHistoryManagement=function(){hm=new HistoryManager();hm.addEvent('onHistoryChange',function(url){Balloon.hide();if(url!=''&&url.indexOf('letter')<0){url=decodeURIComponent(url);if(url.indexOf('watch=')>=0){var permalinkId=url.replace('watch=','');return BrowseWhileWatch.showWatch(permalinkId);}
else{return VeohUtils.makeRequest(url,$('contentInner'),Ads.reloadAds);}}
else if(url!=null&&window.location.pathname.indexOf('watch/')<0&&url.indexOf('letter')<0){BrowseWhileWatch.hideWatch(true);var pageUrl='http://'+window.location.host+window.location.pathname;return VeohUtils.makeRequest(pageUrl,$('contentInner'),Ads.reloadAds);}
else if(url!=null&&window.location.pathname.indexOf('watch/')>=0&&url.indexOf('letter')<0){var pageUrl=window.location.pathname;var i=pageUrl.indexOf('watch/');var permalinkId=pageUrl.substring(i+6,pageUrl.length);return BrowseWhileWatch.showWatch(permalinkId);}});var state=hm.getCurrentLocation();if(state!=''){hm.fireEvent('onHistoryChange',state);}};VeohUtils.addHistory=function(url){hm.addState(url);};VeohUtils.updatePageTitle=function(title){try{document.title=title+' | '+VeohUtils.pageTitleSuffix;}catch(e){}};VeohUtils.loadCookiesForFlash=function(){if($('flashPlayer')){try{document.getElementById('flashPlayer').setCookies(document.cookie);}
catch(e){}}};var Dropdown={dropTimer:0,showRequest:function(url,topLevelLi,nodeToShow){topLevelLi=$(topLevelLi);var dropdown=nodeToShow||topLevelLi.getElement('div.dropdown');Dropdown.show(topLevelLi,nodeToShow,false);VeohUtils.makeRequest(url,dropdown);dropdown=null;},show:function(topLevelLi,deprecated,autoCloseOnMouseLeave){var topLevelLi=$(topLevelLi);var dropdown=topLevelLi.getElement('div.dropdown');if(!topLevelLi.hasDropdownEvents){topLevelLi.hasDropdownEvents=true;topLevelLi.setProperty('onmouseover','');topLevelLi._zindex=topLevelLi.getStyle('z-index');if(autoCloseOnMouseLeave){topLevelLi.addEvents({'mouseover':function(){this.setStyle('z-index',999999);var dropdown=this.getElement('div.dropdown');dropdown.setStyle('display','block');dropdown=null;},'mouseleave':function(){this.setStyle('z-index',this._zindex);var dropdown=this.getElement('div.dropdown');dropdown.setStyle('display','none');dropdown=null;}});dropdown.addEvents({'mouseover':function(){this.getParent().fireEvent('mouseover');return false;},'mouseleave':function(){this.getParent().fireEvent('mouseleave');return false;}});if($defined(topLevelLi.onclick)){topLevelLi.setProperty('onclick','');topLevelLi.addEvents({'click':function(){return this.fireEvent('mouseover');}});}}}
if(!autoCloseOnMouseLeave){dropdown.setStyle('display','block');}
else{topLevelLi.fireEvent('mouseover');}
dropdown=topLevelLi=null;}};var Primitive=new Class({});var Updatable=new Class({Extends:Primitive,Implements:[Options],options:{contentElement:null,loadingElement:null,urlTemplate:null,url:null,callback:null,isUpdated:false,cacheBust:false},initialize:function(options)
{this.setOptions(options);},setUrl:function(url)
{if(!url)
{VeohUtils.log("error setting url: no url specified");return;}
this.options.url=url;if(1==this.state)
{this.update();}},update:function(url,cacheBust)
{if(url)
{this.options.url=url;}
if(!(this.options.url&&this.options.contentElement))
{VeohUtils.log("not enough data to update this Updatable; url and content element are required","error");return;}
if(null==this.options.callback)
{this.options.callback=this.updateSuccess.bind(this);}
var updateUrl=this.options.url;if(cacheBust||this.options.cacheBust){updateUrl+='?'+Math.random();}
VeohUtils.makeRequest(updateUrl,this.options.contentElement,this.options.callback,this.options.loadingElement);},updateSuccess:function()
{this.options.isUpdated=true;},setUrlFromTemplate:function(templateKey,value)
{return this.setUrlFromTemplates([templateKey],[value]);},setUrlFromTemplates:function(templateKey,value)
{if(!this.options.urlTemplate&&templateKey)
{VeohUtils.log("unable to replace template key/value: not enough data; urlTemplate = "+this.options.urlTemplate,"error");return;}
if(templateKey.length!=value.length)
{VeohUtils.log("invalid number of parameters; urlTemplate = "+this.options.urlTemplate,"error");return;}
var template=this.options.urlTemplate;for(var i in templateKey)
{template=template.replace("-"+templateKey[i]+"-",value[i]);}
this.setUrl(template);return template;},reset:function(){this.options.isUpdated=false;}});var ExpandableBox=new Class({Extends:Updatable,options:{stateElement:null,titleElement:null,containerElement:null,stateElementIcon:null,contentElement:null,effect:null,height:200,state:0,stateClosedClass:'sp_arrow-right-grey',stateOpenedClass:'sp_arrow-down-grey',afterClose:function(){},afterOpen:function(){},cacheBust:false},initialize:function(name,options)
{this.name=name;this.parent(options);if(!this.options.containerElement)
this.options.containerElement=$(name+"_"+"container");if(!this.options.stateElement)
this.options.stateElement=$(name+"_"+"state");if(!this.options.stateElementIcon&&$defined(this.options.stateElement))
this.options.stateElementIcon=this.options.stateElement.getElement('span.icon');if(!this.options.contentElement)
this.options.contentElement=$(name+"_"+"content");if(!this.options.titleElement)
this.options.titleElement=$(name+"_"+"title");if(!this.options.effect)
this.options.effect=new Fx.Tween(this.options.contentElement);if(this.options.containerElement&&this.options.stateElement&&this.options.contentElement)
{this.attachStateHandler();this.setInitialState(this.options.state);}},setInitialState:function(state)
{if(state==null){state=0;}
if(1==state){this.expand();}
else if(0==state)
{this.collapse();}},attachStateHandler:function()
{if(!this.options.stateElement)
{return;}
var clickHandler=this.toggle.bind(this);this.options.stateElement.addEvent('click',clickHandler);},toggle:function()
{if(this.options.contentElement.getStyle('height')!=null&&this.options.contentElement.getStyle('height').toInt()>0)
{this.collapse();}
else
{this.expand();}},expand:function()
{if(false==this.options.isUpdated&&this.options.url){this.update();}
this.options.effect.start('height',this.options.height);this.options.stateElementIcon.removeClass(this.options.stateClosedClass);this.options.stateElementIcon.addClass(this.options.stateOpenedClass);this.options.containerElement.addClass('open');if(Browser.Engine.trident){this.options.containerElement.addClass(this.name+'_open');}
this.options.contentElement.setStyle('display','block');this.options.state=1;this.options.afterOpen();},collapse:function()
{this.options.stateElementIcon.removeClass(this.options.stateOpenedClass);this.options.stateElementIcon.addClass(this.options.stateClosedClass);var c=function(){this.options.containerElement.removeClass('open');if(Browser.Engine.trident){this.options.containerElement.removeClass(this.name+'_open');}
this.options.contentElement.setStyle('display','none');};this.options.effect.start('height',0).chain(c.bind(this));this.options.state=0;this.options.afterClose();},show:function()
{if(this.options.containerElement)
{this.options.containerElement.style.display="block";}
else
{VeohUtils.log("unable to show: no container element","error");}},hide:function()
{if(this.options.containerElement)
{this.options.containerElement.style.display="none";}
else
{VeohUtils.log("unable to hide: no container element","error");}},isOpen:function(){return this.options.state==1?true:false;}});var BrowseWhileWatch={renderViaAjax:true,panels:new Hash(),isWatchOpen:false,extraParams:"",autoDownload:false,largeVideoView:false,currentTab:'',commentsTitle:'Comments',watchPaneOpenDuration:0,latestWebPlayerVersion:'',currentWebPlayerVersion:'',watchEvents:new Events(),isWatchOpened:function(){return this.isWatchOpen&&$defined($('watch'));},hideWatch:function(dontRunAdCall,isEmbed){thumbTips.hide();this.currentlyPlaying=$empty;this.isWatchOpen=false;Metrics.stopPlayProgressTracker();if(isEmbed){$('player').empty();VeohUtils.hideEl('player');VeohUtils.hideEl('playerClose');}else{if(this.largeVideoView){this.contentHolder.setStyle('background-color','#ffffff');this.watchPane.setStyle('width',Constants.WATCH_MAX_WIDTH);this.displayLargerVideoLink();this.largeVideoView=false;}
this.player.set('html','');try{if(!dontRunAdCall){Ads.handleWatchCloseEvent();}}catch(e){}
this.fx.watchPane.start(0).chain(function(){BrowseWhileWatch.contentHolder.removeClass('watchOpened');BrowseWhileWatch.contentHolder.removeClass('watchFull');BrowseWhileWatch.watchPane.setStyle('display','none');if($("collection-customStyle")){$("collection-customStyle").media="screen";}});}},init:function(permalinkId){this.initialized=true;this.watchPane=$('watch');this.isWatchOpen=(this.watchPane&&this.watchPane.getWidth()>0);this.browsePane=$('browse');this.contentHolder=$('contentHolder');this.player=$('player');this.fullScreenLauncher=$('launchFullScreen');this.hideBrowseWatch=$('hideBrowseWatchLink');if(!$defined(this.watchPane)||!$defined(this.browsePane)||!$defined(this.player)){return;}
this.fx={watchPane:new Fx.Tween($("watch"),{property:"width",duration:BrowseWhileWatch.watchPaneOpenDuration}),winScroller:new Fx.Scroll(window)};this.fx.watchPane.addEvents({'start':function(){BrowseWhileWatch.watchPane.setStyle('display','block');}});this.initializePanels();if(permalinkId&&permalinkId!=''){this.showWatch(permalinkId);}},resizePlayerWithRatio:function(width){thumbTips.hide();var vobj=Metadata.jsonObj;if(width==null){width=Constants.WATCH_START_WIDTH;}
var ratio=vobj.pWidth/vobj.pHeight;var height=parseInt(width/ratio);BrowseWhileWatch.player.setStyle('width',width);BrowseWhileWatch.player.tween('height',height);},showWatch:function(permalinkId,index,isEmbed){BrowseWhileWatch.watchEvents.fireEvent('beforeOpen');thumbTips.hide();Metrics.stopPlayProgressTracker();if(!this.initialized){BrowseWhileWatch.init();}
if(this.watchPane==null&&!isEmbed){return true;}
if(!permalinkId){return false;}
if(BrowseWhileWatch.currentlyPlaying!=permalinkId){if($("collection-customStyle")){$("collection-customStyle").media="none";}
scroll(0,0);BrowseWhileWatch.currentlyPlaying=permalinkId;var callback=function(){if(Metadata.jsonObj["warn"]&&(VeohUtils.getCookie("confirmedAdult")!="true")){BrowseWhileWatch.currentlyPlaying=$empty;Balloon.display(VeohUtils.rpcRoot+"adultwarning/watch/permalinkId/"+permalinkId,2);return false;}
if(isEmbed){VeohUtils.showEl('player');VeohUtils.showEl('playerClose');BrowseWhileWatch.generateEmbedCode(permalinkId,isEmbed);}else{var subCallback=function(){BrowseWhileWatch.showPanels(permalinkId);};if(window.location.href.indexOf(permalinkId)<0){VeohUtils.addHistory(encodeURIComponent('watch='+permalinkId));}
if(!BrowseWhileWatch.largeVideoView){BrowseWhileWatch.displayLargerVideoLink();}
BrowseWhileWatch.showDisplay(permalinkId,subCallback);}};Metadata.fetchJson(index,permalinkId,callback);}
return false;},useWebPlayer:function(userGeo,webPlayerRequiredGeos,runLength){var returnVal=false;var countryChecked=false;if(userGeo=="US"){countryChecked=true;if(runLength>=1800){returnVal=true;}}
if(!countryChecked){var geoArray=webPlayerRequiredGeos.split(",");for(var i=0;i<geoArray.length;i++){var country=geoArray[i];if(userGeo==country){returnVal=true;countryChecked=true;}}}
if(!countryChecked&&!returnVal&&runLength>=1200){returnVal=true;}
return returnVal;},generateEmbedCode:function(permalinkId,isEmbed,recsType,brandedChannel){if($('playerWrapper-forFull'))$('playerWrapper-forFull').style.display="block";if($('playerWrapper-noFlash'))$('playerWrapper-noFlash').style.display="none";if($('playerWrapper-latestWebPlayer'))$('playerWrapper-latestWebPlayer').style.display="none";if(Metadata.jsonObj&&Metadata.jsonObj.isExternalMedia&&!Metadata.jsonObj.isYouTube){if(!Metadata.jsonObj.isCNN){var embedCode=Metadata.jsonObj.embedCode;BrowseWhileWatch.player.set('html',embedCode);}
else{var turl=Metadata.jsonObj.embedCode;turl=turl.slice(turl.indexOf('?')+1);var ar=turl.split('&');var b={vid:'undefined',loc:'dom'};for(var i=0;i<ar.length;i++){var c=ar[i].split('=');if(c[0].indexOf('vid')>-1){b['vid']=c[1];}else if(c[0].indexOf('loc')>-1){b['loc']=c[1];}}
var vid_id=b.vid;var loc_id=b.loc;var onsite_re=/cnn\.com$/i;BrowseWhileWatch.player.innerHTML='<div style="text-align: center; background: #fff;"><iframe id="_cnn_iframe_'+Math.random()+'" src="http://www.cnn.com/video/savp/evp/?loc='+loc_id+'&vid='+vid_id+'" height="393" width="406" allowtransparency="true" frameborder="0" scrolling="no" style="margin: auto;"></iframe></div>';}
if(Metadata.jsonObj.isABC&&Metadata.jsonObj.isFullLength==''){try{launchABCShortFormPlayer();var oldembed=BrowseWhileWatch.player.innerHTML;if(Browser.Engine.trident){oldembed=oldembed.replace('width=540','width=100%');oldembed=oldembed.replace('height=373','height=100%');}
else{oldembed=oldembed.replace('width="540"','width="100%"');oldembed=oldembed.replace('height="373"','height="100%"');oldembed=oldembed.replace('width=\'540\'','width="100%"');oldembed=oldembed.replace('height=\'373\'','height="100%"');}
BrowseWhileWatch.player.set('html',oldembed);}
catch(e){}}
Target.logWatchEvent.delay(1000);Metrics.startPlayProgressTracker.delay(1000);return false;}else if(Browser.Plugins.Flash&&((Browser.Plugins.Flash.version>=9&&Browser.Plugins.Flash.build>=115)||Browser.Plugins.Flash.version>=10)){this.latestWebPlayerVersion=Metadata.jsonObj.latestWebPlayerVersion;var hasLatestWebPlayer=VeohDetect.isLatestWebPlayerInstalled(this.latestWebPlayerVersion);var userGeo=Metadata.jsonObj.userGeo;var runLength=Metadata.jsonObj.length;if(!hasLatestWebPlayer&&VeohDetect.isVeohWebPlayerInstalled()){if((userGeo=="ES")||(userGeo!="US"&&runLength>=1200)||(userGeo=="US"&&runLength>=1800)){if($('playerWrapper-forFull'))$('playerWrapper-forFull').style.display="none";if($('playerWrapper-latestWebPlayer'))$('playerWrapper-latestWebPlayer').style.display="block";return false;}}
var wpPort='';var wpVersion='';if(hasLatestWebPlayer){var useWebPlayer=BrowseWhileWatch.useWebPlayer(userGeo,Metadata.jsonObj.webPlayerRequiredGeos,runLength);if(useWebPlayer){wpPort=VeohDetect.getVeohWebPlayerPort();wpVersion=VeohDetect.getVeohWebPlayerVersion();}}
var pageData=Ads.getData();var adObj=pageData.adData;var ctxtObj=pageData.contextData;var mobj=pageData.miscData;var uobj=pageData.userData;var vobj=pageData.videoData;if(Metadata.jsonObj['warn']&&(VeohUtils.getCookie('confirmedAdult')=='true')){uobj.filter='off';}
var basePath=VeohUtils.staticRoot;var newPath=VeohUtils.getCookie('newflashplayer');if(newPath&&newPath!='false'){basePath=newPath+'/';}
var recsTypeValue='';if($defined(recsType)){recsTypeValue=recsType;}
var brandedChannelValue='';if($defined(brandedChannel)){brandedChannelValue=brandedChannel;}
var youtubeIdValue='';youtubeIdValue=Metadata.jsonObj.youtubeId;var flashPlayer=new Swiff(basePath+'swf/webplayer/WebPlayer.swf?version='+VeohUtils.iniVersion,{id:'flashPlayer',name:'flashPlayer',width:'100%',height:'100%',container:'player',params:{wmode:'opaque',bgcolor:'#000000',scale:'noscale',allowfullscreen:'true'},properties:{'hosted':'true','permalinkId':permalinkId},vars:{affliateId:'',apiID:(mobj.apiID)?mobj.apiID:'',contentRatingId:(uobj.filter)?(uobj.filter=='on'?1:2):1,contentSource:(vobj.contentSourceId)?vobj.contentSourceId:'',external:0,id:(uobj.userName)?uobj.userName:"anonymous",location:0,permalinkId:permalinkId,playAuto:1,player:isEmbed?"videodetailsembedded":"videodetails",webPlayerInstalled:hasLatestWebPlayer,webPlayerVersion:wpVersion,webPlayerPort:wpPort,fwurl:(mobj.fwurl)?mobj.fwurl:'',fwid:(mobj.fwid)?mobj.fwid:'',fwsandiskid:(mobj.sdid)?mobj.sdid:'',pvrn:(adObj.ord)?adObj.ord:'',ss_partnerId:(adObj.ssPartnerId)?adObj.ssPartnerId:626,searchTerm:(ctxtObj.kw)?ctxtObj.kw:'',sitename:(ctxtObj.sitename)?ctxtObj.sitename:'',dc_age18:(adObj.mature)?adObj.mature:'false',dc_hasPublished:(uobj.hasPublished)?uobj.hasPublished:'',dc_login:(uobj.login)?uobj.login:'',dc_planguage:(uobj.language)?uobj.language:'',dc_pro:(uobj.pro)?uobj.pro:'',dc_publisher:(vobj.publisher)?vobj.publisher:'',dc_sexy:(adObj.sexy)?adObj.sexy:'',dc_site:(ctxtObj.sitename)?ctxtObj.sitename:'',eventType:'content',eventValue:(vobj.videoCategoryIds)?vobj.videoCategoryIds:'',videoId:VeohUtils.getIdFromPermalinkId(permalinkId),userName:(uobj.userName)?uobj.userName:'',userAge21plus:(uobj.userAge21plus)?uobj.userAge21plus:'',userAgeGroup:(uobj.userAgeGroup)?uobj.userAgeGroup:'',pAge:(adObj.mature)?adObj.mature:'false',pFamilyFilter:(uobj.filter)?uobj.filter:'on',pGender:(uobj.gender)?uobj.gender:'',pPubStat:'',dc_intel:'',dc_isHD:'',dc_pcategory:'',dc_target:'',dc_tile:'',dc_ucategory:'',dc_veohtv:'',dc_videopermalink:'',collectionId:'',collectionPermalink:'',description:'',guid:'',image:'',isEmbed:'',logillumenix:'',mature:'',pageUID:Math.floor(Math.random()*100000000),pageUrl:document.location.href,playerVersion:'',targeting:'',tvshow_id:'',veohVisitorId:'',recsType:recsTypeValue,isPageBranded:brandedChannelValue,youtubeId:youtubeIdValue}});return flashPlayer;}else{if($('playerWrapper-forFull'))$('playerWrapper-forFull').style.display="none";if($('playerWrapper-noFlash'))$('playerWrapper-noFlash').style.display="block";return false;}},showDisplay:function(permalinkId,onAfterDisplay){if(!Metadata.jsonObj||Metadata.jsonObj==null){return;}
thumbTips.hide();this.isWatchOpen=true;if(this.largeVideoView){var startValue=Constants.WATCH_MAX_WIDTH;}
else{var startValue=Constants.WATCH_START_WIDTH;}
Ads.handleWatchOpeningEvent(Metadata.jsonObj.allowAds);var onAfterWatchPaneVisible=function(){var w=null;if(BrowseWhileWatch.largeVideoView){BrowseWhileWatch.watchPane.setStyle('width','100%');w=Constants.PLAYER_MAX_WIDTH;}
BrowseWhileWatch.flashPlayer=BrowseWhileWatch.generateEmbedCode(permalinkId);BrowseWhileWatch.resizePlayerWithRatio(w);BrowseWhileWatch.contentHolder.addClass('watchOpened');if(BrowseWhileWatch.autoDownload){$('watchDownload').onclick();BrowseWhileWatch.autoDownload=false;}
VeohUtils.updatePageTitle(Metadata.jsonObj.title+(VeohUtils.basePageTitle!=''?' | '+VeohUtils.basePageTitle:''));if(Metadata.jsonObj.allowComments){VeohUtils.showEl($('comments_container'));if(!BrowseWhileWatch.panels["comments"].isOpen()){$('comments_title').innerHTML=BrowseWhileWatch.commentsTitle+' ('+Metadata.jsonObj.numComments+')';}}
else{VeohUtils.hideEl($('comments_container'));}
if(onAfterDisplay)onAfterDisplay();Ads.handleWatchOpenedEvent(Metadata.jsonObj.isExternalMedia||!BrowseWhileWatch.flashPlayer);if($defined(BrowseWhileWatch.fullScreenLauncher)&&Metadata.jsonObj.isHulu){BrowseWhileWatch.fullScreenLauncher.removeClass('hide');if($defined(BrowseWhileWatch.hideBrowseWatch))
BrowseWhileWatch.hideBrowseWatch.removeClass('right');}
else{BrowseWhileWatch.fullScreenLauncher.addClass('hide');if($defined(BrowseWhileWatch.hideBrowseWatch))
BrowseWhileWatch.hideBrowseWatch.addClass('right');}};if(BrowseWhileWatch.watchPaneOpenDuration==0){$("watch").setStyles({'display':'block','width':startValue});onAfterWatchPaneVisible();}else{this.fx.watchPane.start(startValue).chain(onAfterWatchPaneVisible);}},initializePanels:function(){this.panels.set("playerBottom",new Updatable({contentElement:"playerBottom",urlTemplate:VeohUtils.rpcRoot+"video/playerBottom/permalinkId/-permalinkId--extraParams-"}));this.panels.set("relatedVideos",new ExpandableBox("relatedVideos",{containerElement:$('sliderrel'),contentElement:$('sliderrel_expandWrap'),stateElement:$('sliderrel_state'),titleElement:$('sliderrel_title'),state:1,height:60,urlTemplate:VeohUtils.rpcRoot+"video/relatedVideos/permalinkId/-permalinkId-",stateClosedClass:'sp_arrow-down-grey',stateOpenedClass:'sp_arrow-up-grey',afterOpen:function(){$('sliderrel_title').set('html','Hide Related Videos');},afterClose:function(){$('sliderrel_title').set('html','Show Related Videos');}}));this.panels.set("comments",new ExpandableBox("comments",{height:400,cacheBust:true,urlTemplate:VeohUtils.rpcRoot+"video/comments/permalinkId/-permalinkId-"}));},showPanels:function(permalinkId){if(!this.panels)
{VeohUtils.log("error showing panels: no permalinkId","error");return;}
this.panels.each(function(item,index){item.reset();item.setUrlFromTemplates(["permalinkId","extraParams"],[permalinkId,BrowseWhileWatch.extraParams]);if(item.isOpen&&item.isOpen()){item.expand();}});if(this.panels["playerBottom"]&&this.renderViaAjax)
{this.panels["playerBottom"].update();}
this.renderViaAjax=true;},startDownload:function(linkObj,permalinkId,primaryKey){if(!permalinkId)
{var permalinkId="";}
this.latestWebPlayerVersion=Metadata.jsonObj.latestWebPlayerVersion;if(VeohDetect.isLatestWebPlayerInstalled(this.latestWebPlayerVersion))
{Metrics.logDownloadEvent(primaryKey);var authToken=VeohUtils.getAuthToken();var downloadUrl='veoh2://downloadVideo?permalinkId='+permalinkId+'&command='+Constants.DOWNLOAD_GUID_COMMAND;if(authToken!=null&&authToken!=''){downloadUrl+='&VEOH_GUIDE_AUTH='+authToken;}
BrowseWhileWatch.callToServer(downloadUrl);}
else
{if(VeohDetect.isVeohWebPlayerInstalled()){alert('You must update Veoh Web Player to download this video.');}
return Balloon.display(linkObj,2);}
return false;},callToServer:function(url){var IFrameObj;if(!document.createElement){return true;}
var IFrameDoc;if(!IFrameObj&&document.createElement){try{var tempIFrame=document.createElement('iframe');tempIFrame.setAttribute('id','RSIFrame');tempIFrame.style.border='0px';tempIFrame.style.width='0px';tempIFrame.style.height='0px';IFrameObj=document.body.appendChild(tempIFrame);if(document.frames){IFrameObj=document.frames['RSIFrame'];}}
catch(exception){iframeHTML='\<iframe id="RSIFrame" style="';iframeHTML+='border:0px;';iframeHTML+='width:0px;';iframeHTML+='height:0px;';iframeHTML+='"><\/iframe>';document.body.innerHTML+=iframeHTML;IFrameObj=new Object();IFrameObj.document=new Object();IFrameObj.document.location=new Object();IFrameObj.document.location.iframe=document.getElementById('RSIFrame');IFrameObj.document.location.replace=function(location){this.iframe.src=location;};}}
if(navigator.userAgent.indexOf('Gecko')!=-1&&!IFrameObj.contentDocument){setTimeout('BrowseWhileWatch.callToServer( '+url+' )',10);return false;}
try{if(IFrameObj.contentDocument){IFrameDoc=IFrameObj.contentDocument;}
else if(IFrameObj.contentWindow){IFrameDoc=IFrameObj.contentWindow.document;}
else if(IFrameObj.document){IFrameDoc=IFrameObj.document;}
else{return true;}}
catch(exception){}
try{IFrameDoc.location.replace(url);}
catch(exception){}
return false;},downloadWebPlayer:function(){VeohUtils.hideEl('webplayer-preDownloadLink');VeohUtils.hideEl('webplayer-InfoBar-pre');VeohUtils.hideEl('webplayer-languageLink');VeohUtils.hideEl('webplayer-languages');VeohUtils.showEl('webplayer-postDownload');return false;},hideWebPlayerNotification:function(which){if(which=="installed")
{if($('webplayer-installedBox'))
$('webplayer-installedBox').style.display="none";}
else if(which=="notInstalled")
{if($('webplayer-notInstalledBox'))
$('webplayer-notInstalledBox').style.display="none";}},initWebPlayerNotification:function(webPlayerInstalled,version,errorID,postF2Fversion,usingWebPlayer,showingPreview,errorMsg){if(!webPlayerInstalled)
{switch(errorID)
{case 1:document.getElementById('webplayer-errorBoxBeacon').style.display="block";break;case 2:document.getElementById('webplayer-errorBoxLocalhost').style.display="block";document.getElementById('contactSupport_notavailable').href+=" JS Port "+VeohDetect.getVeohWebPlayerPort()+" webPlayerInstalled="+webPlayerInstalled+" "+errorMsg;break;default:if(showingPreview)
{document.getElementById('webplayer-notInstalledBox').style.display="block";}
break;}
return;}
else
{VeohDetect.version=version;switch(errorID)
{case 2:document.getElementById('webplayer-errorBoxLocalhost').style.display="block";document.getElementById('contactSupport_notavailable').href+=" "+VeohDetect.getVeohWebPlayerPort()+" webPlayerInstalled="+webPlayerInstalled+" "+errorMsg;break;case 1:document.getElementById('webplayer-errorBoxBeacon').style.display="block";break;case 0:if(usingWebPlayer)
{document.getElementById('webplayer-installedBox').style.display="block";}
break;default:document.getElementById('webplayer-notInstalledBox').style.display="block";break;}}},loadUrl:function(linkObj){thumbTips.hide();if(this.isWatchOpened()){if(this.largeVideoView){this.smallWatch();}
VeohUtils.addHistory(encodeURIComponent($type(linkObj)=='string'?linkObj:linkObj.href));VeohUtils.makeRequest(linkObj,$('contentInner'),BrowseWhileWatch.afterLoadUrl,'standard');return false;}
else{if($type(linkObj)=='string'){location.href=linkObj;}
else{return true;}}},afterLoadUrl:function(){Ads.reloadAds();if($("collection-customStyle")){$("collection-customStyle").parentNode.removeChild($("collection-customStyle"));}
cca=$("collection-customStyle-ajax");if(cca){cca.id="collection-customStyle";cca.media="none";document.getElementsByTagName("head")[0].appendChild(cca);}},selectTab:function(tabName){if(this.currentTab!=tabName){$$('ul#browseNav-main a.sp_tab').each(function(el){el.removeClass('selected');});if($('nav-'+tabName+'-cats')){$('nav-'+tabName+'-cats').addClass('selected');this.currentTab=tabName;if($('clearSearch'))
$('clearSearch').setProperty('href',VeohUtils.rpcRoot+'browse/'+Search.browseType+'/');}}},fullWatch:function(){thumbTips.hide();this.largeVideoView=true;try{Ads.handleFullWatchEvent();}catch(e){}
this.fx.watchPane.start(Constants.WATCH_MAX_WIDTH).chain(function(){BrowseWhileWatch.contentHolder.addClass('watchFull');BrowseWhileWatch.resizePlayerWithRatio(Constants.PLAYER_MAX_WIDTH);BrowseWhileWatch.fx.winScroller.toElement('watch').chain(function(){BrowseWhileWatch.contentHolder.tween('background-color','#000000');});});this.displaySmallerVideoLink();},smallWatch:function(){thumbTips.hide();this.largeVideoView=false;try{Ads.handleSmallWatchEvent();}catch(e){}
BrowseWhileWatch.contentHolder.setStyle('background-color','#ffffff');BrowseWhileWatch.watchPane.setStyle('width',Constants.WATCH_MAX_WIDTH);this.fx.watchPane.start(Constants.WATCH_START_WIDTH).chain(function(){BrowseWhileWatch.contentHolder.removeClass('watchFull');BrowseWhileWatch.resizePlayerWithRatio();});this.displayLargerVideoLink();},displayLargerVideoLink:function(){$('fullWatchLink').removeClass('selected');$('fullWatchLink').removeClass('sp_button-white_toggle_selected');$('fullWatchLink').addClass('sp_button-white_toggle');$('previewWatchLink').addClass('selected');$('previewWatchLink').removeClass('sp_button-white_toggle_left');$('previewWatchLink').addClass('sp_button-white_toggle_left_selected');},displaySmallerVideoLink:function(){$('fullWatchLink').addClass('selected');$('fullWatchLink').removeClass('sp_button-white_toggle');$('fullWatchLink').addClass('sp_button-white_toggle_selected');$('previewWatchLink').removeClass('selected');$('previewWatchLink').removeClass('sp_button-white_toggle_left_selected');$('previewWatchLink').addClass('sp_button-white_toggle_left');},launchFullScreen:function(){var embedcode=this.player.innerHTML;var sw=screen.availWidth;var sh=screen.availHeight;var attributes="width="+sw+", height="+sh+", resizable=no, scrollbars=no, toolbar=no, location=no, directories=no, status=no, menubar=no, channelmode=yes, fullscreen=yes, titlebar=no, copyhistory=no, personalbar=no, dialog=no, chrome=no, top=0, left=0";newwin=window.open('','FullScreen',attributes);newwin.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');newwin.document.write('\n<html>\n<head>\n<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />\n');newwin.document.write('<meta http-equiv="Imagetoolbar" content="no" />\n');newwin.document.write('<title>'+(Metadata.jsonObj?Metadata.jsonObj.title:'')+'</title>\n');newwin.document.write('</head>');newwin.document.write('<body style="margin:0;padding:0;background:#000000;overflow:hidden;">\n');newwin.document.write('<table align="center" width="'+sw+'" height="'+sh+'">\n<tr valign="center"><td align="center" width="'+sw+'" height="'+sh+'" valign="center">\n');newwin.document.write(embedcode);newwin.document.write('</td></tr></table>\n');newwin.document.write('<script type="text/javascript" src="http://www.veoh.com/scripts/NoIEActivate.js"></script>\n</body></html>');newwin.document.close();newwin.focus();this.player.innerHTML=this.player.innerHTML;}};function addFavoriteCallback(linkObj){if($(linkObj)){$(linkObj).addClass('added');if(Browser.Engine.trident4){$(linkObj).addClass('sp_fav_added');}
$(linkObj).onclick="";}}
function takedownCallback(permalinkId){alert(permalinkId+" has been canceled. Give it a few minutes to take effect.");}
var Search={browseType:'',baseContext:'search/videos/q/-MENUVALUE-',context:'search/videos/q/-MENUVALUE-',query:'',handleInputField:function(inputField,defaultText){if(inputField.value==defaultText){inputField.value='';}},searchng:function(defaultText,objName){if(!objName){objName='search';}
var obj=$(objName);obj.value=obj.value.clean();if(!Search.isValid(obj.value,defaultText)){if(Search.query){}else{obj.value=defaultText;}
return;}
var sv=encodeURIComponent(obj.value.replace(/\//g,"%2F"));sv=sv.replace(/\%20/g,"+");var url=VeohUtils.rpcRoot+Search.context.replace("-MENUVALUE-",sv);location.href=url;return false;},isValid:function(query,defaultText){return!(''==query||defaultText==query);},runQ2Q:function(qs){$("search").value=qs;Search.searchng();},updateTabs:function(isClear,term){if(isClear){var replaceText='/search/';var replaceWith='/browse/';}
else{var replaceText='/browse/';var replaceWith='/search/';}},clear:function(linkObj,defaultText){if(BrowseWhileWatch.currentTab=='myinterests'){var url=VeohUtils.rpcRoot+BrowseWhileWatch.currentTab;}
else if(BrowseWhileWatch.currentTab==''){var url=VeohUtils.rpcRoot+'browse/videos';}
else{var url=VeohUtils.rpcRoot+'browse/'+BrowseWhileWatch.currentTab;}
if(BrowseWhileWatch.isWatchOpened()){if(BrowseWhileWatch.largeVideoView){BrowseWhileWatch.smallWatch();}
this.updateTabs(true);$('clearSearch').setStyle('display','none');VeohUtils.addHistory(url);VeohUtils.makeRequest(url,$('contentInner'),Ads.reloadAds);$("search").value=defaultText;return false;}
else{$(linkObj).setProperty('href',url);return true;}},showHideAdvanced:function(){advPanel=$("browse-filters-advanced-panel");if(!advPanel)return;if(advPanel.getStyle("display")=="none"){advPanel.setStyle("display","block");$('browse-showAdvanced').removeClass("toShow");$('browse-showAdvanced').innerHTML=$('browse-showAdvanced').title=Search.hideAdvancedCaption;VeohUtils.setCookie("browseFiltersOpen","1",false,"/",0);}else{advPanel.setStyle("display","none");$('browse-showAdvanced').addClass("toShow");$('browse-showAdvanced').innerHTML=$('browse-showAdvanced').title=Search.showAdvancedCaption;VeohUtils.setCookie("browseFiltersOpen","0",false,"/",0);}
return false;},runAdvanced:function(baseUrl){var range=$("browse-filters-range"),pubdate=$("browse-filters-pubdate"),country=$("browse-filters-country"),spoken=$("browse-filters-spoken"),subtitles=$("browse-filters-subtitles"),duration=$("browse-filters-duration");if(range)baseUrl+=(range.value>"")?"/range/"+range.value:"";if(pubdate)baseUrl+=(pubdate.value>"")?"/pubdate/"+pubdate.value:"";if(country)baseUrl+=(country.value>"")?"/country/"+country.value:"";if(spoken)baseUrl+=(spoken.value>"")?"/lang/"+spoken.value:"";if(subtitles)baseUrl+=(subtitles.value>"")?"/subtitles/"+subtitles.value:"";if(duration)baseUrl+=(duration.value>"")?"/duration/"+duration.value:"";baseUrl=baseUrl.replace(/\/\//g,"/");baseUrl+=(baseUrl.indexOf("?")>-1)?"&":"?";baseUrl+="upd=1";VeohUtils.makeRequest(baseUrl,$('contentInner'),Ads.reloadAds);return false;},appendSearchAsParam:function(url){var startSearch=url.indexOf('/q/');if(startSearch!=-1){var endSearch=url.indexOf('/',startSearch+3);if(endSearch==-1){endSearch=url.length;}
var searchTerm=url.substring(startSearch+3,endSearch);if(url.indexOf('?')!=-1){url=url+'&q='+searchTerm;}else{url=url+'?search='+searchTerm;}}
return url;}};var thumbTips={_currentThumbId:null,_mouseWatchTO:null,init:function(tw){tw=$(tw);tw.onmouseover=null;tw.getElement('.thumb').setProperty("title","");tw.getElement('img').setProperty("alt","");tw.addEvents({"mouseenter":function(){this.addClass("showingIcons");this.addClass("thumbWrapper_showingIcons");},"mouseleave":function(){this.removeClass("showingIcons");this.removeClass("thumbWrapper_showingIcons");}});info=tw.getElement(".sp_info");if(info){info.twid=tw.id;info.addEvents({"mouseover":function(){thumbTips.onOver($(this.twid));}});info=null;}
tw.fireEvent("mouseenter");tw=null;},onOver:function(tw){if(!tw||!tw["id"])return;var thisId=tw.id;if(thumbTips._currentThumbId!=thisId){thumbTips._currentThumbId=thisId;tw=null;var showingRightNow=false;setTimeout(function(){if(thumbTips._currentThumbId==thisId){if(showingRightNow)return;showingRightNow=true;var tWrapper=$(thisId);if(!tWrapper)return;var tMeta=tWrapper.getParent().getElement(".thumbMeta");if(tMeta.style.display!="block"){var docBody=document.body;var bltt=$("bodyLevelThumbTip");if(!bltt){var bltt=document.createElement("div");bltt.id="bodyLevelThumbTip";docBody.appendChild(bltt);bltt=$("bodyLevelThumbTip");}else{thumbTips.hide(bltt);}
twXY=tWrapper.getPosition();bltt.style.left=twXY.x+"px";bltt.style.top=twXY.y+"px";bltt.lender=tWrapper.getParent();bltt.appendChild(tWrapper);bltt.appendChild(tMeta);var baseWidth=docBody.offsetWidth,tRight=twXY.x+parseInt(bltt.getStyle("width"))+30;if(tRight>baseWidth){bltt.addClass("leftOf");}else{bltt.removeClass("leftOf");}
bltt.style.visibility="visible";thumbTips.safeZone=tWrapper.getCoordinates();VeohUtils.lastMouse=[twXY.x,twXY.y];VeohUtils.startTrackingMouse();thumbTips.mouseWatchTO=setInterval(thumbTips.watchMouse,25);}
docBody=tMeta=tWrapper=null;showingRightNow=false;}},550);}},hide:function(){bltt=$("bodyLevelThumbTip");if(bltt){lender=bltt["lender"];if(lender){lender.appendChild(bltt.childNodes[0]);lender.appendChild(bltt.childNodes[0]);bltt.lender=null;bltt.style.visibility="hidden";}}
thumbTips._stopWatchingMouse();},onOut:function(tWrapper){if(!tWrapper||!tWrapper["id"])return;thumbTips._currentThumbId="";var thisId=tWrapper.id;tWrapper=null;setTimeout(function(){if(thumbTips._currentThumbId!=thisId){thumbTips.hide();}},150);},watchMouse:function(evt){if(VeohUtils._currentThumbId==""){thumbTips._stopWatchingMouse();}else{var pos=VeohUtils.lastMouse,hide=false;if(pos[0]==0||pos[1]==0){return;}
if(pos[0]<thumbTips.safeZone.left){hide=true;}else if(pos[0]>thumbTips.safeZone.right){hide=true;}else if(pos[1]<thumbTips.safeZone.top){hide=true;}else if(pos[1]>thumbTips.safeZone.bottom){hide=true;}
if(hide){thumbTips.onOut($(thumbTips._currentThumbId));}else{thumbTips.onOver($(thumbTips._currentThumbId));}}},_stopWatchingMouse:function(){if(thumbTips.mouseWatchTO){clearInterval(thumbTips.mouseWatchTO);thumbTips.mouseWatchTO=null;VeohUtils.stopTrackingMouse();}},getValue:function(element){element=$(element);if(element&&element.value)
{return element.value;}
return null;}};var Metadata={jsonObj:{},fetchJson:function(index,permalinkId,callback){try{var j=$('json'+index);if(j){Metadata.jsonObj=JSON.decode($('json'+index).value);if($defined(callback)){callback();}}else if($('jsonWatch')){Metadata.jsonObj=JSON.decode($('jsonWatch').value);if(Metadata.jsonObj.videoId!=permalinkId){Metadata.fetchRemoteJson(permalinkId,callback);}else{if($defined(callback)){callback();}}}else{Metadata.fetchRemoteJson(permalinkId,callback);}
return true;}catch(e){if(window["console"]){console.log("JSON.decode failed. Reason: "+e);}else{}
return false;}},fetchRemoteJson:function(permalinkId,callback){var url=VeohUtils.rpcRoot+'video/metadata/permalinkId/'+permalinkId;var onsuccess=function(responseTree,responseElements,responseHTML,responseJavaScript){Metadata.jsonObj=JSON.decode(responseElements[0].value);if($defined(callback)){callback();}};VeohUtils.makeRequest(url,null,onsuccess);}};var Interests={removeTimers:[],showRemove:function(id){var e=$('rem'+id);if(!e)
return;if(this.removeTimers[id]&&!isNaN(this.removeTimers[id]))
{clearTimeout(this.removeTimers[id]);this.removeTimers[id]=0;}
for(var i in this.removeTimers)
{if(this.removeTimers[i]!=0&&!isNaN(this.removeTimers[id]))
{clearTimeout(this.removeTimers[i]);this.hideRemoveAction(i);}}
e.tween('opacity','1');},hideRemove:function(id){if(this.removeTimers[id]&&!isNaN(this.removeTimers[id]))
{clearTimeout(this.removeTimers[id]);}
this.removeTimers[id]=setTimeout("Interests.hideRemoveAction('"+id+"')",2000);},hideRemoveAction:function(id){this.removeTimers[id]=0;var e=$('rem'+id);if(!e)
return;e.tween('opacity','0');},remove:function(id){url=VeohUtils.rpcRoot+'interest/remove/';var onsuccess=function(){var obj=$('tr'+id);obj.parentNode.removeChild(obj);};var params={'id':id};VeohUtils.makeRequest(url,'',onsuccess,null,params,true);},add:function(type,id,onsuccess){url=VeohUtils.rpcRoot+'interest/add';var params={type:type,id:id};VeohUtils.makeRequest(url,'',onsuccess,null,params,true);},addSearch:function(query,sort,type,onsuccess){if(type==null)
type="videos";url=VeohUtils.rpcRoot+'interest/add';var params={type:'search',sort:sort,id:query,mode:type};VeohUtils.makeRequest(url,'',onsuccess,null,params,true);},addBrowse:function(category,sort,type,onsuccess){if(type==null)
type="videos";url=VeohUtils.rpcRoot+'interest/add';var params={type:'browse',sort:sort,category:category,mode:type};VeohUtils.makeRequest(url,'',onsuccess,null,params,true);}};var SliderBox={hideRecommended:'Hide Recommended',showRecommended:'Show Recommended',toLeft:function(id){var ul=$(id+'_ul');var items=ul.getChildren();if(items!=null&&items.length>0){var itemWidth=items[0].getWidth()+items[0].getStyle('margin-left').toInt()+items[0].getStyle('margin-right').toInt();var totalWidth=itemWidth*items.length;var maskWidth=$(id+'_mask').getWidth();var numItemsShowing=Math.floor(maskWidth/itemWidth);var currentPos=ul.getStyle('left').toInt();if(totalWidth>0){var newPos=currentPos+numItemsShowing*itemWidth;if(newPos<=0){ul.tween('left',newPos);}
else{ul.tween('left',0);}}}},toRight:function(id){var ul=$(id+'_ul');var items=ul.getChildren();if(items!=null&&items.length>0){var itemWidth=items[0].getWidth()+items[0].getStyle('margin-left').toInt()+items[0].getStyle('margin-right').toInt();var totalWidth=itemWidth*items.length;var maskWidth=$(id+'_mask').getWidth();var numItemsShowing=Math.floor(maskWidth/itemWidth);var currentPos=ul.getStyle('left').toInt();if(totalWidth>0){var newPos=currentPos-numItemsShowing*itemWidth;if(newPos>-totalWidth){ul.tween('left',newPos);}
else{}}}},toggleDisplay:function(theLink,id){if($(id).getStyle('display')=='none'){$(id).setStyle('display','block');$(theLink).innerHTML=this.hideRecommended;$(theLink).setProperty('title',this.hideRecommended);}
else{$(id).setStyle('display','none');$(theLink).innerHTML=this.showRecommended;$(theLink).setProperty('title',this.showRecommended);}}};var Balloon={balloonClass:'balloon',balloonId:'balloon',contentsId:'_contents',closeId:'_close',helpId:'balloon-help',currentDisplayType:0,classTypes:['popup','blurb','moodal','tooltip'],onHide:null,create:function(id,target,classname){classname=this.balloonClass+(classname==null?'':' '+classname);var balloon=new Element('div',{'class':classname,'id':id,'styles':{'opacity':0}});var balloon_close=new Element('a',{'id':id+this.closeId,'class':'icon sp_close balloon-close','html':'','href':'javascript:void(0);','events':{'click':function(){Balloon.hide(id);}}});var balloon_content=new Element('div',{'id':id+this.contentsId});target=target==null?'veohPage':target;$(target).grab(balloon.adopt([balloon_close,balloon_content]));},update:function(url){VeohUtils.makeRequest(url,$(Balloon.balloonId+Balloon.contentsId),null,null,{'ajax':'ajax'});},display:function(caller,type,keepInPlace,classToUse){if(!$(this.balloonId)){this.create(this.balloonId);}
if(!keepInPlace){$(this.balloonId).className="balloon";$(this.balloonId).removeProperty('style');}
type=type==null?0:type;$(this.balloonId).addClass(this.classTypes[type]);if(Browser.Engine.trident4)
$(this.balloonId).addClass("balloon_"+this.classTypes[type]);if(classToUse!=null){$(this.balloonId).addClass(classToUse);if(Browser.Engine.trident4)
$(this.balloonId).addClass("balloon_"+classToUse);}
callerIsLink=false;if(caller.id&&caller.id.length>0){callerIsLink=true;$(this.balloonId).addClass("for-"+caller.id);if(Browser.Engine.trident4){$(this.balloonId).addClass("balloon_for-"+caller.id);if(classToUse!=null)
$(this.balloonId).addClass("balloon_"+classToUse+"_for-"+caller.id);}}
else if($type(caller)=='element'&&caller.href){callerIsLink=true;}
if(type==2){this.moodal.create();}
$(this.balloonId+this.contentsId).set('html','loading...');if(callerIsLink){var url=$(caller).getProperty('href');}else{var url=caller;}
this.update(url);if(callerIsLink&&!keepInPlace){var parent=(type==2)?$(document.body):$(caller).getParent();parent.grab($(this.balloonId));}
else if(type==2){$(document.body).grab($(this.balloonId));}
this.currentDisplayType=type;this.show(this.balloonId);return false;},displayHelp:function(caller,formFieldId){if(!$(this.balloonId).getElementById(this.helpId)){this.create(this.helpId,this.balloonId);}
$(this.helpId+this.contentsId).set('html',$(formFieldId).value);var parent=$(caller).getParent();parent.grab($(this.helpId));this.show(this.helpId);},moodal:{moodalId:'balloon-moodal',create:function(){if(!$(this.moodalId)){var moodal=new Element('div',{'id':this.moodalId,'styles':{'opacity':0}});moodal.addEvent('click',function(){Balloon.hide(Balloon.balloonId);});$(document.body).grab(moodal);}},show:function(){if(!$(this.moodalId)){this.create();}
$(this.moodalId).setStyle('display','block');$(this.moodalId).fade(0.6);},hide:function(){$(this.moodalId).fade('out');},keepCenter:function(){var win_width=window.getWidth();var panel_width=$(Balloon.balloonId).getWidth();var center_x=Math.floor(win_width/2);var x=center_x-Math.floor(panel_width/2);var y=window.getScrollTop()+(window.getHeight()/15);$(Balloon.balloonId).setStyle('top',y);$(Balloon.balloonId).setStyle('left',x);if(Browser.Engine.trident4){$(Balloon.moodal.moodalId).setStyle('position','absolute');$(Balloon.moodal.moodalId).setStyle('width',win_width);$(Balloon.moodal.moodalId).setStyle('height',window.getScrollHeight());}}},hide:function(id){if(!id){id=Balloon.balloonId;}
if(Balloon.onHide){Balloon.onHide();Balloon.onHide=null;}
if($(id)){if(Balloon.helpId!=id){if(Browser.Engine.trident4){$(document.body).removeClass('moodal');}
if(Balloon.currentDisplayType==2){Balloon.moodal.hide();window.removeEvent('resize',Balloon.moodal.keepCenter);}}
var fade=new Fx.Tween($(id),{property:'opacity'});fade.start(0).chain(function(){$(id).className="balloon";});}},show:function(id){if(!id){id=Balloon.balloonId;}
if($(id)){if(Browser.Engine.trident4){$(document.body).addClass('moodal');}
if(Balloon.currentDisplayType==2){Balloon.moodal.show();Balloon.moodal.keepCenter();window.addEvent('resize',Balloon.moodal.keepCenter);}
$(id).setStyle('display','block');$(id).fade('in');}}};var Popup=new Class({Implements:[Options,Events],options:{'anchor':null,'contentAttributes':{},'loadingAttributes':{}},initialize:function(options){this.setOptions(options);this.eventClick=this.clickListener.bindWithEvent(this);this.eventKeyDown=this.keyboardListener.bindWithEvent(this);this.anchor=$(this.options.anchor);this.content=new Element('div',this.options.contentAttributes).injectInside(document.body);this.loadingDiv=new Element('div',this.options.loadingAttributes).injectInside(this.content);this.isOpen=false;this.isPopulated=false;},populateAndOpen:function(event){var onsuccess=function(){this.isPopulated=true;}.bind(this);this.open(event);if(!this.isPopulated){VeohUtils.makeRequest(this.anchor,this.content,onsuccess,this.loadingDiv,{'format':'html'});}},open:function(event){if(!this.isOpen){this.closeOthers();this.isOpen=true;this.content.removeClass('hide');document.addEvent('click',this.eventClick);document.addEvent('keydown',this.eventKeyDown);this.fireEvent('open');event.stop();}},close:function(event){if(this.isOpen){this.isOpen=false;this.content.addClass('hide');document.removeEvent('click',this.eventClick);document.removeEvent('keydown',this.eventKeyDown);this.fireEvent('close');}},closeOthers:function(){for(var tab in Popup.list){Popup.list[tab].close();}},getContent:function(){return this.content;},clickListener:function(event){if(!this.getContent().containsPoint(event.page)){this.close();}},keyboardListener:function(event){if((event.key=='esc')){this.close();}}});Popup.list={};Element.implement({containsPoint:function(point){var box=this.getCoordinates();return Math.abs(2*point.x-box.right-box.left)<=box.width&&Math.abs(2*point.y-box.bottom-box.top)<=box.height;}});var VeohDetect={mozProtocol:'application/x-veohtvplugin',ieClassId:'CLSID:AADAA41D-FFD5-4F38-B35A-8CA640D6C037',mozId:'objNPVeohTVPlugin',ieId:'objVeohVersion',mozName5:'VeohTV Plugin',activeXName5:'VeohTV2Version.VeohTV2Version',version:null,getVeohWebPlayerPort:function(){var p2pPort='';if(document.getElementById(this.mozId)&&typeof document.getElementById(this.mozId)=='function'&&document.getElementById(this.mozId).getP2PPort){p2pPort=document.getElementById(this.mozId).getP2PPort();}
else if(document.getElementById(this.ieId)&&typeof document.getElementById(this.ieId)=='object'){p2pPort=document.getElementById(this.ieId).P2PPort;}
return p2pPort;},getVeohWebPlayerVersion:function(){if(document.getElementById(this.mozId)&&typeof document.getElementById(this.mozId)=='function'&&document.getElementById(this.mozId).getVersion){this.version=document.getElementById(this.mozId).getVersion();}
else if(document.getElementById(this.ieId)&&typeof document.getElementById(this.ieId)=='object'){this.version=document.getElementById(this.ieId).Version;}
return this.version;},isVeohWebPlayerInstalled:function(){var installed=false;if(this.version!=null){return true;}
if(navigator.plugins&&navigator.plugins.length){for(var i=0;i<navigator.plugins.length;i++){var plugin=navigator.plugins[i];var pluginName=plugin.name.toLowerCase();if(pluginName.indexOf(this.mozName5.toLowerCase())>-1){installed=true;}}}
else{try{qtObj=new ActiveXObject(this.activeXName5);if(qtObj){installed=true;}}
catch(e){installed=false;}}
return installed;},getWebPlayerPluginHtml:function(){var html='<object id="'+this.ieId+'" classid="'+this.ieClassId+'">'+'<embed id="'+this.mozId+'" height="1" width="1" type="'+this.mozProtocol+'"/></object>';return html;},isLatestWebPlayerInstalled:function(latestWebPlayerVersion){if(!this.isVeohWebPlayerInstalled())
return false;if(this.isMac()){return true;}
var latestWebPlayerVersionArray=latestWebPlayerVersion.split(".");var currentVersionArray=this.getVeohWebPlayerVersion().split(".");for(var i=0;i<latestWebPlayerVersionArray.length;i++){if(i>=currentVersionArray.length){return false;}else if(currentVersionArray[i]>latestWebPlayerVersionArray[i]){return true;}else if(currentVersionArray[i]<latestWebPlayerVersionArray[i]){return false;}}
return true;},isMac:function(){if(navigator&&navigator.platform){if(navigator.platform.toLowerCase().indexOf("mac")!=-1){return true;}}
return false;}};var AdObject=function(tile,width,height,position,sectionId,containerId){this.tile=tile;this.width=width;this.height=height;this.position=position;this.sectionId=sectionId;this.id='adFrame'+tile+'sz'+width+'x'+height;this.containerId=containerId?containerId:this.id+'container';this.frameHeight=height;this.frameWidth=width;if(width==970&&height==120){this.frameHeight=100;}};var AdConstants={WATCH_INNER_ID:'watchInnerAd',BROWSE_INNER_ID:'browseInnerAd',SIDEBAR_AD_ID:'rightAdColumn',TOP_AD_ID:'topAd',FLASH_COMPANION_ID:'_fw_container_external_sidebar'};var AdEvents=new Class({Implements:Events});var Ads={events:new AdEvents(),refreshTimer:null,adsAllowedByPublisher:true,adsEnabled:true,tileAdMap:{1:new AdObject(1,970,120,'top',AdConstants.TOP_AD_ID),2:new AdObject(2,300,250,'right',AdConstants.SIDEBAR_AD_ID),3:new AdObject(3,300,250,'right',AdConstants.BROWSE_INNER_ID,AdConstants.FLASH_COMPANION_ID),4:new AdObject(4,300,100,'right',AdConstants.SIDEBAR_AD_ID),5:new AdObject(5,300,300,'right',AdConstants.SIDEBAR_AD_ID)},nameTileMap:{takeover:1,sidebar:2,companion:3,sidebarcompanion:4,hotrightnow:5},dataKeyNameMap:{adData:{ord:'ord',sexy:'sexy',test:'test',version:'version',watch:'watch',geo:'geo',dentyne:'dentyne',mature:'mature'},contextData:{sitename:'sitename',zone:'zone',kw:'kw',bcategory:'bcategory',collectionPermalink:'collectionPermalink',groupPermalink:'collectionPermalink'},userData:{age:'age',filter:'filter',gender:'gender',hasPublished:'haspublished',language:'language',login:'login',pro:'pro',userName:'username',userAge21plus:'userage21plus',userAgeGroup:'useragegroup'},videoData:{collectionPermalink:'channel',publisher:'publisher',videoCategories:'ucategory',videoId:'videopermalink'}},hasTakeover:function(){var context=VeohUtils.getContextParameters();return $defined(context)&&$defined(context.takeover);},hasSitewideTakeover:function(){var context=VeohUtils.getContextParameters();return $defined(context)&&$defined(context.rosTakeover);},hasNav:function(){var context=VeohUtils.getContextParameters();return $defined(context)&&$defined(context.nav);},hideSection:function(id){var div=$(id);if($defined(div)){div.setStyle('display','none');div.setStyle('opacity','0');}},displaySection:function(id){var div=$(id);if($defined(div)){div.setStyle('display','block');div.setStyle('opacity','1');}},setRefreshTimer:function(){Ads.refreshTimer=setInterval(Ads.refresh,180000);},cancelRefreshTimer:function(){clearInterval(Ads.refreshTimer);Ads.refreshTimer=null;},refresh:function(){for(tile in Ads.tileAdMap){if(Ads.tileAdMap[tile].refresh){Ads.loadAd(tile);}}},reloadAds:function(){if(Ads.adsEnabled){Ads.cancelRefreshTimer();for(tile in Ads.tileAdMap){Ads.tileAdMap[tile].refresh=false;}
if(Ads.hasSitewideTakeover()||Ads.hasTakeover()){Ads.loadAd(Ads.nameTileMap['takeover']);}
if(BrowseWhileWatch.isWatchOpened()){if(Ads.adsAllowedByPublisher){scroll(0,0);Ads.loadAd(Ads.nameTileMap['companion']);}}else{Ads.loadAd(Ads.nameTileMap['sidebar']);Ads.loadAd(Ads.nameTileMap['sidebarcompanion']);Ads.loadAd(Ads.nameTileMap['hotrightnow']);}
Ads.setRefreshTimer();}},loadAd:function(tile){var oldContainer=$(Ads.tileAdMap[tile].containerId);if($defined(oldContainer)){Ads.tileAdMap[tile].refresh=true;var newContainer=document.createElement(oldContainer.tagName);newContainer.setAttribute('id',oldContainer.getAttribute('id'));newContainer.setAttribute('class',oldContainer.getAttribute('class'));var parent=oldContainer.parentNode;parent.replaceChild(newContainer,oldContainer);newContainer.innerHTML='<iframe'+' allowTransparency="true"'+' class="adFrame"'+' frameborder="0"'+' height="'+Ads.tileAdMap[tile].frameHeight+'"'+' id="'+Ads.tileAdMap[tile].id+'"'+' scrolling="no"'+' src="'+Ads.buildUrl(tile)+'"'+' width="'+Ads.tileAdMap[tile].frameWidth+'"'+'></iframe>';Ads.displaySection(Ads.tileAdMap[tile].sectionId);}},unloadAd:function(tile){var oldContainer=$(Ads.tileAdMap[tile].containerId);if($defined(oldContainer)){Ads.tileAdMap[tile].refresh=false;var newContainer=document.createElement(oldContainer.tagName);newContainer.setAttribute('id',oldContainer.getAttribute('id'));newContainer.setAttribute('class',oldContainer.getAttribute('class'));var parent=oldContainer.parentNode;parent.replaceChild(newContainer,oldContainer);Ads.hideSection(Ads.tileAdMap[tile].sectionId);}},moveAd:function(tile,targetSectionId){var target=$(targetSectionId);var source=$(Ads.tileAdMap[tile].sectionId);if($defined(target)&&$defined(source)){target.grab(source.getFirst());Ads.tileAdMap[tile].sectionId=targetSectionId;}},buildUrl:function(tile){var url=VeohUtils.getBaseUrl()+'ad/?';var data=Ads.getData();for(var type in data){for(var param in Ads.dataKeyNameMap[type]){if($defined(data[type][param])){url+=Ads.dataKeyNameMap[type][param]+'='+encodeURI(data[type][param])+'&';}}}
var adObj=Ads.tileAdMap[tile];url+='width='+adObj.width+'&';url+='height='+adObj.height+'&';url+='pos='+adObj.position+'&';url+='tile='+adObj.tile;return url;},getData:function(){var data=VeohUtils.collectParameters();var categoryMap={videoData:{videoCategories:''},contextData:{bcategory:'',collectionCategories:'',groupCategories:''}};for(var segment in categoryMap){for(var category in categoryMap[segment]){if($defined(data[segment][category])&&data[segment][category].contains('sexy'))
{data.adData.sexy='true';break;}}
if('true'==data.adData.sexy){break;}}
if(!$defined(data.adData.sexy)){data.adData.sexy='false';}
if($defined(data.contextData.mature)&&data.contextData.mature=="true"){data.adData.mature="true";}
if($defined(data.videoData.mature)&&data.videoData.mature=="true"){data.adData.mature="true";}
if(!$defined(data.adData.mature)){data.adData.mature="false";}
if(BrowseWhileWatch.isWatchOpened()){data.adData.watch='open';}else{data.adData.watch='closed';}
if($defined(data.videoData.videoCategories)){var categories=data.videoData.videoCategories;if(categories.indexOf('sexy')!=-1){data.adData.ssPartnerId='0';}else if(categories.indexOf('animation')!=-1){data.adData.ssPartnerId='619';}else if(categories.indexOf('anime')!=-1){data.adData.ssPartnerId='619';}else if(categories.indexOf('entertainment')!=-1){data.adData.ssPartnerId='619';}else if(categories.indexOf('sports')!=-1){data.adData.ssPartnerId='621';}else if(categories.indexOf('technology')!=-1){data.adData.ssPartnerId='620';}else if(categories.indexOf('travel')!=-1){data.adData.ssPartnerId='622';}else{data.adData.ssPartnerId='626';}}
if(Ads.getVideoViewTracker().views>4){data.adData.dentyne='true';}
return data;},handleWatchOpeningEvent:function(allowAds){if(Ads.adsEnabled){Ads.adsAllowedByPublisher=allowAds;if(Ads.hasTakeover()){Ads.hideTopAd();Ads.unloadAd(Ads.nameTileMap['takeover']);}
Ads.unloadAd(Ads.nameTileMap['sidebar']);Ads.unloadAd(Ads.nameTileMap['sidebarcompanion']);if(!allowAds){Ads.unloadAd(Ads.nameTileMap['companion']);}}
Ads.incrementVideoViewTracker();},handleWatchOpenedEvent:function(externalPlayer){if(Ads.adsEnabled){if(Ads.adsAllowedByPublisher&&externalPlayer){Ads.reloadAds();}}},handleWatchCloseEvent:function(){Metadata.jsonObj={};if(Ads.adsEnabled){Ads.unloadAd(Ads.nameTileMap['companion']);Ads.moveAd(Ads.nameTileMap['companion'],AdConstants.BROWSE_INNER_ID);Ads.reloadAds();}},handleFullWatchEvent:function(){if(Ads.adsEnabled){Ads.unloadAd(Ads.nameTileMap['companion']);Ads.moveAd(Ads.nameTileMap['companion'],AdConstants.WATCH_INNER_ID);Ads.reloadAds();}},handleSmallWatchEvent:function(){if(Ads.adsEnabled){Ads.unloadAd(Ads.nameTileMap['companion']);Ads.moveAd(Ads.nameTileMap['companion'],AdConstants.BROWSE_INNER_ID);Ads.reloadAds();}},displayTopAd:function(height,backgroundStyle){var searchBox=$('firstHome-searchContainer');if($defined(searchBox)){searchBox.setStyle('display','none');}
var adObj=Ads.tileAdMap[Ads.nameTileMap['takeover']];var frame=$(adObj.id);if($defined(frame)){frame.setStyle('height',height);}
var container=$(adObj.containerId);if($defined(container)){container.setStyle('height',height);container.setStyle('display','block');}
var topAd=$(AdConstants.TOP_AD_ID);if($defined(topAd)){topAd.setStyle('height',height);}
if(backgroundStyle){$(document.body).setStyle('background',backgroundStyle);}},hideTopAd:function(){var adObj=Ads.tileAdMap[Ads.nameTileMap['takeover']];var frame=$(adObj.id);if($defined(frame)){frame.setStyle('height',0);}
var container=$(adObj.containerId);if($defined(container)){container.setStyle('display','none');}},displaySkin:function(imageUrl,bgColor,height){Ads.displayTopAd(height,bgColor+' url('+imageUrl+') no-repeat top center');},displayMongo:function(height){Ads.displayTopAd(height);},getVideoViewTracker:function(){var date=new Date();date.setTime(date.getTime()+(24*60*60*1000));var views=0;var expires=date.toUTCString();;var cookieValue=VeohUtils.getRawCookie('vvt');if(cookieValue!=null){var values=cookieValue.split('&');views=values[0].toInt();expires=values[1];}
return{views:views,expires:expires};},incrementVideoViewTracker:function(){var tracker=Ads.getVideoViewTracker();tracker.views+=1;VeohUtils.setRawCookie('vvt',"{views}&{expires}".substitute(tracker),false,'/',tracker.expires);}};Page=function(){var page={};page.initSideBarAd=function(hasCompanion){if(Ads.adsEnabled){if(hasCompanion){Ads.cancelRefreshTimer();if(Ads.hasSitewideTakeover()||Ads.hasTakeover()){Ads.loadAd(Ads.nameTileMap['takeover']);}
var tile=Ads.nameTileMap['companion'];Ads.unloadAd(tile);Ads.displaySection(Ads.tileAdMap[tile].sectionId);setTimeout(Ads.reloadAds,180000);}else{Ads.reloadAds();}}};return page;};var Autocompleter=new Class({Implements:[Options,Events],options:{minLength:1,markQuery:true,width:'inherit',maxChoices:10,injectChoice:null,customChoices:null,emptyChoices:null,visibleChoices:true,className:'autocompleter-choices',zIndex:42,delay:400,observerOptions:{},fxOptions:{},autoSubmit:false,overflow:false,overflowMargin:25,selectFirst:false,filter:null,filterCase:false,filterSubset:false,forceSelect:false,selectMode:true,choicesMatch:null,multiple:false,separator:', ',separatorSplit:/\s*[,;]\s*/,autoTrim:false,allowDupes:false,cache:true,relative:false,displayLeftOffset:0},initialize:function(element,options){this.element=$(element);this.setOptions(options);this.build();this.observer=new Observer(this.element,this.prefetch.bind(this),$merge({'delay':this.options.delay},this.options.observerOptions));this.queryValue=null;if(this.options.filter)this.filter=this.options.filter.bind(this);var mode=this.options.selectMode;this.typeAhead=(mode=='type-ahead');this.selectMode=(mode===true)?'selection':mode;this.cached=[];},build:function(){if($(this.options.customChoices)){this.choices=this.options.customChoices;}else{this.choices=new Element('ul',{'class':this.options.className,'styles':{'zIndex':this.options.zIndex}}).inject(document.body);this.relative=false;if(this.options.relative){this.choices.inject(this.element,'after');this.relative=this.element.getOffsetParent();}
this.fix=new OverlayFix(this.choices);}
if(!this.options.separator.test(this.options.separatorSplit)){this.options.separatorSplit=this.options.separator;}
this.fx=(!this.options.fxOptions)?null:new Fx.Tween(this.choices,$merge({'property':'opacity','link':'cancel','duration':200},this.options.fxOptions)).addEvent('onStart',Chain.prototype.clearChain).set(0);this.element.setProperty('autocomplete','off').addEvent((Browser.Engine.trident||Browser.Engine.webkit)?'keydown':'keypress',this.onCommand.bind(this)).addEvent('click',this.onCommand.bind(this,[false])).addEvent('focus',this.toggleFocus.create({bind:this,arguments:true,delay:100})).addEvent('blur',this.toggleFocus.create({bind:this,arguments:false,delay:100}));},destroy:function(){if(this.fix)this.fix.destroy();this.choices=this.selected=this.choices.destroy();},toggleFocus:function(state){this.focussed=state;if(!state)this.hideChoices(true);this.fireEvent((state)?'onFocus':'onBlur',[this.element]);},onCommand:function(e){if(!e&&this.focussed)return this.prefetch();if(e&&e.key&&!e.shift){switch(e.key){case'enter':if(this.element.value!=this.opted)return true;if(this.selected&&this.visible){this.choiceSelect(this.selected);if(this["$events"]&&this.$events["selectionEnter"]){this.fireEvent('onSelectionEnter',[this.element,this.selected]);return false;}else{return!!(this.options.autoSubmit);}}
break;case'up':case'down':if(!this.prefetch()&&this.queryValue!==null){var up=(e.key=='up');this.choiceOver((this.selected||this.choices)[(this.selected)?((up)?'getPrevious':'getNext'):((up)?'getLast':'getFirst')](this.options.choicesMatch),true);}
return false;case'esc':case'tab':this.hideChoices(true);break;}}
return true;},setSelection:function(finish){var input=this.selected.inputValue,value=input;var start=this.queryValue.length,end=input.length;if(input.substr(0,start).toLowerCase()!=this.queryValue.toLowerCase())start=0;if(this.options.multiple){var split=this.options.separatorSplit;value=this.element.value;start+=this.queryIndex;end+=this.queryIndex;var old=value.substr(this.queryIndex).split(split,1)[0];value=value.substr(0,this.queryIndex)+input+value.substr(this.queryIndex+old.length);if(finish){var tokens=value.split(this.options.separatorSplit).filter(function(entry){return this.test(entry);},/[^\s,]+/);if(!this.options.allowDupes)tokens=[].combine(tokens);var sep=this.options.separator;value=tokens.join(sep)+sep;end=value.length;}}
this.observer.setValue(value);this.opted=value;if(finish||this.selectMode=='pick')start=end;this.element.selectRange(start,end);this.fireEvent('onSelection',[this.element,this.selected,value,input]);},showChoices:function(){var match=this.options.choicesMatch,first=this.choices.getFirst(match);this.selected=this.selectedValue=null;if(this.fix){var pos=this.element.getCoordinates(this.relative),width=this.options.width||'auto';this.choices.setStyles({'left':pos.left+this.options.displayLeftOffset,'top':pos.bottom,'width':(width===true||width=='inherit')?pos.width:width});}
if(!first)return;if(!this.visible){this.visible=true;this.choices.setStyle('display','');if(this.fx)this.fx.start(1);this.fireEvent('onShow',[this.element,this.choices]);}
if(this.options.selectFirst||this.typeAhead||first.inputValue==this.queryValue)this.choiceOver(first,this.typeAhead);var items=this.choices.getChildren(match),max=this.options.maxChoices;var styles={'overflowY':'hidden','height':''};this.overflown=false;if(items.length>max){var item=items[max-1];styles.overflowY='scroll';styles.height=item.getCoordinates(this.choices).bottom;this.overflown=true;};this.choices.setStyles(styles);this.fix.show();if(this.options.visibleChoices){var scroll=document.getScroll(),size=document.getSize(),coords=this.choices.getCoordinates();if(coords.right>scroll.x+size.x)scroll.x=coords.right-size.x;if(coords.bottom>scroll.y+size.y)scroll.y=coords.bottom-size.y;window.scrollTo(Math.min(scroll.x,coords.left),Math.min(scroll.y,coords.top));}},hideChoices:function(clear){if(clear){var value=this.element.value;if(this.options.forceSelect)value=this.opted;if(this.options.autoTrim){value=value.split(this.options.separatorSplit).filter($arguments(0)).join(this.options.separator);}
this.observer.setValue(value);}
if(!this.visible)return;this.visible=false;if(this.selected)this.selected.removeClass('autocompleter-selected');this.observer.clear();var hide=function(){this.choices.setStyle('display','none');this.fix.hide();}.bind(this);if(this.fx)this.fx.start(0).chain(hide);else hide();this.fireEvent('onHide',[this.element,this.choices]);},prefetch:function(){var value=this.element.value,query=value;if(this.options.multiple){var split=this.options.separatorSplit;var values=value.split(split);var index=this.element.getSelectedRange().start;var toIndex=value.substr(0,index).split(split);var last=toIndex.length-1;index-=toIndex[last].length;query=values[last];}
if(query.length<this.options.minLength){this.hideChoices();}else{if(query===this.queryValue||(this.visible&&query==this.selectedValue)){if(this.visible)return false;this.showChoices();}else{this.queryValue=query;this.queryIndex=index;if(!this.fetchCached())this.query();}}
return true;},fetchCached:function(){return false;if(!this.options.cache||!this.cached||!this.cached.length||this.cached.length>=this.options.maxChoices||this.queryValue)return false;this.update(this.filter(this.cached));return true;},update:function(tokens){this.choices.empty();this.cached=tokens;var type=tokens&&$type(tokens);if(!type||(type=='array'&&!tokens.length)||(type=='hash'&&!tokens.getLength())){(this.options.emptyChoices||this.hideChoices).call(this);}else{if(this.options.maxChoices<tokens.length&&!this.options.overflow)tokens.length=this.options.maxChoices;tokens.each(this.options.injectChoice||function(token){var choice=new Element('li',{'html':this.markQueryValue(token)});choice.inputValue=token;this.addChoiceEvents(choice).inject(this.choices);},this);this.showChoices();}},choiceOver:function(choice,selection){if(!choice||choice==this.selected)return;if(this.selected)this.selected.removeClass('autocompleter-selected');this.selected=choice.addClass('autocompleter-selected');this.fireEvent('onSelect',[this.element,this.selected,selection]);if(!this.selectMode)this.opted=this.element.value;if(!selection)return;this.selectedValue=this.selected.inputValue;if(this.overflown){var coords=this.selected.getCoordinates(this.choices),margin=this.options.overflowMargin,top=this.choices.scrollTop,height=this.choices.offsetHeight,bottom=top+height;if(coords.top-margin<top&&top)this.choices.scrollTop=Math.max(coords.top-margin,0);else if(coords.bottom+margin>bottom)this.choices.scrollTop=Math.min(coords.bottom-height+margin,bottom);}
if(this.selectMode)this.setSelection();},choiceSelect:function(choice){if(choice)this.choiceOver(choice);this.setSelection(true);this.queryValue=false;this.hideChoices();},filter:function(tokens){return(tokens||this.tokens).filter(function(token){return this.test(token);},new RegExp(((this.options.filterSubset)?'':'^')+this.queryValue.escapeRegExp(),(this.options.filterCase)?'':'i'));},markQueryValue:function(str){return(!this.options.markQuery||!this.queryValue)?str:str.replace(new RegExp('('+((this.options.filterSubset)?'':'^')+this.queryValue.escapeRegExp()+')',(this.options.filterCase)?'':'i'),'<span class="autocompleter-queried">$1</span>');},addChoiceEvents:function(el){return el.addEvents({'mouseover':this.choiceOver.bind(this,[el]),'click':this.choiceSelect.bind(this,[el])});}});var OverlayFix=new Class({initialize:function(el){if(Browser.Engine.trident){this.element=$(el);this.relative=this.element.getOffsetParent();this.fix=new Element('iframe',{'frameborder':'0','scrolling':'no','src':'javascript:false;','styles':{'position':'absolute','border':'none','display':'none','filter':'progid:DXImageTransform.Microsoft.Alpha(opacity=0)'}}).inject(this.element,'after');}},show:function(){if(this.fix){var coords=this.element.getCoordinates(this.relative);delete coords.right;delete coords.bottom;this.fix.setStyles($extend(coords,{'display':'','zIndex':(this.element.getStyle('zIndex')||1)-1}));}
return this;},hide:function(){if(this.fix)this.fix.setStyle('display','none');return this;},destroy:function(){if(this.fix)this.fix=this.fix.destroy();}});Element.implement({getSelectedRange:function(){if(!Browser.Engine.trident)return{start:this.selectionStart,end:this.selectionEnd};var pos={start:0,end:0};var range=this.getDocument().selection.createRange();if(!range||range.parentElement()!=this)return pos;var dup=range.duplicate();if(this.type=='text'){pos.start=0-dup.moveStart('character',-100000);pos.end=pos.start+range.text.length;}else{var value=this.value;var offset=value.length-value.match(/[\n\r]*$/)[0].length;dup.moveToElementText(this);dup.setEndPoint('StartToEnd',range);pos.end=offset-dup.text.length;dup.setEndPoint('StartToStart',range);pos.start=offset-dup.text.length;}
return pos;},selectRange:function(start,end){if(Browser.Engine.trident){var diff=this.value.substr(start,end-start).replace(/\r/g,'').length;start=this.value.substr(0,start).replace(/\r/g,'').length;var range=this.createTextRange();range.collapse(true);range.moveEnd('character',start+diff);range.moveStart('character',start);range.select();}else{this.focus();this.setSelectionRange(start,end);}
return this;}});Autocompleter.Base=Autocompleter;Autocompleter.Local=new Class({Extends:Autocompleter,options:{minLength:0,delay:200},initialize:function(element,tokens,options){this.parent(element,options);this.tokens=tokens;},query:function(){this.update(this.filter());}});var Observer=new Class({Implements:[Options,Events],options:{periodical:false,delay:1000},initialize:function(el,onFired,options){this.element=$(el)||$$(el);this.addEvent('onFired',onFired);this.setOptions(options);this.bound=this.changed.bind(this);this.resume();},changed:function(){var value=this.element.get('value');if($equals(this.value,value))return;this.clear();this.value=value;this.timeout=this.onFired.delay(this.options.delay,this);},setValue:function(value){this.value=value;this.element.set('value',value);return this.clear();},onFired:function(){this.fireEvent('onFired',[this.value,this.element]);},clear:function(){$clear(this.timeout||null);return this;},pause:function(){if(this.timer)$clear(this.timer);else this.element.removeEvent('keyup',this.bound);return this.clear();},resume:function(){this.value=this.element.get('value');if(this.options.periodical)this.timer=this.changed.periodical(this.options.periodical,this);else this.element.addEvent('keyup',this.bound);return this;}});var $equals=function(obj1,obj2){return(obj1==obj2||JSON.encode(obj1)==JSON.encode(obj2));};var MooRainbow=new Class({Implements:[Options,Events],options:{id:'mooRainbow',prefix:'moor-',parent:document.body,imgPath:'images/',imgQuerystring:'',startColor:[255,0,0],wheel:false,onComplete:Class.empty,onChange:Class.empty,selectText:'Select'},initialize:function(el,options){this.element=$(el);if(!this.element)return;this.setOptions(options);this.sliderPos=0;this.pickerPos={x:0,y:0};this.backupColor=this.options.startColor;this.currentColor=this.options.startColor;this.sets={rgb:[],hsb:[],hex:[]};this.pickerClick=this.sliderClick=false;if(!this.layout)this.doLayout();this.OverlayEvents();this.sliderEvents();this.backupEvent();if(this.options.wheel)this.wheelEvents();this.element.addEvent('click',function(e){this.toggle(e);}.bind(this));this.layout.overlay.setStyle('background-color',this.options.startColor.rgbToHex());this.layout.backup.setStyle('background-color',this.backupColor.rgbToHex());this.pickerPos.x=this.snippet('curPos').l+this.snippet('curSize','int').w;this.pickerPos.y=this.snippet('curPos').t+this.snippet('curSize','int').h;this.manualSet(this.options.startColor);this.pickerPos.x=this.snippet('curPos').l+this.snippet('curSize','int').w;this.pickerPos.y=this.snippet('curPos').t+this.snippet('curSize','int').h;this.sliderPos=this.snippet('arrPos')-this.snippet('arrSize','int');if(Browser.Engine.webkit)this.hide();},toggle:function(){this[this.visible?'hide':'show']();},show:function(){this.rePosition();this.layout.setStyle('display','block');this.visible=true;},hide:function(){this.layout.setStyles({'display':'none'});this.visible=false;},manualSet:function(color,type){if(!type||(type!='hsb'&&type!='hex'))type='rgb';var rgb,hsb,hex;if(type=='rgb'){rgb=color;hsb=color.rgbToHsb();hex=color.rgbToHex();}
else if(type=='hsb'){hsb=color;rgb=color.hsbToRgb();hex=rgb.rgbToHex();}
else{hex=color;rgb=color.hexToRgb(true);hsb=rgb.rgbToHsb();}
this.setMooRainbow(rgb);this.autoSet(hsb);},autoSet:function(hsb){var curH=this.snippet('curSize','int').h;var curW=this.snippet('curSize','int').w;var oveH=this.layout.overlay.height;var oveW=this.layout.overlay.width;var sliH=this.layout.slider.height;var arwH=this.snippet('arrSize','int');var hue;var posx=Math.round(((oveW*hsb[1])/100)-curW);var posy=Math.round(-((oveH*hsb[2])/100)+oveH-curH);var c=Math.round(((sliH*hsb[0])/360));c=(c==360)?0:c;var position=sliH-c+this.snippet('slider')-arwH;hue=[this.sets.hsb[0],100,100].hsbToRgb().rgbToHex();this.layout.cursor.setStyles({'top':posy,'left':posx});this.layout.arrows.setStyle('top',position);this.layout.overlay.setStyle('background-color',hue);this.sliderPos=this.snippet('arrPos')-arwH;this.pickerPos.x=this.snippet('curPos').l+curW;this.pickerPos.y=this.snippet('curPos').t+curH;},setMooRainbow:function(color,type){if(!type||(type!='hsb'&&type!='hex'))type='rgb';var rgb,hsb,hex;if(type=='rgb'){rgb=color;hsb=color.rgbToHsb();hex=color.rgbToHex();}
else if(type=='hsb'){hsb=color;rgb=color.hsbToRgb();hex=rgb.rgbToHex();}
else{hex=color;rgb=color.hexToRgb();hsb=rgb.rgbToHsb();}
this.sets={rgb:rgb,hsb:hsb,hex:hex};if(!$chk(this.pickerPos.x))
this.autoSet(hsb);this.RedInput.value=rgb[0];this.GreenInput.value=rgb[1];this.BlueInput.value=rgb[2];this.HueInput.value=hsb[0];this.SatuInput.value=hsb[1];this.BrighInput.value=hsb[2];this.hexInput.value=hex;this.currentColor=rgb;this.chooseColor.setStyle('background-color',rgb.rgbToHex());},parseColors:function(x,y,z){var s=Math.round((x*100)/this.layout.overlay.width);var b=100-Math.round((y*100)/this.layout.overlay.height);var h=360-Math.round((z*360)/this.layout.slider.height)+this.snippet('slider')-this.snippet('arrSize','int');h-=this.snippet('arrSize','int');h=(h>=360)?0:(h<0)?0:h;s=(s>100)?100:(s<0)?0:s;b=(b>100)?100:(b<0)?0:b;return[h,s,b];},OverlayEvents:function(){var lim,curH,curW,inputs;curH=this.snippet('curSize','int').h;curW=this.snippet('curSize','int').w;inputs=$A(this.arrRGB).concat(this.arrHSB,this.hexInput);document.addEvent('click',function(){if(this.visible){this.manualSet(this.backupColor,'rgb');this.fireEvent('onChange',[this.sets,this]);this.hide(this.layout);}}.bind(this));inputs.each(function(el){if(el){el.addEvent('keydown',this.eventKeydown.bindWithEvent(this,el));el.addEvent('keyup',this.eventKeyup.bindWithEvent(this,el));}},this);[this.element,this.layout].each(function(el){el.addEvents({'click':function(e){new Event(e).stop();},'keyup':function(e){e=new Event(e);if(e.key=='esc'&&this.visible)this.hide(this.layout);}.bind(this)},this);},this);lim={x:[0-curW,(this.layout.overlay.width-curW)],y:[0-curH,(this.layout.overlay.height-curH)]};this.layout.drag=new Drag(this.layout.cursor,{limit:lim,onStart:this.overlayDrag.bind(this),onDrag:this.overlayDrag.bind(this),snap:0});this.layout.overlay2.addEvent('mousedown',function(e){e=new Event(e);this.layout.cursor.setStyles({'top':e.page.y-this.layout.overlay.getPosition().y-curH,'left':e.page.x-this.layout.overlay.getPosition().x-curW});this.overlayDrag();this.layout.drag.start(e);}.bind(this));this.okButton.addEvent('click',function(){if(this.currentColor==this.options.startColor){this.hide();this.fireEvent('onComplete',[this.sets,this]);}
else{this.backupColor=this.currentColor;this.layout.backup.setStyle('background-color',this.backupColor.rgbToHex());this.hide();this.fireEvent('onComplete',[this.sets,this]);}}.bind(this));},overlayDrag:function(){var curH=this.snippet('curSize','int').h;var curW=this.snippet('curSize','int').w;this.pickerPos.x=this.snippet('curPos').l+curW;this.pickerPos.y=this.snippet('curPos').t+curH;this.setMooRainbow(this.parseColors(this.pickerPos.x,this.pickerPos.y,this.sliderPos),'hsb');this.fireEvent('onChange',[this.sets,this]);},sliderEvents:function(){var arwH=this.snippet('arrSize','int'),lim;lim=[0+this.snippet('slider')-arwH,this.layout.slider.height-arwH+this.snippet('slider')];this.layout.sliderDrag=new Drag(this.layout.arrows,{limit:{y:lim},modifiers:{x:false},onStart:this.sliderDrag.bind(this),onDrag:this.sliderDrag.bind(this),snap:0});this.layout.slider.addEvent('mousedown',function(e){e=new Event(e);this.layout.arrows.setStyle('top',e.page.y-this.layout.slider.getPosition().y+this.snippet('slider')-arwH);this.sliderDrag();this.layout.sliderDrag.start(e);}.bind(this));},sliderDrag:function(){var arwH=this.snippet('arrSize','int'),hue;this.sliderPos=this.snippet('arrPos')-arwH;this.setMooRainbow(this.parseColors(this.pickerPos.x,this.pickerPos.y,this.sliderPos),'hsb');hue=[this.sets.hsb[0],100,100].hsbToRgb().rgbToHex();this.layout.overlay.setStyle('background-color',hue);this.fireEvent('onChange',[this.sets,this]);},backupEvent:function(){this.layout.backup.addEvent('click',function(){this.manualSet(this.backupColor);this.fireEvent('onChange',[this.sets,this]);}.bind(this));},wheelEvents:function(){var arrColors=$A(this.arrRGB).extend(this.arrHSB);arrColors.each(function(el){el.addEvents({'mousewheel':this.eventKeys.bindWithEvent(this,el),'keydown':this.eventKeys.bindWithEvent(this,el)});},this);[this.layout.arrows,this.layout.slider].each(function(el){el.addEvents({'mousewheel':this.eventKeys.bindWithEvent(this,[this.arrHSB[0],'slider']),'keydown':this.eventKeys.bindWithEvent(this,[this.arrHSB[0],'slider'])});},this);},eventKeys:function(e,el,id){var wheel,type;id=(!id)?el.id:this.arrHSB[0];if(e.type=='keydown'){if(e.key=='up')wheel=1;else if(e.key=='down')wheel=-1;else return;}else if(e.type==Element.Events.mousewheel.base)wheel=(e.wheel>0)?1:-1;if(this.arrRGB.contains(el))type='rgb';else if(this.arrHSB.contains(el))type='hsb';else type='hsb';if(type=='rgb'){var rgb=this.sets.rgb,hsb=this.sets.hsb,prefix=this.options.prefix,pass;var value=(el.value.toInt()||0)+wheel;value=(value>255)?255:(value<0)?0:value;switch(el.className){case prefix+'rInput':pass=[value,rgb[1],rgb[2]];break;case prefix+'gInput':pass=[rgb[0],value,rgb[2]];break;case prefix+'bInput':pass=[rgb[0],rgb[1],value];break;default:pass=rgb;}
this.manualSet(pass);this.fireEvent('onChange',[this.sets,this]);}else{var rgb=this.sets.rgb,hsb=this.sets.hsb,prefix=this.options.prefix,pass;var value=(el.value.toInt()||0)+wheel;if(el.className.test(/(HueInput)/))value=(value>359)?0:(value<0)?0:value;else value=(value>100)?100:(value<0)?0:value;switch(el.className){case prefix+'HueInput':pass=[value,hsb[1],hsb[2]];break;case prefix+'SatuInput':pass=[hsb[0],value,hsb[2]];break;case prefix+'BrighInput':pass=[hsb[0],hsb[1],value];break;default:pass=hsb;}
this.manualSet(pass,'hsb');this.fireEvent('onChange',[this.sets,this]);}
e.stop();},eventKeydown:function(e,el){var n=e.code,k=e.key;if((!el.className.test(/hexInput/)&&!(n>=48&&n<=57))&&(k!='backspace'&&k!='tab'&&k!='delete'&&k!='left'&&k!='right'))
e.stop();},eventKeyup:function(e,el){var n=e.code,k=e.key,pass,prefix,chr=el.value.charAt(0);if(!$chk(el.value))return;if(el.className.test(/hexInput/)){if(chr!="#"&&el.value.length!=6)return;if(chr=='#'&&el.value.length!=7)return;}else{if(!(n>=48&&n<=57)&&(!['backspace','tab','delete','left','right'].contains(k))&&el.value.length>3)return;}
prefix=this.options.prefix;if(el.className.test(/(rInput|gInput|bInput)/)){if(el.value<0||el.value>255)return;switch(el.className){case prefix+'rInput':pass=[el.value,this.sets.rgb[1],this.sets.rgb[2]];break;case prefix+'gInput':pass=[this.sets.rgb[0],el.value,this.sets.rgb[2]];break;case prefix+'bInput':pass=[this.sets.rgb[0],this.sets.rgb[1],el.value];break;default:pass=this.sets.rgb;}
this.manualSet(pass);this.fireEvent('onChange',[this.sets,this]);}
else if(!el.className.test(/hexInput/)){if(el.className.test(/HueInput/)&&el.value<0||el.value>360)return;else if(el.className.test(/HueInput/)&&el.value==360)el.value=0;else if(el.className.test(/(SatuInput|BrighInput)/)&&el.value<0||el.value>100)return;switch(el.className){case prefix+'HueInput':pass=[el.value,this.sets.hsb[1],this.sets.hsb[2]];break;case prefix+'SatuInput':pass=[this.sets.hsb[0],el.value,this.sets.hsb[2]];break;case prefix+'BrighInput':pass=[this.sets.hsb[0],this.sets.hsb[1],el.value];break;default:pass=this.sets.hsb;}
this.manualSet(pass,'hsb');this.fireEvent('onChange',[this.sets,this]);}else{pass=el.value.hexToRgb(true);if(isNaN(pass[0])||isNaN(pass[1])||isNaN(pass[2]))return;if($chk(pass)){this.manualSet(pass);this.fireEvent('onChange',[this.sets,this]);}}},doLayout:function(){var id=this.options.id,prefix=this.options.prefix;var idPrefix=id+' .'+prefix;this.layout=new Element('div',{'styles':{'display':'block','position':'absolute'},'id':id}).inject(this.options.parent);var box=new Element('div',{'styles':{'position':'relative'},'class':prefix+'box'}).inject(this.layout);var div=new Element('div',{'styles':{'position':'absolute','overflow':'hidden'},'class':prefix+'overlayBox'}).inject(box);var ar=new Element('div',{'styles':{'position':'absolute','zIndex':1},'class':prefix+'arrows'}).inject(box);ar.width=ar.getStyle('width').toInt();ar.height=ar.getStyle('height').toInt();var ov=new Element('img',{'styles':{'background-color':'#fff','position':'relative','zIndex':2},'src':this.options.imgPath+'moor_woverlay.png'+this.options.imgQuerystring,'class':prefix+'overlay'}).inject(div);var ov2=new Element('img',{'styles':{'position':'absolute','top':0,'left':0,'zIndex':2},'src':this.options.imgPath+'moor_boverlay.png'+this.options.imgQuerystring,'class':prefix+'overlay'}).inject(div);if(Browser.Engine.trident4){div.setStyle('overflow','');var src=ov.src;ov.src=this.options.imgPath+'blank.gif'+this.options.imgQuerystring;ov.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='scale')";src=ov2.src;ov2.src=this.options.imgPath+'blank.gif'+this.options.imgQuerystring;ov2.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='scale')";}
ov.width=ov2.width=div.getStyle('width').toInt();ov.height=ov2.height=div.getStyle('height').toInt();var cr=new Element('div',{'styles':{'overflow':'hidden','position':'absolute','zIndex':2},'class':prefix+'cursor'}).inject(div);cr.width=cr.getStyle('width').toInt();cr.height=cr.getStyle('height').toInt();var sl=new Element('img',{'styles':{'position':'absolute','z-index':2},'src':this.options.imgPath+'moor_slider.png'+this.options.imgQuerystring,'class':prefix+'slider'}).inject(box);this.layout.slider=document.getElement('#'+idPrefix+'slider');sl.width=sl.getStyle('width').toInt();sl.height=sl.getStyle('height').toInt();new Element('div',{'styles':{'position':'absolute'},'class':prefix+'colorBox'}).inject(box);new Element('div',{'styles':{'zIndex':2,'position':'absolute'},'class':prefix+'chooseColor'}).inject(box);this.layout.backup=new Element('div',{'styles':{'zIndex':2,'position':'absolute','cursor':'pointer'},'class':prefix+'currentColor'}).inject(box);var R=new Element('label').inject(box).setStyle('position','absolute');var G=R.clone().inject(box).addClass(prefix+'gLabel').set('html','G: ');var B=R.clone().inject(box).addClass(prefix+'bLabel').set('html','B: ');R.set('html','R: ').addClass(prefix+'rLabel');var inputR=new Element('input');var inputG=inputR.clone().inject(G).addClass(prefix+'gInput');var inputB=inputR.clone().inject(B).addClass(prefix+'bInput');inputR.inject(R).addClass(prefix+'rInput');var HU=new Element('label').inject(box).setStyle('position','absolute');var SA=HU.clone().inject(box).addClass(prefix+'SatuLabel').set('html','S: ');var BR=HU.clone().inject(box).addClass(prefix+'BrighLabel').set('html','B: ');HU.set('html','H: ').addClass(prefix+'HueLabel');var inputHU=new Element('input');var inputSA=inputHU.clone().inject(SA).addClass(prefix+'SatuInput');var inputBR=inputHU.clone().inject(BR).addClass(prefix+'BrighInput');inputHU.inject(HU).addClass(prefix+'HueInput');SA.innerHTML+=" %";BR.innerHTML+=" %";SP=new Element('span',{'styles':{'position':'absolute'},'class':prefix+'ballino'});SP.innerHTML=" &deg;";SP.inject(HU,'after');var hex=new Element('label').inject(box).setStyle('position','absolute').addClass(prefix+'hexLabel').set('html','#hex: ').adopt(new Element('input').addClass(prefix+'hexInput'));var ok=new Element('input',{'styles':{'position':'absolute'},'type':'button','value':this.options.selectText,'class':prefix+'okButton'}).inject(box);this.rePosition();var overlays=$$('#'+idPrefix+'overlay');this.layout.overlay=overlays[0];this.layout.overlay2=overlays[1];this.layout.cursor=document.getElement('#'+idPrefix+'cursor');this.layout.arrows=document.getElement('#'+idPrefix+'arrows');this.chooseColor=document.getElement('#'+idPrefix+'chooseColor');this.layout.backup=document.getElement('#'+idPrefix+'currentColor');this.RedInput=document.getElement('#'+idPrefix+'rInput');this.GreenInput=document.getElement('#'+idPrefix+'gInput');this.BlueInput=document.getElement('#'+idPrefix+'bInput');this.HueInput=document.getElement('#'+idPrefix+'HueInput');this.SatuInput=document.getElement('#'+idPrefix+'SatuInput');this.BrighInput=document.getElement('#'+idPrefix+'BrighInput');this.hexInput=document.getElement('#'+idPrefix+'hexInput');this.arrRGB=[this.RedInput,this.GreenInput,this.BlueInput];this.arrHSB=[this.HueInput,this.SatuInput,this.BrighInput];this.okButton=document.getElement('#'+idPrefix+'okButton');if(!Browser.Engine.webkit419)this.hide();},rePosition:function(){var coords=this.element.getCoordinates();this.layout.setStyles({'left':coords.left,'top':coords.top+coords.height+1});},snippet:function(mode,type){var size;type=(type)?type:'none';switch(mode){case'arrPos':var t=this.layout.arrows.getStyle('top').toInt();size=t;break;case'arrSize':var h=this.layout.arrows.height;h=(type=='int')?(h/2).toInt():h;size=h;break;case'curPos':var l=this.layout.cursor.getStyle('left').toInt();var t=this.layout.cursor.getStyle('top').toInt();size={'l':l,'t':t};break;case'slider':var t=this.layout.slider.getStyle('marginTop').toInt();size=t;break;default:var h=this.layout.cursor.height;var w=this.layout.cursor.width;h=(type=='int')?(h/2).toInt():h;w=(type=='int')?(w/2).toInt():w;size={w:w,h:h};};return size;}});var BrowseEmbed={startWidth:500,baseEmbedUrl:$empty,properties:$empty,previewUrl:$empty,iframeProperties:$empty,init:function(){this.previewUrl=this.baseEmbedUrl;this.resetProperties();var backgroundColorPicker=new MooRainbowBrowseEmbed($('browseEmbed-backgroundBox'),{id:'mooRainbow-backgroundBox',parent:$('browseEmbed'),imgPath:VeohUtils.cdnRoot+'images/',imgQuerystring:"?version="+VeohUtils.iniVersion,startColor:this.properties.get('background-color').hexToRgb(true),onChange:function(color){},onComplete:function(color){$('browseEmbed-backgroundColor').value=color.hex;$('browseEmbed-backgroundBox').setStyle('background-color',color.hex);BrowseEmbed.properties.set('background-color',color.hex);BrowseEmbed.updateIframe();}});var linkColorPicker=new MooRainbowBrowseEmbed($('browseEmbed-linkBox'),{id:'mooRainbow-linkBox',parent:$('browseEmbed'),imgPath:VeohUtils.cdnRoot+'images/',imgQuerystring:"?version="+VeohUtils.iniVersion,startColor:this.properties.get('link-color').hexToRgb(true),onChange:function(color){},onComplete:function(color){$('browseEmbed-linkColor').value=color.hex;$('browseEmbed-linkBox').setStyle('background-color',color.hex);BrowseEmbed.properties.set('link-color',color.hex);BrowseEmbed.updateIframe();}});var textColorPicker=new MooRainbowBrowseEmbed($('browseEmbed-textBox'),{id:'mooRainbow-textBox',parent:$('browseEmbed'),imgPath:VeohUtils.cdnRoot+'images/',imgQuerystring:"?version="+VeohUtils.iniVersion,startColor:this.properties.get('text-color').hexToRgb(true),onChange:function(color){},onComplete:function(color){$('browseEmbed-textColor').value=color.hex;$('browseEmbed-textBox').setStyle('background-color',color.hex);BrowseEmbed.properties.set('text-color',color.hex);BrowseEmbed.updateIframe();}});var thumbLinkColorPicker=new MooRainbowBrowseEmbed($('browseEmbed-thumbLinkBox'),{id:'mooRainbow-thumbLinkBox',parent:$('browseEmbed'),imgPath:VeohUtils.rpcRoot+'images/',imgQuerystring:"?version="+VeohUtils.iniVersion,startColor:this.properties.get('thumb-link-color').hexToRgb(true),onChange:function(color){},onComplete:function(color){$('browseEmbed-thumbLinkColor').value=color.hex;$('browseEmbed-thumbLinkBox').setStyle('background-color',color.hex);BrowseEmbed.properties.set('thumb-link-color',color.hex);BrowseEmbed.updateIframe();}});var thumbBorderColorPicker=new MooRainbowBrowseEmbed($('browseEmbed-thumbBorderBox'),{id:'mooRainbow-thumbBorderBox',parent:$('browseEmbed'),imgPath:VeohUtils.rpcRoot+'images/',imgQuerystring:"?version="+VeohUtils.iniVersion,startColor:this.properties.get('thumb-border-color').hexToRgb(true),onChange:function(color){},onComplete:function(color){$('browseEmbed-thumbBorderColor').value=color.hex;$('browseEmbed-thumbBorderBox').setStyle('background-color',color.hex);BrowseEmbed.properties.set('thumb-border-color',color.hex);BrowseEmbed.updateIframe();}});},resetProperties:function(){this.properties=new Hash({'background-color':'#ffffff','link-color':'#0054A6','text-color':'#2F2F2F','showSearch':true,'thumb-link-color':'#767676','thumb-border-color':'#D7D7D7'});this.iframeProperties=new Hash({'width':500,'height':450});},getQueryStringProperties:function(){return this.properties.toQueryString();},updateIframe:function(){var cleanTheUrl=this.baseEmbedUrl.charAt(this.baseEmbedUrl.length-1)!='?'?'?':'';var url=this.baseEmbedUrl+cleanTheUrl+this.getQueryStringProperties();this.previewUrl=url;var templateValue=$('browseEmbed-embedCodeTemplate').value;var newEmbed=templateValue.replace('--IFRAMESRC--',url);newEmbed=newEmbed.replace('--IFRAMEHEIGHT--',this.iframeProperties.get('height'));newEmbed=newEmbed.replace('--IFRAMEWIDTH--',this.iframeProperties.get('width'));$('browseEmbed-embedCode').value=newEmbed;},updateShowSearch:function(checkbox){this.properties.set('showSearch',$(checkbox).checked?'true':'false');this.updateIframe();},updateIframeWidth:function(width){width=parseInt(width);if(width<450||!$chk(width)){width=450;$('browseEmbed-iframeWidth').value=width;}
this.iframeProperties.set('width',width);this.updateIframe();},updateIframeHeight:function(height){height=parseInt(height);if(height<350||!$chk(height)){height=350;$('browseEmbed-iframeHeight').value=height;}
this.iframeProperties.set('height',height);$('browseEmbed-preview').setProperty('height',height);this.updateIframe();},preview:function(){$('browseEmbed-preview').removeProperty('src');var newPreview=$('browseEmbed-preview').clone(false);newPreview.removeProperty('style');newPreview.setStyle('display','block');newPreview.setProperty('width',this.iframeProperties.get('width'));var parent=$('browseEmbed-preview').getParent();parent.removeChild($('browseEmbed-preview'));newPreview.setProperty('id','browseEmbed-preview');parent.grab(newPreview);newPreview.setProperty('src',this.previewUrl);if($('balloon')&&this.iframeProperties.get('width')>this.startWidth){$('balloon').setStyle('width',this.iframeProperties.get('width')+20);$('browseEmbed').setStyle('width',this.iframeProperties.get('width'));Balloon.moodal.keepCenter();}
else{$('balloon').setStyle('width',this.startWidth+20);$('browseEmbed').setStyle('width',this.startWidth);Balloon.moodal.keepCenter();}}};var MooRainbowBrowseEmbed=new Class({Extends:MooRainbow,initialize:function(el,options){this.parent(el,options);},rePosition:function(){this.layout.setStyles({'left':10,'top':10});}});var Metrics={requestUrl:'metrics/log/',recommendationId:'',vars:{},playProgressTracker:null,elapsedPlayTime:0,progressInterval:30,maxProgress:1200,triggerPlayProgress:{30:true,60:true,120:true,300:true,600:true,1200:true},logEvent:function(action,paramList,valueList){if(!action||(paramList&&!valueList)||(!paramList&&valueList))
return false;params='event='+action;for(var i=0;i<paramList.length;i++){if(params!='')
params+='&';params+=paramList[i]+"="+encodeURI(valueList[i]);}
var url=VeohUtils.rpcRoot+this.requestUrl;new Request({method:'get',url:url}).send(params);},logDownloadEvent:function(videoId){var key=new Array();key[0]="videoId";if(this.recommendationId)
key[1]="recommendationId";var value=new Array();value[0]=videoId;if(this.recommendationId)
value[1]=this.recommendationId;this.logEvent('/download/click',key,value);},logDownloadWebPlayerEvent:function(userId,videoId){var key=new Array();key[0]="userId";key[1]="videoId";var value=new Array();value[0]=userId;value[1]=videoId;this.logEvent('/downloadClick-download',key,value);},logRecommendedClickEvent:function(videoId,rank,source,recId,recRequestId,sourcePermalinkId){var keys=['recommendationId','recRequestId','videoId','rank','source','sourcePermalinkId'];var values=[recId,recRequestId,videoId,rank,source,sourcePermalinkId];this.logEvent('/recommendation/click',keys,values);},logRecommendedQueryClickEvent:function(searchTerm,rank,recId,recRequestId){var keys=['recommendationId','recRequestId','searchTerm','rank','source'];var values=[recId,recRequestId,searchTerm,rank,'searchQ2QRec'];this.logEvent('/recommendation/click',keys,values);},logSearchClickEvent:function(videoId,rank,source,searchId){var keys=['searchId','videoId','rank','source'];var values=[searchId,videoId,rank,source];this.logEvent('/search/click',keys,values);},logCollectionSearchClickEvent:function(collectionId,permalinkId,rank,source,searchId){var keys=['searchId','collectionId','permalinkId','rank','source'];var values=[searchId,collectionId,permalinkId,rank,source];this.logEvent('/search/click',keys,values);},getNewSearchId:function(){var1=(""+Math.random()*1000000000).split(".");var2=(""+Math.random()*1000000000).split(".");return(var1[0]?var1[0]:var1)+(var2[0]?var2[0]:var2);},logAOWPlayProgress:function(){var key=new Array();key[0]="videoId";key[1]="playerSessionID";key[2]="elapsed_time";var value=new Array();value[0]=Metrics.vars.videoId;value[1]=Metrics.vars.playerSessionId;value[2]=Metrics.elapsedPlayTime;Metrics.logEvent('/AOW/PlayProgress',key,value);},playProgressEvent:function(){Metrics.elapsedPlayTime+=Metrics.progressInterval;if(Metrics.vars.runLength<Metrics.elapsedPlayTime){Metrics.stopPlayProgressTracker();return;}
if(Metrics.triggerPlayProgress[Metrics.elapsedPlayTime]){Metrics.logAOWPlayProgress();}
if(Metrics.elapsedPlayTime>=Metrics.maxProgress){Metrics.stopPlayProgressTracker();}},startPlayProgressTracker:function(){if($defined(window.MetricsVars)){Metrics.vars=window.MetricsVars;}else{Metrics.vars={videoId:Metadata.jsonObj.primaryKey,playerSessionId:Metadata.jsonObj.sessionId,runLength:Metadata.jsonObj.length||0};}
Metrics.stopPlayProgressTracker();Metrics.playProgressTracker=setInterval(Metrics.playProgressEvent,Metrics.progressInterval*1000);},stopPlayProgressTracker:function(){Metrics.elapsedPlayTime=0;if(Metrics.playProgressTracker!=null){clearInterval(Metrics.playProgressTracker);Metrics.playProgressTracker=null;}}};var BrowserDetect={checkForUnsupportedBrowser:function(){if(Browser.Engine.trident4&&false)
{var oldBrowserBar=new Element('div',{'id':'oldBrowserBar','html':'<p>We are sorry, but our website has limited support for your browser (Internet Explorer 6). Please <a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx" title="Upgrade to Internet Explorer 7!" target="_blank">upgrade to IE 7</a> to see the new Veoh.com.'});$(oldBrowserBar).inject($(document.body),'top');$(oldBrowserBar).tween('top',0);}}};var HistoryManager=(function(){var HistoryManagerSingleton=new Class({initialize:function(){this._currentLocation=this._getHash();if(Browser.Engine.trident){this.addState=this._addStateIE;this._iframe=new Element('iframe',{src:"javascript:'<html></html>'",styles:{'position':'absolute','top':'-1000px'}}).inject(document.body).contentWindow;$justForIE=function(hash){this._getHash=function(){return hash;};this._monitorDefault.call(this);location.hash=hash;}.bind(this);var waitForLoad=function waitForIframeLoad(){if(this._iframe&&this._iframe.document&&this._iframe.document.body){if(!this._iframe.document.body.innerHTML)
this.addState(this._currentLocation,true);$clear(waitForLoad);}}.periodical(50,this);}
else if(Browser.Engine.webkit419){this._form=new Element("form",{method:'get'}).inject(document.body);this._historyCounter=history.length;this._stateHistory=[];this._stateHistory[history.length]=this._getHash();this.addState=this._addStateSafari;this._monitorSafari.periodical(250,this);}
else if(window.opera&&!Browser.Engine.presto950){this.addState=this._addStateDefault;$justForOpera=this._monitorDefault.bind(this);new Element('img',{src:"javascript:location.href='javascript:$justForOpera();';",style:"position: absolute; top: -1000px;"}).inject(document.body);}
else{this.addState=this._addStateDefault;this._monitorDefault.periodical(250,this);}},getCurrentLocation:function(){return this._currentLocation;},_getHash:function(){return location.href.split('#')[1]||'';},_addStateIE:function(hash,override){if(this._currentLocation==hash&&!override)return;this._currentLocation=hash;this._iframe.document.write('<html><body onload="top.$justForIE(\'',hash.replace("'","\\'"),'\');">Loaded</body></html>');this._iframe.document.close();},_addStateSafari:function(hash){if(this._currentLocation==hash)return;this._form.setProperty('action','#'+hash).submit();this._currentLocation=hash;this._stateHistory[history.length]=this._getHash();this._historyCounter=history.length;},_monitorSafari:function(){if(history.length!=this._historyCounter){this._historyCounter=history.length;this._currentLocation=this._stateHistory[history.length];this.fireEvent('onHistoryChange',[this._currentLocation]);}},_addStateDefault:function(hash){if(this._currentLocation==hash)return;location.hash='#'+hash;this._currentLocation=hash;},_monitorDefault:function(){var hash=this._getHash();if(hash!=this._currentLocation){this._currentLocation=hash;this.fireEvent('onHistoryChange',[hash]);}}});HistoryManagerSingleton.implement(new Events);var singleton;return function(){return singleton?singleton:singleton=new HistoryManagerSingleton();};})();function launchABCPlayer(abcGuid){ABCFEP.openFEP(abcGuid);}
function launchABCShortFormPlayer(){p="fixMe";var guidContainer=document.getElementById("swf_guid");if(!guidContainer)
return;var abcGuid=guidContainer.value;com.abc.player.createAndEmbedPlayer('player',{guid:abcGuid});}
var Rating=new Class({Implements:[Options],options:{startValue:0,callback:$empty,starClass:'sp_star-whole-blue',emptyStarClass:'sp_star-whole-grey',hoverStarClass:'sp_star-whole-green',saveUrl:'video/rate/rating/'},initialize:function(id,permalinkId,options){if(!$(id))return;if(!$defined(permalinkId))return;this.setOptions(options);this.id=id;this.permalinkId=permalinkId;this.stars=$$('#'+id+' a.icon');this._setupStars();$(this.id).addEvents({mouseleave:function(){this.reset();}.bind(this)});},_setupStars:function(){this.stars.each(function(el,i){el.store('startClass',el.hasClass(this.options.emptyStarClass)?this.options.emptyStarClass:(el.hasClass(this.options.hoverStarClass)?this.options.hoverStarClass:this.options.starClass));el.addEvents({mouseover:function(){this.fill(i);}.bind(this),mouseout:function(){this.drain(i);}.bind(this),click:function(){this.click(i);}.bind(this)});}.bind(this));if(this.options.startValue==0){this.options.startValue=-1;}},fill:function(n,isReset){if(n==-1){this.drain(0);return;}
for(var j=0;j<this.stars.length;j++){try{$(this.stars[j]).removeProperty('class');if(j<=n){$(this.stars[j]).addClass('icon '+(isReset?$(this.stars[j]).retrieve('startClass'):this.options.hoverStarClass));}
else{$(this.stars[j]).addClass('icon '+this.options.emptyStarClass);}}catch(e){}}},drain:function(n){for(var j=n;j<this.stars.length;j++){try{$(this.stars[j]).removeClass(this.options.starClass);$(this.stars[j]).removeClass(this.options.hoverStarClass);$(this.stars[j]).addClass(this.options.emptyStarClass);}catch(e){}}},reset:function(){this.fill(this.options.startValue,true);},click:function(n){this.stars.each(function(el,i){if(i<=n){el.store('startClass',this.options.hoverStarClass);}
else{el.store('startClass',this.options.emptyStarClass);}}.bind(this));this.options.startValue=n+1;var rating=n+1;var url=VeohUtils.rpcRoot+this.options.saveUrl+rating+'/permalinkId/'+this.permalinkId+'?'+Math.random();VeohUtils.makeRequest(url,'',this.options.callback,null,null,true);}});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(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!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";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=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 _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,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");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[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(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return"";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;var Comments=new Class({Implements:[Options],options:{newPostLink:'showMainCommentFormLink',formDivId:'commentFormWrapper',formSubjectId:'commentFormSubject',formId:'commentForm',errorId:'commentError',lastLinkRef:null,recaptcha:'recaptcha_widget',recaptchaPublicKey:'6LcgyQAAAAAAAOcV5HwRlHcP2Z_SEJ4HDmPaiBJL',onSuccessfulPost:$empty},initialize:function(options){this.setOptions(options);if(window['Recaptcha']&&$(this.options.recaptcha)){this.recaptchaHtml=$(this.options.recaptcha).innerHTML;this.showRecaptcha();$(this.options.formId).comment.onfocus=function(){if($(this.options.recaptcha).innerHTML==''){this.showRecaptcha();}
$(this.options.recaptcha).removeClass('hide');}.bind(this);}},showRecaptcha:function(){if(window['Recaptcha']&&$(this.options.recaptcha)){$$('div.recaptchaAjax').each(function(el){el.innerHTML='';});$(this.options.recaptcha).innerHTML=this.recaptchaHtml;if(Browser.Engine.trident4){setTimeout(function(){Recaptcha.create(this.options.recaptchaPublicKey,this.options.recaptcha,{theme:'custom'});}.bind(this),1);}
else{Recaptcha.create(this.options.recaptchaPublicKey,this.options.recaptcha,{theme:'custom'});}}},newPost:function(){$(this.options.newPostLink).addClass('hide');if($defined(this.options.lastLinkRef)){$(this.options.lastLinkRef).removeClass('hide');}
this.options.lastLinkRef=$(this.options.newPostLink);$(this.options.formDivId).inject($(this.options.newPostLink),'after');$(this.options.formDivId).removeClass('hide');if($(this.options.formSubjectId))$(this.options.formSubjectId).removeClass("hide");$(this.options.formDivId).removeClass('comment-l1');$(this.options.formDivId).removeClass('comment-l2');this.reset();},addReply:function(replyLinkRef,replyToId){if($defined(this.options.lastLinkRef)){$(this.options.lastLinkRef).removeClass('hide');}
else{$(this.options.newPostLink).removeClass('hide');}
$(replyLinkRef).addClass('hide');var parentLi=$('comment_'+replyToId);$(this.options.formDivId).inject(parentLi);$(this.options.formDivId).removeClass('hide');if($(this.options.formSubjectId))$(this.options.formSubjectId).addClass("hide");parentLiClass=parentLi.getElement('div').className;if(parentLiClass.indexOf("comment-l0")>-1){$(this.options.formDivId).addClass('comment-l1');$(this.options.formDivId).removeClass('comment-l2');}else if(parentLiClass.indexOf("comment-l1")>-1){$(this.options.formDivId).addClass('comment-l2');$(this.options.formDivId).removeClass('comment-l1');}
this.reset();$(this.options.formId).replyTo.value=replyToId;this.options.lastLinkRef=$(replyLinkRef);},postComment:function(){VeohUtils.makePost(this.options.formId,null,this.options.onSuccessfulPost.bind(this));return false;},removeComment:function(removeLink,commentId,target){return VeohUtils.makeRequest(removeLink,target,null,null,{'commentId':commentId},true);},reset:function(){$(this.options.formId).replyTo.value='';$(this.options.formId).comment.value='';if($(this.options.formId).subject)$(this.options.formId).subject.value='';$(this.options.errorId).addClass('hide');$(this.options.errorId).innerHTML='';if(window['Recaptcha']&&$(this.options.recaptcha)){this.showRecaptcha();$(this.options.recaptcha).addClass('hide');}}});var Publish={uploadToken:'',userToken:'',permalinkId:'',validExtensions:['.3gp','.asf','.avi','.divx','.flv','.m4v','.mkv','.mov','.mp4','.mpeg','.mpg','.rm','.wmv'],requiredBox:null,moreDetailsBox:null,privacyBox:null,requiredBoxState:true,moreDetailsBoxState:false,privacyBoxState:false,progressCounter:0,uploadFinished:false,success:false,errorCount:0,customTitle:'',upload:function(a,b,html){if(html)
$('publishFormHolder').innerHTML=html;if(!$('allowEmbedding')){if(errorCount++<5)
Publish.upload.delay(500);else
document.location=VeohUtils.rpcRoot+'/error';return;}
this.errorCount=0;$('publishButtonLink').onclick=function(){return Publish.save();};if(!Publish.success){Publish.load();Publish.toggleSexy.delay(1000);if(Publish.uploadFinished&&$('uploadFrame'))
{$('uploadFrame').style.display='none';}}else{if(Publish.uploadFinished){document.location=VeohUtils.rpcRoot+'myprofile/videos';return;}
Publish.userToken=$('userToken').value;var uploadForm=$('uploadFrame').contentWindow.document.getElementById('uploadForm');var uploadUrl=uploadForm.action;uploadForm.action=uploadUrl+'?userToken='+encodeURIComponent(Publish.userToken)+'&uploadToken='+Publish.uploadToken;if(uploadForm.action)
uploadForm.submit();$('uploadFrame').style.display='none';$('uploadProgressWrapper').style.display='block';Publish.updateProgress();Publish.requiredBoxState=false;Publish.moreDetailsBoxState=true;Publish.privacyBoxState=true;Publish.load();Publish.toggleSexy.delay(1000);$('publishButtonLink').style.display='none';$('publishButtonDisabled').style.display='block';var theFile=$('uploadFrame').contentWindow.document.getElementById('theFile');var urlUpload=$('uploadFrame').contentWindow.document.getElementById('urlUpload');var file=(theFile.value.length>0)?theFile.value:urlUpload.value;if(file.lastIndexOf('/')!=-1)
file=file.substring(file.lastIndexOf('/')+1);if(file.lastIndexOf('\\')!=-1)
file=file.substring(file.lastIndexOf('\\')+1);$('uploadTitle').innerHTML=file;$('uploadCancel').style.display='block';}},cancel:function(error){$('uploadCancel').style.display='none';$('uploadFrame').src="";$('uploadFrame').src=VeohUtils.rpcRoot+'publish/upload'+((error)?('/error/'+error):'');$('uploadFrame').style.display='block';$('uploadProgressWrapper').style.display='none';$('publishButtonDisabled').style.display='none';$('publishButtonLink').style.display='block';},load:function(){if(!Browser.Engine.trident){Publish.requiredBox=new ExpandableBox("required",{state:(Publish.requiredBoxState)?1:0,height:360});Publish.moreDetailsBox=new ExpandableBox("moreDetails",{state:(Publish.moreDetailsBoxState)?1:0,height:140});Publish.privacyBox=new ExpandableBox("privacy",{state:(Publish.privacyBoxState)?1:0,height:70});}else{Publish.requiredBox=new ExpandableBox("required",{state:(Publish.requiredBoxState)?1:0,height:390});Publish.moreDetailsBox=new ExpandableBox("moreDetails",{state:(Publish.moreDetailsBoxState)?1:0,height:140});Publish.privacyBox=new ExpandableBox("privacy",{state:(Publish.privacyBoxState)?1:0,height:120});}
if($('publishButtonLink').style.display!='none'&&$('publishButtonText').innerHTML=='Add Video')
$('publishTOS').style.display='block';else
$('publishTOS').style.display='none';Publish.toggleSexy();if(Publish.customTitle)
$('publishButtonText').innerHTML=Publish.customTitle;},updateProgress:function(){var url=VeohUtils.rpcRoot+'publish/progress?uploadToken='+Publish.uploadToken;var success=function(uploadStatus){if(uploadStatus){if(uploadStatus.error){Publish.cancel(uploadStatus.error);return;}else if(uploadStatus.percentage==""){Publish.errorCount++;if(Publish.errorCount>=4){Publish.cancel(uploadStatus.defaultError);return;}}else{$('uploadPercent').innerHTML=uploadStatus.percentage+"%";$('uploadCurrentProgress').style.width=(uploadStatus.percentage/100)*400+"px";$('uploadTransferred').innerHTML=uploadStatus.uploadedFileSize+" of "+uploadStatus.fileSize+" ("+uploadStatus.transferRate+")";$('uploadRemaining').innerHTML=uploadStatus.timeRemaining+" Remaining";}
if(parseInt(uploadStatus.percentage)>=100){$clear(Publish.intervalId);Publish.uploadComplete();}else{Publish.intervalId=Publish.updateProgress.delay((++Publish.progressCounter>5)?10000:3000);}}};var req=new Request.JSON({url:url,onComplete:success}).send();},uploadComplete:function(){$('publishButtonText').innerHTML=$('publishButtonDisabledText').innerHTML;$('uploadUploading').style.display='none';$('uploadCancel').style.display='none';$('uploadComplete').style.display='block';$('publishButtonDisabled').style.display='none';$('publishButtonLink').style.display='block';Publish.uploadFinished=true;},toggleSexy:function(){active=$('isSexy').checked;var options=$('categoryId').options;if(active){for(var i in options)
if(!isNaN(i)&&options[i].innerHTML=='Sexy'){options[i].selected=true;break;}
$('contentRatingId-2').checked=true;$('contentRatingId-1').disabled=true;$('contentRatingId-2').disabled=true;$('categoryId').disabled=true;}else{$('contentRatingId-1').disabled=false;$('contentRatingId-2').disabled=false;$('categoryId').disabled=false;}},save:function()
{try{if($('uploadFrame').contentWindow.document.getElementById('uploadFormCustomError'))
$('uploadFrame').contentWindow.document.getElementById('uploadFormCustomError').style.display='none';}catch(e){}
if(!Publish.uploadFinished){var emptyError=$('uploadFrame').contentWindow.document.getElementById('uploadFormError');var invalidError=$('uploadFrame').contentWindow.document.getElementById('uploadFormErrorInvalid');var theFile=$('uploadFrame').contentWindow.document.getElementById('theFile');var urlUpload=$('uploadFrame').contentWindow.document.getElementById('urlUpload');if(theFile.value.length==0&&urlUpload.value.length==0){emptyError.style.display="block";invalidError.style.display="none";return;}
if(theFile.value.length>0)
urlUpload.value="";var file=(theFile.value.length>0)?theFile.value:urlUpload.value;if(!Publish.validExtension(file)){emptyError.style.display="none";invalidError.style.display="block";return;}
emptyError.style.display="none";invalidError.style.display="none";}
$('contentRatingId-1').disabled=false;$('contentRatingId-2').disabled=false;$('categoryId').disabled=false;Publish.requiredBoxState=Publish.requiredBox.isOpen();Publish.moreDetailsBoxState=Publish.moreDetailsBox.isOpen();Publish.privacyBoxState=Publish.privacyBox.isOpen();$('publishButtonLink').onclick="";Publish.success=false;Publish.permalinkId=Publish.uploadToken='';return VeohUtils.makePost('publishForm',null,Publish.upload,null);},validExtension:function(file)
{for(var i in Publish.validExtensions)
if(file.toLowerCase().lastIndexOf(Publish.validExtensions[i])!=-1)
return true;return false;},remove:function(videoId)
{if(!confirm('Are you sure you want to remove this video?'))
return;url=VeohUtils.rpcRoot+'publish/remove-video/';var onsuccess=function(){var obj=$('vid'+videoId);if(obj)
obj.parentNode.removeChild(obj);};var params={'videoId':videoId};VeohUtils.makeRequest(url,'',onsuccess,null,params,true);},confirmEmail:function()
{$('emailError').style.display='none';var reg=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(!reg.test($('newEmail').value)){$('emailError').style.display='block';}else{$('confirmationForm').submit();return false;}}};var Favorites={addToQuicklist:function(link){var idparts=link.id.split('_'),permalinkId=idparts[1],index='_'+idparts[2]+'_'+idparts[3],addFavorite=function(){var data={'embed_code':Metadata.jsonObj.embedCode,'format':'html','permalinkId':permalinkId,'playlist_id':'Favorites','playlist_title':'Quicklist','title':Metadata.jsonObj.title,'url':document.URL};VeohUtils.makeRequest(link.href,$('addFavorite_vThumbWrapper'+index),null,null,data,true);};Metadata.fetchJson(index,permalinkId,addFavorite);return false;},remove:function(id){url=VeohUtils.rpcRoot+'video/remove-favorite/permalinkId/'+id;var onsuccess=function(){try{var old=$('rem'+id);var oldli=old.getParent('li');oldli.destroy();}catch(e){}};VeohUtils.makeRequest(url,null,onsuccess,null,null,true);}};var Target={logWatchEvent:function(){var pageData=Ads.getData();var vobj=pageData.videoData;VeohUtils.makeRequest(VeohUtils.rpcRoot+'target.php',false,false,false,{visitor_id:Target.getVisitorId(),bt:'false',category_ids:vobj.videoCategoryIds,video_id:VeohUtils.getIdFromPermalinkId(vobj.videoId),video_permalink_id:vobj.videoId,content_source_id:vobj.contentSourceId,is_embed:'false',embedded_uri:'',category_permalink_id:vobj.collectionPermalink});},getVisitorId:function(){var visitorId=false;var veohCookie=VeohUtils.getCookie('veohCookie');if(!veohCookie)return false;var valueList=veohCookie.replace('"','').split('&');for(var i=0;i<valueList.length;++i){var keyValuePair=valueList[i].split('=');var key=keyValuePair[0];var value=keyValuePair[1];if(key=='VisitorUID'){visitorId=value;break;}}
return visitorId;}};var Bookmarks={deleteList:function(link,fromListView){var confirmed=confirm('Are you sure you want to delete this list?');if(!confirmed)return false;var r=new Request.JSON({url:$(link).getProperty('href'),onComplete:function(responseJSON){if(responseJSON.success=='ok'){if(fromListView){location.href=VeohUtils.rpcRoot+'myplaylists';}
else{var p=$(link).getParent('li');p.set('tween',{duration:'short'});p.tween('opacity',0).get('tween').chain(function(){p.destroy();});}}
else{alert(responseJSON.error);}}}).send();return false;},deleteItem:function(link){var confirmed=confirm('Are you sure you want to delete this video from the playlist?');if(!confirmed)return false;var r=new Request.JSON({url:$(link).getProperty('href'),onComplete:function(responseJSON){if(responseJSON.success=='ok'){var p=$(link).getParent('li');p.set('tween',{duration:'short'});p.tween('opacity',0).get('tween').chain(function(){p.destroy();});}
else{alert(responseJSON.error);}}}).send();return false;}};var FBConnect={userConnected:function(){var url=VeohUtils.rpcRoot+'login/submit-facebook';VeohUtils.makeRequest(url,null,null,null,null,true);return false;},displayPanel:function(){Balloon.display(VeohUtils.rpcRoot+'register/facebook',2,null,'facebookRegister');},link:function(formObj){var url=$(formObj).get('action');if($('balloon')&&$('balloon').getStyle('opacity')==1){var divId=$('balloon_contents');}
else{var divId='contentHolder';}
var options={url:url,data:$(formObj),update:divId};var ret=new Request.HTML(options).send();return false;},linkMyAccount:function(){FB.Connect.showPermissionDialog("email, publish_stream",function(){$('form-associate-fb').submit();});return false;},grantPermissions:function(){FB.Connect.showPermissionDialog("publish_stream",function(permissionsGranted){if(!permissionsGranted||permissionsGranted=='')return false;if($('editAccount-sharing-fb-nopermission')&&permissionsGranted=='publish_stream'){$('editAccount-sharing-fb-nopermission').set('html','<p class="success">Now you can enable which stories you want to publish below:</p>');$('editAccount-sharing-fb-settings').getElement('div.disabled').addClass('hide');}});return false;},fillProfile:function(){$('fbProfileImport').innerHTML=$('a-users-account-submit').innerHTML;$('fbProfileImport').onclick=null;$('fbProfileImport').addEvent('click',function(){$('form-edit-profile').submit();return false;});var api=FB.Facebook.apiClient;var fields=['about_me','activities','birthday','current_location','first_name','last_name','interests','movies','music','tv','sex'];FB.Connect.requireSession(function(){api.users_getLoggedInUser(function(result){var uid=result;api.users_getInfo([uid],fields,function(result){var defaultData={'about_me':'','current_location':{'city':'','state':'','zip':''},'birthday':'December 31, 1969','first_name':'','last_name':'','interests':'','movies':'','music':'','tv':'','sex':'female'};var data=result[0];var d=$merge(defaultData,data);try{$('firstName').value=d['first_name'];$('lastName').value=d['last_name'];if(d['current_location']){$('city').value=d['current_location']['city'];$('province').value=d['current_location']['state'];$('postalCode').value=d['current_location']['zip'];}
$('gender').value=d['sex'];$('description').value=(d['about_me'].length>1024)?d['about_me'].substring(0,1024):d['about_me'];$('interests').value=(d['interests'].length>255)?d['interests'].substring(0,255):d['interests'];$('tv').value=(d['tv'].length>255)?d['tv'].substring(0,255):d['tv'];$('movies').value=(d['movies'].length>255)?d['movies'].substring(0,255):d['movies'];$('music').value=(d['music'].length>255)?d['music'].substring(0,255):d['music'];var bdayArray=d['birthday'].split(' ');var months={'january':1,'february':2,'march':3,'april':4,'may':5,'june':6,'july':7,'august':8,'september':9,'october':10,'november':11,'december':12};if(bdayArray.length>0)
$('monthOfBirth').value=months[bdayArray[0].toLowerCase()];if(bdayArray.length>1)
$('dayOfBirth').value=bdayArray[1].replace(',','');if(bdayArray.length>2)
$('yearOfBirth').value=bdayArray[2];}
catch(e){VeohUtils.log(e);}});});});return false;}};