
window.ff=navigator.userAgent.search("Firefox")>=0;window.ff3=navigator.userAgent.search("Firefox/3")>=0;Sortables=Sortables.extend({initialize:function(list,options){this.parent(list,options);this.last_state=this.serialize_string();},moveGhost:function(event){var value=event.page.y-this.offset;value=value.limit(this.coordinates.top,this.coordinates.bottom);this.ghost.setStyle('top',value);event.stop();},serialize_string:function(){var serial='';this.list.getChildren().each(function(el,i){serial+=el.id+',';},this);return serial;},serialize:function(){var serial=[];this.list.getChildren().each(function(el,i){serial[serial.length]=el.id;},this);return serial;},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.cur_state=this.serialize_string();if(this.last_state!=this.cur_state&&this.last_state!=''){this.last_state=this.cur_state;this.fireEvent('onComplete',this.active);}}});Element.extend({toggle:function(){if(this.getStyle('display')!='none')this.setStyle('display','none');else this.setStyle('display','');},lift:function(){this.toggle();},toggleVis:function(){if(this.getStyle('visibility')!='hidden')this.setStyle('visibility','hidden');else this.setStyle('visibility','visible');},hide:function(){this.setStyle('display','none');},show:function(){this.setStyle('display','');},moveToBottom:function(){var w=this.clone();this.remove();$(document.body).adopt(w);},disable:function(txt){if(this.type=='button'||this.type=='submit'){this.addClass('grey_button');if(txt)this.value=txt;this.disabled=true;this.blur();return;}
$$('#'+this.id+' select, #'+this.id+' input').setProperty('disabled',true);if(!window.ie){this.setStyle('position','relative');if(!$(this.id+'_disable')){var coords=this.getSize();this.adopt(new Element('div',{'id':this.id+'_disable','styles':{'background-color':'#fff','width':coords.size.x,'height':coords.size.y,'top':'0','left':'0','position':'absolute','opacity':0.7}}));}}else{this.addClass('grey_out');if(txt)this.value=txt;}},enable:function(txt){if(this.type=='button'||this.type=='submit'){this.disabled=false;this.removeClass('grey_button');if(txt)this.value=txt;return;}
$$('#'+this.id+' select, #'+this.id+' input').setProperty('disabled',false);if(!window.ie){this.setStyle('position','');if($(this.id+'_disable')){$(this.id+'_disable').remove();}}else{this.removeClass('grey_out');}},setWidth:function(w){this.setStyle('width',w+'px');},getWidth:function(){return this.getStyle('width').toInt();},setHeight:function(h){this.setStyle('height',h+'px');},getHeight:function(){return this.getStyle('height').toInt();},setTop:function(t){this.setStyle('top',t+'px');},setLeft:function(l){this.setStyle('left',l+'px');}});Fx.Slide.implement({getStatus:function(){return this.wrapper.offsetHeight==0||this.wrapper.offsetWidth==0;}});var EventCenterClass=new Class({options:{onLoad:Class.empty},initialize:function(){this.types=['global'];this.calls=[];this.calls[0]=[];},add:function(fn,type){if(!type){type='global';}
var index=this.types.indexOf(type)
if(index<0){index=this.types.length;this.types[index]=type;this.calls[index]=[];}
if($type(fn)=='function'){this.calls[index][this.calls[index].length]=fn;}},fire:function(type){if(!type){type='global';}
var index=this.types.indexOf(type);if(index>=0){for(var i=0;i<this.calls[index].length;i++){var fn=this.calls[index][i];this.calls[index][i]=false;if($type(fn)=='function')fn();}}},fireAll:function(){for(var i=0;i<this.calls.length;i++){for(var j=0;j<this.calls[i].length;j++){var fn=this.calls[i][j];this.calls[i][j]=false;if($type(fn)=='function')fn();}}}});var EventCenter=new EventCenterClass();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,overflow:'hidden',wait:false,alwaysHide:false},initialize:function(){var options,togglers,elements,container;$each(arguments,function(argument,i){switch($type(argument)){case'object':options=argument;break;case'element':container=$(argument);break;default:var temp=$$(argument);if(!togglers)togglers=temp;else elements=temp;}});this.togglers=togglers||[];this.elements=elements||[];this.container=$(container);this.setOptions(options);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(toggler,element,pos){toggler=$(toggler);element=$(element);var test=this.togglers.contains(toggler);var len=this.togglers.length;this.togglers.include(toggler);this.elements.include(element);if(len&&(!test||pos)){pos=$pick(pos,len-1);toggler.injectBefore(this.togglers[pos]);element.injectAfter(toggler);}else if(this.container&&!test){toggler.inject(this.container);element.inject(this.container);}
var idx=this.togglers.indexOf(toggler);toggler.addEvent('click',this.display.bind(this,idx));if(this.options.height)element.setStyles({'padding-top':0,'border-top':'none','padding-bottom':0,'border-bottom':'none'});if(this.options.width)element.setStyles({'padding-left':0,'border-left':'none','padding-right':0,'border-right':'none'});element.fullOpacity=1;if(this.options.fixedWidth)element.fullWidth=this.options.fixedWidth;if(this.options.fixedHeight)element.fullHeight=this.options.fixedHeight;element.setStyle('overflow',this.options.overflow);if(!test){for(var fx in this.effects)element.setStyle(fx,0);}
return this;},display:function(index){index=($type(index)=='element')?this.elements.indexOf(index):index;if((this.timer&&this.options.wait)||(index===this.previous&&!this.options.alwaysHide))return this;this.previous=index;var obj={};this.elements.each(function(el,i){obj[i]={};var hide=(i!=index)||(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(index){return this.display(index);}});Fx.Accordion=Accordion;