Type.registerNamespace("Eviivo");Type.registerNamespace("Eviivo.InstantWeb");Eviivo.InstantWeb.ImageCarousel=function Eviivo$InstantWeb$ImageCarousel(galleryID,imagesID,thumbsID,previousID,nextID){if(ImageCarousel!==null){return;} var e=Function._validateParams(arguments,[{name:"galleryID",type:String},{name:"imagesID",type:String},{name:"thumbsID",type:String},{name:"previousID",type:String},{name:"nextID",type:String}]);if(e)throw e;Eviivo.InstantWeb.ImageCarousel.initializeBase(this);this._delta=0;this._images_displayed=1;this._maxIndex=0;this._index=0;this._images=[];this._galleryElement=$get(galleryID);this._imagesElement=$get(imagesID);this._thumbsElement=$get(thumbsID);this._previousElement=$get(previousID);this._nextElement=$get(nextID);this._previewHandler=null;this._scrollAnimation=null;if(this._galleryElement&&this._imagesElement&&this._thumbsElement&&this._previousElement&&this._nextElement){this.initialize();} else{throw e;}};Eviivo.InstantWeb.ImageCarousel.prototype={initialize:function Eviivo$InstantWeb$ImageCarousel$initialize(){this._previewHandler=Function.createDelegate(this,this.showPreviewHandler);var imageElements=this._imagesElement.getElementsByTagName("img");for(var i=0;i<imageElements.length;i++){var element=imageElements[i];if(this._images.length==0){this.showPreview(element);} this._images.push(element);$addHandler(element,'click',this._previewHandler);} if(this._images.length==0){this._galleryElement.style.display='none';return;} else{this._galleryElement.removeAttribute("class");} if(Sys.Browser.agent==Sys.Browser.InternetExplorer&&Sys.Browser.version<8){this._thumbsElement.style.position='relative';} this._delta=this._images[0].parentNode.offsetWidth;this._imagesElement.style.width=(this._images.length*this._delta)+'px';this._imagesElement.style.left='0px';this._maxIndex=Math.round(this._images.length/this._images_displayed)-1;this._index=0;this._scrollAnimation=new AjaxControlToolkit.Animation.LengthAnimation(this._imagesElement,0.5,30,"style","left",null,null,"px");this.visibility();$addHandlers(this._previousElement,{"click":this.move},this);$addHandlers(this._nextElement,{"click":this.move},this);},dispose:function Eviivo$InstantWeb$ImageCarousel$dispose(){if(this._images){for(var i=0;i<this._images.length;i++){$removeHandler(this._images[i],'click',this._clickHandler);}} $clearHandlers(this._previousElement);$clearHandlers(this._nextElement);this._delta=null;this._images_displayed=null;this._maxIndex=null;this._index=null;this._images=null;this._previewHandler=null;this._imagesElement=null;this._thumbsElement=null;this._previousElement=null;this._nextElement=null;if(this._scrollAnimation){this._scrollAnimation.dispose();} this._scrollAnimation=null;},showPreviewHandler:function Eviivo$InstantWeb$ImageCarousel$showPreviewHandler(e){this.showPreview(e.target);},showPreview:function Eviivo$InstantWeb$ImageCarousel$showPreview(e){},visibility:function Eviivo$InstantWeb$ImageCarousel$visibility(){if(this._maxIndex==0){this._galleryElement.className='first last';} else if(this._index==0){this._galleryElement.className='first';} else if(this._index==this._maxIndex){this._galleryElement.className='last';} else{this._galleryElement.className='';}},move:function Eviivo$InstantWeb$ImageCarousel$move(e){var obj=e.target;var oldIndex=this._index;this._index+=(obj.id==this._nextElement.id)?1:-1;this._scrollAnimation.set_startValue(parseInt(oldIndex*-this._delta));this._scrollAnimation.set_endValue(parseInt(this._index*-this._delta));this._scrollAnimation.play();this.visibility();}};Eviivo.InstantWeb.ImageCarousel.registerClass('Eviivo.InstantWeb.ImageCarousel',null,Sys.IDisposable);var ImageCarousel=null;Sys.Application.add_load(function(){ImageCarousel=new Eviivo.InstantWeb.ImageCarousel("gallery","images","thumbs","previous","next");});if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
