String.prototype.parseColor=function(){var S="#";if(this.slice(0,4)=="rgb("){var w=this.slice(4,this.length-1).split(",");var D=0;do{S+=parseInt(w[D]).toColorPart();}while(++D<3);}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var D=1;D<4;D++){S+=(this.charAt(D)+this.charAt(D)).toLowerCase();}}if(this.length==7){S=this.toLowerCase();}}}return (S.length==7?S:(arguments[0]||this));};Element.collectTextNodes=function(S){return $A($(S).childNodes).collect(function(D){return (D.nodeType==3?D.nodeValue:(D.hasChildNodes()?Element.collectTextNodes(D):""));}).flatten().join("");};Element.collectTextNodesIgnoreClass=function(S,D){return $A($(S).childNodes).collect(function(w){return (w.nodeType==3?w.nodeValue:((w.hasChildNodes()&&!Element.hasClassName(w,D))?Element.collectTextNodesIgnoreClass(w,D):""));}).flatten().join("");};Element.setContentZoom=function(S,D){S=$(S);Element.setStyle(S,{fontSize:(D/100)+"em"});if(navigator.appVersion.indexOf("AppleWebKit")>0){window.scrollBy(0,0);}};Element.getOpacity=function(D){var S;if(S=Element.getStyle(D,"opacity")){return parseFloat(S);}if(S=(Element.getStyle(D,"filter")||"").match(/alpha\(opacity=(.*)\)/)){if(S[1]){return parseFloat(S[1])/100;}}return 1;};Element.setOpacity=function(S,D){S=$(S);if(D==1){Element.setStyle(S,{opacity:(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:null});if(/MSIE/.test(navigator.userAgent)){Element.setStyle(S,{filter:Element.getStyle(S,"filter").replace(/alpha\([^\)]*\)/gi,"")});}}else{if(D<0.00001){D=0;}Element.setStyle(S,{opacity:D});if(/MSIE/.test(navigator.userAgent)){Element.setStyle(S,{filter:Element.getStyle(S,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+D*100+")"});}}};Element.getInlineOpacity=function(S){return $(S).style.opacity||"";};Element.childrenWithClassName=function(w,E,F){var D=new RegExp("(^|\\s)"+E+"(\\s|$)");var S=$A($(w).getElementsByTagName("*"))[F?"detect":"select"](function(G){return (G.className&&G.className.match(D));});if(!S){S=[];}return S;};Element.forceRerendering=function(S){try{S=$(S);var w=document.createTextNode(" ");S.appendChild(w);S.removeChild(w);}catch(D){}};Array.prototype.call=function(){var S=arguments;this.each(function(D){D.apply(this,S);});};var Effect={tagifyText:function(S){var D="position:relative";if(/MSIE/.test(navigator.userAgent)){D+=";zoom:1";}S=$(S);$A(S.childNodes).each(function(w){if(w.nodeType==3){w.nodeValue.toArray().each(function(E){S.insertBefore(Builder.node("span",{style:D},E==" "?String.fromCharCode(160):E),w);});Element.remove(w);}});},multiple:function(D,w){var F;if(((typeof D=="object")||(typeof D=="function"))&&(D.length)){F=D;}else{F=$(D).childNodes;}var S=Object.extend({speed:0.1,delay:0},arguments[2]||{});var E=S.delay;$A(F).each(function(m,G){new w(m,Object.extend(S,{delay:G*S.speed+E}));});},PAIRS:{"slide":["SlideDown","SlideUp"],"blind":["BlindDown","BlindUp"],"appear":["Appear","Fade"]},toggle:function(D,w){D=$(D);w=(w||"appear").toLowerCase();var S=Object.extend({queue:{position:"end",scope:(D.id||"global"),limit:1}},arguments[2]||{});Effect[D.visible()?Effect.PAIRS[w][1]:Effect.PAIRS[w][0]](D,S);}};var Effect2=Effect;Effect.Transitions={};Effect.Transitions.linear=function(S){return S;};Effect.Transitions.sinoidal=function(S){return (-Math.cos(S*Math.PI)/2)+0.5;};Effect.Transitions.reverse=function(S){return 1-S;};Effect.Transitions.flicker=function(S){return ((-Math.cos(S*Math.PI)/4)+0.75)+Math.random()/4;};Effect.Transitions.wobble=function(S){return (-Math.cos(S*Math.PI*(9*S))/2)+0.5;};Effect.Transitions.pulse=function(S){return (Math.floor(S*10)%2==0?(S*10-Math.floor(S*10)):1-(S*10-Math.floor(S*10)));};Effect.Transitions.none=function(S){return 0;};Effect.Transitions.full=function(S){return 1;};Effect.ScopedQueue=Class.create();Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize:function(){this.effects=[];this.interval=null;},_each:function(S){this.effects._each(S);},add:function(D){var w=new Date().getTime();var S=(typeof D.options.queue=="string")?D.options.queue:D.options.queue.position;switch(S){case "front":this.effects.findAll(function(E){return E.state=="idle";}).each(function(E){E.startOn+=D.finishOn;E.finishOn+=D.finishOn;});break;case "end":w=this.effects.pluck("finishOn").max()||w;break;}D.startOn+=w;D.finishOn+=w;if(!D.options.queue.limit||(this.effects.length<D.options.queue.limit)){this.effects.push(D);}if(!this.interval){this.interval=setInterval(this.loop.bind(this),40);}},remove:function(S){this.effects=this.effects.reject(function(D){return D==S;});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var S=new Date().getTime();this.effects.invoke("loop",S);}});Effect.Queues={instances:$H(),get:function(S){if(typeof S!="string"){return S;}if(!this.instances[S]){this.instances[S]=new Effect.ScopedQueue();}return this.instances[S];}};Effect.Queue=Effect.Queues.get("global");Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1,fps:25,sync:false,from:0,to:1,delay:0,queue:"parallel"};Effect.Base=function(){};Effect.Base.prototype={position:null,start:function(S){this.options=Object.extend(Object.extend({},Effect.DefaultOptions),S||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).add(this);}},loop:function(w){if(w>=this.startOn){if(w>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish();}this.event("afterFinish");return ;}var D=(w-this.startOn)/(this.finishOn-this.startOn);var S=Math.round(D*this.options.fps*this.options.duration);if(S>this.currentFrame){this.render(D);this.currentFrame=S;}}},render:function(S){if(this.state=="idle"){this.state="running";this.event("beforeSetup");if(this.setup){this.setup();}this.event("afterSetup");}if(this.state=="running"){if(this.options.transition){S=this.options.transition(S);}S*=(this.options.to-this.options.from);S+=this.options.from;this.position=S;this.event("beforeUpdate");if(this.update){this.update(S);}this.event("afterUpdate");}},cancel:function(){if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).remove(this);}this.state="finished";},event:function(S){if(this.options[S+"Internal"]){this.options[S+"Internal"](this);}if(this.options[S]){this.options[S](this);}},inspect:function(){return "#<Effect:"+$H(this).inspect()+",options:"+$H(this.options).inspect()+">";}};Effect.Parallel=Class.create();Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(S){this.effects=S||[];this.start(arguments[1]);},update:function(S){this.effects.invoke("render",S);},finish:function(S){this.effects.each(function(D){D.render(1);D.cancel();D.event("beforeFinish");if(D.finish){D.finish(S);}D.event("afterFinish");});}});Effect.Opacity=Class.create();Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(D){this.element=$(D);if(/MSIE/.test(navigator.userAgent)&&(!this.element.hasLayout)){this.element.setStyle({zoom:1});}var S=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(S);},update:function(S){this.element.setOpacity(S);}});Effect.Move=Class.create();Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{initialize:function(D){this.element=$(D);var S=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(S);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(S){this.element.setStyle({left:this.options.x*S+this.originalLeft+"px",top:this.options.y*S+this.originalTop+"px"});}});Effect.MoveBy=function(D,S,w){return new Effect.Move(D,Object.extend({x:w,y:S},arguments[3]||{}));};Effect.Scale=Class.create();Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(D,w){this.element=$(D);var S=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:w},arguments[2]||{});this.start(S);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(D){this.originalStyle[D]=this.element.style[D];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var S=this.element.getStyle("font-size")||"100%";["em","px","%"].each(function(D){if(S.indexOf(D)>0){this.fontSize=parseFloat(S);this.fontSizeType=D;}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth];}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth];}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];}},update:function(S){var D=(this.options.scaleFrom/100)+(this.factor*S);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*D+this.fontSizeType});}this.setDimensions(this.dims[0]*D,this.dims[1]*D);},finish:function(S){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle);}},setDimensions:function(S,E){var F={};if(this.options.scaleX){F.width=E+"px";}if(this.options.scaleY){F.height=S+"px";}if(this.options.scaleFromCenter){var w=(S-this.dims[0])/2;var D=(E-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){F.top=this.originalTop-w+"px";}if(this.options.scaleX){F.left=this.originalLeft-D+"px";}}else{if(this.options.scaleY){F.top=-w+"px";}if(this.options.scaleX){F.left=-D+"px";}}}this.element.setStyle(F);}});Effect.Highlight=Class.create();Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(D){this.element=$(D);var S=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(S);},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return ;}this.oldStyle={backgroundImage:this.element.getStyle("background-image")};this.element.setStyle({backgroundImage:"none"});if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff");}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color");}this._base=$R(0,2).map(function(S){return parseInt(this.options.startcolor.slice(S*2+1,S*2+3),16);}.bind(this));this._delta=$R(0,2).map(function(S){return parseInt(this.options.endcolor.slice(S*2+1,S*2+3),16)-this._base[S];}.bind(this));},update:function(S){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(D,w,E){return D+(Math.round(this._base[E]+(this._delta[E]*S)).toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=Class.create();Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(S){this.element=$(S);this.start(arguments[1]||{});},setup:function(){Position.prepare();var D=Position.cumulativeOffset(this.element);if(this.options.offset){D[1]+=this.options.offset;}var S=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);this.scrollStart=Position.deltaY;this.delta=(D[1]>S?S:D[1])-this.scrollStart;},update:function(S){Position.prepare();window.scrollTo(Position.deltaX,this.scrollStart+(S*this.delta));}});Effect.Fade=function(w){w=$(w);var S=w.getInlineOpacity();var D=Object.extend({from:w.getOpacity()||1,to:0,afterFinishInternal:function(E){if(E.options.to!=0){return ;}E.element.hide();E.element.setStyle({opacity:S});}},arguments[1]||{});return new Effect.Opacity(w,D);};Effect.Appear=function(D){D=$(D);var S=Object.extend({from:(D.getStyle("display")=="none"?0:D.getOpacity()||0),to:1,afterFinishInternal:function(w){w.element.forceRerendering();},beforeSetup:function(w){w.element.setOpacity(w.options.from);w.element.show();}},arguments[1]||{});return new Effect.Opacity(D,S);};Effect.Puff=function(D){D=$(D);var S={opacity:D.getInlineOpacity(),position:D.getStyle("position")};return new Effect.Parallel([new Effect.Scale(D,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(D,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(w){w.effects[0].element.setStyle({position:"absolute"});},afterFinishInternal:function(w){w.effects[0].element.hide();w.effects[0].element.setStyle(S);}},arguments[1]||{}));};Effect.BlindUp=function(S){S=$(S);S.makeClipping();return new Effect.Scale(S,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(D){D.element.hide();D.element.undoClipping();}},arguments[1]||{}));};Effect.BlindDown=function(D){D=$(D);var S=D.getDimensions();return new Effect.Scale(D,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:S.height,originalWidth:S.width},restoreAfterFinish:true,afterSetup:function(w){w.element.makeClipping();w.element.setStyle({height:"0px"});w.element.show();},afterFinishInternal:function(w){w.element.undoClipping();}},arguments[1]||{}));};Effect.SwitchOff=function(D){D=$(D);var S=D.getInlineOpacity();return new Effect.Appear(D,{duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(w){new Effect.Scale(w.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(E){E.element.makePositioned();E.element.makeClipping();},afterFinishInternal:function(E){E.element.hide();E.element.undoClipping();E.element.undoPositioned();E.element.setStyle({opacity:S});}});}});};Effect.DropOut=function(D){D=$(D);var S={top:D.getStyle("top"),left:D.getStyle("left"),opacity:D.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(D,{x:0,y:100,sync:true}),new Effect.Opacity(D,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(w){w.effects[0].element.makePositioned();},afterFinishInternal:function(w){w.effects[0].element.hide();w.effects[0].element.undoPositioned();w.effects[0].element.setStyle(S);}},arguments[1]||{}));};Effect.Shake=function(D){D=$(D);var S={top:D.getStyle("top"),left:D.getStyle("left")};return new Effect.Move(D,{x:20,y:0,duration:0.05,afterFinishInternal:function(w){new Effect.Move(w.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(E){new Effect.Move(E.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(F){new Effect.Move(F.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(G){new Effect.Move(G.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(m){new Effect.Move(m.element,{x:-20,y:0,duration:0.05,afterFinishInternal:function(y){y.element.undoPositioned();y.element.setStyle(S);}});}});}});}});}});}});};Effect.SlideDown=function(w){w=$(w);w.cleanWhitespace();var S=$(w.firstChild).getStyle("bottom");var D=w.getDimensions();return new Effect.Scale(w,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:D.height,originalWidth:D.width},restoreAfterFinish:true,afterSetup:function(E){E.element.makePositioned();E.element.firstChild.makePositioned();if(window.opera){E.element.setStyle({top:""});}E.element.makeClipping();E.element.setStyle({height:"0px"});E.element.show();},afterUpdateInternal:function(E){E.element.firstChild.setStyle({bottom:(E.dims[0]-E.element.clientHeight)+"px"});},afterFinishInternal:function(E){E.element.undoClipping();if(/MSIE/.test(navigator.userAgent)){E.element.undoPositioned();E.element.firstChild.undoPositioned();}else{E.element.firstChild.undoPositioned();E.element.undoPositioned();}E.element.firstChild.setStyle({bottom:S});}},arguments[1]||{}));};Effect.SlideUp=function(D){D=$(D);D.cleanWhitespace();var S=$(D.firstChild).getStyle("bottom");return new Effect.Scale(D,0,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(w){w.element.makePositioned();w.element.firstChild.makePositioned();if(window.opera){w.element.setStyle({top:""});}w.element.makeClipping();w.element.show();},afterUpdateInternal:function(w){w.element.firstChild.setStyle({bottom:(w.dims[0]-w.element.clientHeight)+"px"});},afterFinishInternal:function(w){w.element.hide();w.element.undoClipping();w.element.firstChild.undoPositioned();w.element.undoPositioned();w.element.setStyle({bottom:S});}},arguments[1]||{}));};Effect.Squish=function(S){return new Effect.Scale(S,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(D){D.element.makeClipping(D.element);},afterFinishInternal:function(D){D.element.hide(D.element);D.element.undoClipping(D.element);}});};Effect.Grow=function(w){w=$(w);var D=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var S={top:w.style.top,left:w.style.left,height:w.style.height,width:w.style.width,opacity:w.getInlineOpacity()};var m=w.getDimensions();var y,G;var F,E;switch(D.direction){case "top-left":y=G=F=E=0;break;case "top-right":y=m.width;G=E=0;F=-m.width;break;case "bottom-left":y=F=0;G=m.height;E=-m.height;break;case "bottom-right":y=m.width;G=m.height;F=-m.width;E=-m.height;break;case "center":y=m.width/2;G=m.height/2;F=-m.width/2;E=-m.height/2;break;}return new Effect.Move(w,{x:y,y:G,duration:0.01,beforeSetup:function(U){U.element.hide();U.element.makeClipping();U.element.makePositioned();},afterFinishInternal:function(U){new Effect.Parallel([new Effect.Opacity(U.element,{sync:true,to:1,from:0,transition:D.opacityTransition}),new Effect.Move(U.element,{x:F,y:E,sync:true,transition:D.moveTransition}),new Effect.Scale(U.element,100,{scaleMode:{originalHeight:m.height,originalWidth:m.width},sync:true,scaleFrom:window.opera?1:0,transition:D.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(e){e.effects[0].element.setStyle({height:"0px"});e.effects[0].element.show();},afterFinishInternal:function(e){e.effects[0].element.undoClipping();e.effects[0].element.undoPositioned();e.effects[0].element.setStyle(S);}},D));}});};Effect.Shrink=function(w){w=$(w);var D=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var S={top:w.style.top,left:w.style.left,height:w.style.height,width:w.style.width,opacity:w.getInlineOpacity()};var G=w.getDimensions();var F,E;switch(D.direction){case "top-left":F=E=0;break;case "top-right":F=G.width;E=0;break;case "bottom-left":F=0;E=G.height;break;case "bottom-right":F=G.width;E=G.height;break;case "center":F=G.width/2;E=G.height/2;break;}return new Effect.Parallel([new Effect.Opacity(w,{sync:true,to:0,from:1,transition:D.opacityTransition}),new Effect.Scale(w,window.opera?1:0,{sync:true,transition:D.scaleTransition,restoreAfterFinish:true}),new Effect.Move(w,{x:F,y:E,sync:true,transition:D.moveTransition})],Object.extend({beforeStartInternal:function(m){m.effects[0].element.makePositioned();m.effects[0].element.makeClipping();},afterFinishInternal:function(m){m.effects[0].element.hide();m.effects[0].element.undoClipping();m.effects[0].element.undoPositioned();m.effects[0].element.setStyle(S);}},D));};Effect.Pulsate=function(w){w=$(w);var D=arguments[1]||{};var S=w.getInlineOpacity();var F=D.transition||Effect.Transitions.sinoidal;var E=function(G){return F(1-Effect.Transitions.pulse(G));};E.bind(F);return new Effect.Opacity(w,Object.extend(Object.extend({duration:3,from:0,afterFinishInternal:function(G){G.element.setStyle({opacity:S});}},D),{transition:E}));};Effect.Fold=function(D){D=$(D);var S={top:D.style.top,left:D.style.left,width:D.style.width,height:D.style.height};Element.makeClipping(D);return new Effect.Scale(D,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(w){new Effect.Scale(D,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(E){E.element.hide();E.element.undoClipping();E.element.setStyle(S);}});}},arguments[1]||{}));};["setOpacity","getOpacity","getInlineOpacity","forceRerendering","setContentZoom","collectTextNodes","collectTextNodesIgnoreClass","childrenWithClassName"].each(function(S){Element.Methods[S]=Element[S];});Element.Methods.visualEffect=function(D,w,S){s=w.gsub(/_/,"-").camelize();effect_class=s.charAt(0).toUpperCase()+s.substring(1);new Effect[effect_class](D,S);return $(D);};Element.addMethods();