String.prototype.parseColor=function(){var a="#";if(this.slice(0,4)=="rgb("){var c=this.slice(4,this.length-1).split(",");var b=0;do{a+=parseInt(c[b]).toColorPart()}while(++b<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var b=1;
b<4;b++){a+=(this.charAt(b)+this.charAt(b)).toLowerCase()}}if(this.length==7){a=this.toLowerCase()}}}return(a.length==7?a:(arguments[0]||this))};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(b){return(b.nodeType==3?b.nodeValue:(b.hasChildNodes()?Element.collectTextNodes(b):""))
}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(a,b){return $A($(a).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:((c.hasChildNodes()&&!Element.hasClassName(c,b))?Element.collectTextNodesIgnoreClass(c,b):""))
}).flatten().join("")};Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:(b/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""
};Element.forceRerendering=function(a){try{a=$(a);var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(b){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(a){return(-Math.cos(a*Math.PI)/2)+0.5
},reverse:function(a){return 1-a},flicker:function(a){var a=((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4;return a>1?1:a},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(b,a){return(-Math.cos((b*((a||5)-0.5)*2)*Math.PI)/2)+0.5
},spring:function(a){return 1-(Math.cos(a*4.5*Math.PI)*Math.exp(-a*6))},none:function(a){return 0},full:function(a){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var b="position:relative";
if(Prototype.Browser.IE){b+=";zoom:1"}a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){a.insertBefore(new Element("span",{style:b}).update(d==" "?String.fromCharCode(160):d),c)
});Element.remove(c)}})},multiple:function(b,c){var g;if(((typeof b=="object")||Object.isFunction(b))&&(b.length)){g=b}else{g=$(b).childNodes}var a=Object.extend({speed:0.1,delay:0},arguments[2]||{});var d=a.delay;
$A(g).each(function(j,h){new c(j,Object.extend(a,{delay:h*a.speed+d}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(b,c,a){b=$(b);c=(c||"appear").toLowerCase();
return Effect[Effect.PAIRS[c][b.visible()?1:0]](b,Object.extend({queue:{position:"end",scope:(b.id||"global"),limit:1}},a||{}))}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];
this.interval=null},_each:function(a){this.effects._each(a)},add:function(b){var c=new Date().getTime();var a=Object.isString(b.options.queue)?b.options.queue:b.options.queue.position;switch(a){case"front":this.effects.findAll(function(d){return d.state=="idle"
}).each(function(d){d.startOn+=b.finishOn;d.finishOn+=b.finishOn});break;case"with-last":c=this.effects.pluck("startOn").max()||c;break;case"end":c=this.effects.pluck("finishOn").max()||c;break}b.startOn+=c;
b.finishOn+=c;if(!b.options.queue.limit||(this.effects.length<b.options.queue.limit)){this.effects.push(b)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(a){this.effects=this.effects.reject(function(b){return b==a
});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var c=new Date().getTime();for(var b=0,a=this.effects.length;b<a;b++){this.effects[b]&&this.effects[b].loop(c)
}}});Effect.Queues={instances:$H(),get:function(a){if(!Object.isString(a)){return a}return this.instances.get(a)||this.instances.set(a,new Effect.ScopedQueue())}};Effect.Queue=Effect.Queues.get("global");
Effect.Base=Class.create({position:null,start:function(a){if(a&&a.transition===false){a.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});this.currentFrame=0;
this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;
this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function b(d,c){if(d.options[c+"Internal"]){d.options[c+"Internal"](d)}if(d.options[c]){d.options[c](d)}}return function(c){if(this.state==="idle"){this.state="running";
b(this,"beforeSetup");if(this.setup){this.setup()}b(this,"afterSetup")}if(this.state==="running"){c=(this.options.transition(c)*this.fromToDelta)+this.options.from;this.position=c;b(this,"beforeUpdate");
if(this.update){this.update(c)}b(this,"afterUpdate")}}})();this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)
}},loop:function(c){if(c>=this.startOn){if(c>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var b=(c-this.startOn)/this.totalTime,a=(b*this.totalFrames).round();
if(a>this.currentFrame){this.render(b);this.currentFrame=a}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)
}this.state="finished"},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},inspect:function(){var a=$H();for(property in this){if(!Object.isFunction(this[property])){a.set(property,this[property])
}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)
},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");if(b.finish){b.finish(a)}b.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(c,h,g){c=Object.isString(c)?$(c):c;
var b=$A(arguments),d=b.last(),a=b.length==5?b[3]:null;this.method=Object.isFunction(d)?d.bind(c):Object.isFunction(c[d])?c[d].bind(c):function(j){c[d]=j};this.start(Object.extend({from:h,to:g},a||{}))
},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);
if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});
this.start(a)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)
}var a=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(a)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");
if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({left:(this.options.x*a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})
}});Effect.MoveBy=function(b,a,c){return new Effect.Move(b,Object.extend({x:c,y:a},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(b,c){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)
}var a=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:c},arguments[2]||{});this.start(a)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;
this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(b){this.originalStyle[b]=this.element.style[b]}.bind(this));this.originalTop=this.element.offsetTop;
this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);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(a){var b=(this.options.scaleFrom/100)+(this.factor*a);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*b+this.fontSizeType})
}this.setDimensions(this.dims[0]*b,this.dims[1]*b)},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(a,g){var h={};if(this.options.scaleX){h.width=g.round()+"px"
}if(this.options.scaleY){h.height=a.round()+"px"}if(this.options.scaleFromCenter){var c=(a-this.dims[0])/2;var b=(g-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){h.top=this.originalTop-c+"px"
}if(this.options.scaleX){h.left=this.originalLeft-b+"px"}}else{if(this.options.scaleY){h.top=-c+"px"}if(this.options.scaleX){h.left=-b+"px"}}}this.element.setStyle(h)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);
if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(a)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();
return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")
}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")}this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));
this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(b,c,d){return b+((this._base[d]+(this._delta[d]*a)).round().toColorPart())
}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(c){var b=arguments[1]||{},a=document.viewport.getScrollOffsets(),d=$(c).cumulativeOffset();
if(b.offset){d[1]+=b.offset}return new Effect.Tween(null,a.top,d[1],b,function(g){scrollTo(a.left,g.round())})};Effect.Fade=function(c){c=$(c);var a=c.getInlineOpacity();var b=Object.extend({from:c.getOpacity()||1,to:0,afterFinishInternal:function(d){if(d.options.to!=0){return
}d.element.hide().setStyle({opacity:a})}},arguments[1]||{});return new Effect.Opacity(c,b)};Effect.Appear=function(b){b=$(b);var a=Object.extend({from:(b.getStyle("display")=="none"?0:b.getOpacity()||0),to:1,afterFinishInternal:function(c){c.element.forceRerendering()
},beforeSetup:function(c){c.element.setOpacity(c.options.from).show()}},arguments[1]||{});return new Effect.Opacity(b,a)};Effect.Puff=function(b){b=$(b);var a={opacity:b.getInlineOpacity(),position:b.getStyle("position"),top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};
return new Effect.Parallel([new Effect.Scale(b,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(c){Position.absolutize(c.effects[0].element)
},afterFinishInternal:function(c){c.effects[0].element.hide().setStyle(a)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(b){b.element.hide().undoClipping()
}},arguments[1]||{}))};Effect.BlindDown=function(b){b=$(b);var a=b.getDimensions();return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(c){c.element.makeClipping().setStyle({height:"0px"}).show()
},afterFinishInternal:function(c){c.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(b){b=$(b);var a=b.getInlineOpacity();return new Effect.Appear(b,Object.extend({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(d){d.element.makePositioned().makeClipping()
},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned().setStyle({opacity:a})}})}},arguments[1]||{}))};Effect.DropOut=function(b){b=$(b);var a={top:b.getStyle("top"),left:b.getStyle("left"),opacity:b.getInlineOpacity()};
return new Effect.Parallel([new Effect.Move(b,{x:0,y:100,sync:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(c){c.effects[0].element.makePositioned()},afterFinishInternal:function(c){c.effects[0].element.hide().undoPositioned().setStyle(a)
}},arguments[1]||{}))};Effect.Shake=function(d){d=$(d);var b=Object.extend({distance:20,duration:0.5},arguments[1]||{});var g=parseFloat(b.distance);var c=parseFloat(b.duration)/10;var a={top:d.getStyle("top"),left:d.getStyle("left")};
return new Effect.Move(d,{x:g,y:0,duration:c,afterFinishInternal:function(h){new Effect.Move(h.element,{x:-g*2,y:0,duration:c*2,afterFinishInternal:function(j){new Effect.Move(j.element,{x:g*2,y:0,duration:c*2,afterFinishInternal:function(k){new Effect.Move(k.element,{x:-g*2,y:0,duration:c*2,afterFinishInternal:function(l){new Effect.Move(l.element,{x:g*2,y:0,duration:c*2,afterFinishInternal:function(m){new Effect.Move(m.element,{x:-g,y:0,duration:c,afterFinishInternal:function(n){n.element.undoPositioned().setStyle(a)
}})}})}})}})}})}})};Effect.SlideDown=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.SlideUp=function(c){c=$(c).cleanWhitespace();
var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,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().show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})
},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){b.element.makeClipping()
},afterFinishInternal:function(b){b.element.hide().undoClipping()}})};Effect.Grow=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});
var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var j=c.getDimensions();var k,h;var g,d;switch(b.direction){case"top-left":k=h=g=d=0;break;
case"top-right":k=j.width;h=d=0;g=-j.width;break;case"bottom-left":k=g=0;h=j.height;d=-j.height;break;case"bottom-right":k=j.width;h=j.height;g=-j.width;d=-j.height;break;case"center":k=j.width/2;h=j.height/2;
g=-j.width/2;d=-j.height/2;break}return new Effect.Move(c,{x:k,y:h,duration:0.01,beforeSetup:function(l){l.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(l){new Effect.Parallel([new Effect.Opacity(l.element,{sync:true,to:1,from:0,transition:b.opacityTransition}),new Effect.Move(l.element,{x:g,y:d,sync:true,transition:b.moveTransition}),new Effect.Scale(l.element,100,{scaleMode:{originalHeight:j.height,originalWidth:j.width},sync:true,scaleFrom:window.opera?1:0,transition:b.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(m){m.effects[0].element.setStyle({height:"0px"}).show()
},afterFinishInternal:function(m){m.effects[0].element.undoClipping().undoPositioned().setStyle(a)}},b))}})};Effect.Shrink=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});
var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var h=c.getDimensions();var g,d;switch(b.direction){case"top-left":g=d=0;break;case"top-right":g=h.width;
d=0;break;case"bottom-left":g=0;d=h.height;break;case"bottom-right":g=h.width;d=h.height;break;case"center":g=h.width/2;d=h.height/2;break}return new Effect.Parallel([new Effect.Opacity(c,{sync:true,to:0,from:1,transition:b.opacityTransition}),new Effect.Scale(c,window.opera?1:0,{sync:true,transition:b.scaleTransition,restoreAfterFinish:true}),new Effect.Move(c,{x:g,y:d,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(j){j.effects[0].element.makePositioned().makeClipping()
},afterFinishInternal:function(j){j.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a)}},b))};Effect.Pulsate=function(c){c=$(c);var b=arguments[1]||{},a=c.getInlineOpacity(),g=b.transition||Effect.Transitions.linear,d=function(h){return 1-g((-Math.cos((h*(b.pulses||5)*2)*Math.PI)/2)+0.5)
};return new Effect.Opacity(c,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(h){h.element.setStyle({opacity:a})}},b),{transition:d}))};Effect.Fold=function(b){b=$(b);var a={top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};
b.makeClipping();return new Effect.Scale(b,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(c){new Effect.Scale(b,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(d){d.element.hide().undoClipping().setStyle(a)
}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({style:{}},arguments[1]||{});
if(!Object.isString(a.style)){this.style=$H(a.style)}else{if(a.style.include(":")){this.style=a.style.parseStyle()}else{this.element.addClassName(a.style);this.style=$H(this.element.getStyles());this.element.removeClassName(a.style);
var b=this.element.getStyles();this.style=this.style.reject(function(d){return d.value==b[d.key]});a.afterFinishInternal=function(d){d.element.addClassName(d.options.style);d.transforms.each(function(g){d.element.style[g.style]=""
})}}}this.start(a)},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b)){b="#ffffff"}b=b.parseColor();return $R(0,2).map(function(c){return parseInt(b.slice(c*2+1,c*2+3),16)
})}this.transforms=this.style.map(function(j){var h=j[0],g=j[1],d=null;if(g.parseColor("#zzzzzz")!="#zzzzzz"){g=g.parseColor();d="color"}else{if(h=="opacity"){g=parseFloat(g);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})
}}else{if(Element.CSS_LENGTH.test(g)){var c=g.match(/^([\+\-]?[0-9\.]+)(.*)$/);g=parseFloat(c[1]);d=(c.length==3)?c[2]:null}}}var b=this.element.getStyle(h);return{style:h.camelize(),originalValue:d=="color"?a(b):parseFloat(b||0),targetValue:d=="color"?a(g):g,unit:d}
}.bind(this)).reject(function(b){return((b.originalValue==b.targetValue)||(b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))))})},update:function(a){var d={},b,c=this.transforms.length;while(c--){d[(b=this.transforms[c]).style]=b.unit=="color"?"#"+(Math.round(b.originalValue[0]+(b.targetValue[0]-b.originalValue[0])*a)).toColorPart()+(Math.round(b.originalValue[1]+(b.targetValue[1]-b.originalValue[1])*a)).toColorPart()+(Math.round(b.originalValue[2]+(b.targetValue[2]-b.originalValue[2])*a)).toColorPart():(b.originalValue+(b.targetValue-b.originalValue)*a).toFixed(3)+(b.unit===null?"":b.unit)
}this.element.setStyle(d,true)}});Effect.Transform=Class.create({initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(b){b=$H(b);
var c=b.values().first();this.tracks.push($H({ids:b.keys().first(),effect:Effect.Morph,options:{style:c}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var d=a.get("ids"),c=a.get("effect"),b=a.get("options");
var g=[$(d)||$$(d)].flatten();return g.map(function(h){return new c(h,Object.extend({sync:true},b))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");
Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var b,a=$H();if(Prototype.Browser.WebKit){b=new Element("div",{style:this}).style
}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';b=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(c){if(b[c]){a.set(c,b[c])}});if(Prototype.Browser.IE&&this.include("opacity")){a.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])
}return a};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(b){var a=document.defaultView.getComputedStyle($(b),null);return Element.CSS_PROPERTIES.inject({},function(c,d){c[d]=a[d];
return c})}}else{Element.getStyles=function(b){b=$(b);var a=b.currentStyle,c;c=Element.CSS_PROPERTIES.inject({},function(d,g){d[g]=a[g];return d});if(!c.opacity){c.opacity=b.getOpacity()}return c}}Effect.Methods={morph:function(a,b){a=$(a);
new Effect.Morph(a,Object.extend({style:b},arguments[2]||{}));return a},visualEffect:function(c,g,b){c=$(c);var d=g.dasherize().camelize(),a=d.charAt(0).toUpperCase()+d.substring(1);new Effect[a](c,b);
return c},highlight:function(b,a){b=$(b);new Effect.Highlight(b,a);return b}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(c,b){c=$(c);
Effect[a.charAt(0).toUpperCase()+a.substring(1)](c,b);return c}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]
});Element.addMethods(Effect.Methods);if(Object.isUndefined(Effect)){throw ("dragdrop.js requires including script.aculo.us' effects.js library")}var Droppables={drops:[],remove:function(a){this.drops=this.drops.reject(function(b){return b.element==$(a)
})},add:function(b){b=$(b);var a=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(a.containment){a._containers=[];var c=a.containment;if(Object.isArray(c)){c.each(function(d){a._containers.push($(d))
})}else{a._containers.push($(c))}}if(a.accept){a.accept=[a.accept].flatten()}Element.makePositioned(b);a.element=b;this.drops.push(a)},findDeepestChild:function(a){deepest=a[0];for(i=1;i<a.length;++i){if(Element.isParent(a[i].element,deepest.element)){deepest=a[i]
}}return deepest},isContained:function(b,a){var c;if(a.tree){c=b.treeNode}else{c=b.parentNode}return a._containers.detect(function(d){return c==d})},isAffected:function(a,c,b){return((b.element!=c)&&((!b._containers)||this.isContained(c,b))&&((!b.accept)||(Element.classNames(c).detect(function(d){return b.accept.include(d)
})))&&Position.within(b.element,a[0],a[1]))},deactivate:function(a){if(a.hoverclass){Element.removeClassName(a.element,a.hoverclass)}this.last_active=null},activate:function(a){if(a.hoverclass){Element.addClassName(a.element,a.hoverclass)
}this.last_active=a},show:function(a,c){if(!this.drops.length){return}var b,d=[];this.drops.each(function(g){if(Droppables.isAffected(a,c,g)){d.push(g)}});if(d.length>0){b=Droppables.findDeepestChild(d)
}if(this.last_active&&this.last_active!=b){this.deactivate(this.last_active)}if(b){Position.within(b.element,a[0],a[1]);if(b.onHover){b.onHover(c,b.element,Position.overlap(b.overlap,b.element))}if(b!=this.last_active){Droppables.activate(b)
}}},fire:function(b,a){if(!this.last_active){return}Position.prepare();if(this.isAffected([Event.pointerX(b),Event.pointerY(b)],a,this.last_active)){if(this.last_active.onDrop){this.last_active.onDrop(a,this.last_active.element,b);
return true}}},reset:function(){if(this.last_active){this.deactivate(this.last_active)}}};var Draggables={drags:[],observers:[],register:function(a){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);
this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);
Event.observe(document,"keypress",this.eventKeypress)}this.drags.push(a)},unregister:function(a){this.drags=this.drags.reject(function(b){return b==a});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);
Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress)}},activate:function(a){if(a.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;
window.focus();Draggables.activeDraggable=a}.bind(this),a.options.delay)}else{window.focus();this.activeDraggable=a}},deactivate:function(){this.activeDraggable=null},updateDrag:function(a){if(!this.activeDraggable){return
}var b=[Event.pointerX(a),Event.pointerY(a)];if(this._lastPointer&&(this._lastPointer.inspect()==b.inspect())){return}this._lastPointer=b;this.activeDraggable.updateDrag(a,b)},endDrag:function(a){if(this._timeout){clearTimeout(this._timeout);
this._timeout=null}if(!this.activeDraggable){return}this._lastPointer=null;this.activeDraggable.endDrag(a);this.activeDraggable=null},keyPress:function(a){if(this.activeDraggable){this.activeDraggable.keyPress(a)
}},addObserver:function(a){this.observers.push(a);this._cacheObserverCallbacks()},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b.element==a});this._cacheObserverCallbacks()
},notify:function(b,a,c){if(this[b+"Count"]>0){this.observers.each(function(d){if(d[b]){d[b](b,a,c)}})}if(a.options[b]){a.options[b](a,c)}},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(a){Draggables[a+"Count"]=Draggables.observers.select(function(b){return b[a]
}).length})}};var Draggable=Class.create({initialize:function(b){var c={handle:false,reverteffect:function(h,g,d){var j=Math.sqrt(Math.abs(g^2)+Math.abs(d^2))*0.02;new Effect.Move(h,{x:-d,y:-g,duration:j,queue:{scope:"_draggable",position:"end"}})
},endeffect:function(g){var d=Object.isNumber(g._opacity)?g._opacity:1;new Effect.Opacity(g,{duration:0.2,from:0.7,to:d,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[g]=false
}})},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect)){Object.extend(c,{starteffect:function(d){d._opacity=Element.getOpacity(d);
Draggable._dragging[d]=true;new Effect.Opacity(d,{duration:0.2,from:d._opacity,to:0.7})}})}var a=Object.extend(c,arguments[1]||{});this.element=$(b);if(a.handle&&Object.isString(a.handle)){this.handle=this.element.down("."+a.handle,0)
}if(!this.handle){this.handle=$(a.handle)}if(!this.handle){this.handle=this.element}if(a.scroll&&!a.scroll.scrollTo&&!a.scroll.outerHTML){a.scroll=$(a.scroll);this._isScrollChild=Element.childOf(this.element,a.scroll)
}Element.makePositioned(this.element);this.options=a;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this)
},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this)},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")])
},initDrag:function(a){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element]){return}if(Event.isLeftClick(a)){var c=Event.element(a);if((tag_name=c.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return
}var b=[Event.pointerX(a),Event.pointerY(a)];var d=this.element.cumulativeOffset();this.offset=[0,1].map(function(g){return(b[g]-d[g])});Draggables.activate(this);Event.stop(a)}},startDrag:function(b){this.dragging=true;
if(!this.delta){this.delta=this.currentDelta()}if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);
this._originallyAbsolute=(this.element.getStyle("position")=="absolute");if(!this._originallyAbsolute){Position.absolutize(this.element)}this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll){if(this.options.scroll==window){var a=this._getWindowScroll(this.options.scroll);
this.originalScrollLeft=a.left;this.originalScrollTop=a.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}}Draggables.notify("onStart",this,b);
if(this.options.starteffect){this.options.starteffect(this.element)}},updateDrag:function(event,pointer){if(!this.dragging){this.startDrag(event)}if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element)
}Draggables.notify("onDrag",this,event);this.draw(pointer);if(this.options.change){this.options.change(this)}if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height]
}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight)
}var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity)}if(pointer[1]<(p[1]+this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity)
}if(pointer[0]>(p[2]-this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity)}if(pointer[1]>(p[3]-this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity)
}this.startScrolling(speed)}if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(event)},finishDrag:function(b,h){this.dragging=false;if(this.options.quiet){Position.prepare();var g=[Event.pointerX(b),Event.pointerY(b)];
Droppables.show(g,this.element)}if(this.options.ghosting){if(!this._originallyAbsolute){Position.relativize(this.element)}delete this._originallyAbsolute;Element.remove(this._clone);this._clone=null}var j=false;
if(h){j=Droppables.fire(b,this.element);if(!j){j=false}}if(j&&this.options.onDropped){this.options.onDropped(this.element)}Draggables.notify("onEnd",this,b);var a=this.options.revert;if(a&&Object.isFunction(a)){a=a(this.element)
}var c=this.currentDelta();if(a&&this.options.reverteffect){if(j==0||a!="failure"){this.options.reverteffect(this.element,c[1]-this.delta[1],c[0]-this.delta[0])}}else{this.delta=c}if(this.options.zindex){this.element.style.zIndex=this.originalZ
}if(this.options.endeffect){this.options.endeffect(this.element)}Draggables.deactivate(this);Droppables.reset()},keyPress:function(a){if(a.keyCode!=Event.KEY_ESC){return}this.finishDrag(a,false);Event.stop(a)
},endDrag:function(a){if(!this.dragging){return}this.stopScrolling();this.finishDrag(a,true);Event.stop(a)},draw:function(a){var j=this.element.cumulativeOffset();if(this.options.ghosting){var c=Position.realOffset(this.element);
j[0]+=c[0]-Position.deltaX;j[1]+=c[1]-Position.deltaY}var h=this.currentDelta();j[0]-=h[0];j[1]-=h[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){j[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;
j[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var g=[0,1].map(function(d){return(a[d]-j[d]-this.offset[d])}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){g=this.options.snap(g[0],g[1],this)
}else{if(Object.isArray(this.options.snap)){g=g.map(function(d,k){return(d/this.options.snap[k]).round()*this.options.snap[k]}.bind(this))}else{g=g.map(function(d){return(d/this.options.snap).round()*this.options.snap
}.bind(this))}}}var b=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){b.left=g[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){b.top=g[1]+"px"
}if(b.visibility=="hidden"){b.visibility=""}},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(a){if(!(a[0]||a[1])){return
}this.scrollSpeed=[a[0]*this.options.scrollSpeed,a[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10)},scroll:function(){var current=new Date();
var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;
this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000
}Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify("onDrag",this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);
Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0){Draggables._lastScrollPointer[0]=0
}if(Draggables._lastScrollPointer[1]<0){Draggables._lastScrollPointer[1]=0}this.draw(Draggables._lastScrollPointer)}if(this.options.change){this.options.change(this)}},_getWindowScroll:function(w){var T,L,W,H;
with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;
H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}return{top:T,left:L,width:W,height:H}
}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(b,a){this.element=$(b);this.observer=a;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)
},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element)){this.observer(this.element)}}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(a){while(a.tagName.toUpperCase()!="BODY"){if(a.id&&Sortable.sortables[a.id]){return a
}a=a.parentNode}},options:function(a){a=Sortable._findRootElement($(a));if(!a){return}return Sortable.sortables[a.id]},destroy:function(a){a=$(a);var b=Sortable.sortables[a.id];if(b){Draggables.removeObserver(b.element);
b.droppables.each(function(c){Droppables.remove(c)});b.draggables.invoke("destroy");delete Sortable.sortables[b.element.id]}},create:function(c){c=$(c);var b=Object.extend({element:c,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:c,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});
this.destroy(c);var a={revert:true,quiet:b.quiet,scroll:b.scroll,scrollSpeed:b.scrollSpeed,scrollSensitivity:b.scrollSensitivity,delay:b.delay,ghosting:b.ghosting,constraint:b.constraint,handle:b.handle};
if(b.starteffect){a.starteffect=b.starteffect}if(b.reverteffect){a.reverteffect=b.reverteffect}else{if(b.ghosting){a.reverteffect=function(h){h.style.top=0;h.style.left=0}}}if(b.endeffect){a.endeffect=b.endeffect
}if(b.zindex){a.zindex=b.zindex}var d={overlap:b.overlap,containment:b.containment,tree:b.tree,hoverclass:b.hoverclass,onHover:Sortable.onHover};var g={onHover:Sortable.onEmptyHover,overlap:b.overlap,containment:b.containment,hoverclass:b.hoverclass};
Element.cleanWhitespace(c);b.draggables=[];b.droppables=[];if(b.dropOnEmpty||b.tree){Droppables.add(c,g);b.droppables.push(c)}(b.elements||this.findElements(c,b)||[]).each(function(k,h){var j=b.handles?$(b.handles[h]):(b.handle?$(k).select("."+b.handle)[0]:k);
b.draggables.push(new Draggable(k,Object.extend(a,{handle:j})));Droppables.add(k,d);if(b.tree){k.treeNode=c}b.droppables.push(k)});if(b.tree){(Sortable.findTreeElements(c,b)||[]).each(function(h){Droppables.add(h,g);
h.treeNode=c;b.droppables.push(h)})}this.sortables[c.identify()]=b;Draggables.addObserver(new SortableObserver(c,b.onUpdate))},findElements:function(b,a){return Element.findChildren(b,a.only,a.tree?true:false,a.tag)
},findTreeElements:function(b,a){return Element.findChildren(b,a.only,a.tree?true:false,a.treeTag)},onHover:function(g,d,a){if(Element.isParent(d,g)){return}if(a>0.33&&a<0.66&&Sortable.options(d).tree){return
}else{if(a>0.5){Sortable.mark(d,"before");if(d.previousSibling!=g){var b=g.parentNode;g.style.visibility="hidden";d.parentNode.insertBefore(g,d);if(d.parentNode!=b){Sortable.options(b).onChange(g)}Sortable.options(d.parentNode).onChange(g)
}}else{Sortable.mark(d,"after");var c=d.nextSibling||null;if(c!=g){var b=g.parentNode;g.style.visibility="hidden";d.parentNode.insertBefore(g,c);if(d.parentNode!=b){Sortable.options(b).onChange(g)}Sortable.options(d.parentNode).onChange(g)
}}}},onEmptyHover:function(g,j,k){var l=g.parentNode;var a=Sortable.options(j);if(!Element.isParent(j,g)){var h;var c=Sortable.findElements(j,{tag:a.tag,only:a.only});var b=null;if(c){var d=Element.offsetSize(j,a.overlap)*(1-k);
for(h=0;h<c.length;h+=1){if(d-Element.offsetSize(c[h],a.overlap)>=0){d-=Element.offsetSize(c[h],a.overlap)}else{if(d-(Element.offsetSize(c[h],a.overlap)/2)>=0){b=h+1<c.length?c[h+1]:null;break}else{b=c[h];
break}}}}j.insertBefore(g,b);Sortable.options(l).onChange(g);a.onChange(g)}},unmark:function(){if(Sortable._marker){Sortable._marker.hide()}},mark:function(b,a){var d=Sortable.options(b.parentNode);if(d&&!d.ghosting){return
}if(!Sortable._marker){Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker)
}var c=b.cumulativeOffset();Sortable._marker.setStyle({left:c[0]+"px",top:c[1]+"px"});if(a=="after"){if(d.overlap=="horizontal"){Sortable._marker.setStyle({left:(c[0]+b.clientWidth)+"px"})}else{Sortable._marker.setStyle({top:(c[1]+b.clientHeight)+"px"})
}}Sortable._marker.show()},_tree:function(g,b,h){var d=Sortable.findElements(g,b)||[];for(var c=0;c<d.length;++c){var a=d[c].id.match(b.format);if(!a){continue}var j={id:encodeURIComponent(a?a[1]:null),element:g,parent:h,children:[],position:h.children.length,container:$(d[c]).down(b.treeTag)};
if(j.container){this._tree(j.container,b,j)}h.children.push(j)}return h},tree:function(d){d=$(d);var c=this.options(d);var b=Object.extend({tag:c.tag,treeTag:c.treeTag,only:c.only,name:d.id,format:c.format},arguments[1]||{});
var a={id:null,parent:null,children:[],container:d,position:0};return Sortable._tree(d,b,a)},_constructIndex:function(b){var a="";do{if(b.id){a="["+b.position+"]"+a}}while((b=b.parent)!=null);return a},sequence:function(b){b=$(b);
var a=Object.extend(this.options(b),arguments[1]||{});return $(this.findElements(b,a)||[]).map(function(c){return c.id.match(a.format)?c.id.match(a.format)[1]:""})},setSequence:function(b,c){b=$(b);var a=Object.extend(this.options(b),arguments[2]||{});
var d={};this.findElements(b,a).each(function(g){if(g.id.match(a.format)){d[g.id.match(a.format)[1]]=[g,g.parentNode]}g.parentNode.removeChild(g)});c.each(function(g){var h=d[g];if(h){h[1].appendChild(h[0]);
delete d[g]}})},serialize:function(c){c=$(c);var b=Object.extend(Sortable.options(c),arguments[1]||{});var a=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:c.id);if(b.tree){return Sortable.tree(c,arguments[1]).children.map(function(d){return[a+Sortable._constructIndex(d)+"[id]="+encodeURIComponent(d.id)].concat(d.children.map(arguments.callee))
}).flatten().join("&")}else{return Sortable.sequence(c,arguments[1]).map(function(d){return a+"[]="+encodeURIComponent(d)}).join("&")}}};Element.isParent=function(b,a){if(!b.parentNode||b==a){return false
}if(b.parentNode==a){return true}return Element.isParent(b.parentNode,a)};Element.findChildren=function(d,b,a,c){if(!d.hasChildNodes()){return null}c=c.toUpperCase();if(b){b=[b].flatten()}var g=[];$A(d.childNodes).each(function(j){if(j.tagName&&j.tagName.toUpperCase()==c&&(!b||(Element.classNames(j).detect(function(k){return b.include(k)
})))){g.push(j)}if(a){var h=Element.findChildren(j,b,a,c);if(h){g.push(h)}}});return(g.length>0?g.flatten():[])};Element.offsetSize=function(a,b){return a["offset"+((b=="vertical"||b=="height")?"Height":"Width")]
};
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var I="undefined",w="object",X="Shockwave Flash",ab="ShockwaveFlash.ShockwaveFlash",u="application/x-shockwave-flash",W="SWFObjectExprInst",C="onreadystatechange",T=window,m=document,y=navigator,Y=false,Z=[k],s=[],S=[],N=[],p,V,J,G,O=false,a=false,r,L,q=true,R=function(){var af=typeof m.getElementById!=I&&typeof m.getElementsByTagName!=I&&typeof m.createElement!=I,am=y.userAgent.toLowerCase(),ad=y.platform.toLowerCase(),aj=ad?/win/.test(ad):/win/.test(am),ah=ad?/mac/.test(ad):/mac/.test(am),ak=/webkit/.test(am)?parseFloat(am.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,ac=!+"\v1",al=[0,0,0],ag=null;
if(typeof y.plugins!=I&&typeof y.plugins[X]==w){ag=y.plugins[X].description;if(ag&&!(typeof y.mimeTypes!=I&&y.mimeTypes[u]&&!y.mimeTypes[u].enabledPlugin)){Y=true;ac=false;ag=ag.replace(/^.*\s+(\S+\s+\S+$)/,"$1");
al[0]=parseInt(ag.replace(/^(.*)\..*$/,"$1"),10);al[1]=parseInt(ag.replace(/^.*\.(.*)\s.*$/,"$1"),10);al[2]=/[a-zA-Z]/.test(ag)?parseInt(ag.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof T.ActiveXObject!=I){try{var ai=new ActiveXObject(ab);
if(ai){ag=ai.GetVariable("$version");if(ag){ac=true;ag=ag.split(" ")[1].split(",");al=[parseInt(ag[0],10),parseInt(ag[1],10),parseInt(ag[2],10)]}}}catch(ae){}}}return{w3:af,pv:al,wk:ak,ie:ac,win:aj,mac:ah}
}(),n=function(){if(!R.w3){return}if((typeof m.readyState!=I&&m.readyState=="complete")||(typeof m.readyState==I&&(m.getElementsByTagName("body")[0]||m.body))){h()}if(!O){if(typeof m.addEventListener!=I){m.addEventListener("DOMContentLoaded",h,false)
}if(R.ie&&R.win){m.attachEvent(C,function(){if(m.readyState=="complete"){m.detachEvent(C,arguments.callee);h()}});if(T==top){(function(){if(O){return}try{m.documentElement.doScroll("left")}catch(ac){setTimeout(arguments.callee,0);
return}h()})()}}if(R.wk){(function(){if(O){return}if(!/loaded|complete/.test(m.readyState)){setTimeout(arguments.callee,0);return}h()})()}x(h)}}();function h(){if(O){return}try{var ae=m.getElementsByTagName("body")[0].appendChild(H("span"));
ae.parentNode.removeChild(ae)}catch(af){return}O=true;var ac=Z.length;for(var ad=0;ad<ac;ad++){Z[ad]()}}function P(ac){if(O){ac()}else{Z[Z.length]=ac}}function x(ad){if(typeof T.addEventListener!=I){T.addEventListener("load",ad,false)
}else{if(typeof m.addEventListener!=I){m.addEventListener("load",ad,false)}else{if(typeof T.attachEvent!=I){l(T,"onload",ad)}else{if(typeof T.onload=="function"){var ac=T.onload;T.onload=function(){ac();
ad()}}else{T.onload=ad}}}}}function k(){if(Y){aa()}else{M()}}function aa(){var ac=m.getElementsByTagName("body")[0];var af=H(w);af.setAttribute("type",u);var ae=ac.appendChild(af);if(ae){var ad=0;(function(){if(typeof ae.GetVariable!=I){var ag=ae.GetVariable("$version");
if(ag){ag=ag.split(" ")[1].split(",");R.pv=[parseInt(ag[0],10),parseInt(ag[1],10),parseInt(ag[2],10)]}}else{if(ad<10){ad++;setTimeout(arguments.callee,10);return}}ac.removeChild(af);ae=null;M()})()}else{M()
}}function M(){var al=s.length;if(al>0){for(var ak=0;ak<al;ak++){var ad=s[ak].id;var ag=s[ak].callbackFn;var af={success:false,id:ad};if(R.pv[0]>0){var aj=c(ad);if(aj){if(K(s[ak].swfVersion)&&!(R.wk&&R.wk<312)){B(ad,true);
if(ag){af.success=true;af.ref=E(ad);ag(af)}}else{if(s[ak].expressInstall&&F()){var an={};an.data=s[ak].expressInstall;an.width=aj.getAttribute("width")||"0";an.height=aj.getAttribute("height")||"0";if(aj.getAttribute("class")){an.styleclass=aj.getAttribute("class")
}if(aj.getAttribute("align")){an.align=aj.getAttribute("align")}var am={};var ac=aj.getElementsByTagName("param");var ah=ac.length;for(var ai=0;ai<ah;ai++){if(ac[ai].getAttribute("name").toLowerCase()!="movie"){am[ac[ai].getAttribute("name")]=ac[ai].getAttribute("value")
}}U(an,am,ad,ag)}else{t(aj);if(ag){ag(af)}}}}}else{B(ad,true);if(ag){var ae=E(ad);if(ae&&typeof ae.SetVariable!=I){af.success=true;af.ref=ae}ag(af)}}}}}function E(af){var ac=null;var ad=c(af);if(ad&&ad.nodeName=="OBJECT"){if(typeof ad.SetVariable!=I){ac=ad
}else{var ae=ad.getElementsByTagName(w)[0];if(ae){ac=ae}}}return ac}function F(){return !a&&K("6.0.65")&&(R.win||R.mac)&&!(R.wk&&R.wk<312)}function U(af,ag,ac,ae){a=true;J=ae||null;G={success:false,id:ac};
var aj=c(ac);if(aj){if(aj.nodeName=="OBJECT"){p=j(aj);V=null}else{p=aj;V=ac}af.id=W;if(typeof af.width==I||(!/%$/.test(af.width)&&parseInt(af.width,10)<310)){af.width="310"}if(typeof af.height==I||(!/%$/.test(af.height)&&parseInt(af.height,10)<137)){af.height="137"
}m.title=m.title.slice(0,47)+" - Flash Player Installation";var ai=R.ie&&R.win?"ActiveX":"PlugIn",ah="MMredirectURL="+T.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ai+"&MMdoctitle="+m.title;
if(typeof ag.flashvars!=I){ag.flashvars+="&"+ah}else{ag.flashvars=ah}if(R.ie&&R.win&&aj.readyState!=4){var ad=H("div");ac+="SWFObjectNew";ad.setAttribute("id",ac);aj.parentNode.insertBefore(ad,aj);aj.style.display="none";
(function(){if(aj.readyState==4){aj.parentNode.removeChild(aj)}else{setTimeout(arguments.callee,10)}})()}z(af,ag,ac)}}function t(ad){if(R.ie&&R.win&&ad.readyState!=4){var ac=H("div");ad.parentNode.insertBefore(ac,ad);
ac.parentNode.replaceChild(j(ad),ac);ad.style.display="none";(function(){if(ad.readyState==4){ad.parentNode.removeChild(ad)}else{setTimeout(arguments.callee,10)}})()}else{ad.parentNode.replaceChild(j(ad),ad)
}}function j(ah){var ag=H("div");if(R.win&&R.ie){ag.innerHTML=ah.innerHTML}else{var ae=ah.getElementsByTagName(w)[0];if(ae){var ai=ae.childNodes;if(ai){var ad=ai.length;for(var af=0;af<ad;af++){if(!(ai[af].nodeType==1&&ai[af].nodeName=="PARAM")&&!(ai[af].nodeType==8)){ag.appendChild(ai[af].cloneNode(true))
}}}}}return ag}function z(an,al,ad){var ac,af=c(ad);if(R.wk&&R.wk<312){return ac}if(af){if(typeof an.id==I){an.id=ad}if(R.ie&&R.win){var am="";for(var aj in an){if(an[aj]!=Object.prototype[aj]){if(aj.toLowerCase()=="data"){al.movie=an[aj]
}else{if(aj.toLowerCase()=="styleclass"){am+=' class="'+an[aj]+'"'}else{if(aj.toLowerCase()!="classid"){am+=" "+aj+'="'+an[aj]+'"'}}}}}var ak="";for(var ai in al){if(al[ai]!=Object.prototype[ai]){ak+='<param name="'+ai+'" value="'+al[ai]+'" />'
}}af.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+am+">"+ak+"</object>";S[S.length]=an.id;ac=c(an.id)}else{var ae=H(w);ae.setAttribute("type",u);for(var ah in an){if(an[ah]!=Object.prototype[ah]){if(ah.toLowerCase()=="styleclass"){ae.setAttribute("class",an[ah])
}else{if(ah.toLowerCase()!="classid"){ae.setAttribute(ah,an[ah])}}}}for(var ag in al){if(al[ag]!=Object.prototype[ag]&&ag.toLowerCase()!="movie"){g(ae,ag,al[ag])}}af.parentNode.replaceChild(ae,af);ac=ae
}}return ac}function g(ae,ac,ad){var af=H("param");af.setAttribute("name",ac);af.setAttribute("value",ad);ae.appendChild(af)}function D(ad){var ac=c(ad);if(ac&&ac.nodeName=="OBJECT"){if(R.ie&&R.win){ac.style.display="none";
(function(){if(ac.readyState==4){b(ad)}else{setTimeout(arguments.callee,10)}})()}else{ac.parentNode.removeChild(ac)}}}function b(ae){var ad=c(ae);if(ad){for(var ac in ad){if(typeof ad[ac]=="function"){ad[ac]=null
}}ad.parentNode.removeChild(ad)}}function c(ae){var ac=null;try{ac=m.getElementById(ae)}catch(ad){}return ac}function H(ac){return m.createElement(ac)}function l(ae,ac,ad){ae.attachEvent(ac,ad);N[N.length]=[ae,ac,ad]
}function K(ae){var ad=R.pv,ac=ae.split(".");ac[0]=parseInt(ac[0],10);ac[1]=parseInt(ac[1],10)||0;ac[2]=parseInt(ac[2],10)||0;return(ad[0]>ac[0]||(ad[0]==ac[0]&&ad[1]>ac[1])||(ad[0]==ac[0]&&ad[1]==ac[1]&&ad[2]>=ac[2]))?true:false
}function A(ah,ad,ai,ag){if(R.ie&&R.mac){return}var af=m.getElementsByTagName("head")[0];if(!af){return}var ac=(ai&&typeof ai=="string")?ai:"screen";if(ag){r=null;L=null}if(!r||L!=ac){var ae=H("style");
ae.setAttribute("type","text/css");ae.setAttribute("media",ac);r=af.appendChild(ae);if(R.ie&&R.win&&typeof m.styleSheets!=I&&m.styleSheets.length>0){r=m.styleSheets[m.styleSheets.length-1]}L=ac}if(R.ie&&R.win){if(r&&typeof r.addRule==w){r.addRule(ah,ad)
}}else{if(r&&typeof m.createTextNode!=I){r.appendChild(m.createTextNode(ah+" {"+ad+"}"))}}}function B(ae,ac){if(!q){return}var ad=ac?"visible":"hidden";if(O&&c(ae)){c(ae).style.visibility=ad}else{A("#"+ae,"visibility:"+ad)
}}function Q(ad){var ae=/[\\\"<>\.;]/;var ac=ae.exec(ad)!=null;return ac&&typeof encodeURIComponent!=I?encodeURIComponent(ad):ad}var d=function(){if(R.ie&&R.win){window.attachEvent("onunload",function(){var ah=N.length;
for(var ag=0;ag<ah;ag++){N[ag][0].detachEvent(N[ag][1],N[ag][2])}var ae=S.length;for(var af=0;af<ae;af++){D(S[af])}for(var ad in R){R[ad]=null}R=null;for(var ac in swfobject){swfobject[ac]=null}swfobject=null
})}}();return{registerObject:function(ag,ac,af,ae){if(R.w3&&ag&&ac){var ad={};ad.id=ag;ad.swfVersion=ac;ad.expressInstall=af;ad.callbackFn=ae;s[s.length]=ad;B(ag,false)}else{if(ae){ae({success:false,id:ag})
}}},getObjectById:function(ac){if(R.w3){return E(ac)}},embedSWF:function(ag,am,aj,al,ad,af,ae,ai,ak,ah){var ac={success:false,id:am};if(R.w3&&!(R.wk&&R.wk<312)&&ag&&am&&aj&&al&&ad){B(am,false);P(function(){aj+="";
al+="";var ao={};if(ak&&typeof ak===w){for(var aq in ak){ao[aq]=ak[aq]}}ao.data=ag;ao.width=aj;ao.height=al;var ar={};if(ai&&typeof ai===w){for(var ap in ai){ar[ap]=ai[ap]}}if(ae&&typeof ae===w){for(var an in ae){if(typeof ar.flashvars!=I){ar.flashvars+="&"+an+"="+ae[an]
}else{ar.flashvars=an+"="+ae[an]}}}if(K(ad)){var at=z(ao,ar,am);if(ao.id==am){B(am,true)}ac.success=true;ac.ref=at}else{if(af&&F()){ao.data=af;U(ao,ar,am,ah);return}else{B(am,true)}}if(ah){ah(ac)}})}else{if(ah){ah(ac)
}}},switchOffAutoHideShow:function(){q=false},ua:R,getFlashPlayerVersion:function(){return{major:R.pv[0],minor:R.pv[1],release:R.pv[2]}},hasFlashPlayerVersion:K,createSWF:function(ae,ad,ac){if(R.w3){return z(ae,ad,ac)
}else{return undefined}},showExpressInstall:function(ae,af,ac,ad){if(R.w3&&F()){U(ae,af,ac,ad)}},removeSWF:function(ac){if(R.w3){D(ac)}},createCSS:function(af,ae,ad,ac){if(R.w3){A(af,ae,ad,ac)}},addDomLoadEvent:P,addLoadEvent:x,getQueryParamValue:function(af){var ae=m.location.search||m.location.hash;
if(ae){if(/\?/.test(ae)){ae=ae.split("?")[1]}if(af==null){return Q(ae)}var ad=ae.split("&");for(var ac=0;ac<ad.length;ac++){if(ad[ac].substring(0,ad[ac].indexOf("="))==af){return Q(ad[ac].substring((ad[ac].indexOf("=")+1)))
}}}return""},expressInstallCallback:function(){if(a){var ac=c(W);if(ac&&p){ac.parentNode.replaceChild(p,ac);if(V){B(V,true);if(R.ie&&R.win){p.style.display="block"}}if(J){J(G)}}a=false}}}}();try{console.log("init console... done")
}catch(e){console={log:function(){},error:function(){}}}var SL={utils:{},effects:{},ui:{},browser:{IE6:Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==6},storage:$H()};
(function(){SL.getIE=function(){if(navigator.appName!="Microsoft Internet Explorer"){return -1}var a=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(a.exec(navigator.userAgent)!=null){return parseFloat(RegExp.$1)
}return -1};Hash.prototype.setDefault=function(a,b){if(this.get(a)==undefined){this.set(a,b)}};Hash.prototype.ensureHash=function(a){if(this.get(a)==undefined){this.set(a,$H())}return this.get(a)};Element.addMethods({setStyle:function(b,c){try{b=$(b);
var h=b.style,a;if(Object.isString(c)){b.style.cssText+=";"+c;return c.include("opacity")?b.setOpacity(c.match(/opacity:\s*(\d?\.?\d*)/)[1]):b}for(var g in c){var d=c[g];try{if(d&&(d.toLowerCase().startsWith("nan")||d.toLowerCase().startsWith("infinity"))){continue
}if(g=="opacity"){b.setOpacity(d)}else{h[(g=="float"||g=="cssFloat")?(Object.isUndefined(h.styleFloat)?"cssFloat":"styleFloat"):g]=d}}catch(j){console.error("Error setting style:",g,"->",d," ",j)}}}catch(j){console.error(j)
}return b},getStorage:function(a){a=$(a);var b=a._slStorage;if(!b){b=$H();a._slStorage=b}return b},hasFixedPosition:function(a){return Element.getFixedParent(a)?true:false},getFixedParent:function(a){while(a){if(!a.tagName||a.tagName.toLowerCase()=="body"){break
}if(a.getStyle("position")=="fixed"){return a}a=a.up()}return null},cumulativeScrollOffsetFixed:function(b){var a=0,c=0;do{a+=b.scrollTop||0;c+=b.scrollLeft||0;if(b.getStyle("position")=="fixed"){break
}b=b.parentNode}while(b);return Element._returnOffset(c,a)},findZIndex:function(a){do{if(!a.tagName||a.tagName.toLowerCase()=="body"){break}var b=a.getStyle("z-index");if(b){return parseInt(b)}a=a.parentNode
}while(a)}})})();if(typeof PopUp!="function"){function PopUp(j,d,n){if(n==null){var b=SLPopupSize?SLPopupSize[0]:650;var m=SLPopupSize?SLPopupSize[1]:600;var l=(screen.width-b)/2;var g=(screen.height-m)/2;
var k=",top="+g;var h=",left="+l;var a=",width="+b;var c=",height="+m;win=window.open(j,d,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1"+k+h+a+c).focus()}else{win=window.open(j,d,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,"+n).focus()
}}}(function(){SL.utils.removeAMP=function(s){while(true){var i=s.indexOf("&amp;");if(i==-1){break}s=s.substring(0,i)+"&"+s.substring(i+"&amp;".length)}return s};SL.utils.addOrReplaceArg=function(url,arg,value){url=SL.utils.removeAMP(url);
var match="&args."+arg+"=";var matchPos=url.indexOf(match);if(matchPos==-1){return value==null?url:(url+match+value)}var trailing=url.substring(matchPos+match.length);return url.substring(0,matchPos)+(value==null?"":(match+value))+(trailing.indexOf("&")==-1?"":trailing.substring(trailing.indexOf("&")))
};SL.utils.addOrReplaceUrlParam=function(url,arg,value){url=SL.utils.removeAMP(url);var match="&"+arg+"=";var matchPos=url.indexOf(match);if(matchPos==-1){return value==null?url:(url+match+value)}var trailing=url.substring(matchPos+match.length);
return url.substring(0,matchPos)+(value==null?"":(match+value))+(trailing.indexOf("&")==-1?"":trailing.substring(trailing.indexOf("&")))};SL.utils.getArg=function(url,arg,value){url=SL.utils.removeAMP(url);
var match="&args."+arg+"=";var matchPos=url.indexOf(match);if(matchPos<0){return undefined}var trailing=url.substring(matchPos+match.length);matchPos=trailing.indexOf("&");if(matchPos<0){return trailing
}return trailing.substring(0,matchPos)};SL.utils.createBodyElement=function(name,attributes){var e=new Element(name,attributes);$$("body")[0].appendChild(e);return e};SL.utils.reparentToBody=function(e){SL.utils.reparent(e,document.getElementsByTagName("body").item(0))
};SL.utils.reparent=function(e,newParent){e.remove();newParent.appendChild(e)};SL.utils._domReady=false;SL.utils._domReadyExecuted=false;SL.utils._domReadyFunctions=$A();document.observe("dom:loaded",function(){SL.utils._domReady=true;
SL.utils._domReadyFunctions.each(function(f){try{f()}catch(e){console.error("Error executing onDomReady method:",f,e)}});SL.utils._domReadyFunctions=undefined;SL.utils._domReadyExecuted=true});SL.utils.onDomReady=function(f){if(SL.utils._domReady){try{f()
}catch(e){console.error(e)}}else{SL.utils._domReadyFunctions.push(f)}};SL.utils.isDomReady=function(){return SL.utils._domReady};SL.utils.focusFormElement=function(form,name){var elements=Form.getElements(form);
for(var i=0;i<elements.length;i++){if(elements[i].readAttribute("name")==name){elements[i].focus();return}}console.log("Form element not found:",form,":",name)};SL.utils.toArrayString=function(o){if(!o){return o
}if(Object.isString(o)){return o}if(Object.isArray(o)){return o.toString()}return $A(o).toString()};SL.utils.addFormSubmitWorkaround=function(e){$(e).select("form").each(function(f){f.select("input").each(function(e){if(e.readAttribute("type")=="text"||e.readAttribute("type")=="password"){e.observe("keypress",function(event){if(event.keyCode==Event.KEY_RETURN){var form=event.element().form;
try{if(Object.isFunction(form.submit)){form.submit()}else{form.submit.click()}}catch(ex){console.log(ex)}}})}})})};SL.utils.loadScript=function(url,cb,finishedCB){if(!SL.utils._loadedScripts){SL.utils._loadedScripts=$H()
}else{var h=SL.utils._loadedScripts.get(url);if(h){if(h.loaded){cb()}else{h.cbs.push(cb)}return}}console.log("Loading:",url);var h=$H();h.loaded=false;h.cbs=$A();h.cbs.push(cb);SL.utils._loadedScripts.set(url,h);
new Ajax.Request(url,{method:"get",evalJS:false,onSuccess:function(o){try{eval(o.responseText)}catch(e){console.log(e,":",o)}h.loaded=true;console.log("Loaded:",url);if(finishedCB){finishedCB()}h.cbs.each(function(cb){cb()
})}})};SL.utils.getFrameElement=function(frame,id){var f=frames[frame];if(!f){console.error("No frame:",frame,id);return undefined}return f.$(id)};SL.utils.executeAfterFrameDomReady=function(frame,cb){var id=undefined;
id=setInterval(function(){var f=frames[frame];if(f&&f.SL&&f.SL.utils._domReadyExecuted&&!f.__slInvalid){try{cb();clearInterval(id)}catch(e){clearInterval(id);console.error("Error in frame dom ready func:",e);
throw e}}},100)};SL.utils.loadJS=function(url){new Ajax.Request(url,{method:"get",evalJS:false,onSuccess:function(o){eval(o.responseText)}})};SL.utils.endsWithExtension=function(s,extensions){if(s==null||extensions==null){return false
}for(var i=0;i<extensions.length;++i){if(s.toLowerCase().endsWith("."+extensions[i].toLowerCase())){return true}}return false};SL.utils.supportsFileClick=function(){if(Prototype.Browser.IE){return false
}if(Prototype.Browser.Gecko){if(navigator.userAgent.indexOf("Firefox/3")>=0){return false}var r=/rv:([0-9]*).([0-9]*).([0-9]*)/.exec(navigator.userAgent);if(r!=null){console.log(r);var v1=parseInt(r[1]);
var v2=parseInt(r[2]);var v3=parseInt(r[3]);if(v1>1){return true}if(v1<1||v2<9){return false}if(v3<3){return false}}}return true};SL.utils.loadStyle=function(url,cb){if(SL.utils._loadedStyles){if(SL.utils._loadedStyles.get(url)){cb();
return}}else{SL.utils._loadedStyles=$H()}SL.utils._loadedStyles.set(url,true);new Ajax.Request(url,{method:"get",evalJS:false,onSuccess:function(o){var head=$$("head")[0];var e=new Element("link",{href:url,type:"text/css",rel:"stylesheet"});
head.appendChild(e);cb.defer()}})};SL.utils.reloadWithPrompt=function(id,reloadURL,arg,defaultValue,message){var v=window.prompt(message,defaultValue);if(v){SL.byID(id).load(reloadURL+"&args."+arg+"="+v)
}};SL.utils.locationReload=function(args){var href=location.href;$H(args).each(function(e){href=SL.utils.addOrReplaceUrlParam(href,e.key,e.value)});location.href=href}})();SL.events={};(function(){SL.events.pushKeyboardObserver=function(a){if(!SL.events._keyboardObservers){SL.events._keyboardObservers=$A();
SL.events._keyboard={shift:false};document.observe("keydown",function(g,d){var c=d.keyCode;if(c!=Event.KEY_ESC&&SL.events._checkForm()){return}if(c==16){if(!g.shift){g.shift=true;for(var b=SL.events._keyboardObservers.length-1;
b>=0;b--){o=SL.events._keyboardObservers[b];if(o.shiftdown){if(o.shiftdown(g)){d.stop();return}}if(o.modal){return}}}return}g.code=c;g.key=String.fromCharCode(c).toLowerCase();for(var b=SL.events._keyboardObservers.length-1;
b>=0;b--){o=SL.events._keyboardObservers[b];if(o.keydown){if(o.keydown(g)){d.stop();return}}if(o.modal){return}}}.curry(SL.events._keyboard));document.observe("keyup",function(g,d){if(SL.events._checkForm()){return
}var c=d.keyCode;if(c==16){g.shift=false;for(var b=SL.events._keyboardObservers.length-1;b>=0;b--){o=SL.events._keyboardObservers[b];if(o.shiftup){if(o.shiftup(g)){d.stop();return}}if(o.modal){return}}return
}g.code=c;g.key=String.fromCharCode(c).toLowerCase();for(var b=SL.events._keyboardObservers.length-1;b>=0;b--){o=SL.events._keyboardObservers[b];if(o.keyup){if(o.keyup(g)){d.stop();return}if(o.modal){return
}}}g.code=undefined;g.key=undefined}.curry(SL.events._keyboard))}SL.events._keyboardObservers.push(a);return a};SL.events.removeKeyboardObserver=function(a){if(a.modal){var b=SL.events._keyboardObservers.indexOf(a);
if(b>=0){SL.events._keyboardObservers=SL.events._keyboardObservers.slice(0,b)}}else{SL.events._keyboardObservers=SL.events._keyboardObservers.without(a)}};SL.events._checkForm=function(){var b=document.activeElement;
if(!b){return false}var a=b.tagName.toLowerCase();if(a=="body"){return false}if(a=="input"||b.up("form")){return true}return false}})();SL.elements={};(function(){SL.elements.createBlindRow=function(a){var g=0;
var c=a.childElements();for(var b=0;b<c.length;b++){var j=c[b].readAttribute("colspan");g+=j?parseInt(j):1}var d=new Element("tr");var h=new Element("td",{colspan:g});h.setStyle({margin:"0",padding:"0"});
d.appendChild(h);return d};SL.Element=Class.create({isElement:true,initialize:function(b,a){this.e=$(b);this.id=this.e.identify();this.config=$H(a);this.init()},init:function(){},destroy:function(){this.cleanup()
},cleanup:function(){},connectDestroy:function(c){if(!c){return}var b=$(c);var a=b.retrieve("sl_delete_notify");if(!a){a=$H();b.store("sl_delete_notify",a);b.addClassName("sljs__delete_notify__")}if(!a.get(this.id)){a.set(this.id,this)
}},_destroy:function(){if(this.e.parentNode){this.e.remove()}(function(b){var a=$(b);if(a&&a.parentNode){a.remove()}}.curry(this.id).defer())}})})();(function(){SL.byID=function(d){var c=$(d);if(!c){console.error("SL.byID: unable to find element with id '"+d+"'");
return}var a=c.retrieve("sl_component");if(a){return a}if(!SL.legacy){console.error("SL.byID: element '"+d+"' has no component")}var b=c.retrieve("sl_component_info");if(b){console.log("Init configured component:",c,b);
return new b.component(c,b.config)}return SL.legacy.initWidget(c)};SL.getC=function(b){var a=$(b);if(a){return a.retrieve("sl_component")}};SL.getCC=function(b){var c=b;while(c){var a=c.retrieve("sl_component");
if(a){return a}c=c.up()}};SL.register=function(d,b,a){b=$(b);if(!b){console.error("No element to regsiter:",b,d,a)}console.log("Configure component:",b,d,a);b.store("sl_component_info",{component:d,config:a})
};SL.initDefered=function(d,b,a){SL.utils.onDomReady(function(j,h,g){new j(h,g)}.curry(d,b,a))};SL.initOnEvent=function(p,a,m,l,d,b){var n=$(p);if(!n){return}var j=n.retrieve("sl_init_events");if(!j){j=$H();
n.store("sl_init_events",j)}var q=j.get(a);if(!q){q=$A();j.set(a,q);var g=function(t,c,s){var r=t.retrieve("sl_init_events");r.get(c).each(function(u,h){h(s)}.curry(t));t.stopObserving(c,r.get("_f_"+c));
r.set("_f_"+c,undefined);r.set(c,undefined)}.curry(n,a);j.set("_f_"+a,g);n.observe(a,g)}var k=function(x,u,h,w,t){var s=$(u);if(s&&s.retrieve("sl_component")){return}var r=new x(u,h);r.connectDestroy(w);
r.notifyInitEvent(t)}.curry(m,l,d,b?p:null);q.push(k)};SL.ensureComponent=function(h,g,b){var d=$(g);if(!d){return new h(g,b)}var a=d.retrieve("sl_component");if(a){return a}return new h(g,b)};SL.componentExists=function(b){var a=$(b);
if(!a){return false}return a.retrieve("sl_component")?true:false};SL.Component=Class.create({initialize:function(c,b){if(arguments.length==1&&(typeof c)!="string"&&!$(c)){b=c;this.e=undefined}else{this.e=$(c)
}if(!this.e){this.e=SL.utils.createBodyElement("div");this.e.setStyle({display:"none"});if(c){this.e.writeAttribute("id",c)}}else{if(!this.e.up()){var a=document.getElementsByTagName("body").item(0);a.appendChild(this.e)
}}this.id=this.e.identify();this.e.store("sl_component",this);this.e.addClassName("sljs__component__");this.config=$H(b);this.version=1;this.config.setDefault("spinner_class","gui_busy_img");if(this.config.get("add_css")){this.e.addClassName(this.config.get("add_css"))
}this.url=this.config.get("url");if(!this.url){this.url=this.e.readAttribute("slUrl")}if(this.config.get("admin_reset")){this.e.addClassName(this.config.get("admin_reset"))}this.init();if(this.config.get("after_init")){this.config.get("after_init")(this)
}if(this.config.get("auto_init")){if(!this.url){console.log("Auto init component without url",this)}else{console.log("Auto init component",this);this.load(this.url,null)}}},init:function(){},notifyInitEvent:function(a){},setUrl:function(a){this.url=a
},setLoading:function(b){this._cleanup(true);var c=$(this.id+"__custom_loading__");if(c){c.remove();c.setStyle({visibility:"visible"});var a=new Element("div");a.setStyle({width:this.e.getWidth()+"px",height:this.e.getHeight()+"px",position:"relative",margin:"0",padding:"0"});
b.update(a);a.appendChild(c)}else{b.update(this._getLoadingContent())}this._initLoadingDelay();this.e.addClassName("component_loading")},_initLoadingDelay:function(){var a=this.config.get("loading_delay");
if(!a||a<=0){return}this.e.setStyle({visibility:"hidden"});setTimeout(function(b){if(this.version==b){this.e.setStyle({visibility:"visible"})}}.bind(this,this.version+1),a)},_resetLoadingDelay:function(){if(this.e.getStyle("visibility")!="hidden"){return
}this.version++;setTimeout(function(a){if(this.version==a){this.e.setStyle({visibility:"visible"})}}.bind(this,this.version),1)},_getLoadingContent:function(a){return'<div class="'+this.config.get("spinner_class")+(a?" large":"")+'"></div>'
},_onSuccess:function(a){this.e.removeClassName("component_loading");this._onSuccessContent(a.request.options.slVersion,a.responseText)},_onSuccessContent:function(a,b){if(SL.legacy){slCloseTooltips()}if(a!=undefined&&a!=this.version){return
}try{this._setContent(b);this.onSuccess();this._emitContentChanged();if(this.nextLoadJS){this.nextLoadJS.each(function(d){d()});this.nextLoadJS=undefined}}catch(c){log.error(c)}this._resetLoadingDelay()
},onFailure:function(b){this.e.removeClassName("component_loading");this.e.setStyle({visibility:"visible"});var a=b.request.options.slVersion;if(a!=undefined&&a!=this.version){console.error("SL.Component failure on old version: ",b,":",a,":",this.version);
return}if(this.id=="admin_panel_main"){setTimeout(function(){document.location.reload()},1500)}if(this.e.up("html").readAttribute("lang")=="de"){this._setContent('<div class="gui_component_error">Fehler beim Laden der Komponente</div>')
}else{this._setContent('<div class="gui_component_error">Error loading component</div>')}console.error("SL.Component failure: ",b)},onError:function(a){console.error("SL.Component error: ",a)},_setContent:function(a){this._cleanup(true);
try{this.e.update(a);if(SL.legacy){SL.legacy.autoInitWidgets(this.e)}}catch(b){this.onError(b)}Element._cleanupPrototypeEventCache.defer()},_emitContentChanged:function(b){var c=this.e.up();while(c){if(c.tagName=="BODY"){break
}var a=c.retrieve("sl_component");if(a){a.onChildComponentChanged(this,b)}c=c.up()}},_getReloadURL:function(a){if(!a){a=this.url}if(this.reloadArgs){$H(this.reloadArgs).each(function(b){a=SL.utils.addOrReplaceArg(a,b.key,b.value)
})}return a},load:function(b,a){this.updatedArgs=undefined;if(a){this.setLoadingSpinner(a)}else{if(this.config.get("load_shaded")){this.setLoadingSpinner(this.id)}else{this.setLoading(this.e)}}this.version++;
this.url=b;new Ajax.Request(this.getReloadURL(b),{method:"post",onSuccess:this._onSuccess.bind(this),onFailure:this.onFailure.bind(this),slVersion:this.version})},loadPost:function(c,b,a){this.updatedArgs=undefined;
if(a){this.setLoadingSpinner(a)}else{if(this.config.get("load_shaded")){this.setLoadingSpinner(this.id)}else{this.setLoading(this.e)}}if(this.reloadArgs){$H(this.reloadArgs).each(function(d){if(!b){b=$H()
}b.set(d.key,d.value)})}new Ajax.Request(this.getReloadURL(c,true),{method:"post",parameters:b,onSuccess:this._onSuccess.bind(this),onFailure:this.onFailure.bind(this)})},setReloadArg:function(a,b){if(!this.reloadArgs){this.reloadArgs=$H({})
}this.reloadArgs.set(a,b)},onSuccess:function(){},onChildComponentChanged:function(a){},setDimension:function(b,a){this.e.setStyle({width:b+"px",height:a+"px"})},setLoadingSpinner:function(c){var g=$(c);
if(g&&!g.down("#__"+this.id+"__loading")){var b=this.e.getHeight();var d=b<=0||b>=100;var a=g.getStyle("position");if(!a||(a!="absolute"&&a!="relative"&&a!="fixed")){g.setStyle({position:"relative"})}var j=new Element("div",{style:"position:absolute;top:0;bottom:0;left:0;right:0;background-color:#fff;cursor:progress","class":this.config.get("spinner_class")+(d?"_overlay inline":"_overlay")});
j.setOpacity(0.3);g.insert(j);var h=new Element("div",{id:this.id+"__loading",style:"position:absolute;top:0;bottom:0;left:0;right:0;cursor:progress","class":this.config.get("spinner_class")+(d?" inline":"")});
h.setOpacity(0.3);g.insert(h)}this.e.addClassName("component_loading")},loadBackground:function(a){this.url=a;this.updatedArgs=undefined;this.version++;new Ajax.Request(this.getReloadURL(a),{method:"get",onSuccess:this._onSuccess.bind(this),onFailure:this.onFailure.bind(this),slVersion:this.version})
},replaceArgs:function(c,d,b){var a=this.url;if(!a){console.error("Replace args: No url for component:",this);return}$H(c).each(function(g){a=addOrReplaceArg(a,g.key,g.value)});if(d){this.loadBackground(this.getReloadURL(a))
}else{this.load(this.getReloadURL(a),b)}},updateArgs:function(a){if(!this.updatedArgs){this.updatedArgs=$H()}$H(a).each(function(b){this.url=addOrReplaceArg(this.url,b.key,b.value);this.updatedArgs.set(b.key,b.value)
}.bind(this))},toggleArg:function(a,c){if(!this.updatedArgs){this.updatedArgs=$H()}var b=this.updatedArgs.get(a);if(b==undefined&&this.url){b=SL.utils.getArg(this.url)}var d;if(b!=undefined){if(b===true){d=true
}else{if(b===false){d=false}else{if(b=="true"){d=true}else{d=false}}}d=!b}else{d=c}this.url=SL.utils.addOrReplaceArg(this.url,a,d);this.updatedArgs.set(a,d)},refresh:function(a,j,b){if(!this.url){var k=this.getParentComponent();
if(k!=null){k.refresh(a,j,b)}else{console.error("No parent to refresh:",this)}return}if(j){var c=this.url.split("?");if(c.length>1){this.url=c[0]+"?";c=c[1].split("&");var h=true;for(var d=0;d<c.length;
d++){var g=false;for(var l=0;l<j.length;l++){if(c[d].startsWith("args."+j[l])){g=true}}if(!g){if(h){h=false}else{this.url+="&"}this.url+=c[d]}}}}if(b){this.load(this.getReloadURL(),this.id)}else{if(a){this.loadBackground(this.getReloadURL())
}else{this._cleanup(true);this.load(this.getReloadURL())}}},refreshDelay:function(b,a){this.version++;if(this.e&&this.e.parentNode){setTimeout(this._delayedRefresh.bind(this,b,this.version),a)}},_delayedRefresh:function(a,b){if(this.version==b){this.refresh(a)
}},getParentComponent:function(){var b=this.e.up();while(b){if(b.tagName=="BODY"){return null}var a=b.retrieve("sl_component");if(a){return a}b=b.up()}return null},getReloadURL:function(a,b){if(!a){a=this.url
}if(!b&&this.reloadArgs){$H(this.reloadArgs).each(function(c){a=SL.utils.addOrReplaceArg(a,c.key,c.value)})}return a},_destroy:function(){console.log("Destroying component:",this.id);this._cleanup();this.e.store("sl_component",undefined);
if(this.e.parentNode){this.e.remove()}(function(b){var a=$(b);if(a&&a.parentNode){a.remove()}}.curry(this.id).defer())},uploadForm:function(p,n,l){this.version++;try{var a=this.e.select(".sljs__component__");
if(a){a.each(function(h){try{var q=h.retrieve("sl_component");if(q){q.updateForPost()}}catch(h){console.error(h)}})}}catch(k){console.log(k)}try{slUpdateEditors(this.e,true)}catch(k){console.error(k)}var k=SL.utils.createBodyElement("div");
var b=k.identify()+"_iframe";var d=new Element("iframe",{id:b,name:b,stlye:"display:none",src:"about:blank"});k.appendChild(d);d.observe("load",this._iframeLoaded.bind(this,k,b,this.version));var j=$(p);
if(this.updatedArgs){try{this.updatedArgs.each(function(h){var q=j.down('input[name="args.'+h.key+'"]');if(q){q.writeAttribute("value",h.value+"")}else{j.appendChild(new Element("input",{type:"hidden",name:"args."+h.key,value:h.value+""}))
}})}catch(m){console.error(m)}}if(l){var c=$(l);try{if(c){var g=$H(c.serialize(true));g.each(function(q,h){q.insert({bottom:new Element("input",{type:"hidden",name:h.key,value:SL.utils.toArrayString(h.value)})})
}.curry(j))}}catch(k){console.error("Error merging foreign form:",k)}}j.writeAttribute("target",b);if(n){j.submit()}return true},updateForPost:function(){},_iframeLoaded:function(d,g,a){if(this.version!=a){console.error("Old version:",this.version," ",a);
return}console.log("Update for form upload:",this.id);var b=$(g).contentWindow.sl_reload_url;if(b){this.url=b}var c=$(g).contentWindow.sl_reload_content;this._onSuccessContent(a,c);(function(h){h.remove()
}.curry(d).defer())},submitUploadForm:function(d,a,c){var b=$(d);if(a&&c){b.appendChild(new Element("input",{type:"hidden",name:a,value:c}))}this.uploadForm(d,true)},_cleanup:function(a){if(!a){if(this.isCleanedUp){return
}this.isCleanedUp=true;try{this.cleanup()}catch(d){console.error(d)}var b=this.e.retrieve("sl_delete_notify");if(b){b.each(function(h){try{h.value._destroy()}catch(g){console.error(g)}});this.e.store("sl_delete_notify",undefined)
}}try{var c=this.e.select(".sljs__component__");if(c){c.each(function(g){var h=g.retrieve("sl_component");if(h){h._cleanup()}})}c=this.e.select(".sljs__delete_notify__");if(c){c.each(function(j){var g=j.retrieve("sl_delete_notify");
if(g){g.each(function(k){try{k.value._destroy()}catch(h){console.error(h)}})}j.store("sl_delete_notify",undefined)})}}catch(d){console.error(d)}},connectDestroy:function(c){if(!c){return}var b=$(c);var a=b.retrieve("sl_delete_notify");
if(!a){a=$H();b.store("sl_delete_notify",a);b.addClassName("sljs__delete_notify__")}if(!a.get(this.id)){a.set(this.id,this)}},cleanup:function(){},hide:function(a){if(a===true){var b=this.getParentComponent();
if(b){b.hide()}return}},registerAfterNextLoadJS:function(a){if(!this.nextLoadJS){this.nextLoadJS=$A()}this.nextLoadJS.push(a)}})})();(function(){SL.effects.hideEmbededObjects=function(){$$("object","embed","iframe").each(function(a){a.setStyle({visibility:"hidden"})
})};SL.effects.showEmbededObjects=function(){$$("object","embed","iframe").each(function(a){a.setStyle({visibility:"visible"})})};SL.effects.resetStyles=function(b,a){b.setOpacity(1);b.setStyle({height:"auto",overflow:a?"hidden":"visible"})
};SL.effects.resetCurrent=function(b){var a=b.retrieve("effect");if(a){a.cancel();SL.effects.resetStyles(b);if(a.options.slAfterFinish){a.options.slAfterFinish()}b.store("effect",undefined);return true
}return false};SL.effects.registerCurrent=function(a){SL.effects.resetCurrent(a.element);if(a.options.afterFinish){a.options.slAfterFinish=a.options.afterFinish}a.options.afterFinish=function(c){var b=c.retrieve("effect");
if(b&&b.options.slAfterFinish){b.options.slAfterFinish()}c.store("effect",undefined)}.curry(a.element);a.element.store("effect",a)};SL.effects.registerHover=function(b,a){if(!a){a="hover"}b.observe("mouseenter",function(){b.addClassName(a)
});b.observe("mouseleave",function(){b.removeClassName(a)})};SL.effects.reparentToOffscreen=function(b){b.remove();var a=document.getElementsByTagName("body").item(0);a.appendChild(b);b.setStyle({position:"absolute",top:"0px",left:"-999em"});
b.show()};SL.effects.reparentAndReset=function(b,a){a.remove();b.appendChild(a);a.setStyle({position:"static",top:"auto",left:"auto"});a.show()};SL.effects.getBodyHeight=function(){var b=$$("body")[0];
var a=b.getHeight();var c=document.viewport.getHeight()+document.viewport.getScrollOffsets().top;if(c>a){a=c}if(a<=0){a=1000}return a};SL.effects.Preloader=Class.create({initialize:function(b,a){if(!b){console.log("No element");
return}this.element=b;this.finishCallback=a;this.run.bind(this).defer()},run:function(){if(this.element.retrieve("sl_preloaded")){this._emitFinished();return}var a=this.element.select("img");if(a.length==0){this._emitFinished();
return}this.remaining=a.length;a.each(function(d){if(d.readAttribute("width")&&d.readAttribute("height")){this.remaining--;return}var c=d.readAttribute("src");if(!c){this.remaining--;return}var b=new Image();
b.onload=this._onLoad.bind(this);b.onerror=this._onLoad.bind(this);b.onabort=this._onLoad.bind(this);b.src=c}.bind(this));if(this.remaining<=0){this._emitFinished()}else{setTimeout(this._emitFinished.bind(this),20000)
}},_onLoad:function(){this.remaining--;if(this.remaining<=0){this._emitFinished()}},_emitFinished:function(){if(!this.finished){this.finished=true;this.element.store("sl_preloaded",true);if(this.finishCallback){this.finishCallback.defer()
}}}});SL.effects.Queue=Class.create({initialize:function(a){this.config=$H(a);this.effects=$H();this.steps=$A(["first","last"]);this.currentStep=-1},add:function(b,a){var c=this.effects.get(b);if(c==undefined){c=$A();
this.effects.set(b,c)}c.push(a);this.effects.set(b,c)},start:function(){if(this.steps.length==0){_finished();return}this._iter()},isEmpty:function(){return this.effects.size()<=0},_iter:function(){this.currentStep++;
console.log("Step:",this.currentStep);if(this.currentStep>=this.steps.length){this._finished();return}var a=this.effects.get(this.steps[this.currentStep]);if(!a||a.length==0){this._iter();return}var b=0;
a.each(function(c){if(b<c.options.duration){b=c.options.duration}});if(b<=0){console.log("No duration:",this.effects.get(this.steps[this.currentStep]));this._iter();return}new Effect.Parallel(a,{duration:b,afterFinish:this._iter.bind(this)})
},_finished:function(){console.log("Queue finished:",this.config);if(this.config.get("afterFinish")){this.config.get("afterFinish")(this)}}});SL.effects.PointerState=Class.create({initialize:function(b,a){this.e=$(b);
if(this.e){this.onEnterHandler=this.onMouseEnter.bind(this);this.onLeaveHandler=this.onMouseLeave.bind(this);this.e.observe("mouseenter",this.onEnterHandler);this.e.observe("mouseleave",this.onLeaveHandler)
}this.cfg=a;this.hasPointer=false},onMouseEnter:function(a){this.hasPointer=true;if(this.cfg&&this.cfg.enter){this.cfg.enter(a)}},onMouseLeave:function(a){this.hasPointer=false;if(this.cfg&&this.cfg.leave){this.cfg.leave(a)
}},stop:function(){if(this.e){this.e.stopObserving(this.onEnterHandler);this.e.stopObserving(this.onLeaveHandler)}}});SL.effects._initEffect=function(d,b,a){var c=d.retrieve("sl_e_effect");if(c){return c
}c={};c.visible=d.visible();d.store("sl_e_effect",c);if(b){c.element=d.wrap("div");if(!c.visible){d.setStyle("display:block");c.element.setStyle({display:"none"})}}else{c.element=d}if(a){if(a.duration){c.duration=a.duration/1000
}else{c.duration=0.5}}return c};SL.effects.toggleVisibility=function(h,g,a){var d=$(h);if(!d){console.log("Element not found:",h);return}var c;if(a&&a.mode){c=true}else{c=false}var b=SL.effects._initEffect(d,c,a);
d=b.element;if(a&&a.mode){if(a.mode=="slide"){SL.effects.resetCurrent(d);if(b.visible){SL.effects.registerCurrent(Effect.BlindUp(d,{duration:b.duration}));b.visible=false;if($(g)){$(g).addClassName("inactive");
$(g).removeClassName("active")}}else{SL.effects.registerCurrent(Effect.BlindDown(d,{duration:b.duration}));b.visible=true;if($(g)){$(g).removeClassName("inactive");$(g).addClassName("active")}}return}}if(b.visible){d.hide();
if($(g)){$(g).addClassName("inactive");$(g).removeClassName("active")}b.visible=false}else{d.show();if($(g)){$(g).removeClassName("inactive");$(g).addClassName("active")}b.visible=true}};SL.effects.connectHover=function(g,d,a){var h=$(d);
var b=$(g);if(a){h.setStyle({visibility:"hidden"});b.observe("mouseenter",function(){h.setStyle({visibility:"visible"})});b.observe("mouseleave",function(){h.setStyle({visibility:"hidden"})});return}h.hide();
b.observe("mouseenter",function(){h.show()});b.observe("mouseleave",function(){h.hide()})}})();(function(){SL.ui.Panel=Class.create(SL.Component,{init:function(){this.config.setDefault("position","bl");
this.config.setDefault("as_tooltip",true);this.attachedElement=$(this.config.get("attach_id"));this.asTooltip=this.config.get("as_tooltip");this.trigger=$(this.config.get("mouse_over_id"));if(this.trigger){this.trigger.observe("mouseenter",this.onMouseEnter.bind(this));
this.trigger.observe("mouseleave",this.onMouseLeave.bind(this));this.e.observe("mouseenter",this.onMouseEnterOL.bind(this));this.e.observe("mouseleave",this.onMouseLeaveOL.bind(this))}if(this.config.get("expanded")){this.toggle.bind(this).defer()
}},notifyInitEvent:function(a){if(this.trigger){this.onMouseEnter(a)}},onMouseEnter:function(a){this.mouseOnTrigger=true;if(!this.shown){this.toggle()}},onMouseLeave:function(a){this.mouseOnTrigger=false;
if(this.mouseOnOverlay){return}if(this.hideTimeout){clearTimeout(this.hideTimeout)}this.hideTimeout=setTimeout(this.hideDelayed.bind(this),500)},onMouseEnterOL:function(a){this.mouseOnOverlay=true},onMouseLeaveOL:function(a){this.mouseOnOverlay=false;
if(this.mouseOnTrigger){return}if(this.hideTimeout){clearTimeout(this.hideTimeout)}this.hideTimeout=setTimeout(this.hideDelayed.bind(this),500)},hideDelayed:function(){if(!this.shown){return}if(!this.mouseOnTrigger&&!this.mouseOnOverlay){this.hide()
}},toggle:function(){if(this.shown){this.hide();return}if(!this.initialized){if(this.attachedElement){this.ap=this.e.up("#admin_panel");if(!this.ap){this.as=this.e.up(".gui_admin_sidebar_left_main");this.config.set("detach_to_body",true)
}if(!this.ap&&!this.config.get("detach_to_body")){this.attachedElement.insert({after:this.e});this.attachedElement.up().setStyle({position:"relative"})}if(this.config.get("overlay")){this.e.absolutize();
this.e.setStyle({width:null,height:null})}}else{if(this.config.get("attach_id")){console.log("Attached element not found",this.config.get("attach_id"))}}this.initialized=true}this.shown=true;if(this.attachedElement){this.updatePosition()
}this.e.show();if(this.asTooltip){this.bodyCB=this.onBodyClicked.bind(this);(function(){if(this.bodyCB){$$("body")[0].observe("click",this.bodyCB)}}).bind(this).defer();SL.ui._registerActiveTooltip(this)
}else{SL.ui._registerActiveTooltip(null);SL.ui._registerStaticTooltip(this)}if(this.attachedElement){this.attachedElement.addClassName("active")}},onUpdate:function(){},onChildComponentChanged:function(a){this.updatePosition(false)
},updatePosition:function(d){if(!this.shown){return}this.onUpdate();if(d&&this.updateCB){clearTimeout(this.updateCB)}if(this.config.get("detach_to_body")||this.ap){if(!this.detached){if(this.ap){SL.utils.reparent(this.e,this.ap)
}else{SL.utils.reparentToBody(this.e)}this.connectDestroy(this.attachedElement);this.detached=true}var c=this.attachedElement.cumulativeOffset();var g=0;var n=this.attachedElement.getFixedParent();var j;
if(n){j=this.attachedElement.cumulativeScrollOffsetFixed();c.left-=j.left;c.top-=j.top}var a=this.attachedElement.cumulativeScrollOffset();c.left-=a.left;c.right-=a.right;var h=document.viewport.getScrollOffsets();
var k=document.viewport.getDimensions();if(this.as||n){g=h.top}var m=this.config.get("position");if(m=="overlay"){var b=c.left-5;if(b+this.e.getWidth()>h.left+k.width-200){b=c.left+this.attachedElement.getWidth()-this.e.getWidth()
}this.e.setStyle({top:(c.top+g-5)+"px",left:b+"px",zIndex:this.getZIndex()+""})}else{var l=c.top+this.attachedElement.getHeight()+g;if(n){if(l+this.e.getHeight()>h.top+k.height){if(l-this.e.getHeight()>h.top){l=l-this.e.getHeight()-this.attachedElement.getHeight()
}}}if(m=="br"){this.e.setStyle({top:(l)+"px",left:(c.left+this.attachedElement.getWidth()-this.e.getWidth())+"px",zIndex:this.getZIndex()+""})}else{this.e.setStyle({top:(l)+"px",left:c.left+"px",zIndex:this.getZIndex()+""})
}}}else{if(this.config.get("overlay")){var c=this.attachedElement.positionedOffset();var m=this.config.get("position");if(m=="br"){this.e.setStyle({top:(c.top+this.attachedElement.getHeight())+"px",left:(c.left+this.attachedElement.getWidth()-this.e.getWidth())+"px",zIndex:this.getZIndex()+""})
}else{this.e.setStyle({top:(c.top+this.attachedElement.getHeight())+"px",left:c.left+"px",zIndex:this.getZIndex()+""})}}}this.updateCB=setTimeout(this.updatePosition.bind(this),250)},hide:function(){this._hide(false)
},_hide:function(a){if(!this.shown){return}this.e.hide();this.shown=false;if(!a){if(this.asTooltip){SL.ui._registerActiveTooltip(null)}else{SL.ui._registerStaticTooltip(null)}}if(this.bodyCB){$$("body")[0].stopObserving("click",this.bodyCB);
this.bodyCB=undefined}if(this.attachedElement){this.attachedElement.removeClassName("active")}},onBodyClicked:function(j){if(this.shown){var k=this.e.cumulativeOffset();var a=j.pageX;var g=k.left;var b=this.e.offsetWidth;
var l=j.pageY;var d=k.top;var c=this.e.offsetHeight;if(a>g&&a<g+b&&l>d&&l<d+c){return}console.log(a,l,g,d,b,c);this.hide()}},getZIndex:function(){if(this.ap||this.config.get("admin")){if(this.attachedElement&&this.attachedElement.up(".admin_panel_toolbar")){return 960
}return SL.admin._overlayIndex+1}return SL.ui._overlayIndex+5}})})();(function(){SL.ui.MenuHorizontal=Class.create(SL.Component,{init:function(){this.config.setDefault("hide_delay",500);this.config.setDefault("show_effect","blind_down");
this.config.setDefault("show_duration",200);this.config.setDefault("hide_effect","fade");this.config.setDefault("hide_duration",200);this.config.setDefault("css_prefix","dropdown_menu");this.config.setDefault("mode","normal");
this.cssPrefix=this.config.get("css_prefix");if(this.config.get("mode")=="normal"){this.initSubElements(true,this.e.down("ul"))}else{this.e.select("li."+this.cssPrefix+"_horizontal").each(this.initElement.bind(this,true));
this.e.select("li."+this.cssPrefix).each(this.initElement.bind(this,false))}},initSubElements:function(a,b){b.childElements().each(function(d){this.initElement(a,d);var c=d.down(">div.children>ul");if(c&&!c.up().hasClassName("custom_children")){this.initSubElements(false,c)
}}.bind(this))},initElement:function(a,b){if(a&&SL.browser.IE6){b.down().setStyle({width:"1%"})}b.observe("mouseenter",this.onMouseEnter.bind(this,b));b.observe("mouseleave",this.onMouseLeave.bind(this,b))
},onMouseEnter:function(d){var c=d.up();c.childElements().each(this._resetChild.bind(this,d));var a=this.config.get("mode")=="normal"?d.down("div.children"):d.down("div."+this.cssPrefix);if(!a){return}if(a.retrieve("visible")){if(a.retrieve("status")!="visible"){a.store("status","visible")
}return}a.store("visible",true);if(!SL.effects.resetCurrent(a)){SL.effects.resetStyles(d);var b=this.config.get("show_effect");if(b=="appear"){a.hide();SL.effects.registerCurrent(Effect.Appear(a,{duration:this.config.get("show_duration")/1000}))
}else{if(b=="blind_down"){a.hide();SL.effects.registerCurrent(Effect.BlindDown(a,{duration:this.config.get("show_duration")/1000}))}}}d.addClassName("active");this._getNavItem(d).addClassName("active")
},_resetChild:function(b,a){if(b==a){return}var c=this.config.get("mode")=="normal"?a.down("div.children"):a.down("div."+this.cssPrefix);if(c==null){return}SL.effects.resetCurrent(c);SL.effects.resetStyles(c);
c.store("visible",false);c.store("status","hidden");a.removeClassName("active");this._getNavItem(a).removeClassName("active");c.hide()},onMouseLeave:function(b){var a=this.config.get("mode")=="normal"?b.down("div.children"):b.down("div."+this.cssPrefix);
if(!a){return}a.store("status","delayed_hide");setTimeout(this.delayedHide.bind(this,b,a),this.config.get("hide_delay"))},delayedHide:function(c,a){if(a.retrieve("status")!="delayed_hide"){return}SL.effects.resetCurrent(a);
var b=this.config.get("hide_effect");if(b=="blind_up"){SL.effects.registerCurrent(Effect.BlindUp(a,{duration:this.config.get("hide_duration")/1000,afterFinish:this._clearHover.bind(this,c)}))}else{if(b=="fade"){SL.effects.registerCurrent(Effect.Fade(a,{duration:this.config.get("hide_duration")/1000,afterFinish:this._clearHover.bind(this,c)}))
}else{c.removeClassName("hover")}}a.store("visible",false);a.store("status","hidden")},_clearHover:function(a){a.removeClassName("active");this._getNavItem(a).removeClassName("active")},_getNavItem:function(a){return a.down()
}});SL.ui.ContextMenu=Class.create(SL.ui.Panel,{init:function($super){var c=this.config.get("mode");var a=this.config.get("attach_id");if(c=="mouseover"){this.config.setDefault("mouse_over_id",a)}$super();
if(c=="contextmenu"){$(a).observe("contextmenu",function(d){this.toggle(this);d.stop()}.bind(this))}else{if(c=="click"){$(a).observe("click",this.toggle.bind(this))}}var b=$(this.config.get("click_id"));
if(b){b.observe("contextmenu",function(d){this.toggle(this);d.stop()}.bind(this));b.observe("click",function(d){this.toggle(this);d.stop()}.bind(this))}this.e.select("a").each(function(d){d.observe("click",function(){this.hide()
}.bind(this))}.bind(this))},getZIndex:function($super){if(this.ap||this.config.get("admin")){return 960}return $super()}})})();(function(){SL.ui.Expandable=Class.create(SL.Component,{init:function(){this.config.setDefault("duration",0);
this.config.setDefault("state_url",null);this.config.setDefault("css_prefix","expandable");this.config.setDefault("button_class",this.config.get("css_prefix")+"_btn");var a=this.e.down();var c=this.e.select("."+this.config.get("button_class"));
this.img=c[0]?c[0].down():false;this.body=a.next().down();var b=this.body.getStyle("display");this.expanded=!b||b=="block"},toggle:function(){if(this.expanded){this.hide()}else{this.show()}var b=this.config.get("state_url");
if(b){var a=b+"&args.state=";if(this.expanded){a+="true"}else{a+="false"}new Ajax.Request(a,{method:"get"})}},_getImgURL:function(a){if(!this.img){return}var c=this.img.src.lastIndexOf("/");var b=this.img.src.lastIndexOf("_");
if(b>c){c=b}if(c<0){return}return this.img.src.substring(0,c+1)+a+".png"},show:function(){this.e.addClassName("active");this.e.removeClassName("inactive");var a=this.config.get("duration");if(a<=0){this.body.setStyle("display:block")
}else{SL.effects.resetCurrent(this.body);this.body.setStyle({overflow:"hidden"});SL.effects.registerCurrent(Effect.BlindDown(this.body,{duration:a/1000}))}this.img.src=this._getImgURL("up");this.expanded=true
},hide:function(){this.e.removeClassName("active");this.e.addClassName("inactive");var a=this.config.get("duration");if(a<=0){this.body.setStyle("display:none")}else{SL.effects.resetCurrent(this.body);
this.body.setStyle({overflow:"hidden"});SL.effects.registerCurrent(Effect.BlindUp(this.body,{duration:a/1000}))}this.img.src=this._getImgURL("down");this.expanded=false}})})();(function(){SL.ui.Accordion=Class.create(SL.Component,{init:function(){this.config.setDefault("duration",0);
this.config.setDefault("on_mouse_over",false);this.config.setDefault("css_prefix","accordion");this.config.setDefault("button_class",this.config.get("css_prefix")+"_btn");this.config.setDefault("mode","complex");
if(this.config.get("fix_old_ie")){var b=SL.getIE();if(b>0&&b<9){this.config.set("duration",-1)}}this.cssPrefix=this.config.get("css_prefix");this.mode=this.config.get("mode");this.duration=this.config.get("duration");
this.onMouseOver=this.config.get("on_mouse_over");this.active=-1;if(this.mode=="list"){this.list=this.e.down("ul");var d=this.list.childElements();for(var c=0;c<d.length;c++){var h=d[c];if(h.hasClassName("selected")){this.active=c
}if(!h.down("ul")){continue}if(this.onMouseOver){h.observe("mouseenter",this._onMouseOver.bind(this,c))}else{h.observe("click",this._onMouseClicked.bind(this,c))}}}else{this.children=this.e.down().childElements();
for(var c=0;c<this.children.length;c++){var h=this.children[c];h.store("acc_idx",c);try{var a=h.down("."+this.cssPrefix+"_body").down();var g=a.getStyle("display");if(g==null||g=="block"){this.active=c;
h.addClassName("active")}else{h.addClassName("inactive")}}catch(h){console.error(h)}}if(this.onMouseOver){for(var c=0;c<this.children.length;c++){this.children[c].down().observe("mouseenter",this._onMouseOver.bind(this,c))
}}}this.updateState(false)},_onMouseOver:function(b,a){this.setActive(b)},_toggleBtn:function(d,h){var g=d.select("."+this.config.get("button_class"));if(!g){return}for(var c=0;c<g.length;c++){var a=g[c].down();
if(!a){continue}var j=a.src.lastIndexOf("/");var b=a.src.lastIndexOf("_");if(b>j){j=b}if(j<0){continue}a.src=a.src.substring(0,j+1)+h+".png"}},getElement:function(a){if(this.mode=="list"){var b=this.list.childElements()[a];
if(b){return b.down("ul")}console.error("No child for element:",a);return}return this.children[a].down("."+this.cssPrefix+"_body").down()},setActive:function(b){if(this.onMouseOver&&this.active==b){return
}if(this.config.get("multi")){var a=this.getElement(b);if(a.up().up().hasClassName("active")){if(this.duration<=0){a.setStyle("display:none")}else{SL.effects.resetCurrent(a);SL.effects.registerCurrent(Effect.BlindUp(a,{duration:this.duration/1000}))
}a.up().up().addClassName("inactive");a.up().up().removeClassName("active");if(this.mode!="list"){var d=this.children[b];if(d){this._toggleBtn(d.down(),"down")}else{console.error("No child for active element:",this.active)
}}this.active=-1;this.updateState(true);return}}if(this.active>=0&&!this.config.get("multi")){var a=this.getElement(this.active);if(this.duration<=0){a.setStyle("display:none")}else{SL.effects.resetCurrent(a);
SL.effects.registerCurrent(Effect.BlindUp(a,{duration:this.duration/1000}))}a.up().up().addClassName("inactive");a.up().up().removeClassName("active");if(this.mode!="list"){var d=this.children[this.active];
if(d){this._toggleBtn(d.down(),"down")}else{console.error("No child for active element:",this.active)}}}if(this.active==b){this.active=-1;this.updateState(true);return}var a=this.getElement(b);if(this.duration<=0){a.setStyle("display:block")
}else{SL.effects.resetCurrent(a);SL.effects.registerCurrent(Effect.BlindDown(a,{duration:this.duration/1000}))}a.up().up().addClassName("active");a.up().up().removeClassName("inactive");this.active=b;if(this.mode!="list"){var d=this.children[this.active];
if(d){this._toggleBtn(d.down(),"up")}else{console.error("No child for active element:",this.active)}}this.updateState(true)},updateState:function(g){var j=this.config.get("state_url");if(!j){return}if(!this.states){this.states={}
}for(var c=0;c<this.children.length;c++){var d=this.children[c];var h=d.id;if(!h){h=c}this.states[h]=d.hasClassName("active")}if(g){var a=Object.toJSON(this.states);var b=j.replace("@state@",a);new Ajax.Request(b,{method:"get"})
}}})})();(function(){SL.ui._overlayIndex=65;SL.ui._getNewOverlayIndex=function(){SL.ui._overlayIndex=SL.ui._overlayIndex+10;return SL.ui._overlayIndex};SL.ui.Overlay=Class.create(SL.Component,{init:function(){this.config.setDefault("backdrop_opacity",0.7);
this.config.setDefault("backdrop_duration",250);this.config.setDefault("delete_on_hide",false);this.config.setDefault("background-color","#ffffff");this.config.setDefault("load_shaded",true);this.config.setDefault("hide_objects",true);
this.e.setStyle({position:"absolute"});if(this.config.get("background-color")!="auto"){this.e.setStyle({backgroundColor:this.config.get("background-color")})}if(this.config.get("show")){this.show.bind(this).defer()
}},show:function(){if(this.shown){return}SL.ui._closeActiveTooltips();if(!this.admin){if(this.e.up(".gui_admin_panel")){this.admin=SL.byID("admin_panel")}}if(this.config.get("hide_objects")){SL.effects.hideEmbededObjects()
}this.exKB=SL.events.pushKeyboardObserver({modal:true,keydown:this.onKeyDown.bind(this)});if(SL.admin&&(this.admin||this.config.get("admin"))){if(this.id=="admin_panel_dialog"){this.zIndex=915}else{this.zIndex=SL.admin._getNewOverlayIndex()
}}else{this.zIndex=SL.ui._getNewOverlayIndex()}this._showBackdrop();this.beforeShowOverlay();this.centerToViewport(this.e);if(this.zIndex){this.e.setStyle({zIndex:(this.zIndex+1)+""})}this.e.appear({duration:0.1,afterFinish:this.afterShow.bind(this)});
this.shown=true;SL.ui.disableForOverlay()},setCloseJS:function(a){this.closeJS=a},beforeShowOverlay:function(){},afterShow:function(){},afterHideOverlay:function(){},beforeHide:function(){},hide:function(c,a){if(!c){c="abort"
}if(!this.shown){this._hideBackdrop(c);return}this.beforeHide();SL.events.removeKeyboardObserver(this.exKB);this.e.hide();this._hideBackdrop(c);if(this.onClose){var b=this.onClose.get(c)||this.onClose.get("all");
if(b){try{b(c)}catch(d){console.log(d)}}}if(!a&&this.closeJS){this.closeJS(this)}this.shown=false;SL.ui.enableAfterOverlay();this.afterHide();if(this.id=="admin_panel_dialog"){SL.admin.resetTitle();SL.admin.setArea(false)
}else{if(this.id=="admin_sidebar_left_view"){SL.admin.resetTitle()}}},afterHide:function(){},getTopLeftForCenter:function(d,a){var c=document.viewport.getWidth();var b=document.viewport.getHeight();var j=0;
var h=0;if(d<c){h=(c-d)/2}var g=document.viewport.getScrollOffsets();if(this.admin){return{top:25,left:h+g.left}}if(a<b){j=(b-a)/2}return{top:j+g.top,left:h+g.left}},centerToViewport:function(b){if(!b){b=this.e
}var a=this.getTopLeftForCenter(b.getWidth(),b.getHeight());this.e.setStyle({top:a.top+"px",left:a.left+"px"});this.afterCentered()},afterCentered:function(){},_getBackdrop:function(){var b=this.id+"_g_backdrop";
var a=$(b);if(!a){a=SL.utils.createBodyElement("div",{id:b});a.setStyle({position:"absolute",top:"0",left:"0",width:"100%",height:SL.effects.getBodyHeight()+"px",backgroundColor:"#000000"});a.addClassName("dialog_backdrop");
a.hide();a.observe("click",this.hide.bind(this))}a.setStyle({zIndex:this.zIndex+""});return a},_showBackdrop:function(b){this.hideBackdropCB=b;if(this.admin){this.admin.showBackdrop(this.hide.bind(this));
return}var a=this._getBackdrop(b);a.setStyle({height:SL.effects.getBodyHeight()+"px"});a.appear({duration:this.config.get("backdrop_duration")/1000,from:0,to:this.config.get("backdrop_opacity")})},_hideBackdrop:function(a){if(this.admin){if(this.config.get("hide_objects")){SL.effects.showEmbededObjects()
}this.admin.hideBackdrop(a);return}var b=this._getBackdrop();b.fade({duration:this.config.get("backdrop_duration")/1000,afterFinish:this._afterHideOverlay.bind(this,b)});if(this.config.get("hide_objects")){SL.effects.showEmbededObjects()
}},onKeyDown:function(a){if(a.code==Event.KEY_ESC||a.key=="q"){this.hide();return true}return false},_afterHideOverlay:function(a){this.afterHideOverlay();if(this.config.get("delete_on_hide")){a.remove();
this._destroy()}if(this.hideBackdropCB){this.hideBackdropCB()}},cleanup:function($super){SL.events.removeKeyboardObserver(this.exKB);$super()},addOnClose:function(a){this.onClose=$H(a)}});SL.ui.Dialog=Class.create(SL.ui.Overlay,{isDialog:true,init:function($super){this.config.setDefault("backdrop_opacity",0.6);
this.config.setDefault("static_height",false);this.config.setDefault("min_height",-1);$super();this.config.setDefault("dialog_class","gui_dialog");this.config.setDefault("add_class","gui_overlay");this.css=this.config.get("dialog_class");
this.e.addClassName(this.css);this.e.addClassName(this.config.get("add_class"));if(this.config.get("content_only")){this.e.addClassName("content_only")}},onDragStart:function(){this.dragged=true},onChildComponentChanged:function(a,b){this._updateOverlay.bind(this,false,b).defer()
},updateScrollPosition:function(){if(!this.admin){return}var g=this.e.cumulativeOffset().top;var a=document.viewport.getScrollOffsets();if(g>a.top){return}var d=document.viewport.getHeight();var c=g+this.e.getHeight();
if(c<a.top+d){var b=c-d;if(b<0){b=0}window.scrollTo(a.left,b)}},onSuccess:function(){if(this.draggable){this.draggable.destroy()}if(!this.admin&&this.e.select("."+this.css+"_head").size()>0){this.draggable=new SL.dnd.Draggable(this.e,{grip_class:this.css+"_head",cb:{dragStart:this.onDragStart.bind(this),moved:this.afterCentered.bind(this)}})
}if(this.nextMaxWidth){this.maxWidth=this.nextMaxWidth;this.nextMaxWidth=undefined}this._updateOverlay(true)},reset:function(){this._cleanup(true);this.e.update("");this.e.setStyle({width:"100px",height:"100px",minHeight:0,maxHeight:"none"})
},showAndLoad:function(b,a){this.nextMaxWidth=a>0?a:undefined;if(this.shown){var c=this.e.down("."+this.css+"_content_outer");this.load(b,c?c.identify():this.id);return}this.reset();this.show();this.load(b);
if(this.admin){window.scrollTo(0,0)}this.centerToViewport();setTimeout(function(d){if(this.version==d&&this.e.getStyle("visibility")=="hidden"){this.e.setStyle({visibility:"visible"})}}.bind(this,this.version),250);
this.e.setStyle({visibility:"hidden"})},afterHide:function(){this.reset()},show:function($super){this.maxWidth=undefined;$super()},setSize:function(a,c,b){this.config.set("size",a);this.config.set("static_height",c);
if(b){this.config.set("min_height",b)}this._updateOverlay()},setMaxWidth:function(a){this.maxWidth=a;this._updateOverlay()},_updateOverlay:function(c,h){if(this.admin){var k=this.e.down("."+this.css+"_content_outer");
var g=this.admin.backdrop.getWidth()-100;if(k&&this.maxWidth){if(this.maxWidth<g){g=this.maxWidth}this.e.setStyle({width:"auto",height:"auto",minHeight:0});k.setStyle({width:g+"px",height:"auto",maxHeight:(document.viewport.getHeight()-this.admin.backdrop.cumulativeOffset().top-100)+"px"})
}else{if(k){k.setStyle({width:"auto",maxHeight:"none"})}this.e.setStyle({width:g+"px",height:"auto",minHeight:(document.viewport.getHeight()-this.admin.backdrop.cumulativeOffset().top-100)+"px",maxHeight:"none"})
}if(!h){this.centerToViewport()}if(c){new SL.effects.Preloader(this.e,this._updateOverlay.bind(this)).run()}else{this.updateScrollPosition()}return}var k=this.e.down("."+this.css+"_content_outer");if(!k){var d=this.config.get("size");
if(d){this.e.setStyle({width:d.width>0?(d.width+"px"):"auto",height:d.height>0?(d.height+"px"):"auto"})}if(!h){this.centerToViewport()}if(c){new SL.effects.Preloader(this.e,this._updateOverlay.bind(this)).run()
}return}this.e.setStyle({width:"auto",height:"auto"});var b=k.down();var g="auto";var a="auto";var j=true;d=this.config.get("size");if(!d){if(b.getWidth()>document.viewport.getWidth()-60){g=document.viewport.getWidth()-60+"px"
}if(b.getHeight()>document.viewport.getHeight()-60){a=document.viewport.getHeight()-60+"px"}}else{j=!(d.height>0);g=(d.width>0?d.width:b.getWidth()+2)+"px";if(this.config.get("static_height")){a=(d.height>0?d.height:b.getHeight()+2)+"px"
}else{if(d.height>0){a=b.getHeight()>d.height?d.height:b.getHeight();if(a>document.viewport.getHeight()-60){a=document.viewport.getHeight()-60+"px"}else{a=a+"px"}}else{if(b.getHeight()>document.viewport.getHeight()-60){a=document.viewport.getHeight()-60+"px"
}else{a="auto"}}}}if(j){k.setStyle({width:g,height:"auto",minHeight:a})}else{k.setStyle({width:g,height:a,minHeight:"0"})}if(this.config.get("min_height")>k.getHeight()){k.setStyle({height:this.config.get("min_height")+"px"})
}if(!h){this.centerToViewport()}if(c){new SL.effects.Preloader(this.e,this._updateOverlay.bind(this)).run()}},cleanup:function($super){if(this.draggable){this.draggable.destroy()}}});SL.ui.Lightbox=Class.create(SL.ui.Overlay,{init:function($super){$super();
this.config.setDefault("resize_duration",500);this.config.setDefault("counter_template",new Template("#{index} of #{total}"));this.config.setDefault("content_dimension",null);this.config.setDefault("mode","auto");
this.config.setDefault("show_bottom",true);this.config.setDefault("bottom_duration",100);this.config.setDefault("hide_on_click","auto");this.config.setDefault("counter_top",false);this.config.setDefault("switch_duration",1000);
this.e.addClassName("lightbox");this.currentImage=0;this.mode=this.config.get("mode");this.diaTimeout=this.config.get("dia_timeout");this.contentDimension=this.config.get("content_dimension");if(this.mode=="auto"){var a=$(this.config.get("gallery_id"));
this.images=$A();a.select("a").each(function(c){this.images.push({url:c.readAttribute("href"),text:c.readAttribute("title")});c.observe("click",function(d,g){g.stop();this.showImage(d)}.bind(this,this.images.length-1))
}.bind(this))}else{if(this.mode=="json"){this.images=$A(this.config.get("data"))}else{if(this.mode=="html"){var a=$(this.config.get("gallery_id"));var b=this.config.get("content_dimension");this._switchImage(this.currentImage+1);
this.images=$A();a.childElements().each(function(c){this.images.push({e:c,text:c.readAttribute("title")});SL.effects.reparentToOffscreen(c);if(b){c.setStyle({maxWidth:b.width+"px"})}}.bind(this))}else{console.log("Unknown mode:",this.mode)
}}}if(this.config.get("autostart")){this.showImage.bind(this,0).defer()}},beforeShowOverlay:function(){if(this.diaTimeout){this.dia=true}this._initDefaultLayout()},afterShow:function(){this._updateForImage()
},showImage:function(a){this.currentImage=a;this.show()},showImageWithID:function(c){for(var a=0;a<this.images.length;a++){var b=this.images[a];if(b.id==c){this.currentImage=a;this.show();return}}console.log("Lightbox: No image with id ",c)
},next:function(a){if(a){a.stop()}if(this.dia){this.dia=false}if(this.currentTimeout){clearTimeout(this.currentTimeout)}this._switchImage(this.currentImage+1)},prev:function(a){if(a){a.stop()}if(this.dia){this.dia=false
}if(this.currentTimeout){clearTimeout(this.currentTimeout)}this._switchImage(this.currentImage-1)},_initDefaultLayout:function(){if(this.e.childElements().length>0){return}var k;if(this.mode=="html"){k=""
}else{if(!this.config.get("content_dimension")||!this.diaTimeout){k='<img src="" />'}else{k="";for(var h=0;h<this.images.length;h++){k+='<img style="position:absolute;top:0;left:0;display:none;" src="" />'
}}}var b;if(this.config.get("show_bottom")){var a='<div class="lightbox_details">';if(this.config.get("counter_top")){a+='<div class="lightbox_counter"></div><div class="lightbox_text"></div>'}else{a+='<div class="lightbox_text"></div><div class="lightbox_counter"></div>'
}if(this.config.get("add_content")){a=a+'<div class="lightbox_add_content">'+this.config.get("add_content")+"</div>"}if(this.config.get("print_img")){a=a+'<div class="lightbox_print"><img src="'+this.config.get("print_img")+'" /></div>'
}a=a+"</div>";b='<div class="lightbox_bottom" style="display:none">'+a;if(!this.config.get("top_close")){b+='<div class="lightbox_close"></div>'}b+="</div>"}else{b=""}var c;if(this.images.length>1&&!this.config.get("hide_nav")){c='<div class="lightbox_hnav"><a href="#" class="lightbox_hnav_next"></a><a href="#" class="lightbox_hnav_prev"></a></div>';
this.hasHoverNav=true}else{c=""}var j='<div class="lightbox_content">'+c+'<div id="'+this.id+'_content_inner" class="lightbox_content_inner">'+k+"</div></div>"+b;if(this.config.get("top_close")){j='<div class="lightbox_close_top"></div>'+j
}this.e.insert({top:j});this.hoverNext=this.e.down(".lightbox_hnav_next");this.hoverPrev=this.e.down(".lightbox_hnav_prev");this.content=this.e.down(".lightbox_content");this.contentInner=this.e.down(".lightbox_content_inner");
if(this.config.get("top_close")){this.close=this.e.down(".lightbox_close_top")}else{this.close=this.e.down(".lightbox_close")}this.text=this.e.down(".lightbox_text");this.counter=this.e.down(".lightbox_counter");
this.bottom=this.e.down(".lightbox_bottom");this.addContent=this.e.down(".lightbox_add_content");if(this.hasHoverNav){this.hoverNext.observe("click",this.next.bind(this));this.hoverPrev.observe("click",this.prev.bind(this));
SL.effects.registerHover(this.hoverNext);SL.effects.registerHover(this.hoverPrev)}if(this.close){this.close.observe("click",this.hide.bind(this))}var g=this.config.get("content_dimension");if(g){this.content.setStyle({width:g.width>0?(g.width+"px"):"auto",height:g.height>0?(g.height+"px"):"auto",overflow:"hidden",position:"relative"});
this.contentInner.setStyle({position:"relative"});if(this.bottom){this.bottom.show();this.bottom.setStyle({width:g.width+"px"})}}else{this.content.setStyle({width:"200px",height:"200px",overflow:"hidden"})
}this.contentInner.setStyle({overflow:"hidden",width:"100%"});var l=this.config.get("hide_nav")||this.config.get("hide_on_click");if(l=="auto"&&this.images.length<=1){this.e.observe("click",this.hide.bind(this))
}else{if(l==true){this.e.observe("click",this.hide.bind(this))}}var d=this.e.down(".lightbox_print");if(d){d.observe("click",slPrintElement.curry(this.id+"_content_inner"))}},_updateForImage:function(){this.inAnimation=true;
var c=this.images[this.currentImage];if(!this.diaTimeout||!this.config.get("content_dimension")){this.content.addClassName("loading");this.contentInner.hide();this.e.setOpacity(0.8)}if(this.mode=="html"){new SL.effects.Preloader(c.e,this._updateForHTML.bind(this));
return}var b;if(!this.config.get("content_dimension")||!this.diaTimeout){b=this.contentInner.down("img")}else{b=this.contentInner.children[this.currentImage];b.hide()}var a=new Image();a.onload=function(){b.writeAttribute("src",c.url);
this._resizeTo.bind(this,a.width,a.height,b).defer()}.bind(this);a.src=c.url},_updateForHTML:function(){var d=this.images[this.currentImage];var b=d.e.getWidth();var a=d.e.getHeight();this.contentInner.childElements().each(function(g){SL.effects.reparentToOffscreen(g)
});SL.effects.reparentAndReset(this.contentInner,d.e);var c=this.config.get("content_dimension");if(c){if(b>c.width){b=c.width;d.e.setStyle({width:b+"px"});if(c.height>0){a=c.height}}}this._resizeTo(b,a)
},_resizeTo:function(k,a,m){var l=this.content;var j=this.config.get("content_dimension");if(j!=null){var n=0;var g=0;if(j.width>0&&k!=j.width){g=(j.width-k)/2}if(j.height>0&&a!=j.height){n=(j.height-a)/2
}if(!m||!this.diaTimeout){this.contentInner.setStyle({top:n+"px",left:g+"px",width:k+"px",height:a+"px"});this._afterUpdateFinished(j.width,j.height)}else{this.contentInner.setStyle({width:"100%",height:j.height>0?(j.height+"px"):"auto"});
if(!this.currentIE){if(m){m.show()}this.currentIE=m;this._afterUpdateFinished(j.width,j.height)}else{console.log("appear:"+m.src);m.appear({duration:this.config.get("switch_duration")/1000,from:0,to:1,afterFinish:this._afterUpdateFinished.bind(this,k,a)});
this.currentIE.fade({duration:this.config.get("switch_duration")/1000,from:1,to:0});this.currentIE=m}this.currentIE.setStyle({top:n+"px",left:g+"px"})}this.centerToViewport.bind(this,this.e).defer();return
}var c=l.getWidth();var d=l.getHeight();var g=parseFloat(this.e.getStyle("left")||"0");var p=this.getTopLeftForCenter(k,a);var h=this.config.get("resize_duration")/2000;if(h<=0){l.setStyle({width:k+"px",height:a+"px"});
this.e.setStyle({top:p.top+"px",left:p.left+"px"});this._afterUpdateFinished(k,a);return}var b=new SL.effects.Queue({afterFinish:this._afterUpdateFinished.bind(this,k,a)});hScale=a*100/d;wScale=k*100/c;
if(d!=a){b.add("first",new Effect.Scale(l,hScale,{sync:true,scaleX:false,scaleContent:false,duration:h}));b.add("first",new Effect.Move(this.e,{sync:true,y:p.top,x:g,duration:h,mode:"absolute"}))}if(c!=k){b.add("last",new Effect.Scale(l,wScale,{sync:true,scaleY:false,scaleContent:false,duration:h}));
b.add("last",new Effect.Move(this.e,{sync:true,y:p.top,x:p.left,duration:h,mode:"absolute"}))}if(!this.contentDimension&&this.bottom){SL.effects.resetCurrent(this.bottom);this.bottom.hide()}if(b.isEmpty()){this._afterUpdateFinished(k,a);
return}b.start()},_switchImage:function(a){if(this.inAnimation){return}if(a<0){a=this.images.length-1}else{if(a>=this.images.length){a=0}}this.currentImage=a;this._updateForImage()},_afterUpdateFinished:function(c,a){if(this.dia){if(this.currentTimeout){clearTimeout(this.currentTimeout)
}this.currentTimeout=setTimeout(function(){this._switchImage(this.currentImage+1)}.bind(this),this.diaTimeout)}this.images[this.currentImage].loaded=true;var b=(this.currentImage>=this.images.length-1)?0:this.currentImage+1;
if(!this.images[b].loaded){if(this.mode=="html"){new SL.effects.Preloader(this.images[b].e)}else{new Image().src=this.images[b].url}}if(this.hasHoverNav){if(this.currentImage>=this.images.length-1){this.hoverNext.hide()
}else{this.hoverNext.show();if(this.contentDimension){this.hoverNext.setStyle({height:this.contentDimension.height+"px",width:(c/2)-1+"px"})}else{this.hoverNext.setStyle({height:a>0?(a+"px"):"auto",width:(c/2)-1+"px"})
}}if(this.currentImage<=0){this.hoverPrev.hide()}else{this.hoverPrev.show();if(this.contentDimension){this.hoverPrev.setStyle({height:this.contentDimension.height+"px",width:(c/2)-1+"px"})}else{this.hoverPrev.setStyle({height:a>0?(a+"px"):"auto",width:(c/2)-1+"px"})
}}}this.content.removeClassName("loading");this.contentInner.show();this.e.setOpacity(1);if(this.bottom){var d=this.images[this.currentImage];if(d.text){this.text.show();this.text.update(d.text)}else{this.text.hide()
}if(this.images.length>1){this.counter.update(this.config.get("counter_template").evaluate({total:this.images.length,index:this.currentImage+1}))}if(!this.contentDimension){this.bottom.setStyle({width:c+"px"});
SL.effects.registerCurrent(new Effect.BlindDown(this.bottom,{duration:this.config.get("bottom_duration")/1000}))}}setTimeout(function(){this.inAnimation=false}.bind(this),50)},onKeyDown:function($super,a){if($super(a)){return true
}if(this.inAnimation||this.images.length<2){return}if(a.code==Event.KEY_LEFT){this.prev()}else{if(a.code==Event.KEY_RIGHT){this.next()}}}});SL.ui.showSimpleLightbox=function(a,b,l,g,d,k,j,c,h){new SL.ui.Lightbox(a,{counter_template:j,mode:"json",hide_on_click:c,delete_on_hide:true,content_dimension:l,print_img:g,dia_timeout:d,switch_duration:k,hide_nav:h,data:b}).showImage(0)
};SL.ui.getDialog=function(b){var a=SL.byID(b);while(a){if(a.isDialog){return a}a=a.getParentComponent()}};SL.ui.disableForOverlay=function(){$$("div.you_tube>iframe").each(function(a){if(a.getStyle("visibility")!="hidden"){a.addClassName("__sl__hidden");
a.setStyle({visibility:"hidden"})}})};SL.ui.enableAfterOverlay=function(){$$(".__sl__hidden").each(function(a){a.removeClassName("__sl__hidden");a.setStyle({visibility:"visible"})})}})();(function(){SL.ui.TreeTable=Class.create(SL.Component,{init:function(){this.config.setDefault("selectable",false);
this.config.setDefault("keyboard_editing",false);this.config.setDefault("no_double_select",false);this.rows=this.config.get("rows");this.componentID=this.config.get("component_id");if(this.config.get("selectable")&&this.rows){this.selected=false;
this.config.get("rows").each(function(c){var b=$(c.id);b.observe("click",this.onRowClicked.bind(this,b))}.bind(this));var a=this.config.get("selected");if(!this.componentID){if(a){SL.storage.ensureHash("tree_selection").set(this.id,a)
}else{a=SL.storage.ensureHash("tree_selection").get(this.id)}}if(a){this.selected=$(a);if(this.selected){this.selected.addClassName("selected");if(this.componentID){SL.byID(this.componentID).updateArgs({"tree.selection":a})
}}}else{if(this.config.get("select_first")){console.log(this.rows[0].id);this.onRowClicked.bind(this,$(this.rows[0].id)).defer()}}this.dndActionURL=this.config.get("dnd_action_url");this.dndActionComponent=this.config.get("dnd_action_component");
if(this.dndActionURL){this.dnd=new SL.dnd.SortableTable(this.e.down("table"),{cb:{dragStart:this.onDragStart.bind(this),dragStop:this.onDragStop.bind(this)},grip_class:this.config.get("grip_class")})}if(this.config.get("keyboard_editing")){this.keyObserver=SL.events.pushKeyboardObserver({keydown:this.onKey.bind(this)})
}}this.ignoreSelect=0},ignoreNextSelect:function(){this.ignoreSelect++;setTimeout(function(){this.ignoreSelect--}.bind(this),100)},onDragStart:function(a,b){this.rows.each(function(g){if(!g.last){return
}var d=$(g.id);var c=SL.elements.createBlindRow(d);c.setStyle({backgroundColor:"#cccccc",height:"10px"});c.addClassName("sljs__tree_table_dnd_marker");c.id=g.id+"__last_child";d.insert({after:c})}.bind(this))
},onDragStop:function(b,j,h){var g=j.next();var d=j.previous();this.e.select(".sljs__tree_table_dnd_marker").each(function(c){c.remove()});if(this.dndActionURL){var k;var m;if(g){k=g.id;if(k.endsWith("__last_child")){k=k.substring(0,k.length-12);
m=false}else{m=true}}else{if(d){k=d.id;m=false}else{console.log("No target found");return}}var a=this.dndActionURL+"&args.dnd_action_source_id="+j.id+"&args.dnd_action_target_id="+k+"&args.dnd_action_above="+m;
var l=SL.byID(this.dndActionComponent);l.loadBackground(a)}},onKey:function(d){if(!this.selected||this.disabled){return}if(d.shift){var b=$H(this.getActions(this.selected.id));var c=undefined;switch(d.code){case Event.KEY_DOWN:c=b.get("down");
break;case Event.KEY_UP:c=b.get("up");break;case Event.KEY_LEFT:c=b.get("left");break;case Event.KEY_RIGHT:c=b.get("right");break;default:if(d.key=="n"){c=b.get("add")}else{if(d.key=="e"){c=b.get("edit")
}else{if(d.key=="m"){c=b.get("move")}}}}if(c){this._disableTemp();c()}return true}if(d.code==Event.KEY_DOWN){var g=this.selected.next();if(g){this.onRowClicked(g)}return true}if(d.code==Event.KEY_UP){var g=this.selected.previous();
if(g){this.onRowClicked(g)}return true}if(d.code==Event.KEY_ESC){this.onRowClicked(null);return true}if(d.code==Event.KEY_LEFT||d.code==Event.KEY_RIGHT){var b=$H(this.getActions(this.selected.id)).get("toggle");
if(b){this._disableTemp();b()}return true}},toggle:function(c){var b=$(c);if(!b){return}var a=b.down(".gtvlm");if(!a){a=b.down(".gtvtm")}if(!a){a=b.down(".gtvlp")}if(!a){a=b.down(".gtvtp")}if(!a){a=b.down(".gtvtn")
}if(!a){a=b.down(".gtvln")}if(!a){return}a.update(this._getLoadingContent())},onRowClicked:function(c,b){if(b){var a=b.findElement();if(a&&a.hasClassName("_tree_cell_")){return}}if(!c){if(this.selected){this.selected.removeClassName("selected");
this.setSelected();this.selected=undefined}return}if(this.selected){if(this.selected==c&&this.config.get("no_double_select")){return}this.selected.removeClassName("selected")}c.addClassName("selected");
this.selected=c;if(this.ignoreSelect>0){console.log("Ignoring select");return}this.setSelected(c.id)},setSelected:function(c){if(this.componentID){SL.byID(this.componentID).updateArgs({"tree.selection":c})
}else{var a=SL.storage.ensureHash("tree_selection");a.set(this.id,c)}if(this.selectionNotifyHandler){if(c){this.selectionNotifyHandler($(c),this.getActions(c))}else{this.selectionNotifyHandler(null,{})
}}var b=$H(this.getActions(this.selected.id)).get("select");if(b){b()}},getActions:function(c){for(var a=0;a<this.rows.length;a++){var b=this.rows[a];if(b&&b.id==c){return b.actions}}console.log("TreeTable: No actions for id "+c);
return $H()},connectSelectionNotify:function(a,b){this.selectionNotifyHandler=a;if(b&&this.selected){this.selectionNotifyHandler($(this.selected),this.getActions(this.selected.id))}},cleanup:function(){if(this.keyObserver){SL.events.removeKeyboardObserver(this.keyObserver)
}},_disableTemp:function(){if(!this.disabled){this.disabled=true;setTimeout(function(){this.disabled=false}.bind(this),5000)}},onSuccess:function(){this.disabled=undefined}});SL.ui.TreeTableActions=Class.create(SL.Component,{init:function(){this.tree=SL.byID(this.config.get("tree_id"));
this.actions=$H(this.config.get("actions"));this.actions.each(function(d){var b=d.value;var c=$(b.image);if(c){c.observe("click",this._clicked.bind(this,d.key))}}.bind(this));this.tree.connectSelectionNotify(this.onChanged.bind(this),this.config.get("emit_on_load"))
},_clicked:function(d){var b=this.actions.get(d);if(d.startsWith("_entries_")){b.fallback();return}var b=this.actions.get(d);if(!this.currentActions){if(b.fallback){b.fallback()}return}var c=this.currentActions.get(d);
if(c){c()}else{if(b.fallback){b.fallback()}}},setActions:function(a){this.currentActions=a;this.actions.each(function(c,j){var g=j.key;var b=j.value;var h=$(b.image);if(!h){return}var d;if(h.tagName.toLowerCase()=="img"){d=h
}else{d=h.down("img")}if(c.get(g)||b.fallback){if(d&&d.src.endsWith("_i.png")){d.src=d.src.substring(0,d.src.length-6)+".png"}h.setStyle({cursor:"pointer"})}else{if(d&&!d.src.endsWith("_i.png")){d.src=d.src.substring(0,d.src.length-4)+"_i.png"
}h.setStyle({pointer:"default"})}}.curry(a))},onChanged:function(a,b){this.setActions($H(b))}});SL.ui.Tree=Class.create(SL.Component,{init:function(){this.active=this.e.down("li.selected");this.topUL=this.e.down("ul");
this.initDefered.bind(this).defer()},initDefered:function(){this.e.select("li").each(function(c){var b=c.down(">div.item>a");if(b){b.observe("click",this._update.bind(this,c))}}.bind(this))},_deselect:function(c){if(this.active){if(c&&this.active==c){return
}this.active.removeClassName("selected");var b=this.active.up("ul");while(b&&b!=this.topUL){var a=b.up("li");if(!a){break}a.removeClassName("active");b=a.up("ul")}}},_deselectAll:function(a){$$("."+a).each(function(b){var d=SL.getC(b);
if(d){try{d._deselect()}catch(b){console.error(b)}}})},_update:function(d,c){if(c.isRightClick()){return}this._deselect(d);if(this.e.hasClassName("gui_html_tree")){this._deselectAll("gui_html_tree")}else{this._deselectAll("html_tree")
}this.active=d;d.addClassName("selected");var b=this.active.up("ul");while(b&&b!=this.topUL){var a=b.up("li");if(!a){break}a.addClassName("active");b=a.up("ul")}}})})();SL.dnd={};(function(){SL.dnd.SortableTable=Class.create(SL.Component,{init:function(){this.config.setDefault("callbacks",{});
this.config.setDefault("grip_class",null);this.cb=this.config.ensureHash("cb");this.gripClass=this.config.get("grip_class");this.root=this.e.down("tbody");if(!this.root){this.root=this.e}this._initObservedElements()
},_initObservedElements:function(){if(this.observed){this.observed.each(function(e){var element=$(e.key);if(element){element.stopObserving("mousedown",e.value)}}.bind(this))}this.observed=$H();this.root.childElements().each(function(e){if(this.gripClass){e.select("."+this.gripClass).each(function(e,e2){this._observeElement(e,e2)
}.bind(this,e))}else{this._observeElement(e)}}.bind(this))},_observeElement:function(e,e2){if(!this.observed.get(e2)&&!e2.down("form")){var h=this.onMouseDown.bind(this,e);e2.observe("mousedown",h);this.observed.set(e2.identify(),h)
}},onChildComponentChanged:function(component){this._initObservedElements()},onMouseDown:function(e,event){if(this.mouseMoveEvent||!event.isLeftClick()){return}this.mouseMoveEvent=this.onMouseMove.bind(this,e);
this.mouseUpEvent=this.onMouseUp.bind(this,e);document.observe("mousemove",this.mouseMoveEvent);document.observe("mouseup",this.mouseUpEvent);var offset=e.cumulativeOffset();this.xOffset=event.pageX-offset.left;
event.stop()},onMouseUp:function(e,event){document.stopObserving("mousemove",this.mouseMoveEvent);document.stopObserving("mouseup",this.mouseUpEvent);this.mouseMoveEvent=undefined;this.mouseUpEvent=undefined;
if(this.marker){var index=this.marker.up().childElements().indexOf(this.marker);if(this.ghost){this.marker.replace(this.ghost.down("tr"));this.ghost.remove()}else{this.ghost.remove()}this.marker=undefined;
this.ghost=undefined;if(this.cb.dragStop){this.cb.dragStop(this,e,index)}}this.previousIndex=undefined},onMouseMove:function(e,event){if(!this.marker){if(this.cb.dragStart){this.cb.dragStart(this,e)}this.previousIndex=e.up().childElements().indexOf(e);
this.marker=this.createMarker(e);this.ghost=SL.utils.createBodyElement("table",{"class":this.e.readAttribute("class")});this.ghost.setStyle({width:this.e.getWidth()+"px"});this.ghost.hide();var tb=new Element("tbody");
this.ghost.appendChild(tb);tb.appendChild(e.replace(this.marker));this.ghost.setStyle({position:"absolute",cursor:"move",zIndex:"1000"});this.ghost.setOpacity("0.8");this.ghost.show()}this.ghost.setStyle({left:event.pageX-this.xOffset+"px",top:event.pageY-(e.getHeight()/2)+"px"});
var row=this.findRowAt(event.pageX,event.pageY);if(row){if(row.e==this.marker){return}if(row.overlap<0.5){row.e.insert({after:this.marker})}else{row.e.insert({before:this.marker})}}event.stop()},findRowAt:function(x,y){var rows=this.root.childElements();
for(var i=0;i<rows.length;i++){var e=rows[i];var offset=e.cumulativeOffset();if(x<offset.left||y<offset.top){continue}if(x>offset.left+e.getWidth()){continue}if(y>offset.top+e.getHeight()){continue}var overlap=1-((y-offset.top)/e.getHeight());
return{e:e,overlap:overlap}}return false},createMarker:function(origRow){var e=SL.elements.createBlindRow(origRow);var mdiv=new Element("div");mdiv.setStyle({margin:"0",padding:"0",height:origRow.getHeight()-4+"px",border:"dotted #777 2px"});
e.down("td").appendChild(mdiv);return e},cleanup:function(){if(this.mouseMoveEvent){document.stopObserving("mousemove",this.mouseMoveEvent);document.stopObserving("mouseup",this.mouseUpEvent)}if(this.ghost){this.ghost.remove()
}}});SL.dnd.Draggable=Class.create(SL.Element,{init:function(){this.config.setDefault("grip_class",null);this.config.setDefault("orientation","both");this.config.setDefault("spacer_width",10);this.cb=this.config.ensureHash("cb");
this.orientation=this.config.get("orientation");var gripClass=this.config.get("grip_class");this.handle=gripClass?this.e.down("."+gripClass):this.e;if(!this.handle){console.log("Handle not found:"+gripClass);
return}this.mouseDownHandler=this.onMouseDown.bind(this);this.handle.observe("mousedown",this.mouseDownHandler);this.handle.setStyle({cursor:"move"});this.mouseClickHandler=this.onMouseClick.bind(this);
this.handle.observe("click",this.mouseClickHandler)},onMouseDown:function(event){if(this.mouseMoveEvent||!event.isLeftClick()){return}this.mouseMoveEvent=this.onMouseMove.bind(this);this.mouseUpEvent=this.onMouseUp.bind(this);
document.observe("mousemove",this.mouseMoveEvent);document.observe("mouseup",this.mouseUpEvent);this.xOffset=event.pointerX()-this.e.offsetLeft;this.yOffset=event.pointerY()-this.e.offsetTop;event.stop()
},onMouseClick:function(event){event.stop()},onMouseUp:function(event){document.stopObserving("mousemove",this.mouseMoveEvent);document.stopObserving("mouseup",this.mouseUpEvent);this.mouseMoveEvent=undefined;
this.mouseUpEvent=undefined;if(this.active){this.active=false;if(this.cb.dragStop){this.cb.dragStop(this)}}this.reenableIframes();event.stop()},onMouseMove:function(event){if(!this.active){this.active=true;
if(this.cb.dragStart){this.cb.dragStart(this)}}var minX=this.config.get("minX")||0;var minY=this.config.get("minY")||0;var op=this.e.getOffsetParent();var opWidth=op.getWidth();var opHeight=op.getHeight();
if(op.tagName=="BODY"){var bh=SL.effects.getBodyHeight();if(opHeight<bh){opHeight=bh}}var maxX=opWidth-this.config.get("spacer_width")-(this.config.get("maxX")||0)-this.e.getWidth();var maxY=opHeight-this.config.get("spacer_width")-(this.config.get("maxY")||9)-this.e.getHeight();
if(this.orientation=="horizontal"){this.e.setStyle({left:Math.min(Math.max(minX,event.pointerX()+2-this.xOffset),maxX)+"px"})}else{if(this.orientation=="vertical"){this.e.setStyle({top:Math.min(Math.max(minY,event.pointerY()+2-this.yOffset),maxY)+"px"})
}else{this.e.setStyle({left:Math.min(Math.max(minX,event.pointerX()+2-this.xOffset),maxX)+"px",top:Math.min(Math.max(minY,event.pointerY()+2-this.yOffset),maxY)+"px"})}}if(this.cb.moved){this.cb.moved(this)
}this.updateIframes();event.stop()},updateIframes:function(){if(this.iframes){this.iframes.each(function(b){b.e.clonePosition(b.frame)})}else{this.iframes=$A();$$("iframe").each(function(frame){var e=SL.utils.createBodyElement("div");
e.clonePosition(frame);e.setStyle({position:"absolute",backgroundColor:"#ffffff"});e.setOpacity(0);this.iframes.push({e:e,frame:frame})}.bind(this))}},reenableIframes:function(){if(this.iframes){this.iframes.each(function(b){b.e.remove()
});this.iframes=undefined}},cleanup:function(){this.handle.stopObserving("mousedown",this.mouseDownHandler);this.reenableIframes()},updatePos:function(x,y){if(x){this.e.setStyle({left:x+"px"})}if(y){this.e.setStyle({top:y+"px"})
}if(this.cb.moved){this.cb.moved(this)}},getPos:function(){return this.e.positionedOffset()}});SL.dnd.Dashboard=Class.create(SL.Component,{init:function(){this.config.setDefault("prefix","");this.prefix=this.config.get("prefix");
console.log("Init dashboard");this.container=this.e.select("."+this.prefix+"dashboard_container");this.dashlets=$A();console.log("Dashboard containers:",this.container.length);this.container.each(function(c){c.childElements().each(function(d){if(d.hasClassName(this.prefix+"dashlet")){new SL.dnd.Dashlet(d,{grip_class:this.prefix+"dashlet_head",dashboard:this});
this.dashlets.push(d)}}.bind(this))}.bind(this));this.updateHeight();this.e.up("."+this.prefix+"dashboard").setStyle({position:"relative"})},updateHeight:function(){this.container.each(function(c){c.setStyle({height:"auto"})
}.bind(this));this._updateHeightDefered.bind(this).defer()},_updateHeightDefered:function(){this.maxHeight=this.e.down().getHeight();this.container.each(function(c){if(this.maxHeight<c.getHeight()){this.maxHeight=c.getHeight()
}}.bind(this));if(this.maxHeight<=100){this.maxHeight=100}this.container.each(function(c){c.setStyle({height:this.maxHeight+"px"})}.bind(this))},notifyNewPosition:function(dashlet){this.updateHeight();
var url=this.config.get("notify_url");url=url.replace("@container@",dashlet.e.up().id);if(dashlet.isNew){url=url.replace("@id@",dashlet.e.id);url=url.replace("@type@",dashlet.config.get("dashlet_type"))
}else{url=url.replace("@id@",dashlet.e.down("."+this.prefix+"dashlet_body").down().id);url=url.replace("@type@","")}url=url.replace("@index@",dashlet.index);new Ajax.Request(url,{onSuccess:function(dashlet,o){eval(o.responseText)
}.bind(this,dashlet)})},attachNewDashlet:function(dashlet){this.dashlets.push(dashlet.e);dashlet.e.addClassName(this.prefix+"dashlet");dashlet.e.setStyle({display:"block"});dashlet.isNew=undefined;this.updateHeight()
},onChildComponentChanged:function(){this.updateHeight()}});SL.dnd.Dashlet=Class.create(SL.dnd.Draggable,{init:function($super){this.config.setDefault("cb",{dragStart:this.dragStart.bind(this),dragStop:this.dragStop.bind(this),moved:this.moved.bind(this)});
this.dashboard=this.config.get("dashboard");this.isNew=this.config.get("is_new");$super()},dragStart:function(){this.parent=this.e.up();this.index=this.parent.childElements().indexOf(this.e);var width=this.e.getWidth();
var height=this.e.getHeight();this.e.setStyle({width:width+"px",height:height+"px",position:"absolute"});this.ghost=new Element("div");this.ghost.setStyle({width:"100%",height:height+"px",border:"dotted #aaa 2px"});
if(!this.isNew){this.dashboard.e.up().appendChild(this.e.replace(this.ghost))}else{this.rep=new Element("div");this.rep.setStyle({width:width+"px",height:height+"px"});this.e.setStyle({display:"table-cell",width:"auto"});
this.dashboard.e.up().appendChild(this.e.replace(this.rep))}this.config.set("minY",this.e.getHeight()/-2);this.config.set("maxY",this.e.getHeight()/-2)},dragStop:function(){if(this.rep&&!this.ghost.up()){this.rep.replace(this.e)
}else{this.ghost.replace(this.e)}this.e.setStyle({position:"static",width:"auto",height:"auto"});var parent=this.e.up();var index=parent.childElements().indexOf(this.e);if(this.parent==parent&&this.index==index){return
}this.parent=parent;this.index=index;this.dashboard.notifyNewPosition.bind(this.dashboard,this).defer()},moved:function(){var offset=this.e.cumulativeOffset();var hovered=this.findAt(this.dashboard.dashlets,offset.left+this.e.getWidth()/2,offset.top+this.e.getHeight()/2);
if(hovered){if(hovered.overlap<0.4){hovered.e.insert({after:this.ghost});this.dashboard.updateHeight()}else{if(hovered.overlap>0.6){hovered.e.insert({before:this.ghost});this.dashboard.updateHeight()}}return
}hovered=this.findAt(this.dashboard.container,offset.left+this.e.getWidth()/2,offset.top+this.e.getHeight()/2);if(!hovered){return}if(this.isNew&&hovered.e==this.parent){return}hovered.e.appendChild(this.ghost);
this.dashboard.updateHeight()},findAt:function(elements,x,y){for(var i=0;i<elements.length;i++){var e=elements[i];if(!e||e.up==undefined||this.e==e||this.ghost==e||(this.ghost.up()&&this.ghost.up()==e)){continue
}var offset=e.cumulativeOffset();if(x<offset.left||y<offset.top){continue}if(x>offset.left+e.getWidth()){continue}if(y>offset.top+e.getHeight()){continue}var overlap=1-((y-offset.top)/e.getHeight());return{e:e,overlap:overlap}
}return false}})})();(function(){SL.ui.SplitPane=Class.create(SL.Component,{init:function(){this.config.setDefault("spacer_width",7);this.config.setDefault("orientation","horizontal");this.config.setDefault("spacer_class","gui_splitpane_"+this.config.get("orientation")+"_spacer");
this.div1=$(this.e.childElements()[0]);this.div2=$(this.e.childElements()[1]);setTimeout(this.initDefered.bind(this),75)},initDefered:function(){var a=this.config.get("spacer_width");this.spacer=new Element("div",{"class":this.config.get("spacer_class")});
this.e.setStyle({position:"relative"});this.div1.insert({after:this.spacer});if(this.config.get("orientation")=="horizontal"){var b=this.div1.getWidth();this.spacer.setStyle({position:"absolute",left:b+"px",top:"0",width:a+"px",bottom:"0",zIndex:"1"});
this.div1.setStyle({"float":"none",position:"absolute",left:"0",top:"0",width:b+"px"});this.div2.setStyle({"float":"none",position:"absolute",left:(b+a)+"px",top:"0",right:"0",marginLeft:"0"});this.currentHeight=Math.max(this.div1.getHeight(),this.div2.getHeight())+15;
this.e.setStyle({height:this.currentHeight+"px"});this.updateEvent=this.update.bind(this);this.actionURL=this.config.get("action_url");this.draggable=new SL.dnd.Draggable(this.spacer,{orientation:"horizontal",minX:this.config.get("min_left"),maxX:this.config.get("min_right"),cb:{moved:this.updateEvent,dragStop:this.onDragStop.bind(this)}})
}else{var c=this.div1.getHeight();this.spacer.setStyle({position:"absolute",left:"0",top:c+"px",height:a+"px",right:"0",zIndex:"1"});this.div1.setStyle({position:"absolute",left:"0",top:"0"});this.div2.setStyle({position:"absolute",top:(c+a)+"px",left:"0",right:"0",bottom:"0"});
this.updateEvent=this.update.bind(this);this.actionURL=this.config.get("action_url");this.draggable=new SL.dnd.Draggable(this.spacer,{orientation:"vertical",minY:this.config.get("min_left"),maxY:this.config.get("min_right"),cb:{moved:this.updateEvent,dragStop:this.onDragStop.bind(this)}})
}Event.observe(document.onresize?document:window,"resize",this.updateEvent);setTimeout(this.onCheckLayout.bind(this),500)},onCheckLayout:function(){if(this.isCleanedUp){return}if(this.config.get("orientation")=="horizontal"){var a=Math.max(this.div1.getHeight(),this.div2.getHeight())+15;
var b=this.currentHeight!=a;if(b){this.currentHeight=a;this.e.setStyle({height:a+"px"})}this.spacer.setStyle({height:this.currentHeight+"px"});setTimeout(this.onCheckLayout.bind(this),b?150:250)}},update:function(){var b=this.config.get("spacer_width");
if(this.config.get("orientation")=="horizontal"){var a=Math.max(this.div1.getHeight(),this.div2.getHeight())+15;if(this.currentHeight==a){}this.currentHeight=a;var g=this.spacer.offsetLeft;var c=g;this.spacer.setStyle({left:c+"px"});
this.div1.setStyle({width:c+"px"});this.div2.setStyle({left:(c+b)+"px"});this.e.setStyle({height:this.currentHeight+"px"});this.spacer.setStyle({height:this.currentHeight+"px"})}else{var g=this.spacer.offsetTop;
var d=g;this.spacer.setStyle({top:d+"px"});this.div1.setStyle({height:d+"px"});this.div2.setStyle({top:(d+b)+"px"})}},onChildComponentChanged:function(){console.log("Child changed");this.update()},onDragStop:function(){if(this.actionURL){var a=this.spacer.offsetLeft;
new Ajax.Request(this.actionURL+"&args._sp_offset="+a)}},cleanup:function(){this.draggable.destroy();Event.stopObserving(document.onresize?document:window,"resize",this.updateEvent)}})})();(function(){SL.ui.Tooltip=Class.create(SL.Component,{init:function(){this.config.setDefault("hide_delay",500);
this.config.setDefault("show_delay",500);this.config.setDefault("mode","normal");this.trigger=$(this.config.get("connect_id"));this.followMouse=this.config.get("mode")=="follow_mouse";SL.utils.reparentToBody(this.e);
this.e.setStyle({display:"block",position:"absolute",zIndex:"999"});this.e.hide();this.onTriggerEnterEvent=this.onTriggerEnter.bind(this);this.onTriggerLeaveEvent=this.onTriggerLeave.bind(this);this.trigger.observe("mouseenter",this.onTriggerEnterEvent);
this.trigger.observe("mouseleave",this.onTriggerLeaveEvent);this.initURL=this.config.get("url")},notifyInitEvent:function(a){this.onTriggerEnter(a)},onTriggerEnter:function(a){this.onTrigger=true;if(this.hideTimeout){clearTimeout(this.hideTimeout);
this.hideTimeout=undefined}if(this.showTimeout){return}if(this.initURL){this.load(this.initURL);this.initURL=undefined}this.onTooltipEnterEvent=this.onTooltipEnter.bind(this);this.onTooltipLeaveEvent=this.onTooltipLeave.bind(this);
this.e.observe("mouseenter",this.onTooltipEnterEvent);this.e.observe("mouseleave",this.onTooltipLeaveEvent);this.showTimeout=setTimeout(this._showDefered.bind(this),this.config.get("show_delay"));this.triggerPosition={left:a.pageX,top:a.pageY}
},onTriggerLeave:function(b){this.onTrigger=false;if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=undefined}if(!this.shown){return}if(this.hideTimeout){clearTimeout(this.hideTimeout);
this.hideTimeout=undefined}if(!this.onTooltip){var a=this.config.get("hide_delay");if(a>0){this.hideTimeout=setTimeout(this._hide.bind(this),a)}else{this._hide()}}},onTooltipEnter:function(a){if(this.hideTimeout){clearTimeout(this.hideTimeout);
this.hideTimeout=undefined}this.onTooltip=true},onTooltipLeave:function(a){this.onTooltip=false;if(!this.onTrigger){this.timeout=setTimeout(this._hide.bind(this),this.config.get("hide_delay"))}},_showDefered:function(){this.showTimeout=undefined;
if(!this.onTrigger&&!this.onTooltip){return}if(SL.ui._staticTooltip){if(!this.trigger.up("#"+SL.ui._staticTooltip.id)){return}}this.shown=true;SL.ui._registerActiveTooltip(this);if(this.followMouse){this.onMouseMoveEvent=this.onMouseMove.bind(this);
this.trigger.observe("mousemove",this.onMouseMoveEvent);this.e.observe("mousemove",this.onMouseMoveEvent)}this._update()},onSuccess:function(){this._update()},onChildComponentChanged:function(){this._update()
},onMouseMove:function(b){var a=this.trigger.cumulativeOffset();if(b.pageX<a.left){return}if(b.pageX>a.left+this.trigger.getWidth()){return}if(b.pageY<a.top){return}if(b.pageY>a.top+this.trigger.getHeight()){return
}this.triggerPosition={left:b.pageX,top:b.pageY};this._updatePositions()},_update:function(){new SL.effects.Preloader(this.e,this._updatePositions.bind(this)).run()},_updatePositions:function(){if(!this.shown){return
}if(this.config.get("mode")=="beside"){var j=this.trigger.cumulativeOffset();var c=j.left+this.trigger.getWidth()+5;var n=j.top+this.trigger.getHeight()/2-this.e.getHeight()/2;var k=document.viewport.getScrollOffsets();
var m=document.viewport.getDimensions();if(c+this.e.getWidth()>k.left+m.width){c=j.left-5-this.e.getWidth()}if(n<k.top){n=k.top}if(n+this.e.getHeight()>k.top+m.height){n=k.top+m.height-this.e.getHeight()
}this.e.setStyle({left:c+"px",top:n+"px"});if((this.onTrigger||this.onTooltip)&&this.shown){this.e.show()}return}if(this.config.get("mode")=="below"){var j=this.trigger.cumulativeOffset();var n=j.top+this.trigger.getHeight()+5;
this.e.setStyle({left:j.left+"px",top:n+"px"});if((this.onTrigger||this.onTooltip)&&this.shown){this.e.show()}return}if(this.followMouse){if(!this.triggerPosition){console.log("No trigger position");return
}var c=this.triggerPosition.left+2;var n=this.triggerPosition.top+2;var k=document.viewport.getScrollOffsets();var m=document.viewport.getDimensions();var h=k.left+m.width;var d=c+this.e.getWidth()-h;if(d>0){var l=k.left-(c-this.e.getWidth());
if(l<d){c=c-this.e.getWidth()-2}}var b=k.top+m.height;var a=n+this.e.getHeight()-b;if(a>0){var g=k.top-(n-this.e.getHeight());if(g<a){n=n-this.e.getHeight()-2}}this.e.setStyle({left:c+"px",top:n+"px"});
if((this.onTrigger||this.onTooltip)&&this.shown){this.e.show()}return}var j=this.trigger.cumulativeOffset();var k=document.viewport.getScrollOffsets();var m=document.viewport.getDimensions();var c;if(this.triggerPosition){c=this.triggerPosition.left
}else{c=j.left+this.trigger.getWidth()}if(c+this.e.getWidth()>k.left+m.width){c=Math.max(j.left-this.e.getWidth(),k.left)}var n=j.top+this.trigger.getHeight();if(n+this.e.getHeight()>k.top+m.height){n=Math.max(j.top-this.e.getHeight(),k.top)
}this.e.setStyle({left:c+"px",top:n+"px"});if((this.onTrigger||this.onTooltip)&&this.shown){this.e.show()}},_hide:function(a){if(!a&&(this.onTrigger||this.onTooltip)){return}if(this.hideTimeout){clearTimeout(this.hideTimeout);
this.hideTimeout=undefined}if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=undefined}this.e.hide();this.shown=false;if(this.onTooltipEnterEvent){this.e.stopObserving("mouseenter",this.onTooltipEnterEvent);
this.e.stopObserving("mouseleave",this.onTooltipLeaveEvent)}if(this.onMouseMoveEvent){this.trigger.stopObserving("mousemove",this.onMouseMoveEvent);this.e.stopObserving("mousemove",this.onMouseMoveEvent)
}this.onTrigger=false;this.onTooltip=false;this.triggerPosition=undefined;if(!a){SL.ui._registerActiveTooltip(null)}},cleanup:function(){this.trigger.stopObserving("mouseenter",this.onTriggerEnterEvent);
this.trigger.stopObserving("mouseleave",this.onTriggerLeaveEvent);if(this.onTooltipEnterEvent){this.e.stopObserving("mouseenter",this.onTooltipEnterEvent);this.e.stopObserving("mouseleave",this.onTooltipLeaveEvent)
}this.e.hide();this.e.remove()}});SL.ui.Bubble=Class.create(SL.Component,{init:function(){this.attached=$(this.config.get("attach_id"));this.position=this.config.get("position");this.isStatic=this.config.get("static");
SL.utils.reparentToBody(this.e);this.e.setStyle({display:"block",position:"absolute",zIndex:"999"});this.e.hide();if(this.isStatic){this.show()}else{this.trigger=this.attached.down("input");if(this.trigger){this.trigger.observe("focus",this.show.bind(this));
this.trigger.observe("blur",this.hide.bind(this));if(document.activeElement==this.trigger){this.show()}else{if(this.config.get("visible")){this.trigger.focus()}}}if(this.config.get("visible")){this.show()
}}this.connectDestroy(this.attached)},show:function(){if(!this.shown){this.shown=true;this._update()}},hide:function(){if(!this.isStatic&&this.shown){this.e.hide();this.shown=false}},_update:function(){new SL.effects.Preloader(this.e,this._updatePositions.bind(this)).run()
},_updatePositions:function(){if(!this.shown){return}var b=this.attached.getWidth();var j=this.attached.getHeight();var c=this.attached.cumulativeOffset();var a=this.attached.tagName.toLowerCase();if(a=="td"||a=="th"){var d=this.attached.up("tr");
c.top=d.cumulativeOffset().top;j=d.getHeight()}var h;var g;if(this.position=="top"){g=c.left+b/2-this.e.getWidth()/2;h=c.top-this.e.getHeight()-5}else{if(this.position.startsWith("bottom")){h=c.top+j+5;
if(this.position.endsWith("_left")){g=c.left}else{g=c.left+b/2-this.e.getWidth()/2}}else{h=c.top+j/2-this.e.getHeight()/2;if(this.position=="left"){g=c.left-this.e.getWidth()-5}else{g=c.left+b+5}}}this.e.setStyle({left:g+"px",top:h+"px"});
this.e.show();setTimeout(this._updatePositions.bind(this),250)}});SL.ui._registerActiveTooltip=function(a){if(SL.ui._activeTooltip){if(SL.ui._activeTooltip==a){return}SL.ui._activeTooltip._hide(true)}SL.ui._activeTooltip=a
};SL.ui._closeActiveTooltips=function(){if(SL.ui._activeTooltip){try{SL.ui._activeTooltip._hide(true)}catch(a){}}};SL.ui._hasStaticTooltip=function(a){return SL.ui._staticTooltip?true:false};SL.ui._registerStaticTooltip=function(a){if(SL.ui._staticTooltip){if(SL.ui._staticTooltip==a){return
}SL.ui._staticTooltip._hide(true)}SL.ui._staticTooltip=a};SL.ui._closeStaticTooltips=function(){if(SL.ui._staticTooltip){try{SL.ui._staticTooltip._hide(true)}catch(a){}}}})();(function(){SL.effects.ContentChanger=Class.create(SL.Component,{init:function(){this.config.setDefault("timeout",5000);
this.config.setDefault("duration",500);this.content=this.config.get("content");this.current=0;this.mode=this.config.get("mode");if(this.content.length<=1){return}if(this.mode=="slideshow_horizontal"){this.count=this.config.get("count");
if(this.content.length<this.count){return}this.current=0;this.contentDiv=this.e.down(".slideshow_horizontal_content_inner");this.leftBtn=this.e.down(".slideshow_horizontal_left");if(this.leftBtn){this.leftBtn.observe("click",this.onPrev.bind(this));
this.leftBtn.addClassName("disabled")}this.rightBtn=this.e.down(".slideshow_horizontal_right");if(this.rightBtn){this.rightBtn.observe("click",this.onNext.bind(this,false));if(this.current>=this.content.length-this.count){this.rightBtn.addClassName("disabled")
}}if(this.config.get("autostart")){this.startSlideshow.bind(this).defer()}}else{if(this.mode=="slideshow_horizontal_auto_left_right"){this.contentDiv=this.e.down(".slideshow_horizontal_content_inner");
this.horizontalTimer=setTimeout(this.nextHorizontalAuto.bind(this,true),this.config.get("timeout"))}else{if(this.mode=="slideshow_horizontal_auto_right_left"){this.contentDiv=this.e.down(".slideshow_horizontal_content_inner");
this.rl=true;this.horizontalTimer=setTimeout(this.nextHorizontalAuto.bind(this,true),this.config.get("timeout"))}else{this.currentElement=$(this.content[0].id);if(this.config.get("timeout")>0){setTimeout(this.next.bind(this,true),this.content[0].timeout||this.config.get("timeout"))
}}}}this.nav=this.e.down(".content_changer_nav");if(this.nav){var b=this.nav.up().findZIndex()||0;this.nav.setStyle({zIndex:(b+5)+""});this.nav=this.nav.down().childElements();this.nav[0].addClassName("active");
for(var a=0;a<this.nav.length;a++){this.nav[a].observe("click",this.switchTo.bind(this,a));this.nav[a].setStyle({cursor:"pointer"})}}this.e.select(".content_changer_next").each(function(c){c.observe("click",this.next.bind(this,false))
}.bind(this));this.e.select(".content_changer_prev").each(function(c){c.observe("click",this.prev.bind(this,false))}.bind(this));this.mouseOverCSS=this.config.get("mouse_over_css");if(this.mouseOverCSS){this.e.observe("mouseenter",this.mouseOverEnter.bind(this));
this.e.observe("mouseleave",this.mouseOverLeave.bind(this));this.e.select("."+this.mouseOverCSS).each(function(c){c.hide()}.bind(this))}},mouseOverEnter:function(){this.e.select("."+this.mouseOverCSS).each(function(a){SL.effects.registerCurrent(Effect.Appear(a,{duration:0.25}))
}.bind(this))},mouseOverLeave:function(){this.e.select("."+this.mouseOverCSS).each(function(a){SL.effects.registerCurrent(Effect.Fade(a,{duration:0.25}))}.bind(this))},startSlideshow:function(){this.autostart=true;
this.onNext(true)},next:function(a){if(this.disabled){return}if(a||!this.hasAnimation){if(!a&&this.timeout){clearTimeout(this.timeout);this.timeout=undefined;this.userNavigation=true}this.current++;if(this.current>=this.content.length){this.current=0
}var b=$(this.content[this.current].id);if(!b){console.log("Unable to get element for id:",this.content[this.current].id);this.switchToCurrent.bind(this).defer();return}new SL.effects.Preloader(b,this.switchToCurrent.bind(this)).run()
}},prev:function(a){if(this.disabled){return}if(a||!this.hasAnimation){if(!a&&this.timeout){clearTimeout(this.timeout);this.timeout=undefined;this.userNavigation=true}this.current--;if(this.current<0){this.current=this.content.length-1
}new SL.effects.Preloader($(this.content[this.current].id),this.switchToCurrent.bind(this)).run()}},switchTo:function(a){if(this.disabled){return}if(!this.hasAnimation&&this.current!=a){if(this.mode=="slideshow_horizontal_auto_right_left"||this.mode=="slideshow_horizontal_auto_left_right"){this.switchToHorizontal(a);
return}if(this.timeout){clearTimeout(this.timeout);this.timeout=undefined;this.userNavigation=true}this.current=a;new SL.effects.Preloader($(this.content[this.current].id),this.switchToCurrent.bind(this)).run()
}},switchToCurrent:function(){if(this.hasAnimation||this.disabled){return}this.hasAnimation=true;var b=this.currentElement.up().findZIndex()||0;this.currentElement.setStyle({zIndex:b+""});var a=this.config.get("duration");
new Effect.Fade(this.currentElement,{from:1,to:0,duration:a/2000,transition:Effect.Transitions.linear,delay:a/2000});this.currentElement=$(this.content[this.current].id);this.currentElement.setOpacity(0);
this.currentElement.setStyle({visibility:"visible",zIndex:(b+1)+""});new Effect.Appear(this.currentElement,{from:0,to:1,duration:a/1000,transition:Effect.Transitions.linear,afterFinish:function(){this.hasAnimation=false;
this.activateTimeout()}.bind(this)});if(this.nav){setTimeout(this.updateNav.bind(this),a/2)}},updateNav:function(){this.nav.each(function(a){a.removeClassName("active")});this.nav[this.current].addClassName("active")
},activateTimeout:function(){if(!this.userNavigation&&this.config.get("timeout")>0){this.timeout=setTimeout(this.next.bind(this,true),this.content[this.current].timeout||this.config.get("timeout"))}},onNext:function(a){if(this.disabled){return
}if(this.hasAnimation){if(!a){this.autostart=undefined}return}if(this.current>=this.content.length-this.count){if(a){this.autostart=undefined}return}if(!a){this.autostart=undefined}this.hasAnimation=true;
this.current+=this.count;if(this.current>=this.content.length-this.count){this.current=this.content.length-this.count;if(this.rightBtn){this.rightBtn.addClassName("disabled")}}else{if(this.rightBtn){this.rightBtn.removeClassName("disabled")
}}if(this.current>0){if(this.leftBtn){this.leftBtn.removeClassName("disabled")}}this.scrollToCurrent(true)},onPrev:function(){if(this.disabled){return}if(this.hasAnimation){this.autostart=undefined;return
}if(this.current<=0){return}this.autostart=undefined;this.hasAnimation=true;this.current-=this.count;if(this.current<=0){this.current=0;if(this.leftBtn){this.leftBtn.addClassName("disabled")}}else{if(this.leftbtn){this.leftBtn.removeClassName("disabled")
}}if(this.current<this.content.length-this.count){if(this.rightBtn){this.rightBtn.removeClassName("disabled")}}this.scrollToCurrent(false)},scrollToCurrent:function(b){if(this.disabled){return}var a=$(this.content[this.current].id).positionedOffset().left;
new Effect.Move(this.contentDiv,{x:a*-1,y:0,mode:"absolute",duration:this.config.get("duration")/1000,transition:b?Effect.Transitions.linear:Effect.Transitions.sinoidal,afterFinish:function(){this.hasAnimation=false;
if(this.autostart){this.onNext(true)}}.bind(this)})},nextHorizontalAuto:function(){this.switchToHorizontal(this.current+1)},switchToHorizontal:function(a){if(this.hasAnimation||this.disabled){return}if(this.horizontalTimer){clearTimeout(this.horizontalTimer);
this.horizontalTimer=undefined}var b=$(this.content[this.current].id);this.current=a;if(this.current>this.content.length-1){this.current=0}var d=$(this.content[this.current].id);var c=this.contentDiv.getWidth();
this.hasAnimation=true;var g=function(){this.hasAnimation=false;this.horizontalTimer=setTimeout(this.nextHorizontalAuto.bind(this,true),this.config.get("timeout"))}.bind(this);if(this.rl){d.setStyle({left:(c)+"px"});
d.show();new Effect.Move(d,{x:-c,mode:"relative",duration:this.config.get("duration")/1000,afterFinish:g});new Effect.Move(b,{x:-c,mode:"relative",duration:this.config.get("duration")/1000})}else{d.setStyle({left:(-1*c)+"px"});
d.show();new Effect.Move(d,{x:c,mode:"relative",duration:this.config.get("duration")/1000,afterFinish:g});new Effect.Move(b,{x:c,mode:"relative",duration:this.config.get("duration")/1000})}if(this.nav){setTimeout(this.updateNav.bind(this),this.config.get("duration")/2)
}},cleanup:function(){this.disabled=true}});SL.effects.ImageMagnifier=Class.create(SL.Element,{init:function(){this.config.setDefault("position","none");this.url=this.config.get("url");this.attachElement=$(this.config.get("attach_id"));
var a=new Image();a.onload=function(){this.initView.bind(this,a.width,a.height).defer()}.bind(this);a.src=this.url;this.box=new Element("div");this.box.setStyle({position:"absolute",backgroundColor:"#fff"});
this.box.setOpacity(0.3);this.box.hide();this.attachElement.up().appendChild(this.box);this.attachElement.up().setStyle({position:"relative"});var b=new Element("div");this.attachElement.up().appendChild(b);
b.setStyle({position:"absolute",left:0,top:0,width:this.attachElement.getWidth()+"px",height:this.attachElement.getHeight()+"px"});b.observe("mouseenter",this.onMouseEnter.bind(this));b.observe("mouseleave",this.onMouseLeave.bind(this));
b.observe("mousemove",this.onMouseMove.bind(this))},initView:function(c,a){var b=this.attachElement.getWidth()/this.attachElement.getHeight();var g=a*b;var d=this.e.getWidth()/c*this.attachElement.getWidth();
var j=this.e.getHeight()/a*this.attachElement.getHeight();if(g<c){var h=(c/this.attachElement.getWidth()*d);this.width=c+h;this.height=(c/b)+h}else{var h=(a/this.attachElement.getHeight()*j);this.width=(a*b)+h;
this.height=a+h}this.box.setStyle({width:d+"px",height:j+"px"});this.e.down().down().setStyle({position:"absolute",top:0,left:0,width:this.width+"px",height:this.height+"px",backgroundImage:"url("+this.url+")"})
},onMouseEnter:function(b){var a=this.config.get("position");if(a=="right"){this.e.setStyle({position:"absolute",marginLeft:this.attachElement.getWidth()+"px",top:0})}this.setPosition(b.pageX,b.pageY);
this.e.show();this.box.show()},onMouseLeave:function(a){this.e.hide();this.box.hide()},onMouseMove:function(a){this.setPosition(a.pageX,a.pageY)},setPosition:function(l,h){var c=this.attachElement.cumulativeOffset();
var b=this.attachElement.getWidth();var n=this.attachElement.getHeight();var m=l-c.left;var k=h-c.top;var d=this.box.getWidth();var g=this.box.getHeight();if(m<d/2){m=d/2}else{if(m>b-d/2){m=b-d/2}}if(k<g/2){k=g/2
}else{if(k>n-g/2){k=n-g/2}}this.box.setStyle({left:(m-d/2)+"px",top:(k-g/2)+"px"});var a=(this.width-this.e.getWidth())*(m/b*-1);var j=(this.height-this.e.getHeight())*(k/n*-1);this.e.down().down().setStyle({left:a+"px",top:j+"px"})
}})})();(function(){SL.ui.HTMLEditor=Class.create(SL.Component,{init:function(){this.config.setDefault("textarea",this.id+"_t");this.config.setDefault("toolbar","Basic");this.config.setDefault("editor","fck");
this.config.setDefault("language","de");this._init.bind(this).defer()},_init:function(){if(this.config.get("editor")=="mce"){var a=$(this.config.get("textarea"));this.e.setStyle({visibility:"hidden"});
a.setStyle({visibility:"hidden"});setTimeout(function(c,b){if(c.getStyle("visibility")=="hidden"){c.setStyle({visibility:"visible"});b.setStyle({visibility:"visible"})}}.curry(this.e,a),2000);SL.utils.loadScript("/go/gui/_ws/mediabase/_ts_1312459638000/lib/tinymce-3.4.4/tiny_mce.js",this.initMCE.bind(this),function(){tinymce.dom.Event.domLoaded=true
})}else{this.editor=CKEDITOR.replace($(this.config.get("textarea")),{toolbar:this.config.get("toolbar")});this.editor.on("instanceReady",this._instanceReady.bind(this))}},initMCE:function(){console.log("Init MCE");
var a={mode:"none",theme:"advanced",skin:"o2k7",skin_variant:"silver",content_css:"/go/gui/_ws/mediabase/_ts_1311771171000/styles/tinymce.css",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_statusbar_location:"bottom",theme_advanced_resizing:true,plugins:"safari,pagebreak,style,layer,table,advlink,emotions,inlinepopups,preview,media,searchreplace,contextmenu,paste,fullscreen,visualchars,nonbreaking,xhtmlxtras",theme_advanced_buttons1:"paste,pastetext,pasteword,|,bold,italic,underline,sub,sup,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,link,unlink,charmap,cleanup,table,|,code,|,fullscreen",theme_advanced_buttons2:"",theme_advanced_buttons3:"",language:this.config.get("language"),extended_valid_elements:"iframe[src|width|height|name|id|class|align|style|frameborder|border|allowtransparency],script[charset|defer|language|src|type]",init_instance_callback:this._instanceReady.bind(this)};
if(this.config.get("toolbar")=="Advanced"){a.theme_advanced_buttons1="bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect";
a.theme_advanced_buttons2="cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor";
a.theme_advanced_buttons3="tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,fullscreen"}else{if(this.config.get("toolbar")=="easy"){a.theme_advanced_statusbar_location=undefined;a.theme_advanced_buttons1="pastetext,pasteword,|,bold,italic,underline,sub,sup,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,link,unlink,charmap,|,code,fullscreen"
}}tinyMCE.init(a);tinyMCE.execCommand("mceAddControl",false,this.config.get("textarea"))},_instanceReady:function(){console.log("Editor ready");this._emitContentChanged.bind(this,true).defer();if(this.e.getStyle("visibility")=="hidden"){setTimeout(function(a){a.setOpacity(0);
a.setStyle({visibility:"visible"});a.appear({duration:0.075})}.curry(this.e),1)}},updateForPost:function(){try{if(this.config.get("editor")=="mce"){tinyMCE.execCommand("mceRemoveControl",false,this.config.get("textarea"))
}else{if(this.editor){this.editor.updateElement();this.editor.destroy();this.editor=undefined}}}catch(a){console.log(a)}},cleanup:function(){this.updateForPost()},})})();(function(){SL.ui.Rating=Class.create(SL.Component,{init:function(){this.formElement=$(this.config.get("element_id"));
new SL.effects.Preloader(this.e,this._init.bind(this)).run();this.steps=this.e.childElements().length-1},_init:function(){this.active=parseInt(this.formElement.getValue());for(var a=0;a<this.e.childElements().length;
a++){var b=this.e.childElements()[a];if(a!=this.active){b.hide()}}this.e.show();this.e.observe("mousemove",this.onMouseMove.bind(this));this.e.observe("mouseenter",this.onMouseMove.bind(this));this.e.observe("mouseleave",this.onMouseLeave.bind(this));
this.e.observe("click",this.onClick.bind(this));this.formElement.hide()},onMouseMove:function(c){var a=c.pageX-this.e.cumulativeOffset().left;var b=(a/(this.e.getWidth()/this.steps)+0.5).toFixed();if(b>this.teps){b=this.steps
}else{if(b<=0){b=1}}if(this.active!=b){this.e.childElements()[this.active].hide();this.e.childElements()[b].show();this.active=b}},onMouseLeave:function(b){var a=parseInt(this.formElement.getValue());if(this.active!=a){this.e.childElements()[this.active].hide();
this.e.childElements()[a].show();this.active=a;this.formElement.setValue(a)}},onClick:function(){this.formElement.setValue(this.active)}});SL.ui.UrlOrFile=Class.create(SL.Component,{init:function(){this.file=$(this.id+"_f");
this.fakefile=$(this.id+"_ff");this.fileButton=$(this.id+"_fb");this.url=$(this.id+"_u");this.urlButton=$(this.id+"_ub");this.deleteButton=$(this.id+"_d");this.resetButton=$(this.id+"_r");this.origData=$(this.id+"_orig");
this.previewData=$(this.id+"_piid");this.deleteFileField=$(this.id+"_df");this.assetsField=$(this.id+"_ass");this.fallback=!SL.utils.supportsFileClick();if(this.fallback){this.file.setStyle({visibility:"visible",position:"static"});
this.fileButton.hide()}this.inputName=this.file.down().readAttribute("name");this.resetInput();this.fileButton.down().observe("click",this.onFileButtonClicked.bind(this));this.fakefile.observe("click",this.onFileButtonClicked.bind(this));
this.urlButton.down().observe("click",this.onUrlButtonClicked.bind(this));if(this.deleteButton){this.deleteButton.down().observe("click",this.onDeleteClicked.bind(this))}if(this.origData||this.previewData){this.resetButton.down().observe("click",this.onResetClicked.bind(this))
}},onFileChange:function(){this.url.hide();this.urlButton.removeClassName("inactive");if(!this.fallback){var b=this.file.down().value;if(!b){b="file"}else{var c=b.lastIndexOf("/");var a=b.lastIndexOf("\\");
if(c>=0||a>=0){if(c<0){b=b.substring(a+1)}else{if(a<0){b=b.substring(c+1)}else{if(c<a){b=b.substring(a+1)}else{b=b.substring(c+1)}}}}}this.fakefile.show();this.fakefile.down("input").value=b}if(this.deleteButton){this.deleteButton.show()
}this.deleteFileField.down().checked=false;if(this.origData){this.origData.hide();this.resetButton.show()}if(this.previewData){this.previewData.hide();this.resetButton.show()}if(this.assetsField){this.assetsField.value=""
}},resetInput:function(){if(this.file.down()){this.file.down().remove()}var a=new Element("input",{type:"file",name:this.inputName});this.file.appendChild(a);this.file.down().observe("change",this.onFileChange.bind(this))
},onFileButtonClicked:function(a){a.stop();this.file.down().click()},onUrlButtonClicked:function(a){a.stop();this.url.show();this.urlButton.addClassName("inactive");this.fakefile.hide();this.fakefile.down("input").value="";
this.resetInput();if(this.deleteButton){this.deleteButton.hide()}this.deleteFileField.down().checked=true;if(this.origData){this.origData.hide();this.resetButton.show()}if(this.previewData){this.previewData.hide();
this.previewData.show()}if(this.assetsField){this.assetsField.value=""}},onDeleteClicked:function(a){a.stop();this.deleteFileField.down().checked=true;this.fakefile.hide();this.fakefile.down("input").value="";
this.resetInput();this.urlButton.removeClassName("inactive");if(this.deleteButton){this.deleteButton.hide()}if(this.origData){this.origData.hide();this.resetButton.show()}if(this.previewData){this.previewData.hide();
this.resetButton.show()}if(this.assetsField){this.assetsField.value=""}},onResetClicked:function(a){a.stop();this.url.hide();this.url.down("input").value="";this.deleteFileField.down().checked=false;this.fakefile.hide();
this.fakefile.down("input").value="";this.resetInput();this.urlButton.removeClassName("inactive");this.resetButton.hide();if(this.origData){this.origData.show();if(this.origData.down(".gui_orig_file")&&this.deleteButton){this.deleteButton.show()
}}if(this.previewData){this.previewData.show();if(this.deleteButton){this.deleteButton.show()}}if(this.assetsField){this.assetsField.value=""}},setAsset:function(b,a){this.url.hide();this.url.down("input").value="";
this.deleteFileField.down().checked=false;this.resetInput();this.urlButton.removeClassName("inactive");this.resetButton.hide();if(this.origData){this.origData.hide()}if(this.deleteButton){this.deleteButton.hide()
}this.assetsField.value=b;this.fakefile.down("input").value=a;this.fakefile.show()}});SL.ui.FileField=Class.create(SL.Component,{init:function(){this.file=$(this.id+"_f");this.fakefile=$(this.id+"_ff");
this.fileButton=$(this.id+"_fb");this.deleteButton=$(this.id+"_d");this.resetButton=$(this.id+"_r");this.origData=$(this.id+"_orig");this.deleteFileField=$(this.id+"_df");this.assetsField=$(this.id+"_ass");
this.fallback=!SL.utils.supportsFileClick();if(this.fallback){this.file.setStyle({visibility:"visible",position:"static"});this.fileButton.hide()}else{this.fileButton.down().observe("click",this.onFileButtonClicked.bind(this));
this.fakefile.observe("click",this.onFileButtonClicked.bind(this))}this.inputName=this.file.down().readAttribute("name");this.resetInput();if(this.deleteButton){this.deleteButton.down().observe("click",this.onDeleteClicked.bind(this))
}if(this.origData){this.resetButton.down().observe("click",this.onResetClicked.bind(this))}},onFileChange:function(){if(!this.fallback){var b=this.file.down().value;if(!b){b="file"}else{var c=b.lastIndexOf("/");
var a=b.lastIndexOf("\\");if(c>=0||a>=0){if(c<0){b=b.substring(a+1)}else{if(a<0){b=b.substring(c+1)}else{if(c<a){b=b.substring(a+1)}else{b=b.substring(c+1)}}}}}this.fakefile.show();this.fakefile.down("input").value=b
}if(this.deleteButton){this.deleteButton.show()}this.deleteFileField.down().checked=false;if(this.origData){this.origData.hide();this.resetButton.show()}},resetInput:function(){if(this.file.down()){this.file.down().remove()
}var a=new Element("input",{type:"file",name:this.inputName});this.file.appendChild(a);this.file.down().observe("change",this.onFileChange.bind(this))},onFileButtonClicked:function(a){a.stop();this.file.down().click()
},onDeleteClicked:function(a){a.stop();this.deleteFileField.down().checked=true;this.fakefile.hide();this.fakefile.down("input").value="";this.resetInput();if(this.deleteButton){this.deleteButton.hide()
}if(this.origData){this.origData.hide();this.resetButton.show()}if(this.assetsField){this.assetsField.value=""}},onResetClicked:function(a){a.stop();this.deleteFileField.down().checked=false;this.fakefile.hide();
this.fakefile.down("input").value="";this.resetInput();this.resetButton.hide();this.origData.show();if(this.deleteButton){this.deleteButton.show()}if(this.origData.down(".gui_orig_file")&&this.deleteButton){this.deleteButton.show()
}if(this.assetsField){this.assetsField.value=""}},setAsset:function(b,a){this.resetInput();this.assetsField.value=b;this.fakefile.down("input").value=a;this.fakefile.show();if(this.origData){this.origData.hide();
this.resetButton.show()}}})})();(function(){SL.ui.AutoComplete=Class.create(SL.Component,{init:function(){this.config.setDefault("css_prefix","autocomplete");this.config.setDefault("multi",false);this.config.ensureHash("options");
this.input=this.e.down("input");this.input.writeAttribute("autocomplete","off");var form=this.input.up("form");if(form){this.input.writeAttribute("autocomplete","off")}new Form.Element.Observer(this.input,0.2,this.onInputChange.bind(this));
this.input.observe("blur",this.hideDelayed.bind(this))},onInputChange:function(e){if(!this.initialized){this.dd=new Element("div",{"class":this.config.get("css_prefix")+"_dropdown"});this.options=this.config.get("options");
this.url=this.config.get("options_url");this.input.insert({after:this.dd});this.e.setStyle({position:"relative"});this.dd.setStyle({position:"absolute",left:"0px",top:this.input.getHeight()+"px"});this.dd.hide();
this.initialized=true}var values=this.input.getValue().strip();if(!this.config.get("multi")){var value=values}else{var pos=values.lastIndexOf(",");if(pos<0){value=values}else{value=values.substr(pos+1).strip()
}}if(this.lastValue==value){return}this.lastValue=value;if(value.empty()){return}this.updateDropdown(value)},updateDropdown:function(value){options=this.options.get(value);if(!options){if(!this.url){this.hide();
return}if(this.config.get("multi")){var pos=value.lastIndexOf(",");if(pos>0){value=value.substr(pos+1)}}var url=this.url.replace("@value@",value);new Ajax.Request(url,{onSuccess:this.onOptionsResponse.bind(this)});
return}if(options.length>0){this.updateDropdownOptions(options)}else{this.hide()}},updateDropdownOptions:function(options){var inner=new Element("div",{"class":this.config.get("css_prefix")+"_dowpdown_inner"});
this.dd.update(inner);for(var i=0;i<options.length;i++){var o=options[i];if(o.link){var e=new Element("div");inner.appendChild(e);e.update(o.html);e.store("sl_ac_link",o.link);e.observe("click",o.link)
}else{var e=new Element("div");inner.appendChild(e);e.update(o.html);e.store("sl_ac_id",o.id);e.observe("click",this.onOptionClick.bind(this,o.id))}}if(!this.shown){this.dd.show();if(!this.keyHandler){this.keyHandler=this.onInputKey.bind(this);
document.observe("keydown",this.keyHandler)}this.shown=true}},onOptionsResponse:function(o){var options=eval("("+o.responseText+")");if(options&&options.data.length>0){this.options.set(options.id,options.data);
this.updateDropdownOptions(options.data)}else{this.hide()}},onInputKey:function(event){if(!this.shown){return}if(event.keyCode==Event.KEY_DOWN){event.stop();var current=this.dd.down(".selected");var next;
if(!current){next=this.dd.down().down()}else{next=current.next();current.removeClassName("selected");if(!next){return}}next.addClassName("selected")}else{if(event.keyCode==Event.KEY_UP){event.stop();var current=this.dd.down(".selected");
var prev;if(!current){var children=this.dd.down().childElements();prev=children[children.length-1]}else{prev=current.previous();current.removeClassName("selected");if(!prev){return}}prev.addClassName("selected")
}else{if(event.keyCode==Event.KEY_RETURN){var current=this.dd.down(".selected");if(current){event.stop();var link=current.retrieve("sl_ac_link");if(link){link()}else{this.selectOption(current.retrieve("sl_ac_id"))
}}this.hide()}else{if(event.keyCode==Event.KEY_ESC){event.stop();this.hide()}}}}},onOptionClick:function(id,event){this.selectOption(id);this.hide.bind(this).defer()},hideDelayed:function(){setTimeout(this.hide.bind(this),150)
},hide:function(){if(this.shown){this.dd.hide();this.shown=false}},add:function(value){this.selectOption(value,true)},selectOption:function(value,append){if(!this.config.get("multi")){this.lastValue=value;
this.input.value=value;this.input.focus();return}if(!value||this.contains(value)){this.input.focus();return}var values=this.input.value;if(values){var pos=values.lastIndexOf(",");if(pos<0){if(append){values+=", "+value
}else{values=value}}else{if(append){values=values.strip();if(values.endsWith(",")){values+=value}else{values+=", "+value}}else{values=values.substr(0,pos+1)+" "+value}}}else{values=value}this.lastValue=value;
this.input.value=values;this.input.focus();this.hide.bind(this).defer()},contains:function(id){var data=this.input.value;if(!data){return false}data=data.split(",");for(var i=0;i<data.length;i++){if(data[i].strip()==id){return true
}}return false}})})();(function(){SL.legacy={initWidget:function(d,g){var c=undefined;if(this.findWidget){c=this.findWidget(d);if(d.readAttribute("slDDSource")||d.readAttribute("slDDTarget")){c=new SL.widgets.Widget(d)
}}if(!c){c=new SL.Component(d)}if(g){var b=d.readAttribute("slLazy");if(b){var a=d.readAttribute("slUrl");c.load(a)}}d.store("sl_component",c);return c},autoInitWidgets:function(c){var d;if(c){d=$(c).select(".gui_w_ai")
}else{d=$$(".gui_w_ai")}for(var b=0,a=d.length;b<a;b++){SL.legacy.initWidget(d[b],true)}}}})();function slById(a){return SL.byID(a)}function slRefreshInParentWindow(a){if(!window.opener){return}window.opener.SL.byID(a).refresh(false)
}function slAutoInitWidgets(a){console.log("legacy slAutoInitWidgets");SL.legacy.autoInitWidgets(a)}function slUpdateEditors(b,c){var d;if(b){d=b.select(".gui_editor")}else{d=$$(".gui_editor")}for(var a=0;
a<d.length;a++){SL.byID(d[a]).update()}if(!c){if(b){d=b.select(".sljs__component__")}else{d=$$(".sljs__component__")}if(d){d.each(function(g){var h=g.retrieve("sl_component");if(h){h.updateForPost()}})
}}}function slRegisterOverlay(b){var a=document.SLOMgr;if(!a){a=new YAHOO.widget.OverlayManager();document.SLOMgr=a}a.register(b)}function slRaiseOverlay(b){var a=document.SLOMgr;if(!a){a=new YAHOO.widget.OverlayManager();
document.SLOMgr=a}a.bringToTop(b)}function slCloseTooltips(){var a=document.slTooltips;if(a){a.each(function(b){b.value._doHide()})}}function slInitTooltip(b,a){SL.byID(b).initOnce(a)}SL.utils.onDomReady(function(){SL.legacy.autoInitWidgets.defer()
});(function(){SL.legacy.widgets=$H({gui_dialog:function(a){return new SL.widgets.Dialog(a)},gui_date_chooser:function(a){return new SL.widgets.DateChooser(a)},gui_toolbox:function(a){return new SL.widgets.Tooltip(a,{on_click:true})
},gui_tooltip:function(a){return new SL.widgets.Tooltip(a,{on_click:false})},gui_editor:function(a){return new SL.widgets.HTMLEditor(a)},gui_tree:function(a){return new SL.widgets.Tree(a)},gui_menu:function(a){return new SL.widgets.Menu(a,{is_menubar:false})
},gui_menubar:function(a){return new SL.widgets.Menu(a,{is_menubar:true})},gui_popup:function(a){return new SL.widgets.PopupMenu(a,{on_click:false})},gui_overlay:function(a){return new SL.widgets.Overlay(a)
},gui_popupmenu:function(a){return new SL.widgets.PopupMenu(a,{on_click:false})},gui_img_ticker:function(a){return new SL.widgets.ImageTicker(a)},gui_color_chooser:function(a){return new SL.widgets.ColorChooser(a)
},gui_expandable:function(a){return new SL.widgets.Expandable(a)},gui_tabs:function(a){return new SL.widgets.Tabs(a)},gui_image_zoom:function(a){return new SL.widgets.ImageZoom(a)},gui_autocomplete:function(a){return new SL.widgets.AutoComplete(a)
},gui_tree_table:function(a){return new SL.widgets.TreeTable(a)},gui_tree_table_actions:function(a){return new SL.widgets.TreeTableActions(a)}});SL.legacy.findWidget=function(c){var d=$w(c.className);for(var a=0;
a<d.length;a++){var b=this.widgets.get(d[a]);if(b){return b(c)}}}})();SL.admin={};(function(){SL.admin._overlayIndex=915;SL.admin._getNewOverlayIndex=function(){SL.admin._overlayIndex=SL.admin._overlayIndex+2;
return SL.admin._overlayIndex};SL.admin.setArea=function(area){if(area){window.location.hash="#__admin_area="+area}else{window.location.hash=""}};SL.admin.getArea=function(){if(window.location.hash&&window.location.hash.indexOf("#__admin_area=")==0){return window.location.hash.substring("#__admin_area=".length)
}};SL.admin.alterURL=function(url){if(window.location.hash&&window.location.hash.indexOf("#__admin_area=")==0){url=SL.utils.addOrReplaceArg(url,"admin_menu.manual_select","true");url=SL.utils.addOrReplaceArg(url,"admin_menu.selected",window.location.hash.substring("#__admin_area=".length))
}return url};SL.admin.setTitle=function(title){if(!SL.admin._oldTitle){SL.admin._oldTitle=document.title}document.title=title};SL.admin.resetTitle=function(){if(SL.admin._oldTitle){document.title=SL.admin._oldTitle
}};SL.admin.ElementOverlay=Class.create(SL.Component,{init:function(){this.config.setDefault("type","inline");this.isStatic=this.config.get("static");if(this.config.get("type")=="attach"){var attachElement=$(this.config.get("attach_id"));
var old=attachElement.retrieve("sl_admin_overlay");if(old){this.content=old.reattachContentDiv()}var html=this.config.get("top");if(html){this.top=new Element("div",{"class":"gui_style_reset gui_admin_element_overlay_top"});
this.top.update(html);this.e.appendChild(this.top)}var html=this.config.get("left");if(html){this.left=new Element("div",{"class":"gui_style_reset gui_admin_element_overlay_left"});this.left.update(html);
this.e.appendChild(this.left)}if(this.content){this.content.wrap(this.e)}else{this.content=new Element("div",{"class":"gui_admin_element_overlay_content nobg"});attachElement.wrap(this.e);attachElement.wrap(this.content)
}this.e.setStyle({display:"block",position:"relative"});attachElement.store("sl_admin_overlay",this);this.e.addClassName("gui_admin_element_overlay");if(this.left){this.e.addClassName("gui_with_left")}if(this.isStatic){this.e.addClassName("gui_static")
}if(this.config.get("add_css")){this.e.addClassName(this.config.get("add_css"))}}else{this.top=this.e.down(".gui_admin_element_overlay_top");this.left=this.e.down(".gui_admin_element_overlay_left");this.content=this.e.down(".gui_admin_element_overlay_content")
}if(!this.isStatic){var leaveHandler=this.onMouseLeave.bind(this);this.contentState=new SL.effects.PointerState(this.content,{enter:this.onMouseEnter.bind(this),leave:leaveHandler});this.leftState=new SL.effects.PointerState(this.left,{leave:leaveHandler});
this.topState=new SL.effects.PointerState(this.top,{enter:this.onTopMouseEnter.bind(this),leave:leaveHandler})}else{if(this.top){this.deactivateIcons(this.top);this.topState=new SL.effects.PointerState(this.e,{enter:this.activateIcons.bind(this,this.top),leave:this.deactivateIcons.bind(this,this.top)})
}}var z=SL.ui._overlayIndex+1;if(this.left){this.left.setStyle({zIndex:z+""})}if(this.right){this.right.setStyle({zIndex:z+""})}if(this.config.get("visible")){this.onMouseEnter.bind(this).defer()}},onMouseEnter:function(e){if(e){e.stop()
}if(this.visible){return}if(SL.admin._current&&SL.admin._current!=this){SL.admin._current.hide(true)}if(this.top){this.top.setStyle({display:"block"})}if(this.left){this.left.setStyle({display:"block"})
}this.changedElements=$A();try{var parent=this.e.parentNode;while(parent){if(parent.tagName=="BODY"){break}if(parent.getStyle("overflow")=="hidden"){parent.setStyle({overflow:"visible"});this.changedElements.push(parent)
}parent=parent.parentNode}}catch(ex){console.log(ex)}this.content.addClassName("active");SL.admin._current=this;this.visible=true},onTopMouseEnter:function(e){if(!this.config.get("hide_on_top")){return
}this.hide(true);var e=this.e.up(".gui_admin_element_overlay");if(!e){return}SL.byID(e.id).onMouseEnter()},onMouseLeave:function(e){setTimeout(this.hide.bind(this,false),500)},hide:function(force){if(!this.visible){return
}if(!force){if(this.leftState.hasPointer||this.contentState.hasPointer){return}if(!this.config.get("hide_on_top")&&this.topState.hasPointer){return}}if(this.top){this.top.setStyle({display:"none"})}if(this.left){this.left.setStyle({display:"none"})
}this.content.removeClassName("active");if(this.changedElements){this.changedElements.each(function(e){e.setStyle({overflow:"hidden"})});this.changeElements=undefined}if(SL.admin._current==this){SL.admin._current=undefined
}this.visible=false},reattachContentDiv:function(){this.contentState.stop();this.leftState.stop();this.topState.stop();this.content.remove();this.e.replace(this.content);return this.content},activateIcons:function(root){root.select("img.gui_inactivateable").each(function(e){var src=e.readAttribute("src");
if(src.endsWith("_i.png")){src=src.substring(0,src.length-6)+".png";e.writeAttribute("src",src)}})},deactivateIcons:function(root){root.select("img.gui_inactivateable").each(function(e){var src=e.readAttribute("src");
if(!src.endsWith("_i.png")){src=src.substring(0,src.length-4)+"_i.png";e.writeAttribute("src",src)}})}});SL.admin.EditorOverlay=Class.create(SL.Component,{init:function(){this.target=$(this.config.get("attach_id"));
this.connectDestroy(this.target);var url=this.config.get("url");this.e.addClassName(this.config.get("css"));var inner=new Element("div");inner.appendChild(new Element("div",{id:this.id+"_c"}));this.e.appendChild(inner);
SL.byID(this.id+"_c").load(url);this.e.setStyle({position:"absolute",display:"block"});this.updatePosition();setInterval(this.updatePosition.bind(this),100)},updatePosition:function(){var offset=this.target.cumulativeOffset();
var height=this.target.getHeight();var width=this.target.getWidth();this.target.getLayout().get("border-box-height");var correction=this.target.getLayout().get("margin-bottom")+this.target.getLayout().get("padding-bottom");
this.e.setStyle({top:(offset.top+height-correction)+"px",left:offset.left+"px"});if(width<400){this.e.setStyle({minWidth:width+"px"})}else{this.e.setStyle({width:width+"px"})}},hide:function(){try{var rid=this.config.get("refresh_id");
if(rid){SL.byID(rid).refresh()}}catch(e){console.log("Error refreshing component:",e)}this._destroy()}});SL.admin.Panel=Class.create(SL.Component,{init:function(){var expand=this.config.get("expand");this.expander=$("admin_panel_expander");
var expandJS=this.config.get("expand_js");if(expandJS){this.sarea=$("admin_panel_sarea");this.sarea.addClassName("visible");this.expander.observe("click",function(){eval(expandJS)});this.sarea.observe("click",function(){eval(expandJS)
});return}this.content=$("admin_panel_content");this.main=$("admin_panel_main");this.backdrop=$("admin_panel_backdrop");this.sarea=$("admin_panel_sarea");this.mainPage=$("page_content");if(this.mainPage){this.mainPage.setStyle({position:"relative"})
}if(expand){this.show(true);this.expander.hide()}else{this.sarea.addClassName("visible")}this.sarea.observe("click",this.show.bind(this));this.expander.observe("click",this.show.bind(this,false));this.ensureShrinker()
},onSArea:function(){this.show()},hide:function(){if(!this.visible){return}if(this.mainPage){this.mainPage.setStyle({marginTop:"0",});this.expander.show()}this.content.removeClassName("visible");this.sarea.addClassName("visible");
this.visible=false;new Ajax.Request(this.config.get("notify_url").replace("@expanded@",false))},show:function(noNotify){if(this.visible){return}if(this.mainPage){this.mainPage.setStyle({marginTop:"90px"})
}this.expander.hide();this.content.addClassName("visible");this.sarea.removeClassName("visible");this.visible=true;if(!noNotify){new Ajax.Request(this.config.get("notify_url").replace("@expanded@",true))
}},toggle:function(){if(this.visible){this.hide()}else{this.show()}},showBackdrop:function(clickCB){this.updateBackdrop();this.backdrop.show();if(!this.backdropUpdater){this.backdropUpdater=setTimeout(this.updateBackdrop.bind(this),2000)
}if(!this.mainPage){this.expander.hide()}var sb=SL.byID("admin_sidebar_left");if(sb){sb.hide()}},ensureShrinker:function(){if(!this.shrinker){this.shrinker=$("admin_panel_shrinker");if(this.shrinker){this.shrinker.observe("click",this.hide.bind(this))
}}},onSuccess:function(){if(this.needsPageReload){location.reload();return}this.ensureShrinker()},updateBackdrop:function(){var top=this.main.positionedOffset().top+this.main.getHeight();var height=SL.effects.getBodyHeight()-top;
this.backdrop.setStyle({top:top+"px",height:height+"px"})},hideBackdrop:function(state){if(this.backdropUpdater){clearInterval(this.backdropUpdater)}if(this.bdClickCB){this.backdrop.stopObserving("click",this.bdClickCB);
this.bdClickCB=undefined}if(this.needsPageReload){location.hash="";location.reload();this.needsPageReload=false}this.backdrop.fade({duration:0.25});if(!this.mainPage){this.expander.show()}setTimeout(function(){var e=this.e.down(".gui_menu_level2");
if(e){e.hide()}if(state!="close_only"){this.e.select(".selected").each(function(e){e.removeClassName("selected")});this.e.select(".current_page_mode").each(function(e){e.addClassName("selected")})}}.bind(this),250)
},registerPageReload:function(){this.needsPageReload=true},onChildComponentChanged:function(){this.ensureShrinker();if(this.shrinker){this.shrinker=$("admin_panel_shrinker");this.shrinker.observe("click",this.hide.bind(this))
}},resetSelected:function(selectedClass){this.e.select(".selected").each(function(e){e.removeClassName("selected")});if(selectedClass){this.e.select(".gui_menu_item").each(function(e){if(e.hasClassName(selectedClass)){e.addClassName("selected")
}})}else{this.e.select(".current_page_mode").each(function(e){e.addClassName("selected")})}}});SL.admin.getOrCreateDesignEditor=function(frame,id){var editors=SL.storage.get("design_editors");if(!editors){editors=$H();
SL.storage.set("design_editors",editors)}var editor=editors.get(id);if(editor){if(!frame){return editor}if(editor.frame==frame){return editor}if(editor.preview){editor.preview.cleanup()}}editor=new SL.admin.DesignEditor(frame,id);
editors.set(id,editor);return editor};SL.admin.destroyDesignEditors=function(){var editors=SL.storage.get("design_editors");if(!editors){return}editors.each(function(p){p.value._destroy()});SL.storage.unset("design_editors")
};SL.admin.changePreviewStyle=function(frame,url){new Ajax.Request(url,{method:"get",onSuccess:function(){var head=$(frame).contentWindow.$$("head")[0];var c=SL.admin._styleCount++;var e=new Element("link",{id:"sl_design_sets_style_resource_temp_"+c,href:url,type:"text/css",rel:"stylesheet"});
head.appendChild(e);setTimeout(function(){try{$(frame).contentWindow.$("sl_design_sets_style_resource").remove()}catch(err){console.log("Error removing old style:",err)}e.writeAttribute("id","sl_design_sets_style_resource")
},500)}})};SL.admin.refreshPreviewIFrame=function(id){var editors=SL.storage.get("design_editors");if(editors){editors.each(function(e){if(e.value.frame){e.value.notifyForCleanup(true)}})}var frame=frames[id];
if(frame){frame.__slInvalid=true}else{console.log("Unknown frame:",id)}var f=$(id);var e=f.up();f.remove();frames[id]=undefined;f=new Element("iframe",{id:id,name:id,frameborder:"0",framespacing:"0",scrolling:"no",height:f.readAttribute("height"),"class":f.readAttribute("class"),src:f.readAttribute("src")});
e.appendChild(f);frames[id]=f.contentWindow};SL.admin.DesignEditor=Class.create({initialize:function(frame,id){console.log("Init DesignEditor");this.frame=frame;this.id=id;this.first=true;this.styles=$H();
this.images=$H();if(frame){SL.utils.executeAfterFrameDomReady(frame,this.onFrameLoaded.bind(this));var e=$(frame);if(e){var h=e.retrieve("sl_delete_notify");if(!h){h=$H();e.store("sl_delete_notify",h);
e.addClassName("sljs__delete_notify__")}h.set(this.id,this)}}else{this.e=$(id);this.initPreview();this.initialized=true}},_destroy:function(){console.log("Destroying design editor");var f=frames[this.frame];
f.__slInvalid=true;f.SL=undefined;this.initialized=false;this.e=undefined;this.images=undefined;this.styles=undefined;this.preview=undefined},notifyForCleanup:function(reload){this.initialized=false;if(this.e){this.e.__slInvalid=true;
this.e=undefined}if(reload){SL.utils.executeAfterFrameDomReady(this.frame,this.onFrameLoaded.bind(this))}if(this.preview){this.preview.cleanup();this.preview=undefined}this.images.each(function(e){e.value.e=undefined
});console.log("Notify cleanup")},getE:function(){if(!this.frame){return this.e}if(!this.e||this.e.__slInvalid){this.e=SL.utils.getFrameElement(this.frame,this.id);if(!this.e||this.e.__slInvalid){return undefined
}}return this.e},onFrameLoaded:function(){this.getE();if(!this.initPreview()){SL.utils.executeAfterFrameDomReady(this.frame,this.onFrameLoaded.bind(this))}else{this.initialized=true;$(this.frame).observe("load",this.onFrameReload.bind(this))
}},onFrameReload:function(){console.log("Frame loaded");this.initialized=false;this.first=false;SL.utils.executeAfterFrameDomReady(this.frame,this.onFrameLoaded.bind(this))},initPreview:function(){if(!this.getE()){return false
}try{if(this.preview){this.preview.cleanup()}if(this.frame){var p=frames[this.frame].SL.admin.DesignPreview;this.preview=new p(this.getE(),{editor:this})}else{this.preview=new SL.admin.DesignPreview(this.getE(),{editor:this})
}this.images.each(function(p){this.initImage(p.key)}.bind(this));this.styles.each(function(p){this.initStyle(p.key)}.bind(this))}catch(e){console.log(e)}return true},cleanupRegistry:function(){this.styles.each(function(p){if(!SL.componentExists(p.value.componentID)){console.log("Removing style without component:",p.key);
this.styles.unset(p.key)}}.bind(this))},register:function(componentID,id,selector,cfg){this.cleanupRegistry();var style={componentID:componentID,selector:selector,cfg:cfg};this.styles.set(id,style);if(this.initialized){this.initStyle(id)
}},initStyle:function(id){var style=this.styles.get(id);if(!style){console.log("Unable to get style:",id);return}var component=SL.byID(style.componentID);var e=style.selector?this.getE().down(style.selector):this.getE();
if(e){if(style.cfg.unit=="px_constraint"){e.select("a").each(function(link){link.writeAttribute("href","");link.writeAttribute("onclick","")});this.preview.initDraggable(e.identify(),this.onDragChanged.bind(this,id));
this.updateSliderRanges.bind(this,id).defer()}}var img=this.images.get("default");if(img){if(style.cfg.style=="imageZoom"){img.zoomComponent=style;img.zoomComponent.img=img;this.refreshImage(img)}else{if(style.cfg.style=="imagePositionLeft"){img.leftComponent=style;
img.leftComponent.img=img;this.refreshImage(img)}else{if(style.cfg.style=="imagePositionTop"){img.topComponent=style;img.topComponent.img=img;this.refreshImage(img)}else{if(style.cfg.constraint_to_image){img.heightComponent=style;
img.heightComponent.e=style.selector?this.getE().down(style.selector):this.getE();img.heightComponent.img=img;this.refreshImage(img)}}}}}if(style.cfg.type=="slider"){component.setCB({moved:this.onChanged.bind(this,id)});
if(!this.first){component.emitMoved()}}else{if(component.setCB){component.setCB({changed:this.onChanged.bind(this,id)})}}},onChanged:function(id,component,pos,value,value2){var style=this.styles.get(id);
var cfg=style.cfg;var styles={};if(cfg.style.startsWith("imagePosition")){var img=this.images.get("default");if(img){value=Math.round(value2);var e=img.e;if(cfg.style.endsWith("Left")){e.setStyle({left:(-1*value)+"px"})
}else{e.setStyle({top:(-1*value)+"px"})}this.refreshImage(img,style)}return}if(cfg.style=="imageZoom"){var img=this.images.get("default");if(img){value=Math.round(value2);var width=img.width*value/100;
var height=img.height*value/100;img.e.setStyle({width:width+"px",height:height+"px"});this.refreshImage(img,style)}return}if(cfg.type=="color"){value=pos;if(value&&!value.startsWith("#")){value="#"+value
}styles[cfg.style]=value}else{if(cfg.type=="dropdown"){value=pos;if(cfg.unit=="pct"){styles[cfg.style]=value+"%"}else{if(cfg.unit!="plain"){styles[cfg.style]=value+cfg.unit}else{styles[cfg.style]=value
}}}else{value=Math.round(value2);if(cfg.unit=="px_constraint"){if(cfg.style=="left"){styles[cfg.style]=value+"px"}else{if(cfg.style=="top"){styles[cfg.style]=value+"px"}else{console.log("Unknown style:",cfg.style)
}}}else{if(cfg.unit=="pct"){styles[cfg.style]=value+"%"}else{if(cfg.unit!="plain"){styles[cfg.style]=value+cfg.unit}else{styles[cfg.style]=value}}}}}if(!style.selector){this.getE().setStyle(styles)}else{this.getE().select(style.selector).each(function(e){e.setStyle(styles)
})}if(cfg.selectors){$A(cfg.selectors).each(function(selector){this.getE().select(selector).each(function(child){child.setStyle(styles)})}.bind(this))}style.value=value;if(style.img){this.refreshImage(style.img,style)
}},registerImage:function(id,img){if(!id){id="default"}this.images.set(id,img);if(this.initialized){this.initImage(id)}},initImage:function(id){var img=this.images.get(id);if(!img){console.log("Unable to get image for id:",id);
return}img.e=this.preview.initImage(img);img.width=undefined;img.height=undefined;img.zoomInitialized=undefined;img.leftInitialized=undefined;img.topInitialized=undefined;if(img.e){new SL.effects.Preloader(img.e,this.onImageLoaded.bind(this,img))
}},onImageLoaded:function(img){var i=new Image();i.onload=function(){img.width=i.width;img.height=i.height;if(!img.zoomInitialized){img.e.setStyle({width:i.width+"px",height:i.height+"px"})}this.refreshImage(img,false)
}.bind(this);i.src=img.url},refreshImage:function(img,current){if(!img.width||img.e.getWidth()<=0){return}if(img.zoomComponent&&img.zoomComponent!=current){var component=this.getComponent(img.zoomComponent);
if(!img.zoomInitialized){var value=component.getValue();value=Math.round(value);var width=Math.round(img.width*value/100);var height=Math.round(img.height*value/100);img.e.setStyle({width:width+"px",height:height+"px"});
img.zoomInitialized=true}var tall=this.e.up().getWidth()>img.width;var minWidth=tall?100:(img.e.up().getWidth()*100/img.width);var minHeight=img.e.up().getHeight()*100/img.height;var minPCT=Math.max(minWidth,minHeight);
var value=component.getValue();component.config.set("range_min",minPCT);component.config.set("range_max",200);component.setValue(value,true)}if(img.heightComponent&&img.heightComponent!=current&&img.height>0){var component=this.getComponent(img.heightComponent);
var value=component.getValue();component.config.set("range_max",img.e.getHeight());component.setValue(value,true)}if(img.heightComponent){var component=this.getComponent(img.heightComponent);img.e.up().setStyle({height:component.getValue()+"px"})
}if(img.leftComponent){var component=this.getComponent(img.leftComponent);var value=component.getValue();var max=img.e.getWidth()-img.e.up().getWidth();component.config.set("range_max",max);var tall=this.isTall(img);
if((tall&&value<max)||(!tall&&value>max)){component.setValue(max,true);if(!img.leftEmited){img.leftEmited=true;component.emitMoved();img.leftEmited=false}}else{component.setValue(value,true)}if(!img.leftInitialized){img.e.setStyle({left:-value+"px"})
}}if(img.topComponent){var component=this.getComponent(img.topComponent);var value=component.getValue();var max=img.e.getHeight()-img.e.up().getHeight();component.config.set("range_max",max);if(value>max){component.setValue(max);
if(!img.topEmited){img.topEmited=true;component.emitMoved();img.topEmited=false}}else{component.setValue(value,true)}if(!img.topInitialized){img.e.setStyle({top:-value+"px"})}}},onDragChanged:function(id){var style=this.styles.get(id);
var e=style.selector?this.getE().down(style.selector):this.getE();var component=this.getComponent(style);if(style.cfg.style=="left"){var left=e.getLayout().get("left");var total=e.getWidth()-e.up().getWidth();
component.setPCT(left*-100/total)}else{if(style.cfg.style=="top"){var top=e.getLayout().get("top");var total=e.getHeight()-e.up().getHeight();component.setPCT(top*-100/total)}else{console.log("Unknown style:",style.cfg.style)
}}},updateSliderRanges:function(id){if(!this.initialized){return}var style=this.styles.get(id);if(!style){return}var e=style.selector?this.getE().down(style.selector):this.getE();if(!e){return}var component=this.getComponent(style);
var value=component.getValue();if(style.cfg.style=="left"){var total=e.up().getWidth()-e.getWidth();component.config.set("range_max",total)}else{if(style.cfg.style=="top"){var total=e.up().getHeight()-e.getHeight();
component.config.set("range_max",total)}else{console.log("Unknown style:",style.cfg.style)}}component.setValue(value,true)},getComponent:function(style){var component=SL.byID(style.componentID);if(!component){console.log("Unable to get component:",style);
return}return component},isTall:function(img){return img.e.up().getWidth()>img.e.getWidth()}});SL.admin.DesignPreview=Class.create(SL.Element,{init:function(){this.elements=$A();this.images=$A()},initDraggable:function(elementID,cb){var e=$(elementID);
this.elements.push(new SL.dnd.Draggable(e,{maxX:-10,maxY:-10,cb:{moved:cb}}))},initImage:function(img){var elements=this.e.select(img.selector);if(elements.length==0){console.log("Image element not found:",img.selector);
return}var imageBox=elements[0];var origImage=imageBox.down();origImage.setStyle({visibility:"hidden"});var e=new Element("img",{src:img.url,"class":"__edit__img__"});e.setStyle({position:"absolute",top:"0",left:"0"});
imageBox.appendChild(e);imageBox.setStyle({position:"absolute",overflow:"hidden",height:"auto",top:"0",left:"0",right:"0",bottom:"0"});imageBox.up().setStyle({overflow:"hidden"});this.images.push({e:e,orig:origImage});
return e},cleanup:function(){this.elements.each(function(e){e.cleanup()});this.images.each(function(img){img.e.remove();img.orig.setStyle({visibility:"visible"})})}});SL.admin.Sidebar=Class.create(SL.Component,{init:function(){this.e.addClassName("gui_style_reset");
this.e.addClassName(this.config.get("css"));this.e.addClassName("inactive");this.load.bind(this,this.config.get("url")).defer();this.dialog=new SL.admin.SidebarDialog("admin_sidebar_left_view",{sidebar:this})
},onSuccess:function(){this.main=this.e.down(".gui_admin_sidebar_left_main");this.contentEditor=$("admin_panel_left_content_editor");this.main.childElements().each(function(e){e.hide()});this.e.show();
this.grip=this.e.down("."+this.config.get("css")+"_grip");this.expander=this.e.down("."+this.config.get("css")+"_expander");this.grip.observe("click",this.toggle.bind(this,false));this.expander.observe("click",this.toggle.bind(this,false))
},toggle:function(mouseenter){if(mouseenter&&this.visible){return}if(this.visible){this.hide.bind(this).defer()}else{this.show.bind(this).defer();this.active=this.main.childElements()[0]}},hide:function(){if(!this.visible){return
}this.e.addClassName("inactive");this.e.removeClassName("active");this.visible=false;this.dialog.hide();this._getBackdrop().hide();this.active.hide();this.active=undefined;var mainPage=$("page_content");
if(mainPage){mainPage.setStyle({marginLeft:"0"})}SL.admin.resetTitle();SL.admin.setArea(false);SL.byID("admin_panel").resetSelected()},show:function(){if(!this.active){this.active=this.main.childElements()[0]
}this.e.addClassName("active");this.e.removeClassName("inactive");this.visible=true;if(SL.byID(this.active.identify()).needsReloadInPanel){SL.byID(this.active.identify()).refresh()}this.active.show();var mainPage=$("page_content");
if(mainPage){mainPage.setStyle({marginLeft:this.e.down(".gui_admin_sidebar_left_main").getWidth()+"px"})}},showContentEditor:function(id,url,raiseID){if(this.active){this.hide()}this.active=this.contentEditor;
this.show();SL.byID(this.contentEditor.identify()).load(url);if(raiseID){this.raiseElement($(raiseID),"4");this._getBackdrop().show()}},hideContentEditor:function(onClick){this.hide();this.resoreZIndices()
},raiseElement:function(element,newZIndex){if(!element){return}var h=$H();this.raised=h;f=function(e,first){var d=e.getStyle("position");if(first||d=="absolute"||d=="relative"){var z=e.getStyle("zIndex");
if(z){h.set(e.identify(),z);e.setStyle({zIndex:(parseInt(newZIndex)+parseInt(z))+""})}else{e.setStyle({zIndex:newZIndex})}}e.childElements().each(function(c){f(c)})};f(element,true)},resoreZIndices:function(){if(this.raised){this.raised.each(function(h){var e=$(h.key);
if(e){e.setStyle({zIndex:h.value})}})}},_getBackdrop:function(){var id=this.id+"_g_backdrop";var e=$(id);if(!e){e=SL.utils.createBodyElement("div",{id:id});e.setStyle({position:"absolute",top:"0",left:"0",width:"100%",height:SL.effects.getBodyHeight()+"px",backgroundColor:"#000000"});
e.setOpacity(0.5);e.addClassName("dialog_backdrop");e.hide();e.observe("click",this.hide.bind(this))}e.setStyle({zIndex:"3"});return e}});SL.admin.SidebarDialog=Class.create(SL.ui.Dialog,{init:function($super){this.config.setDefault("backdrop_opacity",0.7);
this.e.addClassName("gui_style_reset");this.sidebar=this.config.get("sidebar");$super()},getTopLeftForCenter:function(width,height){var vWidth=document.viewport.getWidth();var vHeight=document.viewport.getHeight();
var top=0;var left=0;if(width<vWidth){left=(vWidth-width)/2}var offsets=document.viewport.getScrollOffsets();if(height<vHeight){top=(vHeight-height)/2}return{top:top+offsets.top,left:250/2+left+offsets.left}
},_getBackdrop:function(){var id=this.id+"_g_backdrop";var e=$(id);if(!e){e=SL.utils.createBodyElement("div",{id:id});e.setStyle({position:"absolute",top:"0",left:"0",width:"100%",height:SL.effects.getBodyHeight()+"px",backgroundColor:"#000000"});
e.addClassName("dialog_backdrop");e.hide();e.observe("click",this.hide.bind(this))}e.setStyle({zIndex:"5"});return e}});SL.admin.EntryOverlay=Class.create(SL.Component,{init:function(){this.e.setStyle({visibility:"visible",display:"none",position:"absolute"});
this.c=this.e.next();if(this.c.tagName=="TR"){this.c=this.c.down("td")}this.c.observe("mouseenter",function(){this.onC=true;this.update()}.bind(this));this.e.observe("mouseenter",function(){this.onE=true;
this.update()}.bind(this));this.c.observe("mouseleave",function(){this.onC=false;this.update()}.bind(this));this.e.observe("mouseleave",function(){this.onE=false;this.update()}.bind(this))},update:function(){if(this.onE||this.onC){var offset=this.c.positionedOffset();
this.e.setStyle({top:(offset.top+5)+"px",left:(offset.left+5)+"px"});this.e.show()}else{this.e.hide()}}})})();(function(){SL.ui.Tabs=Class.create(SL.Component,{init:function(){this.headItems=this.e.select("div."+this.config.get("head_items"));
this.bodyItems=this.e.select("div."+this.config.get("body_items"));this.active=this.config.get("active");if(this.active>=0){this.bodyItems[this.active].show()}},activate:function(a){if(this.active==a){return
}if(this.active>=0){this.headItems[this.active].removeClassName("active");this.headItems[this.active].addClassName("inactive");this.bodyItems[this.active].hide()}this.active=a;this.headItems[this.active].addClassName("active");
this.headItems[this.active].removeClassName("inactive");this.bodyItems[this.active].show();this._emitContentChanged(true)}})})();if(!SL.ext){SL.ext={}}(function(){SL.ext.GoogleMaps=Class.create(SL.Component,{init:function(){this.config.setDefault("type",google.maps.MapTypeId.ROADMAP);
this.config.setDefault("map_type_control",false);this.config.setDefault("navigation_control",false);this.config.setDefault("street_view_control",false);var a={zoom:this.config.get("zoom"),mapTypeId:this.config.get("type"),mapTypeControl:this.config.get("map_type_control"),navigationControl:this.config.get("navigation_control"),streetViewControl:this.config.get("street_view_control")};
this.map=new google.maps.Map(this.e,a);this.geocoder=new google.maps.Geocoder();this.latlng=[];var b=this.config.get("markers");this.multi=b.length>1;$A(b).each(function(c){if(c.latlng){var d=new google.maps.Marker({map:this.map,position:c.latlng,title:c.title});
if(!this.multi){this.map.setCenter(c.latlng)}this.latlng.push(c.latlng);if(c.tooltip){var g=new google.maps.InfoWindow({content:c.tooltip});google.maps.event.addListener(d,"click",function(h){if(h.win){h.win.close()
}g.open(this.map,d);h.win=g}.curry(this))}}else{this.geocoder.geocode({address:c.address},this.onGeoResult.bind(this,c))}}.bind(this));if(this.multi||!this.config.get("zoom")){this.updateMap()}},onGeoResult:function(a,d,c){if(c==google.maps.GeocoderStatus.OK){if(!this.multi){this.map.setCenter(d[0].geometry.location)
}var b=new google.maps.Marker({map:this.map,position:d[0].geometry.location,title:a.title});this.latlng.push(d[0].geometry.location);if(a.tooltip){var g=new google.maps.InfoWindow({content:a.tooltip});
google.maps.event.addListener(b,"click",function(h){if(h.win){h.win.close()}g.open(this.map,b);h.win=g}.curry(this))}if(this.multi||!this.config.get("zoom")){this.updateMap()}else{this.map.setCenter(d[0].geometry.location)
}}else{console.log("No location for address",a.address+c)}},updateMap:function(){var b=new google.maps.LatLngBounds();for(var a=0;a<this.latlng.length;a++){b.extend(this.latlng[a])}this.map.fitBounds(b);
this.map.setCenter(b.getCenter())}})})();(function(){SL.ui.Slider=Class.create(SL.Component,{init:function(){this.config.setDefault("range_min",0);this.config.setDefault("range_max",100);this.left=this.e.down(".left");
this.grip=this.e.down(".grip");this.right=this.e.down(".right");this.input=$(this.config.get("input_id"));this.cb=this.config.ensureHash("cb");this.draggable=new SL.dnd.Draggable(this.grip,{orientation:"horizontal",spacer_width:0,cb:{moved:this.moved.bind(this)}});
this.e.observe("click",this.onClick.bind(this));if(this.input&&this.input.value){var rangeMin=this.config.get("range_min");var rangeMax=this.config.get("range_max");var pct=(this.input.value-rangeMin)/(rangeMax-rangeMin)*100;
this.setPCT(pct,true)}else{if(this.config.get("init_value")!=undefined){var rangeMin=this.config.get("range_min");var rangeMax=this.config.get("range_max");var pct=(this.config.get("init_value")-rangeMin)/(rangeMax-rangeMin)*100;
this.setPCT(pct,true)}}},setCB:function(cb){this.cb=cb},onClick:function(e){var xOffset=e.pageX-this.e.cumulativeOffset().left;var gripWidth=this.grip.getWidth();var width=this.e.getWidth();var pos=xOffset-gripWidth/2;
if(pos<0){pos=0}else{if(pos>(width-gripWidth/2)){pos=this.e.getWidth()-gripWidth/2}}this.grip.setStyle({left:pos+"px"});this.moved()},moved:function(){var pos=this.grip.positionedOffset().left;var gripWidth=this.grip.getWidth();
var width=this.e.getWidth();this.percentage=pos*100/(width-gripWidth);var value=this.getValue();if(this.cb.moved){this.cb.moved(this,pos,this.percentage,value)}if(this.input){this.input.value=value}this.sendAsyncUpdate()
},sendAsyncUpdate:function(){if(!this.config.get("update_url")){return}if(this.asyncUpdate){clearTimeout(this.asyncUpdate)}var url=this.config.get("update_url");url=url.replace("@value@",this.getValue());
this.asyncUpdate=setTimeout(function(){new Ajax.Request(url,{method:"get",onSuccess:function(o){eval(o.responseText);this.asyncUpdate=undefined}.bind(this)})},250)},emitMoved:function(){if(this.cb.moved){var value=this.getValue();
var pos=this.grip.positionedOffset().left;this.cb.moved(this,pos,this.percentage,value)}},getValue:function(){var rangeMin=this.config.get("range_min");var rangeMax=this.config.get("range_max");return rangeMin+Math.round(((rangeMax-rangeMin)*this.percentage/100))
},setValue:function(value,init){var rangeMin=this.config.get("range_min");var rangeMax=this.config.get("range_max");var pct=(value-rangeMin)/(rangeMax-rangeMin)*100;this.setPCT(pct,init)},setPCT:function(pct,init){this.percentage=pct;
var eWidth=this.e.getWidth();var gripWidth=this.grip.getWidth();if(eWidth<=0){eWidth=this.config.get("width")}if(gripWidth<=0){gripWidth=5}if(pct<0){pct=0}else{if(pct>100){pct=100}}var pos=Math.round((eWidth-gripWidth)*pct/100);
this.grip.setStyle({left:pos+"px"});var rangeMin=this.config.get("range_min");var rangeMax=this.config.get("range_max");var value=rangeMin+Math.round(((rangeMax-rangeMin)*this.percentage/100));if(this.input){if(this.input.value!=value){this.input.value=value;
if(!init){this.sendAsyncUpdate()}}}else{if(!init){this.sendAsyncUpdate()}}},getPCT:function(){return this.percentage},refresh:function(){this.setPCT(this.percentage)}});SL.ui.Dropdown=Class.create(SL.Component,{init:function(){this.config.setDefault("min_width",50);
this.input=$(this.config.get("input_id"));this.cb=this.config.ensureHash("cb");this.label=this.e.down("."+this.config.get("css")+"_label");this.options=this.e.down("."+this.config.get("css")+"_options");
this.optionsPanel=new SL.ui.Panel(this.options,{attach_id:this.id});this.label.observe("click",this.optionsPanel.toggle.bind(this.optionsPanel));var elements=this.options.childElements();for(var i=0;i<elements.length;
i++){var e=elements[i];e.observe("click",this.onItemClicked.bind(this,i))}this.updateMinWidth()},setCB:function(cb){this.cb=cb},onItemClicked:function(index){var item=this.config.get("data")[index];if(this.input){this.input.value=item.id
}this.label.down().update(item.label);if(this.cb.changed){this.cb.changed(this,item.id,item.label)}if(item.on_select){item.on_select(this,item)}this.optionsPanel.toggle();this.updateMinWidth()},updateMinWidth:function(){if(this.label.getWidth()<=0){return
}var lw=this.label.down().getWidth()+10;if(lw<=10||lw<this.config.get("min_width")){return}if(lw>this.label.getWidth()){this.label.setStyle({width:lw+"px"})}}})})();SL.color={};(function(){SL.color.Color=new function(){this.hsv2rgb=function(h,s,v){var r,g,b;
if(s==0){r=v*255;g=v*255;b=v*255}else{var var_h=h*6;if(var_h==6){var_h=0}var var_i=Math.floor(var_h);var var_1=v*(1-s);var var_2=v*(1-s*(var_h-var_i));var var_3=v*(1-s*(1-(var_h-var_i)));if(var_i==0){var_r=v;
var_g=var_3;var_b=var_1}else{if(var_i==1){var_r=var_2;var_g=v;var_b=var_1}else{if(var_i==2){var_r=var_1;var_g=v;var_b=var_3}else{if(var_i==3){var_r=var_1;var_g=var_2;var_b=v}else{if(var_i==4){var_r=var_3;
var_g=var_1;var_b=v}else{var_r=v;var_g=var_1;var_b=var_2}}}}}r=var_r*255;g=var_g*255;b=var_b*255}return[Math.round(r),Math.round(g),Math.round(b)]};this.rgb2hsv=function(r,g,b){r=(r/255);g=(g/255);b=(b/255);
var min=Math.min(r,g,b);var max=Math.max(r,g,b);deltaMax=max-min;var v=max;var s,h;var deltaRed,deltaGreen,deltaBlue;if(deltaMax==0){h=0;s=0}else{s=deltaMax/max;deltaRed=(((max-r)/6)+(deltaMax/2))/deltaMax;
deltaGreen=(((max-g)/6)+(deltaMax/2))/deltaMax;deltaBlue=(((max-b)/6)+(deltaMax/2))/deltaMax;if(r==max){h=deltaBlue-deltaGreen}else{if(g==max){h=(1/3)+deltaRed-deltaBlue}else{if(b==max){h=(2/3)+deltaGreen-deltaRed
}else{h=0}}}if(h<0){h+=1}if(h>1){h-=1}}return[h,s,v]};this.rgb2hex=function(r,g,b){return this.toHex(r)+this.toHex(g)+this.toHex(b)};this.hexchars="0123456789ABCDEF";this.toHex=function(n){n=n||0;n=parseInt(n,10);
if(isNaN(n)){n=0}n=Math.round(Math.min(Math.max(0,n),255));return this.hexchars.charAt((n-n%16)/16)+this.hexchars.charAt(n%16)};this.toDec=function(hexchar){return this.hexchars.indexOf(hexchar.toUpperCase())
};this.hex2rgb=function(str){var rgb=[];rgb[0]=(this.toDec(str.substr(0,1))*16)+this.toDec(str.substr(1,1));rgb[1]=(this.toDec(str.substr(2,1))*16)+this.toDec(str.substr(3,1));rgb[2]=(this.toDec(str.substr(4,1))*16)+this.toDec(str.substr(5,1));
return rgb};this.isValidRGB=function(a){if((!a[0]&&a[0]!=0)||isNaN(a[0])||a[0]<0||a[0]>255){return false}if((!a[1]&&a[1]!=0)||isNaN(a[1])||a[1]<0||a[1]>255){return false}if((!a[2]&&a[2]!=0)||isNaN(a[2])||a[2]<0||a[2]>255){return false
}return true}},SL.color.Picker=Class.create(SL.Component,{init:function(){this.field=$(this.config.get("input_id"));this.cb=this.config.ensureHash("cb");if(this.config.get("admin")){this.e.setStyle({zIndex:(SL.admin._overlayIndex+1)+""})
}else{this.e.setStyle({zIndex:SL.ui._getNewOverlayIndex()+""})}this.connectDestroy(this.field);this.rgb={};this.hsv={};this.shown=false;SL.utils.reparentToBody(this.e);this.pickerArea=this.e.down(".gui_color_picker_view");
this.selector=this.e.down(".gui_color_picker_selector");this.picker=new SL.dnd.Draggable(this.selector,{orientation:"both",maxY:-21,maxX:-21,cb:{moved:function(picker){var pos=picker.getPos();this.update(pos.left,pos.top,true)
}.bind(this)}});this.thumb=this.e.down(".gui_color_picker_hue_thumb");this.slider=this.e.down(".gui_color_picker_hue_slider");this.thumbDnD=new SL.dnd.Draggable(this.thumb,{orientation:"vertical",minY:-10,maxY:-20,cb:{moved:this.updateHue.bind(this,true)}});
this.field.observe("click",this.toggle.bind(this));new Form.Element.Observer(this.field,0.2,this.updateFromFieldValue.bind(this));this.slider.observe("click",this.onSliderClick.bind(this));this.updateInputColor()
},setCB:function(cb){this.cb=cb},toggle:function(){if(!this.shown){this.show()}},show:function(){this.shown=true;this.e.show();this.updatePosition(true);this.updateFromFieldValue(null,true);this.pickerArea.observe("mousedown",this.updateSelector.bind(this));
this.bodyCB=this.onBodyClicked.bind(this);(function(){$$("body")[0].observe("click",this.bodyCB)}).bind(this).defer()},updatePosition:function(first){if(!this.shown){if(this.updateCB){clearTimeout(this.updateCB)
}return}if(first&&this.updateCB){clearTimeout(this.updateCB)}var offset=this.field.cumulativeOffset();offset.left+=this.field.getWidth()+5;var fixedElement=this.field.getFixedParent();if(fixedElement){var fixedScrollOffset=this.field.cumulativeScrollOffsetFixed();
offset.left-=fixedScrollOffset.left;offset.top-=fixedScrollOffset.top}var parentScrollOffset=this.field.cumulativeScrollOffset();offset.left-=parentScrollOffset.left;offset.right-=parentScrollOffset.right;
var scrollOffsets=document.viewport.getScrollOffsets();if(fixedElement){offset.top+=scrollOffsets.top}this.e.setStyle({left:offset.left+"px",top:offset.top+"px"});this.updateCB=setTimeout(this.updatePosition.bind(this),250)
},hide:function(){this.shown=false;this.e.hide();if(this.bodyCB){$$("body")[0].stopObserving("click",this.bodyCB);this.bodyCB=undefined}},updateHue:function(updateInput){var h=this.getHue();var rgb=SL.color.Color.hsv2rgb(h,1,1);
if(!SL.color.Color.isValidRGB(rgb)){return}this.pickerArea.setStyle({backgroundColor:"rgb("+rgb[0]+","+rgb[1]+","+rgb[2]+")"});this.update(undefined,undefined,updateInput)},updateFromFieldValue:function(event,keepInitial){var value=this.field.value;
if(this.lastValue&&this.lastValue==value){return}if(keepInitial){this.initialValue=value}if(!value){value="ffffff"}else{if(value.startsWith("#")){value=value.substring(1)}}if(value.length!=3&&value.length!=6){this.field.setStyle({backgroundColor:"#ffffff",color:"#000000"});
return}if(value.length==3){value=value.substring(0,1)+value.substring(0,1)+value.substring(1,2)+value.substring(1,2)+value.substring(2,3)+value.substring(2,3)}var rgb=SL.color.Color.hex2rgb(value);if(!SL.color.Color.isValidRGB(rgb)){this.field.setStyle({backgroundColor:"#ffffff",color:"#000000"});
return}var hsv=SL.color.Color.rgb2hsv(rgb[0],rgb[1],rgb[2]);this.selector.setStyle({left:Math.round(hsv[1]*this.pickerArea.offsetWidth)+"px",top:Math.round((1-hsv[2])*this.pickerArea.offsetWidth)+"px"});
this.thumb.setStyle({top:(((hsv[0]==0?0:1-hsv[0])*this.slider.getHeight())-this.thumb.getHeight()/2)+"px"});this.field.setStyle({backgroundColor:"rgb("+rgb[0]+", "+rgb[1]+", "+rgb[2]+")",color:(hsv[2]>0.65)?"#000000":"#FFFFFF"});
if(event){this.sendAsyncUpdate()}this.updateHue(false)},updateSelector:function(event){var xPos=event.pointerX();var yPos=event.pointerY();var pos=this.pickerArea.down().cumulativeOffset();this.selector.setStyle({left:(xPos-pos[0]-2)+"px",top:(yPos-pos[1]-2)+"px"});
var x=(xPos-pos[0]);var y=(yPos-pos[1]);this.picker.onMouseDown(event);this.update(x,y,true)},updateInputColor:function(){var value=this.field.value;if(!value){value="ffffff"}else{if(value.startsWith("#")){value=value.substring(1)
}}if(value.length!=3&&value.length!=6){value="ffffff"}if(value.length==3){value=value.substring(0,1)+value.substring(0,1)+value.substring(1,2)+value.substring(1,2)+value.substring(2,3)+value.substring(2,3)
}var rgb=SL.color.Color.hex2rgb(value);if(!SL.color.Color.isValidRGB(rgb)){return}var hsv=SL.color.Color.rgb2hsv(rgb[0],rgb[1],rgb[2]);this.field.setStyle({backgroundColor:"rgb("+rgb[0]+", "+rgb[1]+", "+rgb[2]+")",color:(hsv[2]>0.65)?"#000000":"#FFFFFF"})
},getHue:function(){var h=1-(this.thumb.positionedOffset().top+this.thumb.getHeight()/2)/this.slider.getHeight();if(h>=1){h=0}else{if(h<0){h=0}}return h},update:function(x,y,updateInput){if(!x){x=this.picker.getPos().left
}if(!y){y=this.picker.getPos().top}var h=this.getHue();this.hsv={hue:h,saturation:x/this.pickerArea.offsetWidth,brightness:(this.pickerArea.offsetHeight-y)/this.pickerArea.offsetHeight};var rgb=SL.color.Color.hsv2rgb(this.hsv.hue,this.hsv.saturation,this.hsv.brightness);
this.rgb={red:rgb[0],green:rgb[1],blue:rgb[2]};if(updateInput){this.lastValue=(this.config.get("with_prefix")?"#":"")+SL.color.Color.rgb2hex(rgb[0],rgb[1],rgb[2]);this.field.value=this.lastValue;if(this.cb.changed){this.cb.changed(this,this.field.value)
}this.sendAsyncUpdate()}this.updateInputColor()},onBodyClicked:function(e){if(this.shown){var offset=this.e.cumulativeOffset();var x=e.pageX;var left=offset.left;var w=this.e.offsetWidth;var y=e.pageY;
var top=offset.top;var h=this.e.offsetHeight;if(x>left&&x<left+w&&y>top&&y<top+h){return}var offset=this.field.cumulativeOffset();var x=e.pageX;var left=offset.left;var w=this.field.offsetWidth;var y=e.pageY;
var top=offset.top;var h=this.field.offsetHeight;if(x>left&&x<left+w&&y>top&&y<top+h){return}this.hide()}},onSliderClick:function(event){var pos=event.pointerY();pos=pos-this.slider.cumulativeOffset().top-10;
this.thumbDnD.updatePos(undefined,pos);event.stop()},sendAsyncUpdate:function(){if(!this.config.get("update_url")){return}if(this.asyncUpdate){clearTimeout(this.asyncUpdate)}var url=this.config.get("update_url");
v=this.field.value;if(v.startsWith("#")){v=v.substring(1)}url=url.replace("@value@",v);this.asyncUpdate=setTimeout(function(){new Ajax.Request(url,{method:"get",onSuccess:function(o){eval(o.responseText);
this.asyncUpdate=undefined}.bind(this)})},250)}})})();(function(){SL.ui.DatePicker=Class.create(SL.ui.Panel,{init:function($super){this.config.setDefault("overlay",true);this.e.up().setStyle({position:"relative"});
this.input=$(this.config.get("input_id"));$super()},setDateString:function(a){this.input.value=a;this.hide()}})})();
