var Observer=new Class({Implements:[Options,Events],options:{periodical:false,delay:1000},initialize:function(b,c,a){this.setOptions(a);this.addEvent("onFired",c);this.element=$(b)||$$(b);this.value=this.element.get("value");if(this.options.periodical){this.timer=this.changed.periodical(this.options.periodical,this)}else{this.element.addEvent("keyup",this.changed.bind(this))}},changed:function(){var a=this.element.get("value");if($equals(this.value,a)){return}this.clear();this.value=a;this.timeout=this.onFired.delay(this.options.delay,this)},setValue:function(a){this.value=a;this.element.set("value",a);return this.clear()},onFired:function(){this.fireEvent("onFired",[this.value,this.element])},clear:function(){$clear(this.timeout||null);return this}});var $equals=function(b,a){return(b==a||JSON.encode(b)==JSON.encode(a))};var Autocompleter={};Autocompleter.Base=new Class({options:{minLength:1,markQuery:true,width:"inherit",maxChoices:10,injectChoice:null,customChoices:null,className:"autocompleter-choices",zIndex:42,delay:400,observerOptions:{},fxOptions:{},onOver:$empty,onSelect:$empty,onSelection:$empty,onShow:$empty,onHide:$empty,onBlur:$empty,onFocus:$empty,autoSubmit:false,overflow:false,overflowMargin:25,selectFirst:false,filter:null,filterCase:false,filterSingle:false,filterSubset:true,forceSelect:false,selectMode:true,choicesMatch:null,multiple:false,separator:", ",separatorSplit:/\s*[,;]\s*/,autoTrim:true,allowDupes:false,cache:true,relative:true},initialize:function(a,b){this.element=$(a);this.setOptions(b);this.build();this.observer=new Observer(this.element,this.prefetch.bind(this),$merge({delay:this.options.delay},this.options.observerOptions));this.queryValue=null;if(this.options.filter){this.filter=this.options.filter.bind(this)}var c=this.options.selectMode;this.typeAhead=(c=="type-ahead");this.selectMode=(c===true)?"selection":c;this.cached=[]},build:function(){if($(this.options.customChoices)){this.choices=this.options.customChoices}else{this.choices=new Element("ul",{"class":this.options.className,styles:{zIndex:this.options.zIndex}}).inject(document.body);this.relative=false;if(this.options.relative){this.choices.inject(this.element,"after");this.relative=this.element.getOffsetParent()}this.fix=new OverlayFix(this.choices)}if(!this.options.separator.test(this.options.separatorSplit)){this.options.separatorSplit=this.options.separator}this.fx=(!this.options.fxOptions)?null:new Fx.Tween(this.choices,$merge({property:"opacity",link:"cancel",duration:200},this.options.fxOptions)).addEvent("onStart",Chain.prototype.clearChain).set(0);this.element.setProperty("autocomplete","off").addEvent((Browser.Engine.trident||Browser.Engine.webkit)?"keydown":"keypress",this.onCommand.bind(this)).addEvent("click",this.onCommand.bind(this,[false])).addEvent("focus",this.toggleFocus.create({bind:this,arguments:true,delay:100})).addEvent("blur",this.toggleFocus.create({bind:this,arguments:false,delay:100}))},destroy:function(){if(this.fix){this.fix.destroy()}this.choices=this.selected=this.choices.destroy()},toggleFocus:function(a){this.focussed=a;if(!a){this.hideChoices(true)}this.fireEvent((a)?"onFocus":"onBlur",[this.element])},onCommand:function(b){if(!b&&this.focussed){return this.prefetch()}if(b&&b.key&&!b.shift){switch(b.key){case"enter":if(this.element.value!=this.opted){return true}if(this.selected&&this.visible){this.choiceSelect(this.selected);return !!(this.options.autoSubmit)}break;case"up":case"down":if(!this.prefetch()&&this.queryValue!==null){var a=(b.key=="up");this.choiceOver((this.selected||this.choices)[(this.selected)?((a)?"getPrevious":"getNext"):((a)?"getLast":"getFirst")](this.options.choicesMatch),true)}return false;case"esc":case"tab":this.hideChoices(true);break}}return true},setSelection:function(j){var g=this.selected.inputValue,h=g;var c=this.queryValue.length,e=g.length;if(g.substr(0,c).toLowerCase()!=this.queryValue.toLowerCase()){c=0}if(this.options.multiple){var f=this.options.separatorSplit;h=this.element.value;c+=this.queryIndex;e+=this.queryIndex;var d=h.substr(this.queryIndex).split(f,1)[0];h=h.substr(0,this.queryIndex)+g+h.substr(this.queryIndex+d.length);if(j){var b=/[^\s,]+/;var a=h.split(this.options.separatorSplit).filter(b.test,b);if(!this.options.allowDupes){a=[].combine(a)}var k=this.options.separator;h=a.join(k)+k;e=h.length}}this.observer.setValue(h);this.opted=h;if(j||this.selectMode=="pick"){c=e}this.element.selectRange(c,e);this.fireEvent("onSelection",[this.element,this.selected,h,g])},showChoices:function(){var d=this.options.choicesMatch,g=this.choices.getFirst(d);this.selected=this.selectedValue=null;if(this.fix){var h=this.element.getCoordinates(this.relative),e=this.options.width||"auto";this.choices.setStyles({left:h.left,top:h.bottom,width:(e===true||e=="inherit")?h.width:e})}if(!g){return}if(!this.visible){this.visible=true;this.choices.setStyle("display","");if(this.fx){this.fx.start(1)}this.fireEvent("onShow",[this.element,this.choices])}if(this.options.selectFirst||this.typeAhead||g.inputValue==this.queryValue){this.choiceOver(g,this.typeAhead)}var c=this.choices.getChildren(d),a=this.options.maxChoices;var b={overflowY:"hidden",height:""};this.overflown=false;if(c.length>a){var f=c[a-1];b.overflowY="scroll";b.height=f.getCoordinates(this.choices).bottom;this.overflown=true}this.choices.setStyles(b);this.fix.show()},hideChoices:function(a){if(a){var c=this.element.value;if(this.options.forceSelect){c=this.opted}if(this.options.autoTrim){c=c.split(this.options.separatorSplit).filter($arguments(0)).join(this.options.separator)}this.observer.setValue(c)}if(!this.visible){return}this.visible=false;this.observer.clear();var b=function(){this.choices.setStyle("display","none");this.fix.hide()}.bind(this);if(this.fx){this.fx.start(0).chain(b)}else{b()}this.fireEvent("onHide",[this.element,this.choices])},prefetch:function(){var f=this.element.value,e=f;if(this.options.multiple){var b=this.options.separatorSplit;var c=f.split(b);var a=this.element.getCaretPosition();var g=f.substr(0,a).split(b);var d=g.length-1;a-=g[d].length;e=c[d]}if(e.length<this.options.minLength){this.hideChoices()}else{if(e===this.queryValue||(this.visible&&e==this.selectedValue)){if(this.visible){return false}this.showChoices()}else{this.queryValue=e;this.queryIndex=a;if(!this.fetchCached()){this.query()}}}return true},fetchCached:function(){return false;if(!this.options.cache||!this.cached||!this.cached.length||this.cached.length>=this.options.maxChoices||this.queryValue){return false}this.update(this.filter(this.cached));return true},update:function(a){this.choices.empty();this.cached=a;if(!a||!a.length){this.hideChoices()}else{if(this.options.maxChoices<a.length&&!this.options.overflow){a.length=this.options.maxChoices}a.each(this.options.injectChoice||function(b){var c=new Element("li",{html:this.markQueryValue(b)});c.inputValue=b;this.addChoiceEvents(c).inject(this.choices)},this);this.showChoices()}},choiceOver:function(e,c){if(!e||e==this.selected){return}if(this.selected){this.selected.removeClass("autocompleter-selected")}this.selected=e.addClass("autocompleter-selected");this.fireEvent("onSelect",[this.element,this.selected,c]);if(!c){return}this.selectedValue=this.selected.inputValue;if(this.overflown){var b=this.selected.getCoordinates(this.choices),a=this.options.overflowMargin,g=this.choices.scrollTop,f=this.choices.offsetHeight,d=g+f;if(b.top-a<g&&g){this.choices.scrollTop=Math.max(b.top-a,0)}else{if(b.bottom+a>d){this.choices.scrollTop=Math.min(b.bottom-f+a,d)}}}if(this.selectMode){this.setSelection()}},choiceSelect:function(a){if(a){this.choiceOver(a)}this.setSelection(true);this.queryValue=false;this.hideChoices()},filter:function(b){var a=new RegExp(((this.options.filterSubset)?"":"^")+this.queryValue.escapeRegExp(),(this.options.filterCase)?"":"i");return(b||this.tokens).filter(function(c){return a.test(b||this.tokens)})},markQueryValue:function(a){return(!this.options.markQuery||!this.queryValue)?a:a.replace(new RegExp("("+((this.options.filterSubset)?"":"^")+this.queryValue.escapeRegExp()+")",((this.options.filterCase)?"":"i")+((this.options.filterSingle)?"":"g")),'<span class="autocompleter-queried">$1</span>')},addChoiceEvents:function(a){return a.addEvents({mouseover:this.choiceOver.bind(this,[a]),click:this.choiceSelect.bind(this,[a])})}});Autocompleter.Base.implement(new Events);Autocompleter.Base.implement(new Options);Autocompleter.Local=new Class({Extends:Autocompleter.Base,options:{minLength:0,delay:200},initialize:function(a,c,b){this.parent(a,b);this.tokens=c},query:function(){this.update(this.filter())}});Autocompleter.Ajax={};Autocompleter.Ajax.Base=new Class({Extends:Autocompleter.Base,options:{postVar:"value",postData:{},ajaxOptions:{},onRequest:$empty,onComplete:$empty},initialize:function(a,b){this.parent(a,b);var c=$(this.options.indicator);if(c){this.addEvents({onRequest:c.show.bind(c),onComplete:c.hide.bind(c)},true)}},query:function(){var a=$unlink(this.options.postData);a[this.options.postVar]=this.queryValue;this.fireEvent("onRequest",[this.element,this.request,a,this.queryValue]);this.request.send({data:a})},queryResponse:function(){this.fireEvent("onComplete",[this.element,this.request,this.response])}});Autocompleter.Ajax.Json=new Class({Extends:Autocompleter.Ajax.Base,initialize:function(c,a,b){this.parent(c,b);this.request=new Request.JSON($merge({url:a,link:"cancel"},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this))},queryResponse:function(a){this.parent();this.update(a)}});Autocompleter.Ajax.Xhtml=new Class({Extends:Autocompleter.Ajax.Base,initialize:function(c,a,b){this.parent(c,b);this.request=new Request.HTML($merge({url:a,link:"cancel",update:this.choices},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this))},queryResponse:function(b,a){this.parent();if(!a||!a.length){this.hideChoices()}else{this.choices.getChildren(this.options.choicesMatch).each(this.options.injectChoice||function(c){var d=c.innerHTML;c.inputValue=d;this.addChoiceEvents(c.set("html",this.markQueryValue(d)))},this);this.showChoices()}}});var OverlayFix=new Class({initialize:function(a){if(Browser.Engine.trident){this.element=$(a);this.relative=this.element.getOffsetParent();this.fix=new Element("iframe",{frameborder:"0",scrolling:"no",src:"javascript:false;",styles:{position:"absolute",border:"none",display:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}}).inject(this.element,"after")}},show:function(){if(this.fix){var a=this.element.getCoordinates(this.relative);delete a.right;delete a.bottom;this.fix.setStyles($extend(a,{display:"",zIndex:(this.element.getStyle("zIndex")||1)-1}))}return this},hide:function(){if(this.fix){this.fix.setStyle("display","none")}return this},destroy:function(){this.fix=this.fix.destroy()}});Element.implement({getOffsetParent:function(){var a=this.getDocument().body;if(this==a){return null}if(!Browser.Engine.trident){return $(this.offsetParent)}var b=this;while((b=b.parentNode)){if(b==a||Element.getComputedStyle(b,"position")!="static"){return $(b)}}return null},getCaretPosition:function(){if(!Browser.Engine.trident){return this.selectionStart}this.focus();var a=document.selection.createRange();var b=this.createTextRange();a.setEndPoint("StartToStart",b);return a.text.length},selectRange:function(c,a){if(Browser.Engine.trident){var b=this.createTextRange();b.collapse(true);b.moveEnd("character",a);b.moveStart("character",c);b.select()}else{this.focus();this.setSelectionRange(c,a)}return this}});if(typeof(Cnc2)=="undefined"){Cnc2={version:"2010-07-11"}}Cnc2.OverlayFix=new Class({initialize:function(a){if(Browser.Engine.trident){this.element=$(a);this.relative=this.element.getOffsetParent();this.fix=new Element("iframe",{frameborder:"0",scrolling:"no",src:"javascript:false;",styles:{position:"absolute",border:"none",display:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}}).inject(this.element,"after")}},show:function(){if(this.fix){var a=this.element.getCoordinates(this.relative);delete a.right;delete a.bottom;this.fix.setStyles($extend(a,{display:"",zIndex:(this.element.getStyle("zIndex")||1)-1}))}return this},hide:function(){if(this.fix){this.fix.setStyle("display","none")}return this},morph:function(a){if(this.fix){this.fix.morph(a)}return this},destroy:function(){this.fix=this.fix.destroy()}});Cnc2.Dialog=new Class({Implements:[Events,Options,Chain],options:{mask:true,followScroll:true,styles:{},classes:[]},initialize:function(a,d,e,c){this.setOptions(c);this.element=$(a);if(this.options.mask){this.masker=$(document.body).get("mask",this.options)}var b=(this.options.mask)?this.masker.getZIndex():this.element.getParent().getStyle("z-index")||99;this.element.setStyle("z-index",b+1);this.resize=this.adjust.bind(this);this.scroll=this.follow.bind(this);this.element.store("dialog",this);this.fix=new Cnc2.OverlayFix(this.element);d.addEvent("click",this.show.bind(this));e.addEvent("click",this.hide.bind(this))},getCenterPosition:function(){var b=(window.getWidth()/2)-(this.element.getWidth()/2);var a=(window.getHeight()/2)-(this.element.getHeight()/2);b=(b<0)?0:b+window.getScroll().x;a=(a<0)?0:a+window.getScroll().y;return{left:b,top:a}},adjust:function(){if(this.element.getStyle("display")=="none"){this.element.setStyle("visibility","hidden").setStyle("display","block")}var b=this.getCenterPosition().left;var a=this.getCenterPosition().top;this.element.setStyle("position","absolute").setStyle("left",b).setStyle("top",a);this.fix.show()},follow:function(){var b=this.getCenterPosition().left;var a=this.getCenterPosition().top;this.element.morph({left:b,top:a});this.fix.morph({left:b,top:a})},show:function(){this.adjust();if(this.options.mask){this.masker.mask()}this.fix.show();this.element.setStyle("display","block").fade(1);window.addEvent("resize",this.resize);if(this.options.followScroll){window.addEvent("scroll",this.scroll)}},hide:function(){if(this.options.mask){this.masker.unmask()}this.element.fade(0).get("tween").chain(function(){this.element.setStyle("display","none");this.fix.hide()}.bind(this));window.removeEvent("resize",this.resize);if(this.options.followScroll){window.removeEvent("scroll",this.scroll)}}});Element.Properties.dialog={get:function(a){if(a||!this.retrieve("dialog")){this.set("dialog",trigger,closer,a)}return this.retrieve("dialog")},set:function(b,c,a){return this.store("dialog",new Cnc2.Dialog(this,b,c,a))}};Cnc2.Masker=new Class({Implements:[Events,Options,Chain],options:{styles:{opacity:0.6,position:"absolute",display:"none","z-index":99,"background-color":"#fff"},classes:[]},initialize:function(a,b){this.setOptions(b);this.element=$(a);this.cover=$(new Element("div")).addClass("mask");this.cover.setStyles(this.options.styles).setStyle("opacity",0);this.cover.injectInside(this.element);this.adjust();this.resize=this.adjust.bind(this);this.fix=new Cnc2.OverlayFix(this.cover);this.options.classes.each(function(c){this.cover.addClass(c)},this)},getZIndex:function(){return this.cover.getStyle("z-index")},adjust:function(){this.cover.setStyles(this.element.getCoordinates()).setStyle("height",this.element.getScrollSize().y)},mask:function(){this.cover.setStyle("display","block").fade(this.options.styles.opacity);this.fix.show();window.addEvent("resize",this.resize);window.addEvent("scroll",this.resize)},unmask:function(){this.cover.fade(0).get("tween").chain(function(){this.cover.setStyle("display","none");this.fix.hide()}.bind(this));window.removeEvent("resize",this.resize);window.removeEvent("scroll",this.resize)}});Element.Properties.mask={get:function(a){if(a||!this.retrieve("mask")){this.set("mask",a)}return this.retrieve("mask")},set:function(a){return this.store("mask",new Cnc2.Masker(this,a))}};Element.implement({mask:function(a){this.get("mask",a).mask();return this},unmask:function(a){this.get("mask",a).unmask();return this}});Cnc2.Rotator=new Class({Implements:[Chain,Events,Options],initialize:function(b,a,d,c){this.element=b;this.items=$splat(a);this.count=this.items.length;this.order=0;if(d.length==2){this.prevBtn=d[0];this.nextBtn=d[1]}else{if(d.length<2||(d.length>2&&this.controls.length!=this.count)){this.prevBtn=new Element("a").inject(this.element,"after");this.nextBtn=new Element("a").inject(this.element,"after")}else{this.controls=d}}this.setOptions(c);this.scroller=new Fx.Scroll(this.element,this.options);if(d.length>2&&this.controls.length==this.count){this.registerOrdinalRotator()}else{if(this.options.loop&&this.count>=3){this.registerLoopRotator()}else{this.registerRotator()}}if(this.options.timer){$$(this.element,this.prevBtn,this.nextBtn).addEvent("mouseenter",function(){$clear(this.timerId);this.timerId=null}.bind(this));$$(this.element,this.prevBtn,this.nextBtn).addEvent("mouseleave",function(){this.registerTimer()}.bind(this));this.registerTimer()}},registerTimer:function(){if(this.timerId!=null){return}this.timerId=(function(){this.nextBtn.fireEvent("click")}.bind(this)).periodical(this.options.timer)},registerOrdinalRotator:function(){for(ctrlIdx=0;ctrlIdx<this.count;ctrlIdx++){this.controls[ctrlIdx].addEvent("click",function(b,a){this.order=a;this.scroller.toElement(this.items[this.order]);this.nextBtn=this.controls[(this.order+1)%this.count]}.bindWithEvet(this,ctrlIdx))}},registerRotator:function(){this.prevBtn.addEvent("click",function(){this.order=(this.order-1+this.count)%this.count;this.scroller.toElement(this.items[this.order])}.bind(this));this.nextBtn.addEvent("click",function(){this.order=(this.order+1)%this.count;this.scroller.toElement(this.items[this.order])}.bind(this))},registerLoopRotator:function(){this.instantScroller=new Fx.Scroll(this.element,$merge(this.options,{duration:0}));this.fxOrder=0;this.instantScroller.toElement(this.items[1]).chain(function(){this.items[this.count-1].inject(this.items[0],"before")}.bind(this));this.prevBtn.addEvent("click",function(){if(this.fxOrder!=this.order){return}this.mover=this.items[(this.order-2+this.count)%this.count];var a=(this.order+1)%this.count;this.order=(this.order-1+this.count)%this.count;this.element.set("opacity",0.99);this.instantScroller.toElement(this.items[a]).chain(function(){this.mover.inject(this.items[this.order],"before");this.element.set("opacity",1);this.scroller.toElement(this.items[this.order]).chain(function(){this.fxOrder=this.order}.bind(this))}.bind(this))}.bind(this));this.nextBtn.addEvent("click",function(){if(this.fxOrder!=this.order){return}this.mover=this.items[(this.order-1+this.count)%this.count];var a=(this.order-1+this.count)%this.count;this.order=(this.order+1)%this.count;this.element.set("opacity",0.99);this.instantScroller.toElement(this.items[a]).chain(function(){this.mover.inject(this.mover.getParent());this.element.set("opacity",1);this.scroller.toElement(this.items[this.order]).chain(function(){this.fxOrder=this.order}.bind(this))}.bind(this))}.bind(this))}});Cnc2.Tabber=new Class({Implements:[Chain,Events,Options],options:{currentClass:"current",patchIe6Rollover:true},initialize:function(d,a,c){this.tabs=d;this.contents=a;this.setOptions(c);this.order=0;this.fxOrder=0;this.count=this.tabs.length;for(i=0;i<this.count;i++){if(this.tabs[i].hasClass(this.options.currentClass)){this.order=i;this.fxOrder=i}}if(Browser.Engine.trident4&&this.options.patchIe6Rollover){this.tabs.each(function(e){e.addEvent("mouseenter",function(){e.addClass(this.options.currentClass)}.bind(this));e.addEvent("mouseleave",function(f,g){if(g!=this.tabs[this.fxOrder]){g.removeClass(this.options.currentClass)}}.bindWithEvent(this,e))}.bind(this))}this.registerTabChanger();this.contents.hide();if(this.contents.every(function(e){if(e.hasClass(this.options.currentClass)){e.show();return false}return true},this)){this.contents[0].show()}if(this.options.timer){this.tabsBase=this.tabs[0].getParent();this.contentsBase=this.contents[0].getParent();$$(this.tabsBase,this.contentsBase).addEvent("mouseenter",function(){$clear(this.timerId);this.timerId=null}.bind(this));$$(this.tabsBase,this.contentsBase).addEvent("mouseleave",function(){this.registerTimer()}.bind(this));this.registerTimer()}if(this.options.autoResize){var b=this.contents[0].getDimensions();this.contentsBase=this.contents[0].getParent();this.contentsBase.setStyle("width",b.width).setStyle("height",b.height).setStyle("overflow","hidden")}},registerTimer:function(){if(this.timerId!=null){return}this.timerId=(function(){this.tabs[(this.order+1)%this.count].fireEvent("click")}.bind(this)).periodical(this.options.timer)},registerTabChanger:function(){for(tabIdx=0;tabIdx<this.count;tabIdx++){this.contents[tabIdx].set("tween",this.options);if(tabIdx!=this.order){this.contents[tabIdx].fade("hide")}this.tabs[tabIdx].addEvent("click",function(b,a){this.tabs.removeClass(this.options.currentClass);this.tabs[a].addClass(this.options.currentClass);if(this.order!=this.fxOrder){this.contents[this.fxOrder].get("tween").cancel();this.contents[this.fxOrder].fade("hide").hide().removeClass(this.options.currentClass)}this.fxOrder=a;this.contents[this.order].get("tween").cancel().clearChain().chain(function(){this.contents[this.order].removeClass(this.options.currentClass);this.contents[this.order].fade("hide").hide();this.contents[this.fxOrder].addClass(this.options.currentClass);this.contents[this.fxOrder].get("tween").chain(function(){this.order=this.fxOrder}.bind(this));this.contents[this.fxOrder].show().fade("in")}.bind(this));this.contents[this.order].fade("out")}.bindWithEvent(this,tabIdx))}}});Cnc2.FloatingSidebar=new Class({Implements:[Options,Events],options:{contentClass:"floating-sidebar-content",tabClass:"floating-sidebar-tab",relativeTo:document.body,position:"topLeft",edge:"topLeft",offset:{x:0,y:0},timeout:0,record:true,zIndex:999,foldFx:{duration:900,transition:Fx.Transitions.Quad.easeIn},unfoldFx:{duration:900,transition:Fx.Transitions.Expo.easeOut}},initialize:function(a,b){this.setOptions(b);this.floater=a;this.content=a.getElement("."+this.options.contentClass);this.tab=a.getElement("."+this.options.tabClass);if(!this.floater||!this.content||!this.tab){return}this.tabChild=this.tab.getChildren()[0]||this.tab;this.floater.inject(document.body,"bottom");this.folded=false;this.side=(this.options.position.toLowerCase().contains("right"))?"right":"left";$$(this.floater,this.content,this.tab).setStyle("z-index",this.options.zIndex).show();$$(this.content,this.tab).setStyles({"float":this.side,overflow:"hidden"});this.contentWidth=this.content.getDimensions().width;this.tabWidth=this.tab.getDimensions().width;this.floaterWidth=this.contentWidth+(this.tabWidth/2);$$(this.tab,this.tabChild).setStyle("position","relative");this.tab.setStyle("width",this.tabWidth/2).setStyle("cursor","pointer");this.floater.setStyle("width",this.floaterWidth);this.shim=new IframeShim(this.floater,{display:true});if(this.shim.shim){this.floater.setStyle("overflow","hidden");this.shim.shim.inject(this.floater,"top");this.shim.shim.setStyles({width:this.floaterWidth,height:this.floater.getSize().y,"z-index":-1})}this.position();this.followScroll();this._enable();this.cookie=(this.options.record)?new Hash.Cookie("ui"):null;this.id=this.content.get("id")||"universal";if(this.cookie&&this.cookie.get("floatingSidebar")&&this.cookie.get("floatingSidebar").contains(this.id)){this.fold()}else{if(this.options.timeout){this.firstFoldTimeout=(function(){this.fold()}.bind(this)).delay(this.options.timeout)}}},_enable:function(){window.addEvent("scroll",function(){this.followScroll()}.bind(this));window.addEvent("resize",function(){(function(){this.position();this.followScroll()}.bind(this)).delay(10)}.bind(this));this.tab.addEvent("click",function(){this.toggle()}.bind(this))},position:function(){var a=window.getSize().x;this.floater.position({relativeTo:this.options.relativeTo,position:this.options.position,edge:this.options.edge,offset:this.options.offset,ignoreScroll:true});if(this.side=="right"&&this.floater.getPosition().x>(a-this.floaterWidth)){var b=(this.folded)?a-(this.tabWidth/2):a-this.floaterWidth;this.floater.setStyle("left",b)}if(this.side=="left"&&this.floater.getPosition().x<0){this.floater.setStyle("left",0)}},followScroll:function(){var a=this.options.relativeTo.getPosition().y;this.floater.tween("top",a+this.options.offset.y+window.getScroll().y)},unfold:function(){if(!this.folded||this.folded=="ing"){return}this.folded="ing";this.floater.set("morph",this.options.unfoldFx);this.floater.morph({width:this.floaterWidth,left:(this.side=="right")?this.floater.getPosition().x-this.contentWidth:this.floater.getPosition().x});this.content.set("tween",this.options.unfoldFx);this.content.tween("width",this.contentWidth);this.tabChild.setStyle("left",0);if(this.cookie){var a=this.cookie.get("floatingSidebar")||$A([]);a.erase(this.id);this.cookie.set("floatingSidebar",a)}this.folded=false},fold:function(){if($defined(this.firstFoldTimeout)){clearTimeout(this.firstFoldTimeout)}if(this.folded||this.folded=="ing"){return}this.folded="ing";this.content.set("tween",this.options.foldFx);this.content.tween("width",0);this.floater.set("morph",this.options.foldFx);this.floater.get("morph").chain(function(){this.floater.setStyle("width",(this.tabWidth/2))}.bind(this));this.floater.morph({width:(this.tabWith/2),left:(this.side=="right")?this.floater.getPosition().x+this.contentWidth:this.floater.getPosition().x});this.tabChild.setStyle("left",-(this.tabWidth/2));if(this.cookie){var a=this.cookie.get("floatingSidebar")||$A([]);a.combine([this.id]);this.cookie.set("floatingSidebar",a)}this.folded=true},toggle:function(){if(this.folded){this.unfold()}else{this.fold()}}});Cnc2.FloatingAdvert=new Class({Implements:[Options,Events],options:{relSelector:null,position:"topLeft",edge:"topLeft",offset:{x:0,y:0},timeout:0},initialize:function(b,a){this.setOptions(a);this.advert=b;this.flicker=(this.options.timeout)?true:false;this.timeout=this.options.timeout||1000;if(this.options.relSelector){this.checkTimer=this.check.periodical(this.timeout,this);this.check()}},check:function(){if(document.getElement(this.options.relSelector)){$clear(this.checkTimer);this.renderTimer=this.render.periodical(this.timeout,this);this.render()}},render:function(){if(document.getElement(this.options.relSelector)){var b=document.getElement(this.options.relSelector);if(b.get("tag")=="input"&&b.get("type")=="text"){var a=b.retrieve("OverText",new OverText(b,{textOverride:this.advert.get("html"),poll:true,pollInterval:this.timeout}))}else{this.advert.position($merge(this.options,{relativeTo:b}));(this.flicker)?this.advert.toggle():this.advert.show()}}else{$clear(this.renderTimer);this.advert.hide();this.checkTimer=this.check.periodical(this.timeout,this)}}});Cnc2.Countdown=new Class({delay:0,Implements:[Options,Events],options:{timeProperty:"datetime",onComplete:$empty},initialize:function(a,b){this.setOptions(b);this.element=a;this.endTime=Date.parse(this.element.get(this.options.timeProperty));this.delay=Cnc2.Countdown.delay;if(!$type(this.endTime.valueOf())){return false}this.template=this.parseElement(this.element);if(this.template.length==0){return false}this.setDigits(["--","--","--","--"]);this.element.setStyle("visibility","visible");this.timer=this.count.periodical(1000,this)},setDigits:function(a){this.template.each(function(b){if(a.length>0){b.set("text",a.shift())}})},count:function(){var a=new Date().decrement("ms",this.delay);var c=a.diff(this.endTime,"second");if(c<0){$clear(this.timer);this.fireEvent("complete")}else{var b;if(this.template.has("day")){b=Math.floor(c/(3600*24));this.template.get("day").set("text",this.formatDigit(b,false))}if(this.template.has("hour")){b=Math.floor(c/3600);if(this.template.has("day")){b=b%24}this.template.get("hour").set("text",this.formatDigit(b))}if(this.template.has("min")){b=Math.floor(c/60);if(this.template.has("hour")){b=b%60}this.template.get("min").set("text",this.formatDigit(b))}if(this.template.has("sec")){b=Math.floor(c);if(this.template.has("min")){b=b%60}this.template.get("sec").set("text",this.formatDigit(b))}}},formatDigit:function(a,b){b=$type(b)=="boolean"?b:true;if(b){return a.toString().pad(2,"0","left")}else{return a.toString()}},parseElement:function(){var a=new Hash();$each(["day","hour","min","sec"],function(c){var b=this.element.getElement("."+c);if(b){a.set(c,b)}},this);return a}});Cnc2.Countdown.delay=0;Cnc2.Countdown.synchronize=function(a){Cnc2.Countdown.delay=$time()-a*1000};