/*MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006-2007 Valerio Proietti, <http://mad4milk.net>, MIT Style License.||Clientcide Copyright (c) 2006-2008, http://www.clientcide.com/wiki/cnet-libraries#license*/

var Clientcide={version:'775',setAssetLocation:function(baseHref){if(window.StickyWin&&StickyWin.ui){StickyWin.UI.refactor({options:{baseHref:baseHref+'/stickyWinHTML/'}});if(StickyWin.alert){var CGFsimpleErrorPopup=StickyWin.alert.bind(window);StickyWin.alert=function(msghdr,msg,base){return CGFsimpleErrorPopup(msghdr,msg,base||baseHref+"/simple.error.popup")}}}if(window.TagMaker){TagMaker=TagMaker.refactor({options:{baseHref:baseHref+'/tips/'}})}if(window.ProductPicker){ProductPicker.refactor({options:{baseHref:baseHref+'/Picker'}})}if(window.Autocompleter){var AcClientcide={options:{baseHref:baseHref+'/autocompleter/'}};Autocompleter.Base.refactor(AcClientcide);if(Autocompleter.Ajax){["Base","Xhtml","Json"].each(function(c){if(Autocompleter.Ajax[c])Autocompleter.Ajax[c].refactor(AcClientcide)})}if(Autocompleter.Local)Autocompleter.Local.refactor(AcClientcide);if(Autocompleter.JsonP)Autocompleter.JsonP.refactor(AcClientcide)}if(window.Lightbox){Lightbox.refactor({options:{assetBaseUrl:baseHref+'/slimbox/'}})}if(window.Waiter){Waiter.refactor({options:{baseHref:baseHref+'/waiter/'}})}},preLoadCss:function(){if(window.DatePicker)new DatePicker();if(window.ProductPicker)new ProductPicker();if(window.TagMaker)new TagMaker();if(window.StickyWin&&StickyWin.ui)StickyWin.ui();if(window.StickyWin&&StickyWin.pointy)StickyWin.pointy();Clientcide.preloaded=true;return true},preloaded:false};(function(){if(!window.addEvent)return;var preload=function(){if(window.dbug)dbug.log('preloading clientcide css');if(!Clientcide.preloaded)Clientcide.preLoadCss()};window.addEvent('domready',preload);window.addEvent('load',preload)})();setCNETAssetBaseHref=Clientcide.setAssetLocation;var dbug={logged:[],timers:{},firebug:false,enabled:false,log:function(){dbug.logged.push(arguments)},nolog:function(msg){dbug.logged.push(arguments)},time:function(name){dbug.timers[name]=new Date().getTime()},timeEnd:function(name){if(dbug.timers[name]){var end=new Date().getTime()-dbug.timers[name];dbug.timers[name]=false;dbug.log('%s: %s',name,end)}else dbug.log('no such timer: %s',name)},enable:function(silent){if(dbug.firebug){try{dbug.enabled=true;dbug.log=function(){(console.debug||console.log).apply(console,arguments)};dbug.time=function(){console.time.apply(console,arguments)};dbug.timeEnd=function(){console.timeEnd.apply(console,arguments)};if(!silent)dbug.log('enabling dbug');for(var i=0;i<dbug.logged.length;i++){dbug.log.apply(console,dbug.logged[i])}dbug.logged=[]}catch(e){dbug.enable.delay(400)}}},disable:function(){if(dbug.firebug)dbug.enabled=false;dbug.log=dbug.nolog;dbug.time=function(){};dbug.timeEnd=function(){}},cookie:function(set){var value=document.cookie.match('(?:^|;)\\s*jsdebug=([^;]*)');var debugCookie=value?unescape(value[1]):false;if((!$defined(set)&&debugCookie!='true')||($defined(set)&&set)){dbug.enable();dbug.log('setting debugging cookie');var date=new Date();date.setTime(date.getTime()+(24*60*60*1000));document.cookie='jsdebug=true;expires='+date.toGMTString()+';path=/;'}else dbug.disableCookie()},disableCookie:function(){dbug.log('disabling debugging cookie');document.cookie='jsdebug=false;path=/;'}};(function(){var fb=typeof console!="undefined";var debugMethods=['debug','info','warn','error','assert','dir','dirxml'];var otherMethods=['trace','group','groupEnd','profile','profileEnd','count'];function set(methodList,defaultFunction){for(var i=0;i<methodList.length;i++){dbug[methodList[i]]=(fb&&console[methodList[i]])?console[methodList[i]]:defaultFunction}};set(debugMethods,dbug.log);set(otherMethods,function(){})})();if(typeof console!="undefined"&&console.warn){dbug.firebug=true;var value=document.cookie.match('(?:^|;)\\s*jsdebug=([^;]*)');var debugCookie=value?unescape(value[1]):false;if(window.location.href.indexOf("jsdebug=true")>0||debugCookie=='true')dbug.enable();if(debugCookie=='true')dbug.log('debugging cookie enabled');if(window.location.href.indexOf("jsdebugCookie=true")>0){dbug.cookie();if(!dbug.enabled)dbug.enable()}if(window.location.href.indexOf("jsdebugCookie=false")>0)dbug.disableCookie()}Element.implement({isVisible:function(){return this.getStyle('display')!='none'},toggle:function(){return this[this.isVisible()?'hide':'show']()},hide:function(){var d;try{if('none'!=this.getStyle('display'))d=this.getStyle('display')}catch(e){}this.store('originalDisplay',d||'block');this.setStyle('display','none');return this},show:function(display){original=this.retrieve('originalDisplay')?this.retrieve('originalDisplay'):this.get('originalDisplay');this.setStyle('display',(display||original||'block'));return this},swapClass:function(remove,add){return this.removeClass(remove).addClass(add)},fxOpacityOk:function(){return!Browser.Engine.trident4}});var SimpleCarousel=new Class({Implements:[Options,Events],options:{slideInterval:4000,transitionDuration:700,startIndex:0,buttonOnClass:"selected",buttonOffClass:"off",rotateAction:"none",rotateActionDuration:100,autoplay:true},initialize:function(container,slides,buttons,options){this.container=$(container);var instance=this.container.retrieve('SimpleCarouselInstance');if(instance)return instance;this.container.store('SimpleCarouselInstance',this);this.setOptions(options);this.container.addClass('hasCarousel');this.slides=$$(slides);this.buttons=$$(buttons);this.createFx();this.showSlide(this.options.startIndex);if(this.options.autoplay)this.autoplay();if(this.options.rotateAction!='none')this.setupAction(this.options.rotateAction);return this},toElement:function(){return this.container},setupAction:function(action){this.buttons.each(function(el,idx){$(el).addEvent(action,function(){this.slideFx.setOptions(this.slideFx.options,{duration:this.options.rotateActionDuration});if(this.currentSlide!=idx)this.showSlide(idx);this.stop()}.bind(this))},this)},createFx:function(){if(!this.slideFx)this.slideFx=new Fx.Elements(this.slides,{duration:this.options.transitionDuration});this.slides.each(function(slide){slide.setStyle('opacity',0)})},showSlide:function(slideIndex){var action={};this.slides.each(function(slide,index){if(index==slideIndex&&index!=this.currentSlide){$(this.buttons[index]).swapClass(this.options.buttonOffClass,this.options.buttonOnClass);action[index.toString()]={opacity:1}}else{$(this.buttons[index]).swapClass(this.options.buttonOnClass,this.options.buttonOffClass);action[index.toString()]={opacity:0}}},this);this.fireEvent('onShowSlide',slideIndex);this.currentSlide=slideIndex;this.slideFx.start(action);return this},autoplay:function(){this.slideshowInt=this.rotate.periodical(this.options.slideInterval,this);this.fireEvent('onAutoPlay');return this},stop:function(){$clear(this.slideshowInt);this.fireEvent('onStop');return this},rotate:function(){current=this.currentSlide;next=(current+1>=this.slides.length)?0:current+1;this.showSlide(next);this.fireEvent('onRotate',next);return this}});