Effect.PAIRS=Object.extend(Effect.PAIRS,{slidedown:["SlideDownIn","SlideDownOut"],slideup:["SlideUpIn","SlideUpOut"],slideleft:["SlideLeftIn","SlideLeftOut"],slideright:["SlideRightIn","SlideRightOut"],curtain:["CurtainClose","CurtainOpen"]});Object.extend(Effect,{_elementIsNotAListError:{name:"ElementIsNotAListError",message:"The specified DOM element is not a list exist, but is required to be for this effect to operate"}});Effect.PulseList=Class.create();Object.extend(Object.extend(Effect.PulseList.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}if(!["UL","OL"].include(this.element.tagName)){throw (Effect._elementIsNotAListError)}if(!this.element.effectOn){this.element.effectOn=true;var a=Object.extend({_pulse:1,direction:"down",pulses:1,continuous:false,bounce:false,duration:2,min_opacity:0.1},arguments[1]||{});this.start(a)}},setup:function(){var c=this.element.immediateDescendants().size();var b=1;var a=this;this.element.immediateDescendants().each(function(f){var d=(a.options.direction=="down")?(b++-1)/c:(c-b++)/c;var e=function(g){return Effect.Transitions.sinoidal(1-Effect.Transitions.pulse(g,1))};new Effect.Opacity(f,Object.extend(Object.extend({delay:d,duration:a.options.duration,from:a.options.min_opacity,afterFinishInternal:function(g){if(!(a.options.direction=="down"?f.next():f.previous())){if((a.options.continuous)||(a.options._pulse++<a.options.pulses)){if(a.options.bounce){a.options.direction=(a.options.direction=="up")?"down":"up"}new Effect.PulseList(g.element.parentNode,a.options||{})}}}},{}),{transition:e}))})},finish:function(){this.element.effectOn=false}});Effect.Gradient=Class.create();Object.extend(Object.extend(Effect.Gradient.prototype,Effect.Base.prototype),{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({duration:5,rows:10,cols:10,type:"diagonal",colors:["black","white","white","black"]},arguments[1]||{});if(b.type=="horizontal"){b.rows=1}else{if(b.type=="vertical"){b.cols=1}}dims=this.element.getDimensions();cellwidth=dims.width/b.cols;cellheight=dims.height/b.rows;this.cellids=[];var a=this;this.table=Builder.node("table",{border:0,cellpadding:0,cellspacing:0,style:"margin: 0px; padding: 0px;"});tbody=Builder.node("tbody");$(tbody).setStyle({margin:0,padding:0});$R(1,b.rows).each(function(d){tr=Builder.node("tr");$(tr).setStyle({margin:0,padding:0});if(b.type=="vertical"){cellcolor=Color.shade(Color.string2hex(b.colors[0]),Color.string2hex(b.colors[1]),(d-1)/(b.rows-1))}$R(1,b.cols).each(function(e){cellid="grcell-"+d+"-"+e;if(b.type=="diagonal"){cellcolor=Color.shade(Color.shade(Color.string2hex(b.colors[0]),Color.string2hex(b.colors[1]),(e-1)/(b.cols-1)),Color.shade(Color.string2hex(b.colors[2]),Color.string2hex(b.colors[3]),(e-1)/(b.cols-1)),(d-1)/(b.rows-1))}else{if(b.type=="horizontal"){cellcolor=Color.shade(Color.string2hex(b.colors[0]),Color.string2hex(b.colors[1]),(e-1)/(b.cols-1))}}td=Builder.node("td",{id:cellid},"");$(td).setStyle({margin:"0px",padding:"0px",height:cellheight+"px",width:cellwidth+"px",backgroundColor:cellcolor});tr.appendChild(td);a.cellids.push(cellid)});tbody.appendChild(tr)});this.table.appendChild(tbody);this.start(b)},setup:function(){Position.absolutize(this.element);this.element.parentNode.appendChild(this.table);Position.absolutize(this.table)},finish:function(){new Effect.Fade(this.table,{afterFinish:function(a){a.element.parentNode.removeChild(a.element)}})}});Effect.ORIGGradient=Class.create();Object.extend(Object.extend(Effect.ORIGGradient.prototype,Effect.Base.prototype),{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({duration:5,rows:10,cols:10,type:"diagonal",colors:["black","white","white","black"]},arguments[1]||{});if(b.type=="horizontal"){b.rows=1}else{if(b.type=="vertical"){b.cols=1}}dims=this.element.getDimensions();cellwidth=dims.width/b.cols;cellheight=dims.height/b.rows;this.cellids=[];var a=this;this.table=Builder.node("table",{border:0,cellpadding:0,cellspacing:0,style:"margin: 0px; padding: 0px;"});tbody=Builder.node("tbody",{style:"margin: 0px; padding: 0px;"});$R(1,b.rows).each(function(d){tr=Builder.node("tr",{style:"margin: 0px; padding: 0px;"});if(b.type=="vertical"){cellcolor=Color.shade(Color.string2hex(b.colors[0]),Color.string2hex(b.colors[1]),(d-1)/(b.rows-1))}$R(1,b.cols).each(function(e){cellid="grcell-"+d+"-"+e;if(b.type=="diagonal"){cellcolor=Color.shade(Color.shade(Color.string2hex(b.colors[0]),Color.string2hex(b.colors[1]),(e-1)/(b.cols-1)),Color.shade(Color.string2hex(b.colors[2]),Color.string2hex(b.colors[3]),(e-1)/(b.cols-1)),(d-1)/(b.rows-1))}else{if(b.type=="horizontal"){cellcolor=Color.shade(Color.string2hex(b.colors[0]),Color.string2hex(b.colors[1]),(e-1)/(b.cols-1))}}td=Builder.node("td",{id:cellid,style:"margin: 0px; padding: 0px; height: "+cellheight+"px; width: "+cellwidth+"px; background-color: "+cellcolor},"");tr.appendChild(td);a.cellids.push(cellid)});tbody.appendChild(tr)});this.table.appendChild(tbody);Position.absolutize(this.element);this.element.parentNode.appendChild(this.table);Position.absolutize(this.table);this.start(b)},finish:function(){new Effect.Fade(this.table,{afterFinish:function(a){a.element.parentNode.removeChild(a.element)}})}});Effect.Pixelate=Class.create();Object.extend(Object.extend(Effect.Pixelate.prototype,Effect.Base.prototype),{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({duration:5,rows:30,cols:30,startcolor:"transparent",endcolor:"white"},arguments[1]||{});b.cells=b.rows*b.cols;dims=this.element.getDimensions();cellwidth=dims.width/b.cols;cellheight=dims.height/b.rows;this.cellids=[];this.table=Builder.node("table",{border:0,cellpadding:0,cellspacing:0,style:"margin: 0px; padding: 0px;"});var a=this;tbody=Builder.node("tbody");$(tbody).setStyle({margin:0,padding:0});$R(1,b.rows).each(function(d){tr=Builder.node("tr");$(tr).setStyle({margin:"0px",padding:"0px"});$R(1,b.cols).each(function(e){cellid="pxcell-"+d+"-"+e;td=Builder.node("td",{id:cellid},"");$(td).setStyle({margin:"0px",padding:"0px",height:cellheight+"px",width:cellwidth+"px",backgroundColor:b.startcolor});tr.appendChild(td);a.cellids.push(cellid)});tbody.appendChild(tr)});this.cellids.sort(function(e,d){return(0.5-Math.random())});this.table.appendChild(tbody);this.start(b)},setup:function(){Position.absolutize(this.element);this.element.parentNode.appendChild(this.table);Position.absolutize(this.table)},update:function(a){while(this.cellids.size()&&(this.cellids.size()/this.options.cells)>(1-a)){$(this.cellids.pop()).setStyle({backgroundColor:this.options.endcolor})}},finish:function(){new Effect.Fade(this.table,{afterFinish:function(a){a.element.parentNode.removeChild(a.element)}})}});Effect.Duplicate=Class.create();Object.extend(Object.extend(Effect.Duplicate.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}this.element.makePositioned();this.elecopy=this.element.cloneNode(true);this.elecopy.setStyle({color:"red",backgroundColor:"red",backgroundImage:""});this.elecopy.id=b.id+"-copy";this.element.parentNode.appendChild(this.elecopy);Position.relativize(this.element);Position.relativize(this.elecopy);Position.absolutize(this.element);Position.absolutize(this.elecopy);var a=Object.extend({},arguments[1]||{});this.start(a)},asetup:function(){return new Effect.Parallel([new Effect.SlideRightIn(this.element,{sync:true}),new Effect.SlideLeftIn(this.elecopy,{sync:true})],Object.extend({duration:2},arguments[1]||{}))},update:function(a){},finish:function(){this.elecopy.undoClipping().undoPositioned().remove()}});Effect.Flicker=Class.create();Object.extend(Object.extend(Effect.Flicker.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}if(!this.element.effectOn){this.element.effectOn=true;var a=Object.extend({threshold:0.5,endvisibility:"visible"},arguments[1]||{});this.start(a)}},update:function(a){var b=(Math.random()<this.options.threshold)?"hidden":"visible";this.element.setStyle({visibility:b})},finish:function(){this.element.setStyle({visibility:this.options.endvisibility});this.element.effectOn=false}});Effect.CurtainClose=function(b){b=$(b).cleanWhitespace();var a=b.getDimensions();b.makeClipping().makePositioned();b.parentNode.makeClipping();elecopy=$(b.cloneNode(true));elecopy.setStyle({top:"0px",left:"0px"});elecopy.id=b.id+"-copy";b.parentNode.appendChild(elecopy);elecopy.makeClipping().makePositioned();Position.absolutize(b);return new Effect.Parallel([new Effect.SlideRightIn(b,{sync:true}),new Effect.SlideLeftIn(elecopy,{sync:true})],Object.extend({duration:2,afterFinishInternal:function(c){elecopy.undoClipping().undoPositioned().remove();c.effects[0].element.parentNode.undoClipping()}},arguments[1]||{}))};Effect.CurtainOpen=function(b){b=$(b).cleanWhitespace();b.makeClipping().makePositioned();b.parentNode.makeClipping();elecopy=b.cloneNode(true);elecopy.setStyle({top:"0px"});elecopy.id=b.id+"-copy";b.parentNode.appendChild(elecopy);Position.absolutize(b);Position.absolutize(elecopy);var a=b.getDimensions();return new Effect.Parallel([new Effect.SlideRightOut(b,{sync:true}),new Effect.SlideLeftOut(elecopy,{sync:true})],Object.extend({duration:2,beforeSetup:function(c){c.effects[1].element.makeClipping().makePositioned().show()},afterFinishInternal:function(c){b.undoClipping().undoPositioned();c.effects[1].element.parentNode.undoClipping();c.effects[1].element.undoClipping().undoPositioned().remove()}},arguments[1]||{}))};Effect.SlideLeftIn=function(b){b=$(b).cleanWhitespace();if(!b.effectOn){b.effectOn=true;var a=b.getDimensions();return new Effect.Parallel([new Effect.Move(b,Object.extend({x:-(a.width),sync:true,mode:"relative",beforeStartInternal:function(c){if(window.opera){c.element.setStyle({left:""})}c.element.setStyle({left:a.width+"px"});c.element.show()}},arguments[1]||{})),new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleY:false,scaleFrom:window.opera?0:1},arguments[1]||{}))],Object.extend({beforeSetup:function(c){c.effects[0].element.parentNode.makeClipping();c.effects[0].element.makeClipping()},afterFinishInternal:function(c){c.effects[0].element.parentNode.undoClipping();c.effects[0].element.undoClipping()},afterFinish:function(c){c.effects[0].element.effectOn=false}},arguments[1]||{}))}};Effect.SlideRightOut=function(b){b=$(b).cleanWhitespace();var a=b.getDimensions();return new Effect.Parallel([new Effect.Move(b,{x:b.getWidth(),sync:true,mode:"relative"}),new Effect.Scale(b,window.opera?0:1,{sync:true,scaleContent:false,scaleY:false,scaleFrom:100,restoreAfterFinish:true})],Object.extend({beforeSetup:function(c){c.effects[0].element.makeClipping()},afterFinishInternal:function(c){c.effects[0].element.undoClipping().hide()}},arguments[1]||{}))};Effect.SlideLeftOut=function(a){a=$(a).cleanWhitespace();return new Effect.Scale(a,window.opera?0:1,Object.extend({scaleContent:false,scaleY:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(b){b.element.makePositioned();b.element.down().makePositioned();if(window.opera){b.element.setStyle({left:""})}b.element.makeClipping().show()},afterUpdateInternal:function(b){b.element.down().setStyle({right:(b.dims[1]-b.element.clientWidth)+"px"})},afterFinishInternal:function(b){b.element.hide().undoClipping().undoPositioned();b.element.down().undoPositioned()}},arguments[1]||{}))};Effect.SlideRightIn=function(b){b=$(b).cleanWhitespace();var a=b.getDimensions();return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleY:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(c){c.element.makePositioned();c.element.down().makePositioned();if(window.opera){c.element.setStyle({left:""})}c.element.makeClipping().setStyle({width:"0px"}).show()},afterUpdateInternal:function(c){c.element.down().setStyle({right:(c.dims[1]-c.element.clientWidth)+"px"})},afterFinishInternal:function(c){c.element.undoClipping().undoPositioned();c.element.down().undoPositioned()}},arguments[1]||{}))};Effect.SlideUpIn=function(b){b=$(b).cleanWhitespace();var a=b.getDimensions();return new Effect.Parallel([new Effect.Move(b,{y:-(b.getHeight()),sync:true,mode:"relative"}),new Effect.Scale(b,100,Object.extend({sync:true,scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},beforeSetup:function(c){c.element.hide()},afterSetup:function(c){c.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(c){c.element.undoClipping()}},arguments[1]||{}))],Object.extend({afterSetup:function(c){c.effects[0].element.setStyle({top:a.height+"px"})}},arguments[1]||{}))};Effect.SlideDownOut=function(b){b=$(b).cleanWhitespace();var a=b.getDimensions();return new Effect.Parallel([new Effect.Move(b,{y:b.getHeight(),sync:true,mode:"relative"}),new Effect.Scale(b,0,Object.extend({sync:true,scaleContent:false,scaleX:false,restoreAfterFinish:true,beforeSetup:function(c){c.element.makeClipping()},afterFinishInternal:function(c){c.element.hide().undoClipping()}},arguments[1]||{}))],Object.extend({},arguments[1]||{}))};Effect.SlideDownIn=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.SlideUpOut=function(b){b=$(b).cleanWhitespace();var a=b.down().getStyle("bottom");return new Effect.Scale(b,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(c){c.element.makePositioned();c.element.down().makePositioned();if(window.opera){c.element.setStyle({top:""})}c.element.makeClipping().show()},afterUpdateInternal:function(c){c.element.down().setStyle({bottom:(c.dims[0]-c.element.clientHeight)+"px"})},afterFinishInternal:function(c){c.element.hide().undoClipping().undoPositioned().setStyle({bottom:a});c.element.down().undoPositioned()}},arguments[1]||{}))};
