var vSAutoScroll={};vSAutoScrollListeners=new Array;vSAutoScroll=new Class({options:{delay:100,offsetTop:0,relative:false,transition:Fx.Transitions.Expo.easeOut},initialize:function(container,options){this.container=$(container);this.setOptions(options);this.container.updateOffsets(this.options.relative);this.xfx=new Fx.Tween(this.container,{property:"top",duration:this.options.delay,transition:this.options.transition});vSAutoScrollListeners[this.container.id]=this.onScroll.bind(this,this);window.addEvent("scroll",vSAutoScrollListeners[this.container.id]);this.onScroll();return this;},onScroll:function(){this.xfx.cancel();relative=this.options.relative||false;var offY=this.container.offY;var e=this.container.getPosition();var p=(relative)?this.container.getParent().getPosition():null;var st=Window.getScrollTop()+this.options.offsetTop;var sl=Window.getScrollLeft();this.xfx.start(((relative)?(e.y-p.y):e.y),((relative)?((st>(p.y+offY))?(st-p.y):offY):(((offY+st)<st)?st:(offY+st))));}});vSAutoScroll.implement(new Options,new Events);Element.implement({autoScrollOn:function(options){return new vSAutoScroll(this,options);},autoScrollOff:function(){window.removeEvent("scroll",vSAutoScrollListeners[this.id]);},updateOffsets:function(relative){relative=relative||false;var e=this.getPosition();var p=(relative)?this.getParent().getPosition():null;var st=(relative)?0:((Browser.Engine.trident4)?Window.getScrollTop():0);var sl=(relative)?0:Window.getScrollLeft();var nx=(relative)?(e.x-p.x):(e.x+sl);var ny=(relative)?(e.y-p.y):(e.y-st);this.offX=(nx<0)?0:nx;this.offY=(ny<0)?0:ny;}});var Chooser=new Class({options:{container:"chooser",nav:"chooser_nav",selectedClass:"active",sectionElement:"div.chooser_section",linkElement:"a",startTab:0},initialize:function(options){this.setOptions(options);this.container=$(this.options.container);this.nav=$(this.options.nav);this.sections=this.container.getElements(this.options.sectionElement);this.links=this.nav.getElements(this.options.linkElement);var location=new String(window.location);var tabName=null;if(location.contains("#")){tabName=location.split("#")[1];}var clinkIdx=0;this.links.each(function(clink){clink.addEvent("click",this.swap.bindWithEvent(this,clink));clinkName=clink.get("href").split("#")[1];if(clinkName==tabName){this.options.startTab=clinkIdx;}clinkIdx=clinkIdx+1;},this);this.sections.each(function(section){section.set("tween",{wait:false,duration:100});section.fade("hide");},this);this._show(this.links[this.options.startTab]);},swap:function(e,newLink){newLink.blur();this._swap(newLink);},_swap:function(newLink){this.links.each(function(clink){clink.removeClass(this.options.selectedClass);},this);newLink.addClass(this.options.selectedClass);target=this._getTarget(newLink);this.sections.each(function(section){section.fade("hide");},this);$(target).fade("in");},_show:function(newLink){newLink.addClass(this.options.selectedClass);target=this._getTarget(newLink);$(target).fade("show");},_getTarget:function(item){href=item.getProperty("href");return href.substr(1,href.length);}});Chooser.implement(new Options,new Events);var Notice=new Class({Implements:[Events,Options],options:{scope:"Page",effect:"slide",duration:250,delay:5000,fadeIn:1},initialize:function(container,options){this.setOptions(options);this.container=$(container);this.msg=this.container.getElement("div.msg");this.text=this.container.getElement("div.message");this.dismiss=this.container.getElement("a.dismiss");this.timer=null;this.slider=null;if(this.options.scope=="Page"){this.container.autoScrollOn();}this.container.setStyle("display","block");if(this.options.effect=="fade"){this.msg.set("tween",{duration:this.options.duration,wait:false});this.msg.fade("hide");}else{this.slider=new Fx.Slide(this.msg,{duration:this.options.duration,wait:false});this.slider.hide();}if(this.options.delay){this.msg.addEvent("mouseenter",this._show.bind(this));this.msg.addEvent("mouseleave",this.hide.bind(this));}if(this.dismiss){this.dismiss.addEvent("click",this._dismiss.bind(this));}return this;},onShow:function(){},onHide:function(){},show:function(msg,type,delay){this.text.set("html",msg);this.msg.set("class","msg "+((type)?type:"success"));this.options.delay=(delay)?delay:this.options.delay;this._show();this.hide();},hide:function(){if(this.options.delay){this.timer=this._hide.delay(this.options.delay,this);}},_show:function(){this.timer=$clear(this.timer);if(this.options.effect=="slide"){this.msg.fade("show");this.slider.slideIn();}else{this.msg.fade(this.options.fadeIn);}this.onShow();},_hide:function(){if(this.options.effect=="slide"){this.slider.slideOut();}else{this.msg.fade("out");}this.onHide();},_dismiss:function(){this.timer=$clear(this.timer);this._hide();}});ButtonReplacement=new Class({options:{element:"button",IEOnly:true},initialize:function(options){this.setOptions(options);if(Browser.Engine.trident||!this.options.IEOnly){var buttons=$$(this.options.element);buttons.each(function(button){if(!button.hasClass("span-added")&&!button.hasClass("tool")){var buttonHTML=button.get("html");var buttonSpan=new Element("span");buttonSpan.set("html",buttonHTML);button.empty();buttonSpan.inject(button);button.addClass("span-added");}});}}});ButtonReplacement.implement(new Options,new Events);