Element.collectTextNodes=function(_1){
return $A($(_1).childNodes).collect(function(_2){
return (_2.nodeType==3?_2.nodeValue:(_2.hasChildNodes()?Element.collectTextNodes(_2):""));
}).flatten().join("");
};
Element.collectTextNodesIgnoreClass=function(_3,_4){
return $A($(_3).childNodes).collect(function(_5){
return (_5.nodeType==3?_5.nodeValue:((_5.hasChildNodes()&&!Element.hasClassName(_5,_4))?Element.collectTextNodesIgnoreClass(_5,_4):""));
}).flatten().join("");
};
Element.setContentZoom=function(_6,_7){
_6=$(_6);
Element.setStyle(_6,{fontSize:(_7/100)+"em"});
if(navigator.appVersion.indexOf("AppleWebKit")>0){
window.scrollBy(0,0);
}
};
Element.getOpacity=function(_8){
var _9;
if(_9=Element.getStyle(_8,"opacity")){
return parseFloat(_9);
}
if(_9=(Element.getStyle(_8,"filter")||"").match(/alpha\(opacity=(.*)\)/)){
if(_9[1]){
return parseFloat(_9[1])/100;
}
}
return 1;
};
Element.setOpacity=function(_a,_b){
_a=$(_a);
if(_b==1){
Element.setStyle(_a,{opacity:(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:null});
if(/MSIE/.test(navigator.userAgent)){
Element.setStyle(_a,{filter:Element.getStyle(_a,"filter").replace(/alpha\([^\)]*\)/gi,"")});
}
}else{
if(_b<0.00001){
_b=0;
}
Element.setStyle(_a,{opacity:_b});
if(/MSIE/.test(navigator.userAgent)){
Element.setStyle(_a,{filter:Element.getStyle(_a,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+_b*100+")"});
}
}
};
Element.getInlineOpacity=function(_c){
return $(_c).style.opacity||"";
};
Element.childrenWithClassName=function(_d,_e,_f){
var _10=new RegExp("(^|\\s)"+_e+"(\\s|$)");
var _11=$A($(_d).getElementsByTagName("*"))[_f?"detect":"select"](function(c){
return (c.className&&c.className.match(_10));
});
if(!_11){
_11=[];
}
return _11;
};
Element.forceRerendering=function(_13){
try{
_13=$(_13);
var n=document.createTextNode(" ");
_13.appendChild(n);
_13.removeChild(n);
}
catch(e){
}
};
Array.prototype.call=function(){
var _15=arguments;
this.each(function(f){
f.apply(this,_15);
});
};
var Effect={tagifyText:function(_17){
var _18="position:relative";
if(/MSIE/.test(navigator.userAgent)){
_18+=";zoom:1";
}
_17=$(_17);
$A(_17.childNodes).each(function(_19){
if(_19.nodeType==3){
_19.nodeValue.toArray().each(function(_1a){
_17.insertBefore(Builder.node("span",{style:_18},_1a==" "?String.fromCharCode(160):_1a),_19);
});
Element.remove(_19);
}
});
},multiple:function(_1b,_1c){
var _1d;
if(((typeof _1b=="object")||(typeof _1b=="function"))&&(_1b.length)){
_1d=_1b;
}else{
_1d=$(_1b).childNodes;
}
var _1e=Object.extend({speed:0.1,delay:0},arguments[2]||{});
var _1f=_1e.delay;
$A(_1d).each(function(_20,_21){
new _1c(_20,Object.extend(_1e,{delay:_21*_1e.speed+_1f}));
});
},PAIRS:{"slide":["SlideDown","SlideUp"],"blind":["BlindDown","BlindUp"],"appear":["Appear","Fade"]},toggle:function(_22,_23){
_22=$(_22);
_23=(_23||"appear").toLowerCase();
var _24=Object.extend({queue:{position:"end",scope:(_22.id||"global"),limit:1}},arguments[2]||{});
Effect[_22.visible()?Effect.PAIRS[_23][1]:Effect.PAIRS[_23][0]](_22,_24);
}};
var Effect2=Effect;
Effect.Transitions={};
Effect.Transitions.linear=function(pos){
return pos;
};
Effect.Transitions.sinoidal=function(pos){
return (-Math.cos(pos*Math.PI)/2)+0.5;
};
Effect.Transitions.reverse=function(pos){
return 1-pos;
};
Effect.Transitions.flicker=function(pos){
return ((-Math.cos(pos*Math.PI)/4)+0.75)+Math.random()/4;
};
Effect.Transitions.wobble=function(pos){
return (-Math.cos(pos*Math.PI*(9*pos))/2)+0.5;
};
Effect.Transitions.pulse=function(pos){
return (Math.floor(pos*10)%2==0?(pos*10-Math.floor(pos*10)):1-(pos*10-Math.floor(pos*10)));
};
Effect.Transitions.none=function(pos){
return 0;
};
Effect.Transitions.full=function(pos){
return 1;
};
Effect.ScopedQueue=Class.create();
Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize:function(){
this.effects=[];
this.interval=null;
},_each:function(_2d){
this.effects._each(_2d);
},add:function(_2e){
var _2f=new Date().getTime();
var _30=(typeof _2e.options.queue=="string")?_2e.options.queue:_2e.options.queue.position;
switch(_30){
case "front":
this.effects.findAll(function(e){
return e.state=="idle";
}).each(function(e){
e.startOn+=_2e.finishOn;
e.finishOn+=_2e.finishOn;
});
break;
case "end":
_2f=this.effects.pluck("finishOn").max()||_2f;
break;
}
_2e.startOn+=_2f;
_2e.finishOn+=_2f;
if(!_2e.options.queue.limit||(this.effects.length<_2e.options.queue.limit)){
this.effects.push(_2e);
}
if(!this.interval){
this.interval=setInterval(this.loop.bind(this),40);
}
},remove:function(_33){
this.effects=this.effects.reject(function(e){
return e==_33;
});
if(this.effects.length==0){
clearInterval(this.interval);
this.interval=null;
}
},loop:function(){
var _35=new Date().getTime();
this.effects.invoke("loop",_35);
}});
Effect.Queues={instances:$H(),get:function(_36){
if(typeof _36!="string"){
return _36;
}
if(!this.instances[_36]){
this.instances[_36]=new Effect.ScopedQueue();
}
return this.instances[_36];
}};
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(_37){
this.options=Object.extend(Object.extend({},Effect.DefaultOptions),_37||{});
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(_38){
if(_38>=this.startOn){
if(_38>=this.finishOn){
this.render(1);
this.cancel();
this.event("beforeFinish");
if(this.finish){
this.finish();
}
this.event("afterFinish");
return;
}
var pos=(_38-this.startOn)/(this.finishOn-this.startOn);
var _3a=Math.round(pos*this.options.fps*this.options.duration);
if(_3a>this.currentFrame){
this.render(pos);
this.currentFrame=_3a;
}
}
},render:function(pos){
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){
pos=this.options.transition(pos);
}
pos*=(this.options.to-this.options.from);
pos+=this.options.from;
this.position=pos;
this.event("beforeUpdate");
if(this.update){
this.update(pos);
}
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(_3c){
if(this.options[_3c+"Internal"]){
this.options[_3c+"Internal"](this);
}
if(this.options[_3c]){
this.options[_3c](this);
}
},inspect:function(){
return "#<Effect:"+$H(this).inspect()+",options:"+$H(this.options).inspect()+">";
}};
Effect.Scale=Class.create();
Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(_3d,_3e){
this.element=$(_3d);
var _3f=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:_3e},arguments[2]||{});
this.start(_3f);
},setup:function(){
this.restoreAfterFinish=this.options.restoreAfterFinish||false;
this.elementPositioning=this.element.getStyle("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 _41=this.element.getStyle("font-size")||"100%";
["em","px","%"].each(function(_42){
if(_41.indexOf(_42)>0){
this.fontSize=parseFloat(_41);
this.fontSizeType=_42;
}
}.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(_43){
var _44=(this.options.scaleFrom/100)+(this.factor*_43);
if(this.options.scaleContent&&this.fontSize){
this.element.setStyle({fontSize:this.fontSize*_44+this.fontSizeType});
}
this.setDimensions(this.dims[0]*_44,this.dims[1]*_44);
},finish:function(_45){
if(this.restoreAfterFinish){
this.element.setStyle(this.originalStyle);
}
},setDimensions:function(_46,_47){
var d={};
if(this.options.scaleX){
d.width=_47+"px";
}
if(this.options.scaleY){
d.height=_46+"px";
}
if(this.options.scaleFromCenter){
var _49=(_46-this.dims[0])/2;
var _4a=(_47-this.dims[1])/2;
if(this.elementPositioning=="absolute"){
if(this.options.scaleY){
d.top=this.originalTop-_49+"px";
}
if(this.options.scaleX){
d.left=this.originalLeft-_4a+"px";
}
}else{
if(this.options.scaleY){
d.top=-_49+"px";
}
if(this.options.scaleX){
d.left=-_4a+"px";
}
}
}
this.element.setStyle(d);
}});
Effect.SlideDown=function(_4b,_4c){
_4b=$(_4b);
_4b.cleanWhitespace();
var _4d=$(_4b.firstChild).getStyle("bottom");
var _4e=_4b.getDimensions();
return new Effect.Scale(_4b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:_4e.height,originalWidth:_4e.width},restoreAfterFinish:true,afterSetup:function(_4f){
_4f.element.makePositioned();
_4f.element.firstChild.makePositioned();
if(window.opera){
_4f.element.setStyle({top:""});
}
_4f.element.makeClipping();
_4f.element.setStyle({height:"0px"});
document.getElementById(_4c).style.visibility="visible";
_4f.element.show();
},afterUpdateInternal:function(_50){
_50.element.firstChild.setStyle({bottom:(_50.dims[0]-_50.element.clientHeight)+"px"});
},afterFinishInternal:function(_51){
_51.element.undoClipping();
if(/MSIE/.test(navigator.userAgent)){
_51.element.undoPositioned();
_51.element.firstChild.undoPositioned();
}else{
_51.element.firstChild.undoPositioned();
_51.element.undoPositioned();
}
_51.element.firstChild.setStyle({bottom:_4d});
}},arguments[1]||{}));
};
Effect.SlideUp=function(_52,_53){
_52=$(_52);
_52.cleanWhitespace();
var _54=$(_52.firstChild).getStyle("bottom");
return new Effect.Scale(_52,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(_55){
_55.element.makePositioned();
_55.element.firstChild.makePositioned();
if(window.opera){
_55.element.setStyle({top:""});
}
_55.element.makeClipping();
_55.element.show();
},afterUpdateInternal:function(_56){
_56.element.firstChild.setStyle({bottom:(_56.dims[0]-_56.element.clientHeight)+"px"});
},afterFinishInternal:function(_57){
_57.element.hide();
_57.element.undoClipping();
_57.element.firstChild.undoPositioned();
_57.element.undoPositioned();
_57.element.setStyle({bottom:_54});
}},arguments[1]||{}));
};
Element.addMethods();


