String.prototype.parseColor=function(){var b='#';if(this.slice(0,4)=='rgb('){var c=this.slice(4,this.length-1).split(',');var i=0;do{b+=parseInt(c[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)b+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)b=this.toLowerCase();}}
return(b.length==7?b:(arguments[0]||this));}
Element.collectTextNodesIgnoreClass=function(b,c){var d=$(b).childNodes;var e='';var f=new RegExp('^([^ ]+ )*'+c+'( [^ ]+)*$','i');for(var i=0;i<d.length;i++){if(d[i].nodeType==3){e+=d[i].nodeValue;}else{if((!d[i].className.match(f))&&d[i].hasChildNodes())
e+=Element.collectTextNodesIgnoreClass(d[i],c);}}
return e;}
Element.setStyle=function(b,c){b=$(b);for(k in c)b.style[k.camelize()]=c[k];}
Element.setContentZoom=function(b,c){Element.setStyle(b,{fontSize:(c/100)+'em'});if(navigator.appVersion.indexOf('AppleWebKit')>0)window.scrollBy(0,0);}
Element.getOpacity=function(b){var c;if(c=Element.getStyle(b,'opacity'))
return parseFloat(c);if(c=(Element.getStyle(b,'filter')||'').match(/alpha\(c=(.*)\)/))
if(c[1])return parseFloat(c[1])/100;return 1.0;}
Element.setOpacity=function(b,c){b=$(b);if(c==1){Element.setStyle(b,{opacity:(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:null});if(/MSIE/.test(navigator.userAgent))
Element.setStyle(b,{filter:Element.getStyle(b,'filter').replace(/alpha\([^\)]*\)/gi,'')});}else{if(c<0.00001)c=0;Element.setStyle(b,{opacity:c});if(/MSIE/.test(navigator.userAgent))
Element.setStyle(b,{filter:Element.getStyle(b,'filter').replace(/alpha\([^\)]*\)/gi,'')+'alpha(opacity='+c*100+')'});}}
Element.getInlineOpacity=function(b){return $(b).style.opacity||'';}
Element.childrenWithClassName=function(b,d){return $A($(b).getElementsByTagName('*')).select(function(c){return Element.hasClassName(c,d)});}
Array.prototype.call=function(){var b=arguments;this.each(function(f){f.apply(this,b)});}
var Effect={tagifyText:function(g){var h='position:relative';if(/MSIE/.test(navigator.userAgent))h+=';zoom:1';g=$(g);$A(g.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(b){g.insertBefore(Builder.node('span',{style:h},b==' '?String.fromCharCode(160):b),c);});Element.remove(c);}});},multiple:function(d,e){var f;if(((typeof d=='object')||(typeof d=='function'))&&(d.length))
f=d;else
f=$(d).childNodes;var g=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var h=g.delay;$A(f).each(function(b,c){new e(b,Object.extend(g,{delay:c*g.speed+h}));});}};var i=Effect;Effect.Transitions={}
Effect.Transitions.linear=function(b){return b;}
Effect.Transitions.sinoidal=function(b){return(-Math.cos(b*Math.PI)/2)+0.5;}
Effect.Transitions.reverse=function(b){return 1-b;}
Effect.Transitions.flicker=function(b){return((-Math.cos(b*Math.PI)/4)+0.75)+Math.random()/4;}
Effect.Transitions.wobble=function(b){return(-Math.cos(b*Math.PI*(9*b))/2)+0.5;}
Effect.Transitions.pulse=function(b){return(Math.floor(b*10)%2==0?(b*10-Math.floor(b*10)):1-(b*10-Math.floor(b*10)));}
Effect.Transitions.none=function(b){return 0;}
Effect.Transitions.full=function(b){return 1;}
Effect.Queue={effects:[],_each:function(b){this.effects._each(b);},interval:null,add:function(b){var c=new Date().getTime();switch(b.options.queue){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=b.finishOn;e.finishOn+=b.finishOn;});break;case'end':c=this.effects.pluck('finishOn').max()||c;break;}
b.startOn+=c;b.finishOn+=c;this.effects.push(b);if(!this.interval)
this.interval=setInterval(this.loop.bind(this),40);},remove:function(b){this.effects=this.effects.reject(function(e){return e==b});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();this.effects.invoke('loop',timePos);}}
Object.extend(Effect.Queue,Enumerable);Effect.Base=function(){};Effect.Base.prototype={position:null,setOptions:function(b){this.options=Object.extend({transition:Effect.Transitions.sinoidal,duration:1.0,fps:25.0,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'},b||{});},start:function(b){this.setOptions(b||{});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.Queue.add(this);},loop:function(b){if(b>=this.startOn){if(b>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;}
var c=(b-this.startOn)/(this.finishOn-this.startOn);var d=Math.round(c*this.options.fps*this.options.duration);if(d>this.currentFrame){this.render(c);this.currentFrame=d;}}},render:function(b){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)b=this.options.transition(b);b*=(this.options.to-this.options.from);b+=this.options.from;this.position=b;this.event('beforeUpdate');if(this.update)this.update(b);this.event('afterUpdate');}},cancel:function(){if(!this.options.sync)Effect.Queue.remove(this);this.state='finished';},event:function(b){if(this.options[b+'Internal'])this.options[b+'Internal'](this);if(this.options[b])this.options[b](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(b){this.effects=b||[];this.start(arguments[1]);},update:function(b){this.effects.invoke('render',b);},finish:function(c){this.effects.each(function(b){b.render(1.0);b.cancel();b.event('beforeFinish');if(b.finish)b.finish(c);b.event('afterFinish');});}});Effect.Opacity=Class.create();Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);if(/MSIE/.test(navigator.userAgent)&&(!this.element.hasLayout))
Element.setStyle(this.element,{zoom:1});var c=Object.extend({from:Element.getOpacity(this.element)||0.0,to:1.0},arguments[1]||{});this.start(c);},update:function(b){Element.setOpacity(this.element,b);}});Effect.MoveBy=Class.create();Object.extend(Object.extend(Effect.MoveBy.prototype,Effect.Base.prototype),{initialize:function(b,c,d){this.element=$(b);this.toTop=c;this.toLeft=d;this.start(arguments[3]);},setup:function(){Element.makePositioned(this.element);this.originalTop=parseFloat(Element.getStyle(this.element,'top')||'0');this.originalLeft=parseFloat(Element.getStyle(this.element,'left')||'0');},update:function(b){Element.setStyle(this.element,{top:this.toTop*b+this.originalTop+'px',left:this.toLeft*b+this.originalLeft+'px'});}});Effect.Scale=Class.create();Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(b,c){this.element=$(b)
var d=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:c},arguments[2]||{});this.start(d);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=Element.getStyle(this.element,'position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var d=Element.getStyle(this.element,'font-size')||'100%';['em','px','%'].each(function(b){if(d.indexOf(b)>0){this.fontSize=parseFloat(d);this.fontSizeType=b;}}.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(b){var c=(this.options.scaleFrom/100.0)+(this.factor*b);if(this.options.scaleContent&&this.fontSize)
Element.setStyle(this.element,{fontSize:this.fontSize*c+this.fontSizeType});this.setDimensions(this.dims[0]*c,this.dims[1]*c);},finish:function(b){if(this.restoreAfterFinish)Element.setStyle(this.element,this.originalStyle);},setDimensions:function(b,c){var d={};if(this.options.scaleX)d.width=c+'px';if(this.options.scaleY)d.height=b+'px';if(this.options.scaleFromCenter){var f=(b-this.dims[0])/2;var g=(c-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-f+'px';if(this.options.scaleX)d.left=this.originalLeft-g+'px';}else{if(this.options.scaleY)d.top=-f+'px';if(this.options.scaleX)d.left=-g+'px';}}
Element.setStyle(this.element,d);}});Effect.Highlight=Class.create();Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);var c=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(c);},setup:function(){if(Element.getStyle(this.element,'display')=='none'){this.cancel();return;}
this.oldStyle={backgroundImage:Element.getStyle(this.element,'background-image')};Element.setStyle(this.element,{backgroundImage:'none'});if(!this.options.endcolor)
this.options.endcolor=Element.getStyle(this.element,'background-color').parseColor('#ffffff');if(!this.options.restorecolor)
this.options.restorecolor=Element.getStyle(this.element,'background-color');this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(b){Element.setStyle(this.element,{backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+(Math.round(this._base[i]+(this._delta[i]*b)).toColorPart());}.bind(this))});},finish:function(){Element.setStyle(this.element,Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=Class.create();Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);this.start(arguments[1]||{});},setup:function(){Position.prepare();var b=Position.cumulativeOffset(this.element);if(this.options.offset)b[1]+=this.options.offset;var c=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-
(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);this.scrollStart=Position.deltaY;this.delta=(b[1]>c?c:b[1])-this.scrollStart;},update:function(b){Position.prepare();window.scrollTo(Position.deltaX,this.scrollStart+(b*this.delta));}});Effect.Fade=function(c){var d=Element.getInlineOpacity(c);var e=Object.extend({from:Element.getOpacity(c)||1.0,to:0.0,afterFinishInternal:function(b){with(Element){if(b.options.to!=0)return;hide(b.element);setStyle(b.element,{opacity:d});}}},arguments[1]||{});return new Effect.Opacity(c,e);}
Effect.Appear=function(c){var d=Object.extend({from:(Element.getStyle(c,'display')=='none'?0.0:Element.getOpacity(c)||0.0),to:1.0,beforeSetup:function(b){with(Element){setOpacity(b.element,b.options.from);show(b.element);}}},arguments[1]||{});return new Effect.Opacity(c,d);}
Effect.Puff=function(c){c=$(c);var d={opacity:Element.getInlineOpacity(c),position:Element.getStyle(c,'position')};return new Effect.Parallel([new Effect.Scale(c,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(c,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(b){with(Element){setStyle(b.effects[0].element,{position:'absolute'});}},afterFinishInternal:function(b){with(Element){hide(b.effects[0].element);setStyle(b.effects[0].element,d);}}},arguments[1]||{}));}
Effect.BlindUp=function(c){c=$(c);Element.makeClipping(c);return new Effect.Scale(c,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(b){with(Element){[hide,undoClipping].call(b.element);}}},arguments[1]||{}));}
Effect.BlindDown=function(c){c=$(c);var e=Element.getStyle(c,'height');var f=Element.getDimensions(c);return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:f.height,originalWidth:f.width},restoreAfterFinish:true,afterSetup:function(b){with(Element){makeClipping(b.element);setStyle(b.element,{height:'0px'});show(b.element);}},afterFinishInternal:function(b){with(Element){undoClipping(b.element);setStyle(b.element,{height:e});}}},arguments[1]||{}));}
Effect.SwitchOff=function(d){d=$(d);var e=Element.getInlineOpacity(d);return new Effect.Appear(d,{duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(c){new Effect.Scale(c.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(b){with(Element){[makePositioned,makeClipping].call(b.element);}},afterFinishInternal:function(b){with(Element){[hide,undoClipping,undoPositioned].call(b.element);setStyle(b.element,{opacity:e});}}})}});}
Effect.DropOut=function(c){c=$(c);var d={top:Element.getStyle(c,'top'),left:Element.getStyle(c,'left'),opacity:Element.getInlineOpacity(c)};return new Effect.Parallel([new Effect.MoveBy(c,100,0,{sync:true}),new Effect.Opacity(c,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(b){with(Element){makePositioned(b.effects[0].element);}},afterFinishInternal:function(b){with(Element){[hide,undoPositioned].call(b.effects[0].element);setStyle(b.effects[0].element,d);}}},arguments[1]||{}));}
Effect.Shake=function(h){h=$(h);var i={top:Element.getStyle(h,'top'),left:Element.getStyle(h,'left')};return new Effect.MoveBy(h,0,20,{duration:0.05,afterFinishInternal:function(g){new Effect.MoveBy(g.element,0,-40,{duration:0.1,afterFinishInternal:function(f){new Effect.MoveBy(f.element,0,40,{duration:0.1,afterFinishInternal:function(e){new Effect.MoveBy(e.element,0,-40,{duration:0.1,afterFinishInternal:function(d){new Effect.MoveBy(d.element,0,40,{duration:0.1,afterFinishInternal:function(c){new Effect.MoveBy(c.element,0,-20,{duration:0.05,afterFinishInternal:function(b){with(Element){undoPositioned(b.element);setStyle(b.element,i);}}})}})}})}})}})}});}
Effect.SlideDown=function(c){c=$(c);Element.cleanWhitespace(c);var f=Element.getStyle(c.firstChild,'bottom');var g=Element.getDimensions(c);return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:g.height,originalWidth:g.width},restoreAfterFinish:true,afterSetup:function(b){with(Element){makePositioned(b.element);makePositioned(b.element.firstChild);if(window.opera)setStyle(b.element,{top:''});makeClipping(b.element);setStyle(b.element,{height:'0px'});show(c);}},afterUpdateInternal:function(b){with(Element){setStyle(b.element.firstChild,{bottom:(b.dims[0]-b.element.clientHeight)+'px'});}},afterFinishInternal:function(b){with(Element){undoClipping(b.element);undoPositioned(b.element.firstChild);undoPositioned(b.element);setStyle(b.element.firstChild,{bottom:f});}}},arguments[1]||{}));}
Effect.SlideUp=function(d){d=$(d);Element.cleanWhitespace(d);var e=Element.getStyle(d.firstChild,'bottom');return new Effect.Scale(d,0,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(b){with(Element){makePositioned(b.element);makePositioned(b.element.firstChild);if(window.opera)setStyle(b.element,{top:''});makeClipping(b.element);show(d);}},afterUpdateInternal:function(b){with(Element){setStyle(b.element.firstChild,{bottom:(b.dims[0]-b.element.clientHeight)+'px'});}},afterFinishInternal:function(b){with(Element){[hide,undoClipping].call(b.element);undoPositioned(b.element.firstChild);undoPositioned(b.element);setStyle(b.element.firstChild,{bottom:e});}}},arguments[1]||{}));}
Effect.Squish=function(c){return new Effect.Scale(c,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){with(Element){makeClipping(b.element);}},afterFinishInternal:function(b){with(Element){hide(b.element);undoClipping(b.element);}}});}
Effect.Grow=function(e){e=$(e);var f=Object.extend({direction:'center',moveTransistion:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var g={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:Element.getInlineOpacity(e)};var h=Element.getDimensions(e);var i,initialMoveY;var j,moveY;switch(f.direction){case'top-left':i=initialMoveY=j=moveY=0;break;case'top-right':i=h.width;initialMoveY=moveY=0;j=-h.width;break;case'bottom-left':i=j=0;initialMoveY=h.height;moveY=-h.height;break;case'bottom-right':i=h.width;initialMoveY=h.height;j=-h.width;moveY=-h.height;break;case'center':i=h.width/2;initialMoveY=h.height/2;j=-h.width/2;moveY=-h.height/2;break;}
return new Effect.MoveBy(e,initialMoveY,i,{duration:0.01,beforeSetup:function(b){with(Element){hide(b.element);makeClipping(b.element);makePositioned(b.element);}},afterFinishInternal:function(d){new Effect.Parallel([new Effect.Opacity(d.element,{sync:true,to:1.0,from:0.0,transition:f.opacityTransition}),new Effect.MoveBy(d.element,moveY,j,{sync:true,transition:f.moveTransition}),new Effect.Scale(d.element,100,{scaleMode:{originalHeight:h.height,originalWidth:h.width},sync:true,scaleFrom:window.opera?1:0,transition:f.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(b){with(Element){setStyle(b.effects[0].element,{height:'0px'});show(b.effects[0].element);}},afterFinishInternal:function(b){with(Element){[undoClipping,undoPositioned].call(b.effects[0].element);setStyle(b.effects[0].element,g);}}},f))}});}
Effect.Shrink=function(c){c=$(c);var d=Object.extend({direction:'center',moveTransistion:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var e={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:Element.getInlineOpacity(c)};var f=Element.getDimensions(c);var g,moveY;switch(d.direction){case'top-left':g=moveY=0;break;case'top-right':g=f.width;moveY=0;break;case'bottom-left':g=0;moveY=f.height;break;case'bottom-right':g=f.width;moveY=f.height;break;case'center':g=f.width/2;moveY=f.height/2;break;}
return new Effect.Parallel([new Effect.Opacity(c,{sync:true,to:0.0,from:1.0,transition:d.opacityTransition}),new Effect.Scale(c,window.opera?1:0,{sync:true,transition:d.scaleTransition,restoreAfterFinish:true}),new Effect.MoveBy(c,moveY,g,{sync:true,transition:d.moveTransition})],Object.extend({beforeStartInternal:function(b){with(Element){[makePositioned,makeClipping].call(b.effects[0].element)}},afterFinishInternal:function(b){with(Element){[hide,undoClipping,undoPositioned].call(b.effects[0].element);setStyle(b.effects[0].element,e);}}},d));}
Effect.Pulsate=function(c){c=$(c);var d=arguments[1]||{};var e=Element.getInlineOpacity(c);var f=d.transition||Effect.Transitions.sinoidal;var g=function(b){return f(1-Effect.Transitions.pulse(b))};g.bind(f);return new Effect.Opacity(c,Object.extend(Object.extend({duration:3.0,from:0,afterFinishInternal:function(b){Element.setStyle(b.element,{opacity:e});}},d),{f:g}));}
Effect.Fold=function(d){d=$(d);var e={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(c){new Effect.Scale(d,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(b){with(Element){[hide,undoClipping].call(b.element);setStyle(b.element,e);}}});}},arguments[1]||{}));}
