
        function YHCarousel (mover, thumbs, content, height, leftButton, rightButton, width, pages, thumbSpeed, contentSpeed, pageMode) {
			
			this.elements = content;
			this.height = height;
			var showH = new yhfx.Style($('carousel_content_align'), 'height', {duration:0});
			showH.custom (0, this.elements[0].offsetHeight);
			

            this.position = 0;
            this.width = width;
            this.pages = pages;
			this.thumbSpeed = thumbSpeed;
			this.contentSpeed = contentSpeed;
			this.pageMode = pageMode;		
			this.height = height;
			
            this.carousel = new yhfx.Style(mover, 'marginLeft', {duration:this.thumbSpeed});
			
			this.rightHeight = $(rightButton).scrollHeight;
			$(rightButton).addEvent('mouseover', function(){
				$(rightButton+'_idle').style.display='none';
				$(rightButton+'_hover').style.display='block';
				$(rightButton+'_down').style.display='none';
			});
			$(rightButton).addEvent('mouseout', function(){
				$(rightButton+'_idle').style.display='block';
				$(rightButton+'_hover').style.display='none';
				$(rightButton+'_down').style.display='none';
			});
			$(rightButton).addEvent('mousedown', function(){
				$(rightButton+'_idle').style.display='none';
				$(rightButton+'_hover').style.display='none';
				$(rightButton+'_down').style.display='block';
			});
			$(rightButton).addEvent('mouseup', function(){
				g.moveRight();
				$(rightButton+'_idle').style.display='none';
				$(rightButton+'_down').style.display='none';
				$(rightButton+'_hover').style.display='block';
			});
			
			this.leftHeight = $(leftButton).scrollHeight;
			$(leftButton).addEvent('mouseover', function(){
				$(leftButton+'_idle').style.display='none';
				$(leftButton+'_hover').style.display='block';
				$(leftButton+'_down').style.display='none';
			});
			$(leftButton).addEvent('mouseout', function(){
				$(leftButton+'_idle').style.display='block';
				$(leftButton+'_hover').style.display='none';
				$(leftButton+'_down').style.display='none';
			});
			$(leftButton).addEvent('mousedown', function(){
				$(leftButton+'_idle').style.display='none';
				$(leftButton+'_hover').style.display='none';
				$(leftButton+'_down').style.display='block';
			});
			$(leftButton).addEvent('mouseup', function(){
				g.moveLeft();
				$(leftButton+'_idle').style.display='none';
				$(leftButton+'_down').style.display='none';
				$(leftButton+'_hover').style.display='block';
			});
			
			var hideH;
			this.elements.each(function(el, i){
				if (i != 0) {
					var hideO = new yhfx.Style(el, 'opacity', {duration:0});
					hideO.custom (0, 0);
					//el.style.opacity = 0;
					$(el).style.height = 0;
					//el.style.overflow = 'auto';
				}
			}, this);
			i=0;
            thumbs.each(function(thumb, i) {
                $(thumb).addEvent('click', function(){this.showThisHideOpen(i)}.bind(this));
           }, this);
        }

		
		YHCarousel.prototype.leftButtonHover = function (button) {
			$(button).style.height = 0;
			$(button+'_hover').style.height = $(button+'_hover').scrollHeight;
			$(button+'_down').style.height = 0;
		}
        

        YHCarousel.prototype.moveLeft = function () {
            if (this.position == 0) {
                return;
			}
            oldM = this.position * this.width * -1;
            this.position = this.position - 1;
            newM = this.position * this.width * -1;
            this.carousel.custom(oldM, newM);
        }
        

        YHCarousel.prototype.moveRight = function () {
            if (this.position >= this.pages-1) {
                return;
			}
            oldM = this.position * this.width * -1;
            this.position = this.position + 1;
            newM = this.position * this.width * -1;
            this.carousel.custom(oldM, newM);
        }
        

        YHCarousel.prototype.showThisHideOpen = function(iToShow) {
            if (iToShow != this.previousClick){
                this.previousClick = iToShow;
                var objObjs = {};
                var madeInactive = false;
				var elToShow = '';
				var elToHide = '';
				var showHeight = this.height;
                this.elements.each(function(el, i){
                    if (i != iToShow) {
						if ($(el).offsetHeight > 0) {
							elToHide = $(this.elements[i]);
						}
                    } else {
						elToShow = $(this.elements[i]);
                    }
                }, this);
				if (elToHide == '') {
					if (iToShow == 0)
						return;
					else
						elToHide = $(this.elements[0]);
				}
				
				var showO = new yhfx.Style(elToShow, 'opacity', {duration:this.contentSpeed, onComplete: function(){
				}});
				
				var changeH = new yhfx.Style($('carousel_content_align'), 'height', {duration:this.contentSpeed, onComplete: function(){
					showO.custom(0, 1);
				}});
				
				var showH = new yhfx.Style(elToShow, 'height', {duration:0});

				var hideO = new yhfx.Style(elToHide, 'opacity', {duration:this.contentSpeed, onComplete: function(){
					if (showHeight > 0) {
						elToShow.style.height = showHeight + 'px';
					} else {
						elToShow.style.height = elToShow.scrollHeight + 'px';
					}
					
					changeH.custom(elToHide.offsetHeight, elToShow.offsetHeight);
					elToHide.style.height = 0;
				}});
				
				//elToShow.opacity = 0;
				hideO.custom (1, 0);
            }
		}












