var Color=new Class({initialize:function(_370,type){
type=type||(_370.push?"rgb":"hex");
var rgb,hsb;
switch(type){
case "rgb":
rgb=_370;
hsb=rgb.rgbToHsb();
break;
case "hsb":
rgb=_370.hsbToRgb();
hsb=_370;
break;
default:
rgb=_370.hexToRgb(true);
hsb=rgb.rgbToHsb();
}
rgb.hsb=hsb;
rgb.hex=rgb.rgbToHex();
return $extend(rgb,Color.prototype);
},mix:function(){
var _373=$A(arguments);
var _374=($type(_373[_373.length-1])=="number")?_373.pop():50;
var rgb=this.copy();
_373.each(function(_376){
_376=new Color(_376);
for(var i=0;i<3;i++){
rgb[i]=Math.round((rgb[i]/100*(100-_374))+(_376[i]/100*_374));
}
});
return new Color(rgb,"rgb");
},invert:function(){
return new Color(this.map(function(_378){
return 255-_378;
}));
},setHue:function(_379){
return new Color([_379,this.hsb[1],this.hsb[2]],"hsb");
},setSaturation:function(_37a){
return new Color([this.hsb[0],_37a,this.hsb[2]],"hsb");
},setBrightness:function(_37b){
return new Color([this.hsb[0],this.hsb[1],_37b],"hsb");
}});
function $RGB(r,g,b){
return new Color([r,g,b],"rgb");
}
function $HSB(h,s,b){
return new Color([h,s,b],"hsb");
}
Array.extend({rgbToHsb:function(){
var red=this[0],green=this[1],blue=this[2];
var hue,saturation,brightness;
var max=Math.max(red,green,blue),min=Math.min(red,green,blue);
var _385=max-min;
brightness=max/255;
saturation=(max!=0)?_385/max:0;
if(saturation==0){
hue=0;
}else{
var rr=(max-red)/_385;
var gr=(max-green)/_385;
var br=(max-blue)/_385;
if(red==max){
hue=br-gr;
}else{
if(green==max){
hue=2+rr-br;
}else{
hue=4+gr-rr;
}
}
hue/=6;
if(hue<0){
hue++;
}
}
return [Math.round(hue*360),Math.round(saturation*100),Math.round(brightness*100)];
},hsbToRgb:function(){
var br=Math.round(this[2]/100*255);
if(this[1]==0){
return [br,br,br];
}else{
var hue=this[0]%360;
var f=hue%60;
var p=Math.round((this[2]*(100-this[1]))/10000*255);
var q=Math.round((this[2]*(6000-this[1]*f))/600000*255);
var t=Math.round((this[2]*(6000-this[1]*(60-f)))/600000*255);
switch(Math.floor(hue/60)){
case 0:
return [br,t,p];
case 1:
return [q,br,p];
case 2:
return [p,br,t];
case 3:
return [p,q,br];
case 4:
return [t,p,br];
case 5:
return [br,p,q];
}
}
return false;
}});
var Hash=new Class({length:0,initialize:function(_38f){
this.obj=_38f||{};
this.setLength();
},get:function(key){
return (this.hasKey(key))?this.obj[key]:null;
},hasKey:function(key){
return (key in this.obj);
},set:function(key,_393){
if(!this.hasKey(key)){
this.length++;
}
this.obj[key]=_393;
return this;
},setLength:function(){
this.length=0;
for(var p in this.obj){
this.length++;
}
return this;
},remove:function(key){
if(this.hasKey(key)){
delete this.obj[key];
this.length--;
}
return this;
},each:function(fn,bind){
$each(this.obj,fn,bind);
},extend:function(obj){
$extend(this.obj,obj);
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 keys=[];
for(var _39a in this.obj){
keys.push(_39a);
}
return keys;
},values:function(){
var _39b=[];
for(var _39c in this.obj){
_39b.push(this.obj[_39c]);
}
return _39b;
}});
function $H(obj){
return new Hash(obj);
}
Hash.Cookie=Hash.extend({initialize:function(name,_39f){
this.name=name;
this.options=$extend({"autoSave":true},_39f||{});
this.load();
},save:function(){
if(this.length==0){
Cookie.remove(this.name,this.options);
return true;
}
var str=Json.toString(this.obj);
if(str.length>4096){
return false;
}
Cookie.set(this.name,str,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(_3a1){
Hash.Cookie.Methods[_3a1]=function(){
Hash.prototype[_3a1].apply(this,arguments);
if(this.options.autoSave){
this.save();
}
return this;
};
});
Hash.Cookie.implement(Hash.Cookie.Methods);
var Scroller=new Class({options:{area:20,velocity:1,onChange:function(x,y){
this.element.scrollTo(x,y);
}},initialize:function(_3a4,_3a5){
this.setOptions(_3a5);
this.element=$(_3a4);
this.mousemover=([window,document].contains(_3a4))?$(document.body):this.element;
},start:function(){
this.coord=this.getCoords.bindWithEvent(this);
this.mousemover.addListener("mousemove",this.coord);
},stop:function(){
this.mousemover.removeListener("mousemove",this.coord);
this.timer=$clear(this.timer);
},getCoords:function(_3a6){
this.page=(this.element==window)?_3a6.client:_3a6.page;
if(!this.timer){
this.timer=this.scroll.periodical(50,this);
}
},scroll:function(){
var el=this.element.getSize();
var pos=this.element.getPosition();
var _3a9={"x":0,"y":0};
for(var z in this.page){
if(this.page[z]<(this.options.area+pos[z])&&el.scroll[z]!=0){
_3a9[z]=(this.page[z]-this.options.area-pos[z])*this.options.velocity;
}else{
if(this.page[z]+this.options.area>(el.size[z]+pos[z])&&el.scroll[z]+el.size[z]!=el.scrollSize[z]){
_3a9[z]=(this.page[z]-el.size[z]+this.options.area-pos[z])*this.options.velocity;
}
}
}
if(_3a9.y||_3a9.x){
this.fireEvent("onChange",[el.scroll.x+_3a9.x,el.scroll.y+_3a9.y]);
}
}});
Scroller.implement(new Events,new Options);
var Slider=new Class({options:{onChange:Class.empty,onComplete:Class.empty,onTick:function(pos){
this.knob.setStyle(this.p,pos);
},mode:"horizontal",steps:100,offset:0},initialize:function(el,knob,_3ae){
this.element=$(el);
this.knob=$(knob);
this.setOptions(_3ae);
this.previousChange=-1;
this.previousEnd=-1;
this.step=-1;
this.element.addEvent("mousedown",this.clickedElement.bindWithEvent(this));
var mod,offset;
switch(this.options.mode){
case "horizontal":
this.z="x";
this.p="left";
mod={"x":"left","y":false};
offset="offsetWidth";
break;
case "vertical":
this.z="y";
this.p="top";
mod={"x":false,"y":"top"};
offset="offsetHeight";
}
this.max=this.element[offset]-this.knob[offset]+(this.options.offset*2);
this.half=this.knob[offset]/2;
this.getPos=this.element["get"+this.p.capitalize()].bind(this.element);
this.knob.setStyle("position","relative").setStyle(this.p,-this.options.offset);
var lim={};
lim[this.z]=[-this.options.offset,this.max-this.options.offset];
this.drag=new Drag.Base(this.knob,{limit:lim,modifiers:mod,snap:0,onStart:function(){
this.draggedKnob();
}.bind(this),onDrag:function(){
this.draggedKnob();
}.bind(this),onComplete:function(){
this.draggedKnob();
this.end();
}.bind(this)});
if(this.options.initialize){
this.options.initialize.call(this);
}
},set:function(step){
this.step=step.limit(0,this.options.steps);
this.checkStep();
this.end();
this.fireEvent("onTick",this.toPosition(this.step));
return this;
},clickedElement:function(_3b2){
var _3b3=_3b2.page[this.z]-this.getPos()-this.half;
_3b3=_3b3.limit(-this.options.offset,this.max-this.options.offset);
this.step=this.toStep(_3b3);
this.checkStep();
this.end();
this.fireEvent("onTick",_3b3);
},draggedKnob:function(){
this.step=this.toStep(this.drag.value.now[this.z]);
this.checkStep();
},checkStep:function(){
if(this.previousChange!=this.step){
this.previousChange=this.step;
this.fireEvent("onChange",this.step);
}
},end:function(){
if(this.previousEnd!==this.step){
this.previousEnd=this.step;
this.fireEvent("onComplete",this.step+"");
}
},toStep:function(_3b4){
return Math.round((_3b4+this.options.offset)/this.max*this.options.steps);
},toPosition:function(step){
return this.max*step/this.options.steps;
}});
Slider.implement(new Events);
Slider.implement(new Options);
var SmoothScroll=Fx.Scroll.extend({initialize:function(_3b6){
this.parent(window,_3b6);
this.links=(this.options.links)?$$(this.options.links):$$(document.links);
var _3b7=window.location.href.match(/^[^#]*/)[0]+"#";
this.links.each(function(link){
if(link.href.indexOf(_3b7)!=0){
return;
}
var _3b9=link.href.substr(_3b7.length);
if(_3b9&&$(_3b9)){
this.useLink(link,_3b9);
}
},this);
if(!window.webkit419){
this.addEvent("onComplete",function(){
window.location.hash=this.anchor;
});
}
},useLink:function(link,_3bb){
link.addEvent("click",function(_3bc){
this.anchor=_3bb;
this.toElement(_3bb);
_3bc.stop();
}.bindWithEvent(this));
}});
var Sortables=new Class({options:{handles:false,onStart:Class.empty,onComplete:Class.empty,ghost:true,snap:3,onDragStart:function(_3bd,_3be){
_3be.setStyle("opacity",0.7);
_3bd.setStyle("opacity",0.7);
},onDragComplete:function(_3bf,_3c0){
_3bf.setStyle("opacity",1);
_3c0.remove();
this.trash.remove();
}},initialize:function(list,_3c2){
this.setOptions(_3c2);
this.list=$(list);
this.elements=this.list.getChildren();
this.handles=(this.options.handles)?$$(this.options.handles):this.elements;
this.bound={"start":[],"moveGhost":this.moveGhost.bindWithEvent(this)};
for(var i=0,l=this.handles.length;i<l;i++){
this.bound.start[i]=this.start.bindWithEvent(this,this.elements[i]);
}
this.attach();
if(this.options.initialize){
this.options.initialize.call(this);
}
this.bound.move=this.move.bindWithEvent(this);
this.bound.end=this.end.bind(this);
},attach:function(){
this.handles.each(function(_3c4,i){
_3c4.addEvent("mousedown",this.bound.start[i]);
},this);
},detach:function(){
this.handles.each(function(_3c6,i){
_3c6.removeEvent("mousedown",this.bound.start[i]);
},this);
},start:function(_3c8,el){
this.active=el;
this.coordinates=this.list.getCoordinates();
if(this.options.ghost){
var _3ca=el.getPosition();
this.offset=_3c8.page.y-_3ca.y;
this.trash=new Element("div").inject(document.body);
this.ghost=el.clone().inject(this.trash).setStyles({"position":"absolute","left":_3ca.x,"top":_3c8.page.y-this.offset});
document.addListener("mousemove",this.bound.moveGhost);
this.fireEvent("onDragStart",[el,this.ghost]);
}
document.addListener("mousemove",this.bound.move);
document.addListener("mouseup",this.bound.end);
this.fireEvent("onStart",el);
_3c8.stop();
},moveGhost:function(_3cb){
var _3cc=_3cb.page.y-this.offset;
_3cc=_3cc.limit(this.coordinates.top,this.coordinates.bottom-this.ghost.offsetHeight);
this.ghost.setStyle("top",_3cc);
_3cb.stop();
},move:function(_3cd){
var now=_3cd.page.y;
this.previous=this.previous||now;
var up=((this.previous-now)>0);
var prev=this.active.getPrevious();
var next=this.active.getNext();
if(prev&&up&&now<prev.getCoordinates().bottom){
this.active.injectBefore(prev);
}
if(next&&!up&&now>next.getCoordinates().top){
this.active.injectAfter(next);
}
this.previous=now;
},serialize:function(_3d2){
return this.list.getChildren().map(_3d2||function(el){
return this.elements.indexOf(el);
},this);
},end:function(){
this.previous=null;
document.removeListener("mousemove",this.bound.move);
document.removeListener("mouseup",this.bound.end);
if(this.options.ghost){
document.removeListener("mousemove",this.bound.moveGhost);
this.fireEvent("onDragComplete",[this.active,this.ghost]);
}
this.fireEvent("onComplete",this.active);
}});
Sortables.implement(new Events,new Options);
var Group=new Class({initialize:function(){
this.instances=$A(arguments);
this.events={};
this.checker={};
},addEvent:function(type,fn){
this.checker[type]=this.checker[type]||{};
this.events[type]=this.events[type]||[];
if(this.events[type].contains(fn)){
return false;
}else{
this.events[type].push(fn);
}
this.instances.each(function(_3d6,i){
_3d6.addEvent(type,this.check.bind(this,[type,_3d6,i]));
},this);
return this;
},check:function(type,_3d9,i){
this.checker[type][i]=true;
var _3db=this.instances.every(function(_3dc,j){
return this.checker[type][j]||false;
},this);
if(!_3db){
return;
}
this.checker[type]={};
this.events[type].each(function(_3de){
_3de.call(this,this.instances,_3d9);
},this);
}});
var Accordion=Fx.Elements.extend({options:{onActive:Class.empty,onBackground:Class.empty,display:0,show:false,height:true,width:false,opacity:true,fixedHeight:false,fixedWidth:false,wait:false,alwaysHide:false},initialize:function(){
var _3df,togglers,elements,container;
$each(arguments,function(_3e0,i){
switch($type(_3e0)){
case "object":
_3df=_3e0;
break;
case "element":
container=$(_3e0);
break;
default:
var temp=$$(_3e0);
if(!togglers){
togglers=temp;
}else{
elements=temp;
}
}
});
this.togglers=togglers||[];
this.elements=elements||[];
this.container=$(container);
this.setOptions(_3df);
this.previous=-1;
if(this.options.alwaysHide){
this.options.wait=true;
}
if($chk(this.options.show)){
this.options.display=false;
this.previous=this.options.show;
}
if(this.options.start){
this.options.display=false;
this.options.show=false;
}
this.effects={};
if(this.options.opacity){
this.effects.opacity="fullOpacity";
}
if(this.options.width){
this.effects.width=this.options.fixedWidth?"fullWidth":"offsetWidth";
}
if(this.options.height){
this.effects.height=this.options.fixedHeight?"fullHeight":"scrollHeight";
}
for(var i=0,l=this.togglers.length;i<l;i++){
this.addSection(this.togglers[i],this.elements[i]);
}
this.elements.each(function(el,i){
if(this.options.show===i){
this.fireEvent("onActive",[this.togglers[i],el]);
}else{
for(var fx in this.effects){
el.setStyle(fx,0);
}
}
},this);
this.parent(this.elements);
if($chk(this.options.display)){
this.display(this.options.display);
}
},addSection:function(_3e7,_3e8,pos){
_3e7=$(_3e7);
_3e8=$(_3e8);
var test=this.togglers.contains(_3e7);
var len=this.togglers.length;
this.togglers.include(_3e7);
this.elements.include(_3e8);
if(len&&(!test||pos)){
pos=$pick(pos,len-1);
_3e7.injectBefore(this.togglers[pos]);
_3e8.injectAfter(_3e7);
}else{
if(this.container&&!test){
_3e7.inject(this.container);
_3e8.inject(this.container);
}
}
var idx=this.togglers.indexOf(_3e7);
_3e7.addEvent("click",this.display.bind(this,idx));
if(this.options.height){
_3e8.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"});
}
if(this.options.width){
_3e8.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"});
}
_3e8.fullOpacity=1;
if(this.options.fixedWidth){
_3e8.fullWidth=this.options.fixedWidth;
}
if(this.options.fixedHeight){
_3e8.fullHeight=this.options.fixedHeight;
}
_3e8.setStyle("overflow","hidden");
if(!test){
for(var fx in this.effects){
_3e8.setStyle(fx,0);
}
}
return this;
},display:function(_3ee){
_3ee=($type(_3ee)=="element")?this.elements.indexOf(_3ee):_3ee;
if((this.timer&&this.options.wait)||(_3ee===this.previous&&!this.options.alwaysHide)){
return this;
}
this.previous=_3ee;
var obj={};
this.elements.each(function(el,i){
obj[i]={};
var hide=(i!=_3ee)||(this.options.alwaysHide&&(el.offsetHeight>0));
this.fireEvent(hide?"onBackground":"onActive",[this.togglers[i],el]);
for(var fx in this.effects){
obj[i][fx]=hide?0:el[this.effects[fx]];
}
},this);
return this.start(obj);
},showThisHideOpen:function(_3f4){
return this.display(_3f4);
}});
Fx.Accordion=Accordion;
