/* Metacafe Copyright - http://www.metacafe.com/ */
/* Files included: GoogleAnalytics.js MooBox.js PageInit.js Kpi.js 3oldportal.js 1swfobject.js 2mootools.js AutoComplete.js AdManager.js rpc.js BaseFunctions.js BaseClasses.js 4MootoolsExt.js 6Facebook.js */

var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();swfobject.defaultParams={'wmode':'transparent',"quality":"high","allowfullscreen":"true","allowscriptaccess":"always"};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 MooTools={version:"1.11"};function $defined(A){return(A!=undefined);}function $type(B){if(!$defined(B)){return false;}if(B.htmlElement){return"element";}var A=typeof B;if(A=="object"&&B.nodeName){switch(B.nodeType){case 1:return"element";case 3:return(/\S/).test(B.nodeValue)?"textnode":"whitespace";}}if(A=="object"||A=="function"){switch(B.constructor){case Array:return"array";case RegExp:return"regexp";case Class:return"class";}if(typeof B.length=="number"){if(B.item){return"collection";}if(B.callee){return"arguments";}}}return A;}function $merge(){var C={};for(var B=0;B<arguments.length;B++){for(var E in arguments[B]){var A=arguments[B][E];var D=C[E];if(D&&$type(A)=="object"&&$type(D)=="object"){C[E]=$merge(D,A);}else{C[E]=A;}}}return C;}var $extend=function(){var A=arguments;if(!A[1]){A=[this,A[0]];}for(var B in A[1]){A[0][B]=A[1][B];}return A[0];};var $native=function(){for(var B=0,A=arguments.length;B<A;B++){arguments[B].extend=function(C){for(var D in C){if(!this.prototype[D]){this.prototype[D]=C[D];}if(!this[D]){this[D]=$native.generic(D);}}};}};$native.generic=function(A){return function(B){return this.prototype[A].apply(B,Array.prototype.slice.call(arguments,1));};};$native(Function,Array,String,Number);function $chk(A){return!!(A||A===0);}function $pick(B,A){return $defined(B)?B:A;}function $random(B,A){return Math.floor(Math.random()*(A-B+1)+B);}function $time(){return new Date().getTime();}function $clear(A){clearTimeout(A);clearInterval(A);return null;}var Abstract=function(A){A=A||{};A.extend=$extend;return A;};var Window=new Abstract(window);var Document=new Abstract(document);document.head=document.getElementsByTagName("head")[0];window.xpath=!!(document.evaluate);if(window.ActiveXObject){window.ie=window[window.XMLHttpRequest?"ie7":"ie6"]=true;}else{if(document.childNodes&&!document.all&&!navigator.taintEnabled){window.webkit=window[window.xpath?"webkit420":"webkit419"]=true;}else{if(document.getBoxObjectFor!=null){window.gecko=true;}}}window.khtml=window.webkit;Object.extend=$extend;if(typeof HTMLElement=="undefined"){var HTMLElement=function(){};if(window.webkit){document.createElement("iframe");}HTMLElement.prototype=(window.webkit)?window["[[DOMElement.prototype]]"]:{};}HTMLElement.prototype.htmlElement=function(){};if(window.ie6){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}var Class=function(B){var A=function(){return(arguments[0]!==null&&this.initialize&&$type(this.initialize)=="function")?this.initialize.apply(this,arguments):this;};$extend(A,this);A.prototype=B;A.constructor=Class;return A;};Class.empty=function(){};Class.prototype={extend:function(B){var C=new this(null);for(var D in B){var A=C[D];C[D]=Class.Merge(A,B[D]);}return new Class(C);},implement:function(){for(var B=0,A=arguments.length;B<A;B++){$extend(this.prototype,arguments[B]);}}};Class.Merge=function(C,D){if(C&&C!=D){var B=$type(D);if(B!=$type(C)){return D;}switch(B){case"function":var A=function(){this.parent=arguments.callee.parent;return D.apply(this,arguments);};A.parent=C;return A;case"object":return $merge(C,D);}}return D;};var Chain=new Class({chain:function(A){this.chains=this.chains||[];this.chains.push(A);return this;},callChain:function(){if(this.chains&&this.chains.length){this.chains.shift().delay(10,this);}},clearChain:function(){this.chains=[];}});var Events=new Class({addEvent:function(B,A){if(A!=Class.empty){this.$events=this.$events||{};this.$events[B]=this.$events[B]||[];this.$events[B].include(A);}return this;},fireEvent:function(C,B,A){if(this.$events&&this.$events[C]){this.$events[C].each(function(D){D.create({"bind":this,"delay":A,"arguments":B})();},this);}return this;},removeEvent:function(B,A){if(this.$events&&this.$events[B]){this.$events[B].remove(A);}return this;}});var Options=new Class({setOptions:function(){this.options=$merge.apply(null,[this.options].extend(arguments));if(this.addEvent){for(var A in this.options){if($type(this.options[A]=="function")&&(/^on[A-Z]/).test(A)){this.addEvent(A,this.options[A]);}}}return this;}});Array.extend({forEach:function(C,D){for(var B=0,A=this.length;B<A;B++){C.call(D,this[B],B,this);}},filter:function(D,E){var C=[];for(var B=0,A=this.length;B<A;B++){if(D.call(E,this[B],B,this)){C.push(this[B]);}}return C;},map:function(D,E){var C=[];for(var B=0,A=this.length;B<A;B++){C[B]=D.call(E,this[B],B,this);}return C;},every:function(C,D){for(var B=0,A=this.length;B<A;B++){if(!C.call(D,this[B],B,this)){return false;}}return true;},some:function(C,D){for(var B=0,A=this.length;B<A;B++){if(C.call(D,this[B],B,this)){return true;}}return false;},indexOf:function(C,D){var A=this.length;for(var B=(D<0)?Math.max(0,A+D):D||0;B<A;B++){if(this[B]===C){return B;}}return-1;},copy:function(D,C){D=D||0;if(D<0){D=this.length+D;}C=C||(this.length-D);var A=[];for(var B=0;B<C;B++){A[B]=this[D++];}return A;},remove:function(C){var B=0;var A=this.length;while(B<A){if(this[B]===C){this.splice(B,1);A--;}else{B++;}}return this;},contains:function(A,B){return this.indexOf(A,B)!=-1;},associate:function(C){var D={},B=Math.min(this.length,C.length);for(var A=0;A<B;A++){D[C[A]]=this[A];}return D;},extend:function(C){for(var B=0,A=C.length;B<A;B++){this.push(C[B]);}return this;},merge:function(C){for(var B=0,A=C.length;B<A;B++){this.include(C[B]);}return this;},include:function(A){if(!this.contains(A)){this.push(A);}return this;},getRandom:function(){return this[$random(0,this.length-1)]||null;},getLast:function(){return this[this.length-1]||null;}});Array.prototype.each=Array.prototype.forEach;Array.each=Array.forEach;function $A(A){return Array.copy(A);}function $each(C,B,D){if(C&&typeof C.length=="number"&&$type(C)!="object"){Array.forEach(C,B,D);}else{for(var A in C){B.call(D||C,C[A],A);}}}Array.prototype.test=Array.prototype.contains;String.extend({test:function(A,B){return(($type(A)=="string")?new RegExp(A,B):A).test(this);},toInt:function(){return parseInt(this,10);},toFloat:function(){return parseFloat(this);},camelCase:function(){return this.replace(/-\D/g,function(A){return A.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/\w[A-Z]/g,function(A){return(A.charAt(0)+"-"+A.charAt(1).toLowerCase());});},capitalize:function(){return this.replace(/\b[a-z]/g,function(A){return A.toUpperCase();});},trim:function(){return this.replace(/^\s+|\s+$/g,"");},clean:function(){return this.replace(/\s{2,}/g," ").trim();},rgbToHex:function(B){var A=this.match(/\d{1,3}/g);return(A)?A.rgbToHex(B):false;},hexToRgb:function(B){var A=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(A)?A.slice(1).hexToRgb(B):false;},contains:function(A,B){return(B)?(B+this+B).indexOf(B+A+B)>-1:this.indexOf(A)>-1;},escapeRegExp:function(){return this.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1");}});Array.extend({rgbToHex:function(D){if(this.length<3){return false;}if(this.length==4&&this[3]==0&&!D){return"transparent";}var B=[];for(var A=0;A<3;A++){var C=(this[A]-0).toString(16);B.push((C.length==1)?"0"+C:C);}return D?B:"#"+B.join("");},hexToRgb:function(C){if(this.length!=3){return false;}var A=[];for(var B=0;B<3;B++){A.push(parseInt((this[B].length==1)?this[B]+this[B]:this[B],16));}return C?A:"rgb("+A.join(",")+")";}});Function.extend({create:function(A){var B=this;A=$merge({"bind":B,"event":false,"arguments":null,"delay":false,"periodical":false,"attempt":false},A);if($chk(A.arguments)&&$type(A.arguments)!="array"){A.arguments=[A.arguments];}return function(E){var C;if(A.event){E=E||window.event;C=[(A.event===true)?E:new A.event(E)];if(A.arguments){C.extend(A.arguments);}}else{C=A.arguments||arguments;}var F=function(){return B.apply($pick(A.bind,B),C);};if(A.delay){return setTimeout(F,A.delay);}if(A.periodical){return setInterval(F,A.periodical);}if(A.attempt){try{return F();}catch(D){return false;}}return F();};},pass:function(A,B){return this.create({"arguments":A,"bind":B});},attempt:function(A,B){return this.create({"arguments":A,"bind":B,"attempt":true})();},bind:function(B,A){return this.create({"bind":B,"arguments":A});},bindAsEventListener:function(B,A){return this.create({"bind":B,"event":true,"arguments":A});},delay:function(B,C,A){return this.create({"delay":B,"bind":C,"arguments":A})();},periodical:function(A,C,B){return this.create({"periodical":A,"bind":C,"arguments":B})();}});Number.extend({toInt:function(){return parseInt(this);},toFloat:function(){return parseFloat(this);},limit:function(B,A){return Math.min(A,Math.max(B,this));},round:function(A){A=Math.pow(10,A||0);return Math.round(this*A)/A;},times:function(B){for(var A=0;A<this;A++){B(A);}}});var Element=new Class({initialize:function(D,C){if($type(D)=="string"){if(window.ie&&C&&(C.name||C.type)){var A=(C.name)?' name="'+C.name+'"':"";var B=(C.type)?' type="'+C.type+'"':"";delete C.name;delete C.type;D="<"+D+A+B+">";}D=document.createElement(D);}D=$(D);return(!C||!D)?D:D.set(C);}});var Elements=new Class({initialize:function(A){return(A)?$extend(A,this):this;}});Elements.extend=function(A){for(var B in A){this.prototype[B]=A[B];this[B]=$native.generic(B);}};function $(B){if(!B){return null;}if(B.htmlElement){return Garbage.collect(B);}if([window,document].contains(B)){return B;}var A=$type(B);if(A=="string"){B=document.getElementById(B);A=(B)?"element":false;}if(A!="element"){return null;}if(B.htmlElement){return Garbage.collect(B);}if(["object","embed"].contains(B.tagName.toLowerCase())){return B;}$extend(B,Element.prototype);B.htmlElement=function(){};return Garbage.collect(B);}document.getElementsBySelector=document.getElementsByTagName;function $$(){var D=[];for(var C=0,B=arguments.length;C<B;C++){var A=arguments[C];switch($type(A)){case"element":D.push(A);case"boolean":break;case false:break;case"string":A=document.getElementsBySelector(A,true);default:D.extend(A);}}return $$.unique(D);}$$.unique=function(G){var D=[];for(var C=0,A=G.length;C<A;C++){if(G[C].$included){continue;}var B=$(G[C]);if(B&&!B.$included){B.$included=true;D.push(B);}}for(var F=0,E=D.length;F<E;F++){D[F].$included=null;}return new Elements(D);};Elements.Multi=function(A){return function(){var D=arguments;var B=[];var G=true;for(var E=0,C=this.length,F;E<C;E++){F=this[E][A].apply(this[E],D);if($type(F)!="element"){G=false;}B.push(F);}return(G)?$$.unique(B):B;};};Element.extend=function(A){for(var B in A){HTMLElement.prototype[B]=A[B];Element.prototype[B]=A[B];Element[B]=$native.generic(B);var C=(Array.prototype[B])?B+"Elements":B;Elements.prototype[C]=Elements.Multi(B);}};Element.extend({set:function(A){for(var C in A){var B=A[C];switch(C){case"styles":this.setStyles(B);break;case"events":if(this.addEvents){this.addEvents(B);}break;case"properties":this.setProperties(B);break;default:this.setProperty(C,B);}}return this;},inject:function(C,A){C=$(C);switch(A){case"before":C.parentNode.insertBefore(this,C);break;case"after":var B=C.getNext();if(!B){C.parentNode.appendChild(this);}else{C.parentNode.insertBefore(this,B);}break;case"top":var D=C.firstChild;if(D){C.insertBefore(this,D);break;}default:C.appendChild(this);}return this;},injectBefore:function(A){return this.inject(A,"before");},injectAfter:function(A){return this.inject(A,"after");},injectInside:function(A){return this.inject(A,"bottom");},injectTop:function(A){return this.inject(A,"top");},adopt:function(){var A=[];$each(arguments,function(B){A=A.concat(B);});$$(A).inject(this);return this;},remove:function(){return this.parentNode.removeChild(this);},clone:function(C){var B=$(this.cloneNode(C!==false));if(!B.$events){return B;}B.$events={};for(var A in this.$events){B.$events[A]={"keys":$A(this.$events[A].keys),"values":$A(this.$events[A].values)};}return B.removeEvents();},replaceWith:function(A){A=$(A);this.parentNode.replaceChild(A,this);return A;},appendText:function(A){this.appendChild(document.createTextNode(A));return this;},hasClass:function(A){return this.className.contains(A," ");},addClass:function(A){if(!this.hasClass(A)){this.className=(this.className+" "+A).clean();}return this;},removeClass:function(A){this.className=this.className.replace(new RegExp("(^|\\s)"+A+"(?:\\s|$)"),"$1").clean();return this;},toggleClass:function(A){return this.hasClass(A)?this.removeClass(A):this.addClass(A);},setStyle:function(B,A){switch(B){case"opacity":return this.setOpacity(parseFloat(A));case"float":B=(window.ie)?"styleFloat":"cssFloat";}B=B.camelCase();switch($type(A)){case"number":if(!["zIndex","zoom"].contains(B)){A+="px";}break;case"array":A="rgb("+A.join(",")+")";}this.style[B]=A;return this;},setStyles:function(A){switch($type(A)){case"object":Element.setMany(this,"setStyle",A);break;case"string":this.style.cssText=A;}return this;},setOpacity:function(A){if(A==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(window.ie){this.style.filter=(A==1)?"":"alpha(opacity="+A*100+")";}this.style.opacity=this.$tmp.opacity=A;return this;},getStyle:function(C){C=C.camelCase();var A=this.style[C];if(!$chk(A)){if(C=="opacity"){return this.$tmp.opacity;}A=[];for(var B in Element.Styles){if(C==B){Element.Styles[B].each(function(F){var E=this.getStyle(F);A.push(parseInt(E)?E:"0px");},this);if(C=="border"){var D=A.every(function(E){return(E==A[0]);});return(D)?A[0]:false;}return A.join(" ");}}if(C.contains("border")){if(Element.Styles.border.contains(C)){return["Width","Style","Color"].map(function(E){return this.getStyle(C+E);},this).join(" ");}else{if(Element.borderShort.contains(C)){return["Top","Right","Bottom","Left"].map(function(E){return this.getStyle("border"+E+C.replace("border",""));},this).join(" ");}}}if(document.defaultView){A=document.defaultView.getComputedStyle(this,null).getPropertyValue(C.hyphenate());}else{if(this.currentStyle){A=this.currentStyle[C];}}}if(window.ie){A=Element.fixStyle(C,A,this);}if(A&&C.test(/color/i)&&A.contains("rgb")){return A.split("rgb").splice(1,4).map(function(E){return E.rgbToHex();}).join(" ");}return A;},getStyles:function(){return Element.getMany(this,"getStyle",arguments);},walk:function(A,C){A+="Sibling";var B=(C)?this[C]:this[A];while(B&&$type(B)!="element"){B=B[A];}return $(B);},getPrevious:function(){return this.walk("previous");},getNext:function(){return this.walk("next");},getFirst:function(){return this.walk("next","firstChild");},getLast:function(){return this.walk("previous","lastChild");},getParent:function(){return $(this.parentNode);},getChildren:function(){return $$(this.childNodes);},hasChild:function(A){return!!$A(this.getElementsByTagName("*")).contains(A);},getProperty:function(D){var B=Element.Properties[D];if(B){return this[B];}var A=Element.PropertiesIFlag[D]||0;if(!window.ie||A){return this.getAttribute(D,A);}var C=this.attributes[D];return(C)?C.nodeValue:null;},removeProperty:function(B){var A=Element.Properties[B];if(A){this[A]="";}else{this.removeAttribute(B);}return this;},getProperties:function(){return Element.getMany(this,"getProperty",arguments);},setProperty:function(C,B){var A=Element.Properties[C];if(A){this[A]=B;}else{this.setAttribute(C,B);}return this;},setProperties:function(A){return Element.setMany(this,"setProperty",A);},setHTML:function(){this.innerHTML=$A(arguments).join("");return this;},setText:function(B){var A=this.getTag();if(["style","script"].contains(A)){if(window.ie){if(A=="style"){this.styleSheet.cssText=B;}else{if(A=="script"){this.setProperty("text",B);}}return this;}else{this.removeChild(this.firstChild);return this.appendText(B);}}this[$defined(this.innerText)?"innerText":"textContent"]=B;return this;},getText:function(){var A=this.getTag();if(["style","script"].contains(A)){if(window.ie){if(A=="style"){return this.styleSheet.cssText;}else{if(A=="script"){return this.getProperty("text");}}}else{return this.innerHTML;}}return($pick(this.innerText,this.textContent));},getTag:function(){return this.tagName.toLowerCase();},empty:function(){Garbage.trash(this.getElementsByTagName("*"));return this.setHTML("");}});Element.fixStyle=function(E,A,D){if($chk(parseInt(A))){return A;}if(["height","width"].contains(E)){var B=(E=="width")?["left","right"]:["top","bottom"];var C=0;B.each(function(F){C+=D.getStyle("border-"+F+"-width").toInt()+D.getStyle("padding-"+F).toInt();});return D["offset"+E.capitalize()]-C+"px";}else{if(E.test(/border(.+)Width|margin|padding/)){return"0px";}}return A;};Element.Styles={"border":[],"padding":[],"margin":[]};["Top","Right","Bottom","Left"].each(function(B){for(var A in Element.Styles){Element.Styles[A].push(A+B);}});Element.borderShort=["borderWidth","borderStyle","borderColor"];Element.getMany=function(B,D,C){var A={};$each(C,function(E){A[E]=B[D](E);});return A;};Element.setMany=function(B,D,C){for(var A in C){B[D](A,C[A]);}return B;};Element.Properties=new Abstract({"class":"className","for":"htmlFor","colspan":"colSpan","rowspan":"rowSpan","accesskey":"accessKey","tabindex":"tabIndex","maxlength":"maxLength","readonly":"readOnly","frameborder":"frameBorder","value":"value","disabled":"disabled","checked":"checked","multiple":"multiple","selected":"selected"});Element.PropertiesIFlag={"href":2,"src":2};Element.Methods={Listeners:{addListener:function(B,A){if(this.addEventListener){this.addEventListener(B,A,false);}else{this.attachEvent("on"+B,A);}return this;},removeListener:function(B,A){if(this.removeEventListener){this.removeEventListener(B,A,false);}else{this.detachEvent("on"+B,A);}return this;}}};window.extend(Element.Methods.Listeners);document.extend(Element.Methods.Listeners);Element.extend(Element.Methods.Listeners);var Garbage={elements:[],collect:function(A){if(!A.$tmp){Garbage.elements.push(A);A.$tmp={"opacity":1};}return A;},trash:function(D){for(var B=0,A=D.length,C;B<A;B++){if(!(C=D[B])||!C.$tmp){continue;}if(C.$events){C.fireEvent("trash").removeEvents();}for(var E in C.$tmp){C.$tmp[E]=null;}for(var F in Element.prototype){C[F]=null;}Garbage.elements[Garbage.elements.indexOf(C)]=null;C.htmlElement=C.$tmp=C=null;}Garbage.elements.remove(null);},empty:function(){Garbage.collect(window);Garbage.collect(document);Garbage.trash(Garbage.elements);}};window.addListener("beforeunload",function(){window.addListener("unload",Garbage.empty);if(window.ie){window.addListener("unload",CollectGarbage);}});var Event=new Class({initialize:function(C){if(C&&C.$extended){return C;}this.$extended=true;C=C||window.event;this.event=C;this.type=C.type;this.target=C.target||C.srcElement;if(this.target.nodeType==3){this.target=this.target.parentNode;}this.shift=C.shiftKey;this.control=C.ctrlKey;this.alt=C.altKey;this.meta=C.metaKey;if(["DOMMouseScroll","mousewheel"].contains(this.type)){this.wheel=(C.wheelDelta)?C.wheelDelta/120:-(C.detail||0)/3;}else{if(this.type.contains("key")){this.code=C.which||C.keyCode;for(var B in Event.keys){if(Event.keys[B]==this.code){this.key=B;break;}}if(this.type=="keydown"){var A=this.code-111;if(A>0&&A<13){this.key="f"+A;}}this.key=this.key||String.fromCharCode(this.code).toLowerCase();}else{if(this.type.test(/(click|mouse|menu)/)){this.page={"x":C.pageX||C.clientX+document.documentElement.scrollLeft,"y":C.pageY||C.clientY+document.documentElement.scrollTop};this.client={"x":C.pageX?C.pageX-window.pageXOffset:C.clientX,"y":C.pageY?C.pageY-window.pageYOffset:C.clientY};this.rightClick=(C.which==3)||(C.button==2);switch(this.type){case"mouseover":this.relatedTarget=C.relatedTarget||C.fromElement;break;case"mouseout":this.relatedTarget=C.relatedTarget||C.toElement;}this.fixRelatedTarget();}}}return this;},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;}});Event.fix={relatedTarget:function(){if(this.relatedTarget&&this.relatedTarget.nodeType==3){this.relatedTarget=this.relatedTarget.parentNode;}},relatedTargetGecko:function(){try{Event.fix.relatedTarget.call(this);}catch(A){this.relatedTarget=this.target;}}};Event.prototype.fixRelatedTarget=(window.gecko)?Event.fix.relatedTargetGecko:Event.fix.relatedTarget;Event.keys=new Abstract({"enter":13,"up":38,"down":40,"left":37,"right":39,"esc":27,"space":32,"backspace":8,"tab":9,"delete":46});Element.Methods.Events={addEvent:function(C,B){this.$events=this.$events||{};this.$events[C]=this.$events[C]||{"keys":[],"values":[]};if(this.$events[C].keys.contains(B)){return this;}this.$events[C].keys.push(B);var A=C;var D=Element.Events[C];if(D){if(D.add){D.add.call(this,B);}if(D.map){B=D.map;}if(D.type){A=D.type;}}if(!this.addEventListener){B=B.create({"bind":this,"event":true});}this.$events[C].values.push(B);return(Element.NativeEvents.contains(A))?this.addListener(A,B):this;},removeEvent:function(C,B){if(!this.$events||!this.$events[C]){return this;}var F=this.$events[C].keys.indexOf(B);if(F==-1){return this;}var A=this.$events[C].keys.splice(F,1)[0];var E=this.$events[C].values.splice(F,1)[0];var D=Element.Events[C];if(D){if(D.remove){D.remove.call(this,B);}if(D.type){C=D.type;}}return(Element.NativeEvents.contains(C))?this.removeListener(C,E):this;},addEvents:function(A){return Element.setMany(this,"addEvent",A);},removeEvents:function(A){if(!this.$events){return this;}if(!A){for(var B in this.$events){this.removeEvents(B);}this.$events=null;}else{if(this.$events[A]){this.$events[A].keys.each(function(C){this.removeEvent(A,C);},this);this.$events[A]=null;}}return this;},fireEvent:function(C,B,A){if(this.$events&&this.$events[C]){this.$events[C].keys.each(function(D){D.create({"bind":this,"delay":A,"arguments":B})();},this);}return this;},cloneEvents:function(C,A){if(!C.$events){return this;}if(!A){for(var B in C.$events){this.cloneEvents(C,B);}}else{if(C.$events[A]){C.$events[A].keys.each(function(D){this.addEvent(A,D);},this);}}return this;}};window.extend(Element.Methods.Events);document.extend(Element.Methods.Events);Element.extend(Element.Methods.Events);Element.Events=new Abstract({"mouseenter":{type:"mouseover",map:function(A){A=new Event(A);if(A.relatedTarget!=this&&!this.hasChild(A.relatedTarget)){this.fireEvent("mouseenter",A);}}},"mouseleave":{type:"mouseout",map:function(A){A=new Event(A);if(A.relatedTarget!=this&&!this.hasChild(A.relatedTarget)){this.fireEvent("mouseleave",A);}}},"mousewheel":{type:(window.gecko)?"DOMMouseScroll":"mousewheel"}});Element.NativeEvents=["click","dblclick","mouseup","mousedown","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","keydown","keypress","keyup","load","unload","beforeunload","resize","move","focus","blur","change","submit","reset","select","error","abort","contextmenu","scroll"];Function.extend({bindWithEvent:function(B,A){return this.create({"bind":B,"arguments":A,"event":Event});}});Elements.extend({filterByTag:function(A){return new Elements(this.filter(function(B){return(Element.getTag(B)==A);}));},filterByClass:function(A,C){var B=this.filter(function(D){return(D.className&&D.className.contains(A," "));});return(C)?B:new Elements(B);},filterById:function(C,B){var A=this.filter(function(D){return(D.id==C);});return(B)?A:new Elements(A);},filterByAttribute:function(B,A,D,E){var C=this.filter(function(F){var G=Element.getProperty(F,B);if(!G){return false;}if(!A){return true;}switch(A){case"=":return(G==D);case"*=":return(G.contains(D));case"^=":return(G.substr(0,D.length)==D);case"$=":return(G.substr(G.length-D.length)==D);case"!=":return(G!=D);case"~=":return G.contains(D," ");}return false;});return(E)?C:new Elements(C);}});function $E(A,B){return($(B)||document).getElement(A);}function $ES(A,B){return($(B)||document).getElementsBySelector(A);}$$.shared={"regexp":/^(\w*|\*)(?:#([\w-]+)|\.([\w-]+))?(?:\[(\w+)(?:([!*^$]?=)["']?([^"'\]]*)["']?)?])?$/,"xpath":{getParam:function(B,D,E,C){var A=[D.namespaceURI?"xhtml:":"",E[1]];if(E[2]){A.push('[@id="',E[2],'"]');}if(E[3]){A.push('[contains(concat(" ", @class, " "), " ',E[3],' ")]');}if(E[4]){if(E[5]&&E[6]){switch(E[5]){case"*=":A.push("[contains(@",E[4],', "',E[6],'")]');break;case"^=":A.push("[starts-with(@",E[4],', "',E[6],'")]');break;case"$=":A.push("[substring(@",E[4],", string-length(@",E[4],") - ",E[6].length,' + 1) = "',E[6],'"]');break;case"=":A.push("[@",E[4],'="',E[6],'"]');break;case"!=":A.push("[@",E[4],'!="',E[6],'"]');}}else{A.push("[@",E[4],"]");}}B.push(A.join(""));return B;},getItems:function(B,E,G){var F=[];var A=document.evaluate(".//"+B.join("//"),E,$$.shared.resolver,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(var D=0,C=A.snapshotLength;D<C;D++){F.push(A.snapshotItem(D));}return(G)?F:new Elements(F.map($));}},"normal":{getParam:function(A,C,E,B){if(B==0){if(E[2]){var D=C.getElementById(E[2]);if(!D||((E[1]!="*")&&(Element.getTag(D)!=E[1]))){return false;}A=[D];}else{A=$A(C.getElementsByTagName(E[1]));}}else{A=$$.shared.getElementsByTagName(A,E[1]);if(E[2]){A=Elements.filterById(A,E[2],true);}}if(E[3]){A=Elements.filterByClass(A,E[3],true);}if(E[4]){A=Elements.filterByAttribute(A,E[4],E[5],E[6],true);}return A;},getItems:function(A,B,C){return(C)?A:$$.unique(A);}},resolver:function(A){return(A=="xhtml")?"http://www.w3.org/1999/xhtml":false;},getElementsByTagName:function(D,C){var E=[];for(var B=0,A=D.length;B<A;B++){E.extend(D[B].getElementsByTagName(C));}return E;}};$$.shared.method=(window.xpath)?"xpath":"normal";Element.Methods.Dom={getElements:function(A,H){var C=[];A=A.trim().split(" ");for(var E=0,D=A.length;E<D;E++){var F=A[E];var G=F.match($$.shared.regexp);if(!G){break;}G[1]=G[1]||"*";var B=$$.shared[$$.shared.method].getParam(C,this,G,E);if(!B){break;}C=B;}return $$.shared[$$.shared.method].getItems(C,this,H);},getElement:function(A){return $(this.getElements(A,true)[0]||false);},getElementsBySelector:function(A,E){var D=[];A=A.split(",");for(var C=0,B=A.length;C<B;C++){D=D.concat(this.getElements(A[C],true));}return(E)?D:$$.unique(D);}};Element.extend({getElementById:function(C){var B=document.getElementById(C);if(!B){return false;}for(var A=B.parentNode;A!=this;A=A.parentNode){if(!A){return false;}}return B;},getElementsByClassName:function(A){return this.getElements("."+A);}});document.extend(Element.Methods.Dom);Element.extend(Element.Methods.Dom);Element.extend({getValue:function(){switch(this.getTag()){case"select":var A=[];$each(this.options,function(B){if(B.selected){A.push($pick(B.value,B.text));}});return(this.multiple)?A:A[0];case"input":if(!(this.checked&&["checkbox","radio"].contains(this.type))&&!["hidden","text","password"].contains(this.type)){break;}case"textarea":return this.value;}return false;},getFormElements:function(){return $$(this.getElementsByTagName("input"),this.getElementsByTagName("select"),this.getElementsByTagName("textarea"));},toQueryString:function(){var A=[];this.getFormElements().each(function(D){var C=D.name;var E=D.getValue();if(E===false||!C||D.disabled){return;}var B=function(F){A.push(C+"="+encodeURIComponent(F));};if($type(E)=="array"){E.each(B);}else{B(E);}});return A.join("&");}});Element.extend({scrollTo:function(A,B){this.scrollLeft=A;this.scrollTop=B;},getSize:function(){return{"scroll":{"x":this.scrollLeft,"y":this.scrollTop},"size":{"x":this.offsetWidth,"y":this.offsetHeight},"scrollSize":{"x":this.scrollWidth,"y":this.scrollHeight}};},getPosition:function(A){A=A||[];var B=this,D=0,C=0;do{D+=B.offsetLeft||0;C+=B.offsetTop||0;B=B.offsetParent;}while(B);A.each(function(E){D-=E.scrollLeft||0;C-=E.scrollTop||0;});return{"x":D,"y":C};},getTop:function(A){return this.getPosition(A).y;},getLeft:function(A){return this.getPosition(A).x;},getCoordinates:function(B){var A=this.getPosition(B);var C={"width":this.offsetWidth,"height":this.offsetHeight,"left":A.x,"top":A.y};C.right=C.left+C.width;C.bottom=C.top+C.height;return C;}});Element.Events.domready={add:function(B){if(window.loaded){B.call(this);return;}var A=function(){if(window.loaded){return;}window.loaded=true;window.timer=$clear(window.timer);this.fireEvent("domready");}.bind(this);if(document.readyState&&window.webkit){window.timer=function(){if(["loaded","complete"].contains(document.readyState)){A();}}.periodical(50);}else{if(document.readyState&&window.ie){if(!$("ie_ready")){var C=(window.location.protocol=="https:")?"://0":"javascript:void(0)";document.write('<script id="ie_ready" defer src="'+C+'"><\/script>');$("ie_ready").onreadystatechange=function(){if(this.readyState=="complete"){A();}};}}else{window.addListener("load",A);document.addListener("DOMContentLoaded",A);}}}};window.onDomReady=function(A){return this.addEvent("domready",A);};window.extend({getWidth:function(){if(this.webkit419){return this.innerWidth;}if(this.opera){return document.body.clientWidth;}return document.documentElement.clientWidth;},getHeight:function(){if(this.webkit419){return this.innerHeight;}if(this.opera){return document.body.clientHeight;}return document.documentElement.clientHeight;},getScrollWidth:function(){if(this.ie){return Math.max(document.documentElement.offsetWidth,document.documentElement.scrollWidth);}if(this.webkit){return document.body.scrollWidth;}return document.documentElement.scrollWidth;},getScrollHeight:function(){if(this.ie){return Math.max(document.documentElement.offsetHeight,document.documentElement.scrollHeight);}if(this.webkit){return document.body.scrollHeight;}return document.documentElement.scrollHeight;},getScrollLeft:function(){return this.pageXOffset||document.documentElement.scrollLeft;},getScrollTop:function(){return this.pageYOffset||document.documentElement.scrollTop;},getSize:function(){return{"size":{"x":this.getWidth(),"y":this.getHeight()},"scrollSize":{"x":this.getScrollWidth(),"y":this.getScrollHeight()},"scroll":{"x":this.getScrollLeft(),"y":this.getScrollTop()}};},getPosition:function(){return{"x":0,"y":0};}});var Fx={};Fx.Base=new Class({options:{onStart:Class.empty,onComplete:Class.empty,onCancel:Class.empty,transition:function(A){return-(Math.cos(Math.PI*A)-1)/2;},duration:500,unit:"px",wait:true,fps:50},initialize:function(A){this.element=this.element||null;this.setOptions(A);if(this.options.initialize){this.options.initialize.call(this);}},step:function(){var A=$time();if(A<this.time+this.options.duration){this.delta=this.options.transition((A-this.time)/this.options.duration);this.setNow();this.increase();}else{this.stop(true);this.set(this.to);this.fireEvent("onComplete",this.element,10);this.callChain();}},set:function(A){this.now=A;this.increase();return this;},setNow:function(){this.now=this.compute(this.from,this.to);},compute:function(B,A){return(A-B)*this.delta+B;},start:function(B,A){if(!this.options.wait){this.stop();}else{if(this.timer){return this;}}this.from=B;this.to=A;this.change=this.to-this.from;this.time=$time();this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);this.fireEvent("onStart",this.element);return this;},stop:function(A){if(!this.timer){return this;}this.timer=$clear(this.timer);if(!A){this.fireEvent("onCancel",this.element);}return this;},custom:function(B,A){return this.start(B,A);},clearTimer:function(A){return this.stop(A);}});Fx.Base.implement(new Chain,new Events,new Options);Fx.CSS={select:function(B,C){if(B.test(/color/i)){return this.Color;}var A=$type(C);if((A=="array")||(A=="string"&&C.contains(" "))){return this.Multi;}return this.Single;},parse:function(C,D,A){if(!A.push){A=[A];}var F=A[0],E=A[1];if(!$chk(E)){E=F;F=C.getStyle(D);}var B=this.select(D,E);return{"from":B.parse(F),"to":B.parse(E),"css":B};}};Fx.CSS.Single={parse:function(A){return parseFloat(A);},getNow:function(C,B,A){return A.compute(C,B);},getValue:function(C,A,B){if(A=="px"&&B!="opacity"){C=Math.round(C);}return C+A;}};Fx.CSS.Multi={parse:function(A){return A.push?A:A.split(" ").map(function(B){return parseFloat(B);});},getNow:function(E,D,C){var A=[];for(var B=0;B<E.length;B++){A[B]=C.compute(E[B],D[B]);}return A;},getValue:function(C,A,B){if(A=="px"&&B!="opacity"){C=C.map(Math.round);}return C.join(A+" ")+A;}};Fx.CSS.Color={parse:function(A){return A.push?A:A.hexToRgb(true);},getNow:function(E,D,C){var A=[];for(var B=0;B<E.length;B++){A[B]=Math.round(C.compute(E[B],D[B]));}return A;},getValue:function(A){return"rgb("+A.join(",")+")";}};Fx.Style=Fx.Base.extend({initialize:function(B,C,A){this.element=$(B);this.property=C;this.parent(A);},hide:function(){return this.set(0);},setNow:function(){this.now=this.css.getNow(this.from,this.to,this);},set:function(A){this.css=Fx.CSS.select(this.property,A);return this.parent(this.css.parse(A));},start:function(C,B){if(this.timer&&this.options.wait){return this;}var A=Fx.CSS.parse(this.element,this.property,[C,B]);this.css=A.css;return this.parent(A.from,A.to);},increase:function(){this.element.setStyle(this.property,this.css.getValue(this.now,this.options.unit,this.property));}});Element.extend({effect:function(B,A){return new Fx.Style(this,B,A);}});Fx.Styles=Fx.Base.extend({initialize:function(B,A){this.element=$(B);this.parent(A);},setNow:function(){for(var A in this.from){this.now[A]=this.css[A].getNow(this.from[A],this.to[A],this);}},set:function(C){var A={};this.css={};for(var B in C){this.css[B]=Fx.CSS.select(B,C[B]);A[B]=this.css[B].parse(C[B]);}return this.parent(A);},start:function(C){if(this.timer&&this.options.wait){return this;}this.now={};this.css={};var E={},D={};for(var B in C){var A=Fx.CSS.parse(this.element,B,C[B]);E[B]=A.from;D[B]=A.to;this.css[B]=A.css;}return this.parent(E,D);},increase:function(){for(var A in this.now){this.element.setStyle(A,this.css[A].getValue(this.now[A],this.options.unit,A));}}});Element.extend({effects:function(A){return new Fx.Styles(this,A);}});Fx.Elements=Fx.Base.extend({initialize:function(B,A){this.elements=$$(B);this.parent(A);},setNow:function(){for(var C in this.from){var F=this.from[C],E=this.to[C],B=this.css[C],A=this.now[C]={};for(var D in F){A[D]=B[D].getNow(F[D],E[D],this);}}},set:function(G){var B={};this.css={};for(var D in G){var F=G[D],C=this.css[D]={},A=B[D]={};for(var E in F){C[E]=Fx.CSS.select(E,F[E]);A[E]=C[E].parse(F[E]);}}return this.parent(B);},start:function(D){if(this.timer&&this.options.wait){return this;}this.now={};this.css={};var I={},J={};for(var E in D){var G=D[E],A=I[E]={},H=J[E]={},C=this.css[E]={};for(var B in G){var F=Fx.CSS.parse(this.elements[E],B,G[B]);A[B]=F.from;H[B]=F.to;C[B]=F.css;}}return this.parent(I,J);},increase:function(){for(var C in this.now){var A=this.now[C],B=this.css[C];for(var D in A){this.elements[C].setStyle(D,B[D].getValue(A[D],this.options.unit,D));}}}});Fx.Scroll=Fx.Base.extend({options:{overflown:[],offset:{"x":0,"y":0},wheelStops:true},initialize:function(B,A){this.now=[];this.element=$(B);this.bound={"stop":this.stop.bind(this,false)};this.parent(A);if(this.options.wheelStops){this.addEvent("onStart",function(){document.addEvent("mousewheel",this.bound.stop);}.bind(this));this.addEvent("onComplete",function(){document.removeEvent("mousewheel",this.bound.stop);}.bind(this));}},setNow:function(){for(var A=0;A<2;A++){this.now[A]=this.compute(this.from[A],this.to[A]);}},scrollTo:function(B,F){if(this.timer&&this.options.wait){return this;}var D=this.element.getSize();var C={"x":B,"y":F};for(var E in D.size){var A=D.scrollSize[E]-D.size[E];if($chk(C[E])){C[E]=($type(C[E])=="number")?C[E].limit(0,A):A;}else{C[E]=D.scroll[E];}C[E]+=this.options.offset[E];}return this.start([D.scroll.x,D.scroll.y],[C.x,C.y]);},toTop:function(){return this.scrollTo(false,0);},toBottom:function(){return this.scrollTo(false,"full");},toLeft:function(){return this.scrollTo(0,false);},toRight:function(){return this.scrollTo("full",false);},toElement:function(B){var A=this.element.getPosition(this.options.overflown);var C=$(B).getPosition(this.options.overflown);return this.scrollTo(C.x-A.x,C.y-A.y);},increase:function(){this.element.scrollTo(this.now[0],this.now[1]);}});Fx.Transition=function(B,A){A=A||[];if($type(A)!="array"){A=[A];}return $extend(B,{easeIn:function(C){return B(C,A);},easeOut:function(C){return 1-B(1-C,A);},easeInOut:function(C){return(C<=0.5)?B(2*C,A)/2:(2-B(2*(1-C),A))/2;}});};Fx.Transitions=new Abstract({linear:function(A){return A;}});Fx.Transitions.extend=function(A){for(var B in A){Fx.Transitions[B]=new Fx.Transition(A[B]);Fx.Transitions.compat(B);}};Fx.Transitions.compat=function(A){["In","Out","InOut"].each(function(B){Fx.Transitions[A.toLowerCase()+B]=Fx.Transitions[A]["ease"+B];});};Fx.Transitions.extend({Pow:function(B,A){return Math.pow(B,A[0]||6);},Expo:function(A){return Math.pow(2,8*(A-1));},Circ:function(A){return 1-Math.sin(Math.acos(A));},Sine:function(A){return 1-Math.sin((1-A)*Math.PI/2);},Back:function(B,A){A=A[0]||1.618;return Math.pow(B,2)*((A+1)*B-A);},Bounce:function(D){var C;for(var B=0,A=1;1;B+=A,A/=2){if(D>=(7-4*B)/11){C=-Math.pow((11-6*B-11*D)/4,2)+A*A;break;}}return C;},Elastic:function(B,A){return Math.pow(2,10*--B)*Math.cos(20*B*Math.PI*(A[0]||1)/3);}});["Quad","Cubic","Quart","Quint"].each(function(B,A){Fx.Transitions[B]=new Fx.Transition(function(C){return Math.pow(C,[A+2]);});Fx.Transitions.compat(B);});var Drag={};Drag.Base=new Class({options:{handle:false,unit:"px",onStart:Class.empty,onBeforeStart:Class.empty,onComplete:Class.empty,onSnap:Class.empty,onDrag:Class.empty,limit:false,modifiers:{x:"left",y:"top"},grid:false,snap:6},initialize:function(B,A){this.setOptions(A);this.element=$(B);this.handle=$(this.options.handle)||this.element;this.mouse={"now":{},"pos":{}};this.value={"start":{},"now":{}};this.bound={"start":this.start.bindWithEvent(this),"check":this.check.bindWithEvent(this),"drag":this.drag.bindWithEvent(this),"stop":this.stop.bind(this)};this.attach();if(this.options.initialize){this.options.initialize.call(this);}},attach:function(){this.handle.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handle.removeEvent("mousedown",this.bound.start);return this;},start:function(C){this.fireEvent("onBeforeStart",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;}this.value.now[D]=this.element.getStyle(this.options.modifiers[D]).toInt();this.mouse.pos[D]=C.page[D]-this.value.now[D];if(A&&A[D]){for(var B=0;B<2;B++){if($chk(A[D][B])){this.limit[D][B]=($type(A[D][B])=="function")?A[D][B]():A[D][B];}}}}if($type(this.options.grid)=="number"){this.options.grid={"x":this.options.grid,"y":this.options.grid};}document.addListener("mousemove",this.bound.check);document.addListener("mouseup",this.bound.stop);this.fireEvent("onStart",this.element);C.stop();},check:function(A){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){document.removeListener("mousemove",this.bound.check);document.addListener("mousemove",this.bound.drag);this.drag(A);this.fireEvent("onSnap",this.element);}A.stop();},drag:function(A){this.out=false;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.limit[B]){if($chk(this.limit[B][1])&&(this.value.now[B]>this.limit[B][1])){this.value.now[B]=this.limit[B][1];this.out=true;}else{if($chk(this.limit[B][0])&&(this.value.now[B]<this.limit[B][0])){this.value.now[B]=this.limit[B][0];this.out=true;}}}if(this.options.grid[B]){this.value.now[B]-=(this.value.now[B]%this.options.grid[B]);}this.element.setStyle(this.options.modifiers[B],this.value.now[B]+this.options.unit);}this.fireEvent("onDrag",this.element);A.stop();},stop:function(){document.removeListener("mousemove",this.bound.check);document.removeListener("mousemove",this.bound.drag);document.removeListener("mouseup",this.bound.stop);this.fireEvent("onComplete",this.element);}});Drag.Base.implement(new Events,new Options);Element.extend({makeResizable:function(A){return new Drag.Base(this,$merge({modifiers:{x:"width",y:"height"}},A));}});var XHR=new Class({options:{method:"post",async:true,onRequest:Class.empty,onSuccess:Class.empty,onFailure:Class.empty,urlEncoded:true,encoding:"utf-8",autoCancel:false,headers:{}},setTransport:function(){this.transport=(window.XMLHttpRequest)?new XMLHttpRequest():(window.ie?new ActiveXObject("Microsoft.XMLHTTP"):false);return this;},initialize:function(A){this.setTransport().setOptions(A);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers={};if(this.options.urlEncoded&&this.options.method=="post"){var B=(this.options.encoding)?"; charset="+this.options.encoding:"";this.setHeader("Content-type","application/x-www-form-urlencoded"+B);}if(this.options.initialize){this.options.initialize.call(this);}},onStateChange:function(){if(this.transport.readyState!=4||!this.running){return;}this.running=false;var A=0;try{A=this.transport.status;}catch(B){}if(this.options.isSuccess.call(this,A)){this.onSuccess();}else{this.onFailure();}this.transport.onreadystatechange=Class.empty;},isSuccess:function(A){return((A>=200)&&(A<300));},onSuccess:function(){this.response={"text":this.transport.responseText,"xml":this.transport.responseXML};this.fireEvent("onSuccess",[this.response.text,this.response.xml]);this.callChain();},onFailure:function(){this.fireEvent("onFailure",this.transport);},setHeader:function(A,B){this.headers[A]=B;return this;},send:function(A,C){if(this.options.autoCancel){this.cancel();}else{if(this.running){return this;}}this.running=true;if(C&&this.options.method=="get"){A=A+(A.contains("?")?"&":"?")+C;C=null;}this.transport.open(this.options.method.toUpperCase(),A,this.options.async);this.transport.onreadystatechange=this.onStateChange.bind(this);if((this.options.method=="post")&&this.transport.overrideMimeType){this.setHeader("Connection","close");}$extend(this.headers,this.options.headers);for(var B in this.headers){try{this.transport.setRequestHeader(B,this.headers[B]);}catch(D){}}this.fireEvent("onRequest");this.transport.send($pick(C,null));return this;},cancel:function(){if(!this.running){return this;}this.running=false;this.transport.abort();this.transport.onreadystatechange=Class.empty;this.setTransport();this.fireEvent("onCancel");return this;}});XHR.implement(new Chain,new Events,new Options);var Ajax=XHR.extend({options:{data:null,update:null,onComplete:Class.empty,evalScripts:false,evalResponse:false},initialize:function(B,A){this.addEvent("onSuccess",this.onComplete);this.setOptions(A);this.options.data=this.options.data||this.options.postBody;if(!["post","get"].contains(this.options.method)){this._method="_method="+this.options.method;this.options.method="post";}this.parent();this.setHeader("X-Requested-With","XMLHttpRequest");this.setHeader("Accept","text/javascript, text/html, application/xml, text/xml, */*");this.url=B;},onComplete:function(){if(this.options.update){$(this.options.update).empty().setHTML(this.response.text);}if(this.options.evalScripts||this.options.evalResponse){this.evalScripts();}this.fireEvent("onComplete",[this.response.text,this.response.xml],20);},request:function(A){A=A||this.options.data;switch($type(A)){case"element":A=$(A).toQueryString();break;case"object":A=Object.toQueryString(A);}if(this._method){A=(A)?[this._method,A].join("&"):this._method;}return this.send(this.url,A);},evalScripts:function(){var B,A;if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){A=this.response.text;}else{A=[];var C=/<script[^>]*>([\s\S]*?)<\/script>/gi;while((B=C.exec(this.response.text))){A.push(B[1]);}A=A.join("\n");}if(A){(window.execScript)?window.execScript(A):window.setTimeout(A,0);}},getHeader:function(A){try{return this.transport.getResponseHeader(A);}catch(B){}return null;}});Object.toQueryString=function(B){var C=[];for(var A in B){C.push(encodeURIComponent(A)+"="+encodeURIComponent(B[A]));}return C.join("&");};Element.extend({send:function(A){return new Ajax(this.getProperty("action"),$merge({data:this.toQueryString()},A,{method:"post"})).request();}});var Cookie=new Abstract({options:{domain:false,path:false,duration:false,secure:false},set:function(C,D,B){B=$merge(this.options,B);D=encodeURIComponent(D);if(B.domain){D+="; domain="+B.domain;}if(B.path){D+="; path="+B.path;}if(B.duration){var A=new Date();A.setTime(A.getTime()+B.duration*24*60*60*1000);D+="; expires="+A.toGMTString();}if(B.secure){D+="; secure";}document.cookie=C+"="+D;return $extend(B,{"key":C,"value":D});},get:function(A){var B=document.cookie.match("(?:^|;)\\s*"+A.escapeRegExp()+"=([^;]*)");return B?decodeURIComponent(B[1]):false;},remove:function(B,A){if($type(B)=="object"){this.set(B.key,"",$merge(B,{duration:-1}));}else{this.set(B,"",$merge(A,{duration:-1}));}}});var Json={toString:function(C){switch($type(C)){case"string":return'"'+C.replace(/(["\\])/g,"\\$1")+'"';case"array":return"["+C.map(Json.toString).join(",")+"]";case"object":var A=[];for(var B in C){A.push(Json.toString(B)+":"+Json.toString(C[B]));}return"{"+A.join(",")+"}";case"number":if(isFinite(C)){break;}case false:return"null";}return String(C);},evaluate:function(str,secure){return(($type(str)!="string")||(secure&&!str.test(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/)))?null:eval("("+str+")");}};Json.Remote=XHR.extend({initialize:function(B,A){this.url=B;this.addEvent("onSuccess",this.onComplete);this.parent(A);this.setHeader("X-Request","JSON");},send:function(A){return this.parent(this.url,"json="+Json.toString(A));},onComplete:function(){this.fireEvent("onComplete",[Json.evaluate(this.response.text,this.options.secure)]);}});var Asset=new Abstract({javascript:function(C,B){B=$merge({"onload":Class.empty},B);var A=new Element("script",{"src":C}).addEvents({"load":B.onload,"readystatechange":function(){if(this.readyState=="complete"){this.fireEvent("load");}}});delete B.onload;return A.setProperties(B).inject(document.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":Class.empty,"onabort":Class.empty,"onerror":Class.empty},B);var D=new Image();D.src=C;var A=new Element("img",{"src":C});["load","abort","error"].each(function(E){var F=B["on"+E];delete B["on"+E];A.addEvent(E,function(){this.removeEvent(E,arguments.callee);F.call(this);});});if(D.width&&D.height){A.fireEvent("load",A,1);}return A.setProperties(B);},images:function(D,C){C=$merge({onComplete:Class.empty,onProgress:Class.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);B++;if(B==D.length){C.onComplete();}}});A.push(E);});return new Elements(A);}});var Hash=new Class({length:0,initialize:function(A){this.obj=A||{};this.setLength();},get:function(A){return(this.hasKey(A))?this.obj[A]:null;},hasKey:function(A){return(A in this.obj);},set:function(A,B){if(!this.hasKey(A)){this.length++;}this.obj[A]=B;return this;},setLength:function(){this.length=0;for(var A in this.obj){this.length++;}return this;},remove:function(A){if(this.hasKey(A)){delete this.obj[A];this.length--;}return this;},each:function(A,B){$each(this.obj,A,B);},extend:function(A){$extend(this.obj,A);return this.setLength();},merge:function(){this.obj=$merge.apply(null,[this.obj].extend(arguments));return this.setLength();},empty:function(){this.obj={};this.length=0;return this;},keys:function(){var A=[];for(var B in this.obj){A.push(B);}return A;},values:function(){var A=[];for(var B in this.obj){A.push(this.obj[B]);}return A;}});function $H(A){return new Hash(A);}Hash.Cookie=Hash.extend({initialize:function(B,A){this.name=B;this.options=$extend({"autoSave":true},A||{});this.load();},save:function(){if(this.length==0){Cookie.remove(this.name,this.options);return true;}var A=Json.toString(this.obj);if(A.length>4096){return false;}Cookie.set(this.name,A,this.options);return true;},load:function(){this.obj=Json.evaluate(Cookie.get(this.name),true)||{};this.setLength();}});Hash.Cookie.Methods={};["extend","set","merge","empty","remove"].each(function(A){Hash.Cookie.Methods[A]=function(){Hash.prototype[A].apply(this,arguments);if(this.options.autoSave){this.save();}return this;};});Hash.Cookie.implement(Hash.Cookie.Methods);
var reloadWindow=false;function getElement(id){return $(id);}
function findPos(obj){if(!obj)return;var curleft=curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft
curtop=obj.offsetTop
while(obj=obj.offsetParent){curleft+=obj.offsetLeft
curtop+=obj.offsetTop}}
return[curleft,curtop];}
function setItemCookie(nextItemID,cookieName,index){if(cookieName=='Related'){cookieName='nextVideosClkItemID';}
else if(cookieName=='Recommended'){cookieName='sideBarDynBanClkItemID';}
else if(cookieName=='Newest'||cookieName=='User'){cookieName='newestVideosClkItemID';}
if(cookieName){setRealCookie(cookieName,nextItemID,getExpDate(0,0,10),"/",".metacafe.com");setRealCookie('prev'+cookieName,itemID,getExpDate(0,0,10),"/",".metacafe.com");setRealCookie('index'+cookieName,index-1,getExpDate(0,0,10),"/",".metacafe.com");}}
function AjaxRequest(method,sUrl,sPostdata,fnOnComplete,fnOnError)
{var ajaxObj=new ajaxObject(method,sUrl,sPostdata,fnOnComplete,fnOnError);ajaxObj.load();return true;}
function ajaxObject(method,url,postData,onCompleteFn,onErrorFn){this.method=method;this.url=getFullURL(url);this.postData=postData;this.onComplete=onCompleteFn;this.onError=onErrorFn;}
ajaxObject.prototype.load=function(){this.request=this.getXHR();var _this=this;this.request.onreadystatechange=function(){_this.onData()};this.request.open(this.method,this.url,true);this.request.setRequestHeader('X-Requested-With','XMLHttpRequest');this.request.setRequestHeader('Connection','close');this.request.setRequestHeader('Content-type','application/x-www-form-urlencoded');this.request.send(this.postData);}
ajaxObject.prototype.getXHR=function(){var xmlHttp;try{xmlHttp=new ActiveXObject("Msxml2.XMLHttp");}
catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHttp");}
catch(e2){}}
if(xmlHttp==undefined&&(typeof XMLHttpRequest!='undefined')){xmlHttp=new XMLHttpRequest();}
return xmlHttp;}
ajaxObject.prototype.onData=function(){if(this.request.readyState==1){}
if(this.request.readyState==4){if(this.request.status=="200"){this.headers=this.request.getAllResponseHeaders();if(this.onComplete!=undefined){this.onComplete(this.request.responseText);}}else{if(this.onError!=undefined){this.onError(this.request.status,this.request.responseText);}}
delete this.request;}}
function getFullURL(sUrl){if(sUrl.charAt(0)=='/'){var rand=new String(Math.random());rand=rand.substring(2,11);var serverAddr=location.href;var lastSlashIndex=serverAddr.indexOf('/',8);var fullUrl=new String(serverAddr.substr(0,lastSlashIndex));fullUrl=fullUrl.concat('/ajax_services/'+rand+sUrl);return fullUrl;}
return sUrl;}
var reloadWindow=false;function getExpDate(days,hours,minutes){var expDate=new Date();if(typeof days=="number"&&typeof hours=="number"&&typeof hours=="number"){expDate.setDate(expDate.getDate()+parseInt(days));expDate.setHours(expDate.getHours()+parseInt(hours));expDate.setMinutes(expDate.getMinutes()+parseInt(minutes));return expDate.toGMTString();}}
function escape_utf8(data){if(typeof(data)!='string'){return data;}
if(data==''||data==null){return'';}
var buffer='';for(var i=0;i<data.length;i++){var c=data.charCodeAt(i);var bs=new Array();if(c>0x10000){bs[0]=0xF0|((c&0x1C0000)>>>18);bs[1]=0x80|((c&0x3F000)>>>12);bs[2]=0x80|((c&0xFC0)>>>6);bs[3]=0x80|(c&0x3F);}else if(c>0x800){bs[0]=0xE0|((c&0xF000)>>>12);bs[1]=0x80|((c&0xFC0)>>>6);bs[2]=0x80|(c&0x3F);}else if(c>0x80){bs[0]=0xC0|((c&0x7C0)>>>6);bs[1]=0x80|(c&0x3F);}else{bs[0]=c;}
for(var j=0;j<bs.length;j++){var b=bs[j];var hex=nibble_to_hex((b&0xF0)>>>4)+nibble_to_hex(b&0x0F);buffer+='%'+hex;}}
return buffer;}
function nibble_to_hex(nibble){var chars='0123456789ABCDEF';return chars.charAt(nibble);}
function getCookie(name){var cookies=document.cookie;var prefix=name+"=";var beginP=cookies.indexOf("; "+prefix);if(beginP==-1){beginP=cookies.indexOf(prefix);if(beginP!=0)return null;}
else{beginP+=2;}
var endP=cookies.indexOf(";",beginP);if(endP==-1){endP=cookies.length;}
return unescape(cookies.substring(beginP+prefix.length,endP));}
function onErrorChangeCookie(error){alert('Error: '+error);}
function onCompleteChangeCookie(data){if(data!=0){document.cookie="mainData="+data+"; expires="+getExpDate(1000,0,0)+"; path='/'"+"; domain='.metacafe.com'";if(reloadWindow){var jsonData=Json.evaluate(data);reloadWindow=false;if(headerObj.category=="adult"){var currURL=window.location.href;currURL=currURL.replace('/adult','');window.location.href=currURL;}
else{window.location.href=window.location.href;}}}}
function setCookies(values){var postData='values='+values+'&action=setc';if(typeof sid=="undefined")sid='';AjaxRequest("POST","/cookies.php?sid="+sid,postData,onCompleteChangeCookie,onErrorChangeCookie);}
function setCookie(name,value,needToReloadWindow){var postData='name='+name+'&value='+value+'&action=set';if(needToReloadWindow)reloadWindow=true;AjaxRequest("POST","/cookies.php?sid="+sid,postData,onCompleteChangeCookie,onErrorChangeCookie);}
function setRealCookie(name,value,expires,path,domain,secure){document.cookie=name+"="+escape_utf8(value)+
((expires)?"; expires="+expires:"")+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+
((secure)?"; secure":"");}
function deleteCookie(name,path,domain){var postData='name='+name+'&action=delete';AjaxRequest("POST","/cookies.php?sid="+sid,postData,onCompleteChangeCookie,onErrorChangeCookie);}
Element.extend({toHash:function(){var hash=new Hash();this.getFormElements().each(function(el){var _name=el.name;var value=el.getValue();if(value===false||!_name||el.disabled)return;var qs=function(val){hash.set(_name,val);};if($type(value)=='array')value.each(qs);else qs(value);});return hash.obj;},center:function(containerID){cWidth=!$defined(containerID)?window.getWidth():$(containerID).getCoordinates().width;var top=Math.round((window.getHeight()-this.getCoordinates().height-this.getSizeOffset('height'))/2+window.getSize().scroll.y);var left=Math.round((cWidth/2)-(this.getCoordinates().width/2));this.setStyles({'top':top+'px','left':left+'px'});return this;},getSizeOffset:function(offset){var size=0;if(offset=='width')
size=this.getStyle('padding-left').toInt()+this.getStyle('padding-right').toInt()+(this.getStyle('border').toInt()*2);if(offset=='height')
size=this.getStyle('padding-top').toInt()+this.getStyle('padding-bottom').toInt()+(this.getStyle('border').toInt()*2);return size;}});Element.Events.clickOutside={type:'click',map:function(e){},add:function(callback){document.addEvent('click',function(e){var target=this.getCoordinates();var isInVer=target.top<=e.clientY&&target.top+target.height>=e.clientY;var isInHor=target.left<=e.clientX&&target.left+target.width>=e.clientX;if(!isInHor||!isInVer)
callback.call(this,e);}.bind(this));}};Hash.implement({buildCombo:function(combo){var comboObj=$(combo);$ES('option',combo).each(function(el){el.remove();});this.each(function(i,index){var o=new Element('option',{'value':i.value}).setHTML(i.text).injectInside(comboObj);if(i.selected)
comboObj.selectedIndex=index;},this);}});String.extend({shorten:function(len){if(this.length>len-3)
return this.substring(0,len-3)+"...";else return this;},isURL:function(){var regexp=/((https{0,1}:\/\/\w+\.[^\s]+))|(www\.[^.][^\s]*)/;return regexp.test(this);},isNormal:function(){return this.test(/^[a-zA-Z0-9\-_\.]+$/);},toObject:function(){var p=this.split('&');var obj={};p.each(function(el){var a=el.split('=');obj[a[0]]=a[1];});return obj;},toObjectString:function(){return JSON.encode(this.toObject());}});Array.extend({subtract:function(ar){if((ar==null)||(ar==false))
return this;ar.each(function(value){this.remove(value)}.bind(this));return this;}});AjaxIndicator=Ajax.extend({options:{offsets:{'x':10,'y':8}},initialize:function(url,options){this.setOptions(options);this.parent(url,options);this.indicator=null;if(typeof headerObj!='undefined'&&$('AjaxProg')){this.indicator=$('AjaxProg');this.options.imagePath=headerObj.cdnImages+this.options.imagePath;this.parent();}else{this.parent();}},indicatorOff:function(){document.removeEvents('mousemove');if(this.indicator!=null)
this.indicator.addClass('Hidden');},onComplete:function(){this.indicatorOff();this.parent();},onFailure:function(){this.indicatorOff();this.parent();},cancel:function(){this.indicatorOff();this.parent();},request:function(){if(this.indicator!=null){document.addEvent('mousemove',this.move.bind(this));this.indicator.removeClass('Hidden');}
this.parent();},move:function(event){var event=new Event(event);if((event.client.y>window.getHeight()-this.options.offsets.y-20)||(event.client.x>window.getWidth()-this.options.offsets.x-20)){this.posX=event.page.x-this.options.offsets.x-20;this.posY=event.page.y-this.options.offsets.y;this.indicator.setStyles({'left':this.posX,'top':this.posY});}else{this.posX=event.page.x+this.options.offsets.x;this.posY=event.page.y+this.options.offsets.y;this.indicator.setStyles({'left':this.posX,'top':this.posY});}}});Ajax=AjaxIndicator;var AjaxKeepAlive=new Class({initialize:function(){this.keepAliveAjax=null;this.sendKeepAlive.periodical(600000);},sendKeepAlive:function(){if(this.keepAliveAjax)this.keepAliveAjax.cancel();this.keepAliveAjax=new Ajax("/index.php?inputType=keepAlive",{method:'POST',postBody:'dummy=1'}).request();},onComplete:function(){this.keepAliveAjax=null;}});
var Facebook=new Class({options:{redirectUrl:null},initialize:function(options){this.setOptions(options);this.apiKey='af03e94415e2d3a7e5dfb7ed27262365';this.xd_received='/Static/Facebook/xd_receiver.htm';FB.init(this.apiKey,this.xd_received);$ES('.FBConnect').addEvent('click',this.onConnect.bindWithEvent(this));},onConnect:function(ev){ev.preventDefault();FB.Facebook.get_sessionState().waitUntilReady(function(session){this.onLogin(session);}.bind(this));FB.Connect.requireSession();},onLogin:function(session){var s={uid:session.uid,expires:session.expires,session_key:session.session_key};if(this.options.redirectUrl){window.location=this.options.redirectUrl+'?'+Object.toQueryString(s);}}});Facebook.implement(new Options);function bindPermissionDialogNewAccount(){$('FBCreateAccount').addEvent('submit',showPermissionsDialogNewAccount);}
function showPermissionsDialogNewAccount(ev){new Event(ev).preventDefault();var checked=false;$ES('input','FBPostSettings').each(function(el){if(el.checked){checked=true;}});if(checked){FB.Connect.showPermissionDialog('publish_stream',onDialogCloseNewAccount);}else{$('FBCreateAccount').submit();}}
function onDialogCloseNewAccount(result){if(result===false)return;$('FBCreateAccount').submit();}
function bindPermissionDialogChannel(){var btn=$('FBAllowPerms');if(!btn){return};btn.addEvent('click',showPermissionsDialogChannel)}
function showPermissionsDialogChannel(ev){new Event(ev).preventDefault();FB.Connect.showPermissionDialog('publish_stream',onDialogCloseChannel);}
function onDialogCloseChannel(result){if(result===false)return;if(result===''){$ES('input','FBPostSettings').setProperty('disabled',true).setProperty('checked',false);}else{$ES('input','FBPostSettings').setProperty('disabled',false);$('FBAllowPermsWrap').remove();}}
var AdManager=new Class({initialize:function(){this.links=$ES('.Ifrm');this.ads=$ES('.AdProduct').concat($ES('.MedRect'));this.ads.each(function(el){el.addClass('Hidden');});this.run();},run:function(){this.renderAds();this.ads.each(function(el){var first=el.getFirst();if(first&&!first.hasClass('IfrmStub')){el.removeClass('Hidden');}},this);},renderAds:function(){this.links.each(function(el){var url=el.getProperty('href');var size=url.match(/sz=(\d+)x(\d+)/).splice(1,2)||[300,250];var parent=el.getParent();var iframe=new Element('iframe',{'src':url,'width':size[0],'height':size[1],'frameborder':'0','allowtransparancy':'1','scrolling':'no'});el.replaceWith(iframe);if(window.gecko){if(parent.hasClass('Hidden')&&!parent.hasClass('Panel'))
parent.removeClass('Hidden');}else{iframe.addEvent('load',this.onFrameLoad.pass(parent));}},this);},onFrameLoad:function(parent){if(parent.hasClass('Hidden')&&!parent.hasClass('Panel'))
parent.removeClass('Hidden');}});
Element.extend({autoexpand:function(){if(this.getTag()!=='input'){return;}
this.addEvents({'keydown':function(){this.caret=this.getCaretPosition();this.setStyle('width',(this.value.length*15)+'px');}.bind(this),'focus':function(){this.setStyle('width',(this.value.length>0?this.value.length*15:25)+'px');}.bind(this)});},getCaretPosition:function(){try{if(this.createTextRange){var r=document.selection.createRange().duplicate();r.moveEnd('character',this.value.length);if(r.text===''){return this.value.length;}
return this.value.lastIndexOf(r.text);}else{try{return this.selectionStart;}catch(err1){return'0';}}}catch(err2){return'0';}},setCaretPosition:function(pos){try{if(document.selection){this.focus();var r=document.selection.createRange();r.moveStart('character',-this.value.length);r.moveStart('character',pos);r.moveEnd('character',0);r.select();}else if(this.selectionStart){this.selectionStart=pos;this.selectionEnd=pos;this.focus();}}catch(err){}},highlight:function(from){try{if(document.selection){this.focus();var r=document.selection.createRange();r.moveStart('character',-this.value.length);r.moveStart('character',from);r.moveEnd('character',this.value.length);r.select();}else if(this.selectionStart){this.selectionStart=from;this.selectionEnd=this.value.length;}}catch(err){}}});var AutoComplete=new Class({options:{minchars:3,separator:',',holderClass:'TagInput',containerClass:'TagInputWrap',suggestionBoxClass:'Suggestions',scriptTagId:'SuggestionScript',tagField:null,targetForm:null,suggestUrl:null,callback:null},initialize:function(options){this.setOptions(options);this.element=$(this.options.tagField);this.initInputValue=this.element.value;this.form=$(this.options.targetForm);this.cancelSuggestion=false;this.timer=null;this.usageData={acUsageCount:0,acUsageResTimeAvg:0,acUsageClickedFlag:0};this.createHolder();},createHolder:function(){this.container=new Element('div',{'class':this.options.containerClass,'events':{'clickOutside':this.onClickOutside.bindWithEvent(this)}}).injectBefore(this.element);this.holder=new Element('div',{'class':this.options.holderClass,'events':{'click':function(ev){if($(ev.target)===this.holder&&this.input){this.input.focus();}}.bindWithEvent(this)}}).injectInside(this.container);this.element.injectInside(this.holder);this.createSuggestionBox();this.form.addEvent('submit',this.onFormSubmit.bindWithEvent(this));this.element.addEvents({'focus':this.onTextBoxFocus.bind(this),'blur':this.onTextBoxBlur.bind(this),'keydown':this.onTextBoxTypeDown.bindWithEvent(this),'keyup':this.onTextBoxTypeUp.bindWithEvent(this)});},createSuggestionBox:function(){this.suggestionBox=new Element('div',{'class':this.options.suggestionBoxClass}).injectAfter(this.holder).setStyle('display','none');var big=new Element('big').setHTML('Suggestions').injectInside(this.suggestionBox);this.suggestionList=new Element('div').injectInside(this.suggestionBox);if(window.ie6){this.iframe=new Element('iframe',{'frameborder':0}).setOpacity(0.1).injectTop(this.suggestionBox);}},closeSuggest:function(){this.suggestionBox.setStyle('display','none');this.suggestOpen=false;},openSuggest:function(){if(this.cancelSuggest){this.closeSuggest();return;}
this.suggestionBox.setStyle('display','block');this.suggestOpen=true;},getSuggestions:function(){if(this.options.suggestUrl===null){return;}
this.reqTimer=new Date().getTime();if($(this.options.scriptTagId)){$(this.options.scriptTagId).remove();}
var url=this.options.suggestUrl+(this.options.suggestUrl.match(/\?/g)?'&':'?')+'prefix='+encodeURIComponent(this.element.value)+'&callback='+this.options.callback+'.suggest';var js=new Asset.javascript(url,{id:this.options.scriptTagId});},suggest:function(json){if(json===undefined){return;}
var diff=new Date().getTime()-this.reqTimer;this.usageData.acUsageCount+=1;this.usageData.acUsageResTimeAvg=this.usageData.acUsageCount==1?diff:Math.round(((this.usageData.acUsageResTimeAvg*(this.usageData.acUsageCount-1))+diff)/this.usageData.acUsageCount);if(typeof json!=='object'){json=Json.evaluate(json);}
this.suggestionList.setHTML('');if(json.options.length==0){this.closeSuggest();return;}
for(el in json.options){if(json.options.hasOwnProperty(el)){if(typeof json.options[el]=='string'){this.addSuggestionItem(json.options[el]);}else if(typeof json.options[el]=='object'){var big=new Element('strong').set('html',el).inject(this.suggestionList);for(elm in json.options[el]){if(json.options[el].hasOwnProperty(elm)){this.addSuggestionItem(json.options[el][elm],el);}}}}}
this.suggestionBox.scrollTo(0,0);if(this.iframe){this.iframe.setProperty('height','0px').setStyle('height','0px');}
if(!this.suggestOpen&&this.suggestionList.getChildren()){this.openSuggest();}
var size=this.suggestionBox.getSize();var scroll=size.scrollSize.y>size.size.y?size.scrollSize.y:size.size.y;this.shouldScroll=scroll>0?true:false;this.scrollCount=json.options.length;this.suggestionBoxHeight=size.size.y;if(this.iframe){this.iframe.setProperty('height',scroll+'px').setStyle('height',scroll+'px');}
this.currentValue=this.element.value;},addSuggestionItem:function(el,cls){var c=['suggestion',(cls||'')].join(' ').trim();var a=new Element('a',{'href':'#','class':c,'events':{'click':function(ev){ev.stop();this.add($(ev.target).get('text'),true);this.usageData.acUsageClickedFlag=1;this.fireEvent('onSuggestClick');}.bindWithEvent(this),'mouseover':this.hover.bindWithEvent(this)}}).setHTML(decodeURIComponent(el)).injectInside(this.suggestionList);},onFormSubmit:function(ev){if(this.inEdit){ev.stop();return false;}},onTextBoxFocus:function(e){this.inEdit=true;this.element.addClass('Focused');},onTextBoxBlur:function(e){this.inEdit=false;this.element.removeClass('Focused');},onTextBoxTypeUp:function(ev){switch(ev.key){case'esc':if(this.suggestOpen){this.closeSuggest();}
break;case'down':if(!this.suggestOpen){this.openSuggest();}
var el=$E('.focused',this.suggestionList)||this.suggestionList.getLast();this.traverse(el,'next',false);break;case'up':if(!this.suggestOpen){this.openSuggest();}
var el=$E('.focused',this.suggestionList)||this.suggestionList.getFirst();this.traverse(el,'previous',false);break;case'enter':case'space':break;default:this.timer=$clear(this.timer);this.timer=this.getSuggestions.delay(150,this);break;}},onTextBoxTypeDown:function(ev){if(ev.key==='enter'){if(!this.suggestOpen){return;}
var text=$E('.focused',this.suggestionList);if(text!==null){this.add(text.getText(),true);this.usageData.acUsageClickedFlag=1;}}},onClickOutside:function(ev){this.closeSuggest();},add:function(html){this.cancelSuggest=true;var html=html.clean();if(html.length==0){return;}
html=html.replace(/(<\/?strong>)|(<em>.*<\/em>)/gi,'');this.element.value=html;this.closeSuggest();this.cancelSuggest=false;},traverse:function(el,dir,focus){var parent=el.getParent();if(!parent.getChildren()){return;}
switch(dir){case'next':el.removeClass('focused');var next=el===parent.getLast()?parent.getFirst():el.getNext();if(next.getTag()!='a'){next=next.getNext();}
break;case'previous':el.removeClass('focused');var next=el===parent.getFirst()?parent.getLast():el.getPrevious();if(next.getTag()!='a'){next=next.getPrevious()||parent.getLast();}
break;}
if(next===this.inputWrap){this.input.focus();}else{next.addClass('focused');if(focus)next.focus();if(!this.shouldScroll){return;}
var h=next.getCoordinates().height;var index=parent.getChildren().indexOf(next);var visibleIndex=Math.round(this.suggestionBoxHeight/h)-1;if(dir==='next'){if(index>=visibleIndex){this.suggestionBox.scrollTo(0,index*h);}else{this.suggestionBox.scrollTo(0,0);}}else if(dir==='previous'){if(index<=visibleIndex){this.suggestionBox.scrollTo(0,0);}else{this.suggestionBox.scrollTo(0,index*h);}}
this.highlight(next);}},hover:function(ev){var oldLink=$E('.focused',this.suggestionList);var newLink=$(ev.target);if(oldLink){oldLink.removeClass('focused');}
newLink.addClass('focused');},highlight:function(el){this.element.value=el.getText();this.element.highlight(this.currentValue.length);}});AutoComplete.implement(new Options);AutoComplete.implement(new Events);
var OmnitureMC=new Class({initialize:function(props,clickReports){this.props=props;this.clickReports=new Hash(clickReports);this.reportedElements=null;window.document.addEvent('click',this.documentClick.bindWithEvent(this));},documentClick:function(event){for(var el=new Element(event.target);el&&el!=document.body&&el.nodeName!='#document';el=el.getParent()){if($defined(el.hasClass)){if(el.hasClass('report')){this.saveClickReport(event,el);break;}}}},hookClickReports:function(){},saveClickReport:function(event,target){var clickReport=null;target.className.split(' ').each(function(val){var t=this.clickReports.get(val);if(t!=null)
clickReport=t;}.bind(this));clickReport=clickReport||this.clickReports.get(target.getProperty('id'));this.saveCookie(clickReport,event,target);if(typeof kpi!=='undefined'){kpi.setRndtrpCookie();}},saveCookie:function(clickReport,event,target){var hashCookie=new Hash.Cookie("Omniture",{domain:headerObj.cookieDomain,path:'/',duration:100});if(clickReport){new Hash(clickReport).each(function(val,key){var oldVal=hashCookie.get(key);if(key=='events'&&oldVal){if(!oldVal.test(val))
hashCookie.set(key,oldVal+','+val);}
else
hashCookie.set(key,val);}.bind(this));}else{var elementText=event.target.innerHTML.replace(/(<([^>]+)>)/ig,"").replace('+',' ')||event.target.getProperty('id');hashCookie.set('prop23',elementText);}},setModel:function(model){if(model!=undefined){this.model=model;}},onPlay:function(){var props={'prop32':this.model.selectedItem.itemID+' '+this.model.selectedItem.title};this.report(props,'Item');},report:function(propsSent,section){if(omnitureEnv==undefined)
return;if(typeof console!='undefined'&&document.location.href.test('.(dev|qa).'))console.log('OmnitureMC::report ',propsSent,section);var props=propsSent;var s2=s_gi(omnitureEnv);s2.linkTrackVars='';for(prop in props){s2[prop]=props[prop];s2.linkTrackVars+=(s2.linkTrackVars.length?',':'')+prop;}
s2.linkTrackEvents=s2.events;s2.tl(this,'o',section);}});function getOmnitureIntervalTime(sec){if(sec<3)return"<3";else if(sec<5)return"3-5";else if(sec<8)return"5-8";else if(sec<11)return"8-11";else if(sec<15)return"11-15";else if(sec<20)return"15-20";else if(sec<25)return"20-25";else return">25";}
function goToCatalogPage(url){top.location.href=url;}
function goToURL(strURL){if(window.ie){var aLink=new Element('a',{'styles':{'display':'none'},'href':strURL});aLink.injectInside($E('body'));aLink.click();}else{window.location=strURL;}}
var MainReportItems=false;var ReportItems=new Class({initialize:function(){if(typeof ReportItemsID=='undefined'||ReportItemsID==0)
return;this.reportID=ReportItemsID;$$('.Items').each(function(catalogContainer){$ES('li',catalogContainer).addEvent('click',this.onClick.bindWithEvent(this));}.bind(this));},initAjax:function(catalog){},onClick:function(event){for(var el=event.target;el.nodeName!='LI'&&el!=document.body;el=el.parentNode);if(el==document.body)return;var thumb=$E('.ItemThumb',el);for(var catalog=el;!catalog.hasClass('Items')&&catalog!=document.body;catalog=catalog.getParent());if(catalog==document.body)return;var indexOf=$ES('.ItemThumb',catalog).indexOf(thumb);if(indexOf==-1)return;var i=catalog.getProperty('id');if(!i)
return;else
id=i.match(/([0-9]+)/gi)[0];var spotID=id.toInt()*100+indexOf.toInt();Cookie.set('itemReport',spotID+"__"+this.reportID,{domain:headerObj.cookieDomain,path:"/"})}});var Search=new Class({options:{form:null,type:null,defaultPath:'videos/',appendSelectValue:true,path:''},initialize:function(options){this.setOptions(options);this.serverUrl='http://'+self.location.hostname.replace(/wikicafe/,'www')+'/';this.autoCompleteInstance=null;if(this.options.form){this.form=this.options.form;this.filter=$E('.SearchFilter',this.form);this.form.setProperty('target','_top');this.form.addEvent('submit',this.onSearch.bindWithEvent(this));}},onSearch:function(ev){if(ev){ev.preventDefault();}
var searchText=$E('input[type="text"]',this.form).value.clean();if(searchText=='Search'){searchText='';}
if(searchText===''){var url=this.serverUrl+this.options.defaultPath;var filter=this.filter?this.filter.value:'';if(this.options.appendSelectValue&&filter!=''){var filter=$E('.SearchFilter',this.form)?$E('.SearchFilter',this.form).value:'';url+=filter+'/';}
self.location.href=url;}else{this.search(searchText);}},search:function(searchText){var filter=this.filter?this.filter.value:'';var url=this.serverUrl+(this.options.path+(filter==''?'':'f/')+'tags/'+(filter==''?'':filter+'/')+this.createSearchString(searchText)+'/').replace(/(\/\/)/g,'/');var d=10/(24*60);Cookie.set('searchFromSite',1,{duration:d,domain:headerObj.cookieDomain,path:"/"});if(typeof kpi!=='undefined'&&this.autoCompleteInstance!==null){var d=this.autoCompleteInstance.usageData;for(r in d){kpi.addReport({name:r,value:d[r].toString()});}}
if(this.options.type&&typeof ga!=='undefined'&&typeof ga.onGAClick!=='undefined'){ga.onGAClick({'searchType':this.options.type});}
self.location.href=url;},createSearchString:function(searchText){var string=new String('');var strLen=searchText.length;var field="[A-Za-z0-9~]";var lastchar=false;for(var ii=0;ii<strLen;ii++){if(searchText.charCodeAt(ii)>192){string+=searchText.charAt(ii);lastchar=true;}
else{var tmpStr=new String(searchText.charAt(ii));if(tmpStr.match(field)){string+=tmpStr;lastchar=true;}
else{if((ii<strLen-1)&&lastchar){string+="_";lastchar=false;}}}}
return string;},setAutoCompleteInstance:function(instance){this.autoCompleteInstance=instance;}});Search.implement(new Options);var FormFocusHighlight=new Class({initialize:function(form){this.form=form;this.fields=$ES('input',this.form);this.fields.push($ES('select',this.form));this.fields.push($ES('textarea',this.form));this.bindEvents();},bindEvents:function(){this.fields.addEvent('click',this.focusField.bind(this));this.fields.addEvent('focus',this.focusField.bind(this));this.fields.addEvent('blur',this.blurField.bind(this));},focusField:function(e){var ev=new Event(e);var el=new Element(ev.target);try{for(var parent=el;!parent.hasClass('FormRow')&&parent!=document.body;parent=parent.getParent());$ES('.Focused').removeClass('Focused');parent.addClass('Focused');}catch(e){}},blurField:function(e){var ev=new Event(e);var el=new Element(ev.target);try{for(var parent=el;!parent.hasClass('FormRow')&&parent!=document.body;parent=parent.getParent());parent.removeClass('Focused');}catch(e){}}});var ItemCatalog2=new Class({initialize:function(objID,saveAsLastCatalog){this.hashCookie=new Hash.Cookie('User',{domain:headerObj.cookieDomain,path:'/',duration:362});if(document.location.toString().test('/watch/')){this.itemPage=true;}else{this.itemPage=false;this.hashCookie.set('LastCatalogReference','');}
this.objID=objID;this.saveAsLastCatalog=saveAsLastCatalog||false;this.obj=$(this.objID);if(this.obj)
this.obj.addEvent('click',this.onItemClick.bindWithEvent(this));},onItemClick:function(event){var foundAnchor=false;var foundSend2Mobile=false;for(var el=new Element(event.target);el.getTag()!='body';el=el.getParent()){if(el.getTag()=='a'&&(el.getProperty('href').test('/watch/'))){foundAnchor=true;break;}
if(el.hasClass('Send2Mobile'))
foundSend2Mobile=true;}
if(foundAnchor&&this.objID.match(/\d.?/)&&(!this.itemPage||this.saveAsLastCatalog)){this.hashCookie.set('LastCatalogReference',this.objID.match(/\d.?/)[0]);if(foundSend2Mobile){Cookie.set('s2m','1',{domain:headerObj.cookieDomain,path:'/'});}}}});var PanelMgr=new Class({initialize:function(){$ES('.Scrl').addEvent('scroll',this.loadThumbs.bindWithEvent(this));this.hashCookie=new Hash.Cookie('Panels',{domain:headerObj.cookieDomain,path:'/',duration:362});},togglePanel:function(h3){var panel=this.getPanel(h3);panel.toggleClass('Closed');this.savePanelState(panel,panel.hasClass('Closed')?0:1);},loadThumbs:function(ev){var panel=ev.target;if(panel.hasClass('Loaded'))
return;$ES('img',panel).each(function(el){if(el.getAttribute('title')){el.src=el.getProperty('title');el.removeProperty('title');}});panel.addClass('Loaded');},getPanel:function(target){for(el=target;!el.hasClass('Panel');el=el.getParent());return el;},toggleLayout:function(target){var panel=this.getPanel(target);var catalog=$E('.Items',panel);if(!catalog||target.hasClass('Active'))
return;var modes=catalog.hasClass('Mode1')||catalog.hasClass('Mode4')?['Mode1','Mode4']:['Default','Mode3'];var listView=$E('.ListView',panel);var thumbView=$E('.ThumbView',panel);catalog.toggleClass(modes[0]).toggleClass(modes[1]);listView.toggleClass('Active');thumbView.toggleClass('Active');var mode=catalog.hasClass(modes[0])?modes[0]:modes[1];this.savePanelMode(panel,mode);},savePanelState:function(panel,state){if(panel.getProperty('id')){this.hashCookie.set(panel.getProperty('id'),state);}},savePanelMode:function(panel,state){if(panel.getProperty('id')){this.hashCookie.set(panel.getProperty('id')+'-Mode',state);}}});var Console=new Class({initialize:function(){},log:function(msg){}});var DropDown=new Class({initialize:function(trigger,target){this.opened=false;this.trigger=[];if($defined(trigger.length)){trigger.each(function(el){this.trigger.push($(el));},this);}else{this.trigger=[$(trigger)];}
this.target=$(target);this.target.addClass('Hidden');this.initEvents();},initEvents:function(){this.trigger.each(function(el){el.addEvent('click',this.toggleTarget.bindWithEvent(this));},this);this.target.addEvent('clickOutside',this.onClickOutside.bindWithEvent(this));},toggleTarget:function(ev){ev.preventDefault();this.trigger.each(function(el){el.toggleClass('Open');});this.target.toggleClass('Hidden');this.opened=!this.opened;},onClickOutside:function(ev){if(!this.trigger.contains(ev.target))
this.hideTarget();},hideTarget:function(){this.trigger.each(function(el){el.removeClass('Open');});this.target.addClass('Hidden').removeClass('Open');this.opened=false;}});var ReportManager=new Class({initialize:function(){return this;},report:function(el){var classes=new String(el.removeClass('reports').className).clean();var newValues=classes==''?[]:classes.split(' ');var oldValues=Cookie.get('reports')?new String(Cookie.get('reports')).clean().split(' '):[];var reports=oldValues.merge(newValues).join(' ');Cookie.set('reports',reports,{domain:headerObj.cookieDomain,path:'/',duration:1});}});var DefaultHPToggler=new Class({initialize:function(pageName,activeSetter){this.pageName=pageName||'';var s=$(activeSetter);if(!s){return};this.activeSetter=s.getParent();this.setters=$ES('.HPSetter');this.setters.addEvent('click',this.toggleHomepage.bindWithEvent(this));this.activateLinks();},activateLinks:function(){var activeHub=$('Hub'+this.pageName);if(activeHub){activeHub.addClass('Active');}
if(this.pageName!='home'){this.activeSetter.removeClass('Hidden');}},toggleHomepage:function(ev){ev.preventDefault();for(var target=$(ev.target);target.getTag()!='li';target=target.getParent());if(target.getFirst().getProperty('id')=='SetHP'){var url=self.location.pathname;var gaEvent='DefaultHomepage/Set/'+self.location.pathname.replace(/\//gi,'');}else{var url='/';var gaEvent='DefaultHomepage/Unet/'+self.location.pathname.replace(/\//gi,'');}
if(typeof ga!=='undefined'){ga.reportEvent(gaEvent);}
Cookie.set('hp',url,{domain:headerObj.cookieDomain,path:'/',duration:362});this.setters.toggleClass('Hidden');}});
function initMoreText(){$ES('.moreToggler').removeEvents().addEvent('click',function(e){new Event(e).preventDefault();this.getParent().addClass('invisible');this.findUpstream('.moreText',this).removeClass('invisible');});$ES('.lessToggler').removeEvents().addEvent('click',function(e){new Event(e).preventDefault();this.findUpstream('.moreText',this).addClass('invisible');this.findUpstream('.moreTogglerWrapper').removeClass('invisible');});}
var uuID;function fpSetUUID(val){if(uuID==undefined&&val.length>0){uuID=val;var jsonCookie=new Hash.Cookie('User',{domain:headerObj.cookieDomain,path:'/',duration:362});jsonCookie.set('uuID',val);}
if(typeof kpi!=='undefined'){kpi.onUUID();}}
function initUUID(){if($('uuGenContainer')){var flashvars=false;var attributes={id:'uuGenFlashObj'};swfobject.embedSWF(headerObj.uuIDFlashFileURL,"uuGenContainer","1","1","8",false,false,swfobject.defaultParams,attributes);}}
function createSearchString(id){var string=new String('');var searchText=$(id).value;var strLen=searchText.length;var field="[A-Za-z0-9~]";var lastchar=false;for(var ii=0;ii<strLen;ii++){if(searchText.charCodeAt(ii)>192){string+=searchText.charAt(ii);lastchar=true;}
else{var tmpStr=new String(searchText.charAt(ii));if(tmpStr.match(field)){string+=tmpStr.toLowerCase();lastchar=true;}
else{if((ii<strLen-1)&&lastchar){string+="_";lastchar=false;}}}}
return string;}
function removeElement(id){if($(id)){$(id).remove();}}
function randomize(min,max){var val=min+(Math.random()*(max-min));return Math.round(val);}
var GoogleAnalytics=new Class({options:{clickReport:null,sessionVars:null},initialize:function(options){this.setOptions(options);this.pageTracker=null;this.eventTracker=null;this.pageName=null;this.ready=false;this.tries=0;this.events=[];window.addEvent('gaClick',this.onGAClick.bind(this));},run:function(){if(typeof _gat!='undefined'){this.pageTracker=_gat._getTracker("UA-6119600-1");this.ready=true;this.send();}else if(typeof _gat=='undefined'&&this.tries<10){this.tries+=1;this.run.delay(500,this);}},send:function(){this.setEnvVars();if(typeof this.pageName==='string'){this.pageTracker._trackPageview(this.pageName);}
if(this.events.length>0){this.events.each(function(event,index){this.sendEvent(event);},this);}
this.events=[];},concatenate:function(obj){str=[]
for(key in obj){str.push(key+'-'+obj[key])}
return str.join('/');},reportPageName:function(pageName){this.pageName=(pageName||'pageType-unknown')+this.getSearchQueryString();if(!this.ready){this.run();}else{this.send();}},reportEvent:function(event){if(!this.ready){this.events.push(event);}else{this.sendEvent(event);}},sendEvent:function(event){var e=event.split('/');switch(e.length){case 4:this.pageTracker._trackEvent(e[0],e[1],e[2],e[3]);break;case 3:this.pageTracker._trackEvent(e[0],e[1],e[2]);break;default:this.pageTracker._trackEvent(e[0],e[1]);break;}},getSearchQueryString:function(){if(!headerObj.search)return'';var search=headerObj.search;var category=headerObj.category||null;return'?q='+search+(category?'&c='+category:'&c=all');},setEnvVars:function(){var landing=this.concatenate(this.options.sessionVars);try{var envVar=Cookie.get('__utmv').split('.')[1];if(envVar!=landing){this.pageTracker._setVar(landing);}}catch(e){}
return landing;},onGAClick:function(el){if(typeof console!='undefined'&&document.location.href.test('.(dev|qa).'))console.log('onGAClick click',el);if(el.getProperty){var reports=this.options.clickReport;obj=null;classes=el.getProperty('class')+' '+el.getProperty('id');classes=classes.split(' ');for(i=0;i<classes.length;i++){c=classes[i];if(c in reports){obj=reports[c];break;}}}
else{obj=el;}
if(typeof console!='undefined'&&document.location.href.test('.(dev|qa).'))console.log('onGAClick reporting',obj);if(!obj)return;var hashCookie=new Hash.Cookie("GA",{domain:headerObj.cookieDomain,path:'/',duration:100});for(key in obj){hashCookie.set(key,obj[key]);}}});GoogleAnalytics.implement(new Options);GoogleAnalytics.implement(new Events);
var KPI=new Class({initialize:function(){if(typeof pageStartTime=='undefined'){return;}
this.headerTime=pageStartTime;this.reported=false;this.combinedReports=new Array();this.params;this.prevReports=new Array();this.prevServerParams;this.prevServerParams;this.UUIDReady=false;this.windowLoadReady=false;this.addLostSessionReport();this.initPreviousReports();window.addEvent('load',this.onWindowLoad.bind(this));window.onerror=function(msg,url,line){this.addReport({name:'JSError',value:'Error: '+msg+',URL: '+url+',Line: '+line},true);return true;}.bind(this);},addSimpleReport:function(name){this.addReport({name:name,value:this.getTimeFromInit()});},addReport:function(report,force){if((typeof force=='undefined')&&(!this.isKPIReporting())){return true;}
if(!this.reported){this.combinedReports.push(report);}
else{this.combinedReports.data.push(report);Cookie.set('KPIPrevReports',Json.toString(this.combinedReports),{path:'/',duration:0,domain:document.domain});}},initPreviousReports:function(){prevReports=Cookie.get('KPIPrevReports',{path:'/',duration:0,domain:document.domain});if(!prevReports)
return false;Cookie.remove('KPIPrevReports',{path:'/',duration:0,domain:document.domain});prevReports=Json.evaluate(prevReports);this.prevClientParams=prevReports.PrevClientParams;this.prevServerParams=prevReports.PrevServerParams;delete prevReports.PrevClientParams;delete prevReports.PrevServerParams;this.prevReports=prevReports.data;return true;},getBrowser:function(){if(window.ie6)browser='IE6';if(window.ie7)browser='IE7';if(window.ie&&navigator.userAgent.test(/MSIE\s8/g))browser='IE8';if(window.gecko)browser='Mozilla/Gecko';if(window.webkit)browser='Safari/Konqueror';if(window.opera)browser='Opera';return browser;},report:function(params){if((this.combinedReports.length==0)||(this.reported)){return true;}
if(typeof KPIServerParams=='undefined'){serverParams='';}
else{serverParams=KPIServerParams;}
var rand=Math.floor(Math.random()*100*Math.random()*200);this.reported=true;var qs=reportURL+'/index.php?inputType=reporter&reportName=KPI&rand='+rand+'&headerType=css&'
+'serverParams='+encodeURIComponent(Json.toString(serverParams))+'&clientParams='
+encodeURIComponent(Json.toString(this.params))+'&data='+encodeURIComponent(Json.toString(this.combinedReports))+'&isBeta='+isBeta;if(this.prevReports.length>0){qs+='&prevClientParams='+encodeURIComponent(Json.toString(this.prevClientParams))+'&prevServerParams='
+encodeURIComponent(Json.toString(this.prevServerParams))+'&prevData='+
encodeURIComponent(Json.toString(this.prevReports));}
var img=new Element('img',{'src':qs,'alt':'kpi-img','class':'Hidden'});if(img.injectInside($(document.body))){delete img;}
delete this.combinedReports;this.combinedReports={'PrevClientParams':this.params,'PrevServerParams':KPIServerParams,'data':new Array()};},addRndtrpReport:function(serverLoadTime){var lastClicktime;if(!(lastClickTime=Cookie.get('KPIRndtrpStart'))){return;}
lastClickTime=new Date(Cookie.get('KPIRndtrpStart'));Cookie.remove('KPIRndtrpStart',{duration:0,domain:document.domain,path:'/'});rndtrpTime=(this.headerTime-lastClickTime)-serverLoadTime;this.addReport({name:'Rndtrp',value:rndtrpTime});},getTimeFromInit:function(){var d=new Date();return d.getTime()-this.headerTime;},addLostSessionReport:function(){if(Cookie.get('KPIPageInit')){this.addReport({name:'LostSession',value:'1'});this.removePageInitCookie();return true;}
return false;},isKPIReporting:function(){return!(typeof KPIServerParams=='undefined');},setRndtrpCookie:function(){if(this.isKPIReporting()){Cookie.set('KPIRndtrpStart',new Date(),{duration:0,domain:document.domain,path:'/'});}},setKPIPageInitCookie:function(){if(this.isKPIReporting()){Cookie.set('KPIPageInit',this.headerTime,{duration:0,domain:document.domain,path:'/'});}},initParams:function(){var d=new Date();this.params={OS:navigator.platform,browser:this.getBrowser(),gmtOffset:d.getTimezoneOffset(),UUID:(uuID||'')};},removePageInitCookie:function(){Cookie.remove('KPIPageInit',{duration:0,domain:document.domain,path:'/'});},onUUID:function(){if(!this.UUIDReady){this.initParams();this.UUIDReady=true;}
if(this.UUIDReady&this.windowLoadReady){this.report();}},onDOMLoad:function(serverLoadTime){this.addSimpleReport('HTMLLoadTime');this.addRndtrpReport(serverLoadTime);this.removePageInitCookie();},onWindowLoad:function(){this.addSimpleReport('FullLoadTime');this.windowLoadReady=true;if(this.UUIDReady&this.windowLoadReady){this.report();}}});
var Moobox=new Class({options:{useOverlay:false,openerClass:'modalOpener',closerClass:'modalCloser',internalCloserClass:'modalInternalCloser',internalOpenerClass:'modalInternalOpener',bindOpeners:true,addGlobalCloser:true,initialHeight:80,initialWidth:120,zIndex:2,externalCSS:null,modalID:null,overlayOpacity:0.7},initialize:function(options){this.setOptions(options);this.options.container=document.body;this.opener=null;this.opened=false;if(this.options.externalCSS!=null)
new Asset.css(this.options.externalCSS,{id:'mooboxCSS'});if(this.options.useOverlay){this.overlay=new Overlay({container:this.options.container,onClick:this.closeAll.bind(this),zIndex:this.options.zIndex-1,opacity:this.options.overlayOpacity});}
var html='<table cellspacing="0" cellpadding="0"><tr><td colspan="3" class="Edge"><em>&nbsp;</em></td></tr><tr><td class="Side"><em>&nbsp;</em></td><td class="ContCell"></td><td class="Side"><em>&nbsp;</em></td></tr><tr><td colspan="3" class="Edge"><em>&nbsp;</em></td></tr></table>'
this.container=new Element('div').addClass('MooboxContainer').setStyles({'position':'absolute','z-index':this.options.zIndex,'display':'none'}).setHTML(html).injectInside(this.options.container);if(this.options.modalID!=null)
this.container.setProperty('id',this.options.modalID);this.table=this.container.getFirst();if(window.ie6){this.iframe=new Element('iframe',{'width':'100%','height':'100%','class':'IE6IframeHack','frameborder':0}).setOpacity(0.1).injectTop(this.container);}
if(this.options.addGlobalCloser){this.closer=new Element('a',{'class':'MooboxCloser','title':'Close'}).setStyle('z-index',this.options.zIndex+1).setHTML('Close').injectTop(this.container);this.closer.addEvent('click',this.closeAll.bind(this));}
this.content=$E('td.ContCell',this.container);this.contentElements=0;this.containerFx=new Fx.Styles(this.container,{duration:200,transition:Fx.Transitions.sineInOut});if(this.options.bindOpeners)this.bindOpeners();this.tempContainer=new Element('div').setStyles({'display':'block','position':'absolute','top':'-1000px','left':'-1000px','visibility':'hidden'}).injectInside(document.body);},bindOpeners:function(){if($ES('.'+this.options.openerClass))
$ES('.'+this.options.openerClass).addEvent('click',function(e){var url;var ev=new Event(e);ev.preventDefault();var el=new Element(ev.target);url=el.getProperty('href')||el.getProperty('rel');if(url==undefined)
return;this.open(url,el);}.bind(this));},bindInternalOpeners:function(p){if($ES('.'+this.options.internalOpenerClass,$(p)))
$ES('.'+this.options.internalOpenerClass,$(p)).addEvent('click',function(e){var url;var ev=new Event(e);ev.preventDefault();var el=new Element(ev.target);url=el.getProperty('href')||el.getProperty('rel');if(url==undefined)
return;this.open(url,el);}.bind(this));},bindClosers:function(p){if($ES('.'+this.options.closerClass,$(p)))
$ES('.'+this.options.closerClass,$(p)).addEvent('click',this.closeAll.bind(this));},bindInternalClosers:function(p){if($ES('.'+this.options.internalCloserClass,$(p)))
$ES('.'+this.options.internalCloserClass,$(p)).addEvent('click',this.close.bind(this));},open:function(url,el){if(url==undefined||url=='#')
return;if(typeof el!='undefined'){this.openMode=(el.getCoordinates().top.toInt()-window.getSize().scroll.y>(window.getHeight()/2).toInt())?'above':'below';this.openMode+=(el.getCoordinates().left.toInt()>(window.getWidth()/2).toInt())?'Right':'Left';this.opener=el;}else{this.openMode='centered';this.opener=null;}
if(!this.opened){if(this.options.useOverlay)
this.overlay.show();if(el){this.getOpenClosePos(el);this.container.setStyles(this.openClosePos);}
else
this.container.setStyles(this.getOpenClosePos(null));this.container.setStyles({opacity:0,display:'block'});}
if(typeof el!='undefined'&&!el.hasClass(this.options.internalOpenerClass)){this.moveToElement(el);var d=400;}else
var d=0;if(!this.opened)
this.onModalOpen.pass(null,this).delay(d);this.load.pass(url,this).delay(d);},onModalOpen:function(){this.opened=true;this.fireEvent('onOpen');},close:function(e){if(e)
new Event(e).preventDefault();this.removeCurrentContent();},closeAll:function(e){if(e)
new Event(e).preventDefault();if(this.options.useOverlay)
this.overlay.hide();if(this.mbAjax)this.mbAjax.cancel();this.containerFx.stop();this.zoomOut.bind(this).delay(500);},zoomOut:function(){this.containerFx.start({opacity:0}).chain(function(){this.fireEvent('onClose');}.bind(this));this.reset.bind(this).delay(500);},reset:function(){if(this.openClosePos==undefined){this.getOpenClosePos();}
this.container.setStyles({display:'none',width:this.openClosePos.width,height:this.openClosePos.height,top:this.openClosePos.top,left:this.openClosePos.left});this.content.getChildren().each(function(el){el.remove();});this.opened=false;this.opener=null;this.contentObj=null;},getOpenClosePos:function(el){if(el==null){this.openClosePos={width:0,height:0,top:0,left:0};}else{var w=el.getCoordinates().width-el.getSizeOffset('width');if(w<0)w=0;var h=el.getCoordinates().height-el.getSizeOffset('height');if(h<0)h=0;this.openClosePos={width:w,height:h,top:el.getCoordinates().top,left:el.getCoordinates().left,right:el.getCoordinates().right};}
return this.openClosePos;},load:function(url){if(!this.opened)this.open(url);else{if(this.opener!=null){this.openMode=(this.opener.getCoordinates().top.toInt()-window.getSize().scroll.y>(window.getHeight()/2).toInt())?'above':'below';this.openMode+=(this.opener.getCoordinates().left.toInt()>(window.getWidth()/2).toInt())?'Right':'Left';}else this.openMode='centered';url+='&rand='+Math.random();this.mbAjax=new Ajax(url,{method:'get',onRequest:this.onRequest.bind(this),onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)}).request();}},onRequest:function(){if(this.contentObj){if(this.contentObj.getStyle('opacity')>0){this.contentFx=new Fx.Styles(this.contentObj,{duration:200,transition:Fx.Transitions.linear});this.contentFx.start({opacity:[1,0]});}}
this.content.addClass('Loading');},onSuccess:function(response){this.content.removeClass('Loading');this.addContent(response);this.timer=this.showContent.bind(this).delay(200);this.bindClosers(this.contentObj);this.bindInternalClosers(this.contentObj);this.bindInternalOpeners(this.contentObj);this.fireEvent('onLoad');},onFailure:function(){this.addContent("<p>Loading content failed</p>");this.timer=this.showContent.bind(this).delay(200);},removeCurrentContent:function(){if(this.contentElements.toInt()>0){this.contentObj.remove();this.contentElements-=1;var content=$ES('.MooboxContent');if(content.length>0){this.contentObj=content[content.length-1];this.contentObj.setStyles({'display':'block','visibility':'hidden','float':'left'}).injectInside(this.tempContainer);this.showContent();}}
if(this.contentElements.toInt()==0)
this.closeAll();},moveToElement:function(el){if(el==undefined)
this.openMode='centered';var fxHash=!this.opened?this.getFXHash(el):this.getFXHash();if(this.contentObj){this.contentFx.start({opacity:[1,0]}).chain(function(){this.container.setStyles(fxHash);}.bind(this));}else{this.containerFx.start(fxHash);}},showContent:function(){var fxHash=this.getFXHash();this.container.setStyles(fxHash);$ES('.MooboxContent',this.container).setStyle('display','none');this.contentObj.setStyles({'display':'block','visibility':'hidden','float':'none'}).injectInside(this.content);if(!window.gecko)
this.evalScripts(this.contentObj);this.contentFx=new Fx.Styles(this.contentObj,{duration:200,transition:Fx.Transitions.linear});this.contentFx.start({opacity:[0,1]});if(this.iframe){this.iframe.setStyle('height',this.container.getCoordinates().height+'px');}
this.fireEvent('onContentLoad');},getFXHash:function(el){var fxHash;if(el){fxHash={opacity:[0,1],width:this.options.initialWidth,height:this.options.initialHeight}
switch(this.openMode){case'belowLeft':fxHash.top=el.getCoordinates().top+(el.getCoordinates().height*2);fxHash.left=el.getCoordinates().left;break;case'belowRight':fxHash.top=el.getCoordinates().top+(el.getCoordinates().height*2);fxHash.left=el.getCoordinates().right-this.options.initialWidth-16;break;case'aboveLeft':fxHash.top=el.getCoordinates().top-(el.getCoordinates().height+this.options.initialHeight+16);fxHash.left=el.getCoordinates().left;break;case'aboveRight':fxHash.top=el.getCoordinates().top-(el.getCoordinates().height+this.options.initialHeight+16);fxHash.left=el.getCoordinates().right-this.options.initialWidth-16;break;default:fxHash.top=(window.getHeight()/2)-((this.options.initialHeight+16)/2);fxHash.left=(window.getWidth()/2)-((this.options.initialHeight+16)/2);break;}
fxHash.top=fxHash.top<0?0:fxHash.top;fxHash.left=fxHash.left<0?0:fxHash.left;fxHash.left=fxHash.left>=(window.getWidth()-this.options.initialWidth-16)?(window.getWidth()-this.options.initialWidth-16):fxHash.left;}else{this.getOpenClosePos(this.opener);fxHash={width:this.contentObj.getCoordinates().width+16,height:'auto',opacity:1};if(this.opener==null||!this.opener.hasClass(this.options.internalOpenerClass)){switch(this.openMode){case'belowLeft':fxHash.left=this.openClosePos.left;fxHash.top=this.openClosePos.top+this.openClosePos.height*2;break;case'belowRight':fxHash.left=(this.openClosePos.right-this.contentObj.getCoordinates().width-16);fxHash.top=this.openClosePos.top+this.openClosePos.height*2;break;case'aboveLeft':fxHash.left=this.openClosePos.left;fxHash.top=this.openClosePos.top-this.openClosePos.height-this.contentObj.getCoordinates().height-this.content.getSizeOffset('height')-16;break;case'aboveRight':fxHash.left=(this.openClosePos.right-this.contentObj.getCoordinates().width-16);fxHash.top=this.openClosePos.top-this.openClosePos.height-this.contentObj.getCoordinates().height-this.content.getSizeOffset('height')-16;break;default:fxHash.left=window.getWidth()/2-this.contentObj.getCoordinates().width/2-16;fxHash.top=window.getHeight()/2-this.contentObj.getCoordinates().height/2-16;break;}
fxHash.top=fxHash.top<0?0:fxHash.top;fxHash.left=fxHash.left<0?0:fxHash.left;fxHash.left=fxHash.left>=(window.getWidth()-this.contentObj.getCoordinates().width-16-this.content.getSizeOffset('width'))?(window.getWidth()-this.contentObj.getCoordinates().width-16-this.content.getSizeOffset('width')):fxHash.left;}}
return fxHash;},addContent:function(html){this.contentObj=new Element('div').addClass('MooboxContent').setStyles({'visibility':'hidden','float':'left'}).setHTML(html);this.contentObj.injectInside(this.tempContainer);this.contentElements+=1;},evalScripts:function(parentEl){var elements=parentEl.getChildren()
elements.each(function(el){if(el.getTag()=='script'&&!el.getProperty('src')){if(typeof console!='undefined'&&document.location.href.test('.dev.'))console.log('evaluating script ',el.innerHTML);eval(el.innerHTML);return;}
else if(el.getTag()=='script'||el.getTag()=='link'){if((el.getTag()=='script'&&$$('script[src="'+el.getProperty('src')+'"]').length)||(el.getTag()=='link'&&$$('link[href="'+el.getProperty('href')+'"]').length)){return;}
if(typeof console!='undefined'&&document.location.href.test('.dev.'))console.log('Injecting script tag',el);if(document.location.href.test('debug'))alert('injecting '+el.getProperty('src')+el.getProperty('href'));if(document.location.href.test('debug'))alert('handling element tag:'+el.getTag()+' id:'+el.getProperty('id')+' defer:'+el.getProperty('defer')+' src:'+el.getProperty('src')+' href:'+el.getProperty('href')+' innerHTML:'+el.innerHTML);if(el.getTag()=='script')
new Asset.javascript(el.getProperty('src'));else
el.injectTop(document.head);}});}});Moobox.implement(new Options);Moobox.implement(new Events);var Overlay=new Class({getOptions:function(){return{colour:'#000',opacity:0.7,zIndex:1,container:document.body,onClick:Class.empty};},initialize:function(options){this.setOptions(this.getOptions(),options);this.options.container=$(this.options.container);if(!$('Overlay')){this.overlay=new Element('div').setProperty('id','Overlay').setStyles({position:'absolute',left:'0px',top:'0px',width:'100%',zIndex:this.options.zIndex,backgroundColor:this.options.colour}).injectInside(this.options.container);}
else{this.overlay=$('Overlay');this.overlay.setStyle('z-index',this.options.zIndex);}
this.overlay.addEvent('click',function(){}.bind(this));this.fade=new Fx.Style(this.overlay,'opacity').set(0);this.position();window.addEvent('resize',this.position.bind(this));},position:function(){if(this.options.container==document.body){var h=window.getScrollHeight()+'px';this.overlay.setStyles({top:'0px',height:h});}else{var myCoords=this.options.container.getCoordinates();this.overlay.setStyles({top:myCoords.top+'px',height:myCoords.height+'px',left:myCoords.left+'px',width:myCoords.width+'px'});}},show:function(){this.fade.start(0,this.options.opacity);if(window.ie6)
$ES('select').addClass('Hidden');},hide:function(){this.fade.start(this.options.opacity,0);if(window.ie6)
$ES('select').removeClass('Hidden');}});Overlay.implement(new Options);
var panelMgr,siteSearch;function initPage(){headerObj.target=headerObj.target?headerObj.target:'_top';if(headerObj.target){$ES('a','Header').setProperty('target',headerObj.target);$ES('a','Footer').setProperty('target',headerObj.target);}
if(headerObj.currentTab&&$(headerObj.currentTab))
$(headerObj.currentTab).addClass('Active');else{var links=$ES('a','SiteNav');for(i=0;i<links.length;i++){el=links[i];if(el.getProperty('href')==self.location.pathname){el.getParent().addClass('Active');break;}}}
if(window.ie6){if($E('body').getFirst().getTag()=='img')
$E('img',document.body).setStyle('display','none');}
if($('ClientDL')&&$('fpObj')){$('ClientDL').addEvent('click',function(e){try{itemManager.shouldPausePlayer=false}catch(e){};});$('ClientDL').addEvent('mouseout',function(e){try{itemManager.shouldPausePlayer=true}catch(e){};});}
if(headerObj.search){var sTop=$('SearchQuery'),sBtm=$('SearchQueryBtm');sTop.setProperty('value',headerObj.search);if(sBtm){sBtm.setProperty('value',headerObj.search);}}
if(!(new String(window.location.href).test('/notifications'))&&headerObj.userID){$('Notices').addEvent('click',function(e){iOmnitureMC.report({'events':'event72'},"Private Messaging");});$('Msgs').addEvent('click',function(e){iOmnitureMC.report({'events':'event72'},"Private Messaging");});}
initWikiCloseMsg();if(!Cookie.get('TZOffset')){var d=new Date();Cookie.set('TZOffset',d.getTimezoneOffset(),{duration:1,domain:document.domain,path:'/'});}
if($E('.Panel'))
panelMgr=new PanelMgr();if($('slCat')){$('slCat').addEvent('change',function(){document.location=$('slCat').value;});}
if(!$('AjaxProg')){var ajaxProg=new Element('div',{id:'AjaxProg','class':'Hidden'}).injectInside(document.body);}
var attributes={id:'AjaxProgSwf'};swfobject.embedSWF(headerObj.cdnFlash+'/Misc/ajax.swf','AjaxProgSwf',"20","20","8",false,false,swfobject.defaultParams,attributes);if($E('.Ifrm')||$E('.MedRect')){adManager=new AdManager();}
if(window.ie){console=new Console();}}
function initTopSearch(){var filter=$('CategoryFilter');var label=$E('big',filter);var input=$E('.SearchFilter',filter);var form=$('SiteSearch');var catList=new DropDown($ES('.CatFilterTrigger',filter),$('CategoryFilterList'));var catListLinks=$ES('a','CategoryFilterList');catListLinks.each(function(el){if(window.ie){el.setProperty('href','#');}
el.addEvent('click',function(e){var ev=new Event(e);var target=$(ev.target);ev.preventDefault();label.setText(target.getText());input.value=target.getProperty('rel');if(searchField.value!='Search'){form.removeClass('Disabled');}
catList.hideTarget();});},this);var searchField=$('SearchQuery');var initValue='Search';searchField.addEvent('focus',function(e){if(searchField.value=='Search'){searchField.value='';}
searchField.addClass('Focused');});searchField.addEvent('blur',function(e){if(searchField.value.trim()==''){searchField.value=initValue;searchField.removeClass('Focused');}});}
function initWikiCloseMsg(){var closeWikiMsg=$('CloseWikiMsg');if(closeWikiMsg){closeWikiMsg.addEvent('click',function(ev){new Event(ev).preventDefault();$('NoticeArea').remove();Cookie.set('wikimsg',0,{domain:headerObj.cookieDomain,path:'/',duration:0});});}}
function initFooter(){window.addEvent('load',function(){MainReportItems=new ReportItems();$('SearchQuery').focus();});}
function cacheItemPageAssets(){var parts=self.location.pathname.split('/').splice(1),pages=['videos','tags','watch'];var watched=Cookie.get('watched')||0;if(pages.contains(parts[0])&&watched!=1){var js=new Asset.javascript(headerObj.cdnJS+'/ItemR/'+headerObj.verJS);Cookie.set('watched',1,{domain:headerObj.cookieDomain,path:'/',duration:0});}}
var RPC=new Class({initialize:function(){this.cachedObjects={};this.inProcess=false;this.scrollToTop=false;},doRPC:function(el,event){if(this.inProcess||el.hasClass('Disabled')||el.getParent().hasClass('Disabled')){if(event)
event.stop();return;}
if(el.getProperty('href')||el.getProperty('rel')){var url=el.hasClass('useHREF')?el.getProperty('href'):(el.getProperty('rel')||el.getProperty('href'));if(el.getProperty('class').match('post([0-9a-zA-Z_\-]*)')){var data=$ES('.'+el.getProperty('class').match('post([0-9a-zA-Z_\-]*)')[1]).toQueryString().join('&');var method='post';}else{var method='get';var data=null;}}
if(el.getTag()=='input'||el.getTag()=='button'){if(event)
event.preventDefault();for(p=el;p.getTag()!='form';p=p.getParent());p.fireEvent('onBeforeSubmit');if(p.hasClass('notvalid'))
return;var method=p.getProperty('method')||'post';var url=p.getProperty('action');var data=p.toQueryString();}
this.url=url=url+(url.test('/$')?'?':'&')+'ajax=1&rand='+Math.random();this.postBody=data||'';this.inProcess=true;this.scrollToTop=el.hasClass('scrollTop');this.ajax=new Ajax(url,{method:method,postBody:data,headers:{'X-Requested-With':'XMLHttpRequest'},onSuccess:this.onRequest.bind(this),onFailure:this.onFailure.bind(this)}).request();},onRequest:function(response){var elements=new Element('div').setHTML(response).getChildren();this.replaceElements(elements);delete elements;this.inProcess=false;this.fireEvent('onComplete');if(this.scrollToTop)
new Fx.Scroll(window).scrollTo(0,$('Content').getCoordinates().top-20);},onFailure:function(response){this.fireEvent('onFailure');var msg='Your request could not be completed.';if($defined(response)&&response.responseText.length>0)
msg+='\n'+response.responseText;alert(msg);},replaceElements:function(elements){elements.each(function(el){var id=el.getProperty('id');if(el.getTag()=='script'&&!el.getProperty('src')){if(typeof console!='undefined'&&document.location.href.test('.(dev|qa).'))console.log('evaluating script ',el.innerHTML);eval(el.innerHTML.replace('<!--','').replace('--!>',''));return;}
else if(el.getTag()=='script'||el.getTag()=='link'){if((el.getTag()=='script'&&$$('script[src="'+el.getProperty('src')+'"]').length)||(el.getTag()=='link'&&$$('link[href="'+el.getProperty('href')+'"]').length)){return;}
if(typeof console!='undefined'&&document.location.href.test('.dev.'))console.log('Injecting script tag',el);if(document.location.href.test('debug'))alert('injecting '+el.getProperty('src')+el.getProperty('href'));if(document.location.href.test('debug'))alert('handling element tag:'+el.getTag()+' id:'+el.getProperty('id')+' defer:'+el.getProperty('defer')+' src:'+el.getProperty('src')+' href:'+el.getProperty('href')+' innerHTML:'+el.innerHTML);if(el.getTag()=='script')
new Asset.javascript(el.getProperty('src'));else
el.injectTop(document.head);}
else if(el.innerHTML==''&&el.getTag()!='input'&&el.getTag()!='button'){if(this.cachedObjects[id])
this.getFromCache(id);}
else{var oldElement=$(id);this.fireEvent('onUnload',[id,this.url],0)
if(!oldElement){if(typeof console!='undefined'&&document.location.href.test('.dev.'))console.log('could not find an element to replace with',el);return;}
if(!oldElement.hasClass('nocache'))
this.cachedObjects[id]=oldElement;if(document.location.href.test('debug'))alert(el);oldElement.replaceWith(el);}
this.fireEvent('onChange',[id,this.url,this.postBody],0)},this);},getFromCache:function(id){return $(id).replaceWith(this.cachedObjects[id]);},callModal:function(el){clickManager.callModal(el);},setManager:function(manager){this.manager=manager;}});RPC.implement(new Events);var rpc=new RPC();var ClickManager=new Class({initialize:function(){this.modal=null;this.reportManager=new ReportManager();document.addEvent('click',this.documentClick.bindWithEvent(this));},documentClick:function(event){if(event.rightClick)
return;var BrandedContainer=BrandedContainer||false;var _break=false;for(var el=new Element(event.target);el&&el!=document.body;el=el.parentNode){if($defined(el.hasClass)){if(el.hasClass('windowBlank')){el.setProperty('target','_blank');_break=true;}
if(el.hasClass('modalOpener')){event.preventDefault();this.callModal(el);_break=true;}
if(el.hasClass('rpc')){if(el.getTag()=='a')
event.preventDefault();rpc.doRPC(el,event);_break=true;}
if(el.hasClass('rpcConf')){if(el.getTag()=='a')
event.preventDefault();if(confirm('Are you sure you want to '+(el.getProperty('title')||'continue')+'?'))
rpc.doRPC(el,event);_break=true;}
if(el.hasClass('Fold')){el.blur();panelMgr.togglePanel(el);_break=true;}
if(el.hasClass('Toggler')&&!BrandedContainer){event.preventDefault();el.blur();this.toggleSibling(el);_break=true;}
if(el.hasClass('ListView')||el.hasClass('ThumbView')){el.blur();panelMgr.toggleLayout(el);_break=true;}
if(el.hasClass('reports')){this.reportManager.report(el);_break=true;}
if(el.hasClass('ga')){window.fireEvent('gaClick',[el]);}
if(_break)
break;if(el.getTag()=='a'){break;}}}
if($('AjaxProg')){$('AjaxProg').setStyles({'top':(event.page.y+10)+'px','left':(event.page.x+8)+'px'});}},toggleSibling:function(el){$ES('.Toggled',el.getParent()).toggleClass('Hidden');if(el.hasClass('More')){el.setHTML('&laquo;Less').removeClass('More').addClass('Less');if(el.getProperty('title'))
el.setProperty('title',el.getProperty('title').replace(/(more)/gi,'less'));}else if(el.hasClass('Less')){el.setHTML('More&raquo;').addClass('More').removeClass('Less');if(el.getProperty('title'))
el.setProperty('title',el.getProperty('title').replace(/(less)/gi,'more'));}else
el.toggleClass('Folded');},callModal:function(el){if(this.modal==null){this.modal=new Moobox({bindOpeners:false,zIndex:10000});}
var url=(el.getProperty('rel')||el.getProperty('href'));this.modal.open(url,el);}});var clickManager=new ClickManager();