
var carousel;
(function() {
    var Event = YAHOO.util.Event,
        Dom   = YAHOO.util.Dom,
        lang  = YAHOO.lang,
        slider, 
        bg="slider-bg", thumb="slider-thumb"

    var topConstraint = 0;

   
    var bottomConstraint = 560;

    var scaleFactor = .1;

   
 

    Event.onDOMReady(function() {

        slider = YAHOO.widget.Slider.getHorizSlider(bg, 
                         thumb, topConstraint, bottomConstraint);

        slider.getRealValue = function() {
			


	        if 	((this.getValue() > 24) && (this.getValue() <= 130)) {
	            
	        	//slider.setValue(139);
				return 2;
	        }
  			if 	((this.getValue() > 130) && (this.getValue() <= 206)) {
	            
	        	//slider.setValue(139);
				return 3;
	        }
			if 	((this.getValue() > 206) && (this.getValue() <= 252)) {

				if (this.getValue() < 230) {
					return 4;
        		} else     
				{
					return 5;
        		}
				
	        }
			if 	((this.getValue() > 252) && (this.getValue() <= 288)) {

				if (this.getValue() < 266) {
					return 6;
        		} else     
				{
					return 7;
        		}
				
	        }
			if 	((this.getValue() > 288) && (this.getValue() <= 320)) {

				if (this.getValue() < 295) {
					return 8;
        		} else     
				{
					return 9;
        		}
				
	        }
			if ((this.getValue() > 320) && (this.getValue() <= 348)) {
		            
		        	//slider.setValue(139);
					return 10;
		    }
			if 	((this.getValue() > 348) && (this.getValue() <= 381)) {
	            
	        	//slider.setValue(139);
				return 11;
	        }
			if 	((this.getValue() > 381) && (this.getValue() <= 467)) {

				if (this.getValue() < 395) {
					return 12;
        		} else if  (this.getValue() < 420) {    
				
					return 13;
        		} else {
					return 14;
        		}
				
	        }
			if 	((this.getValue() > 467) && (this.getValue() <= 522)) {
				return 15;
			} 
			if 	((this.getValue() > 522) && (this.getValue() <= 560)) {
				if (this.getValue() < 545) {
					return 16;
        		} else {
        			return 17;
        		}
            	
			}
	        
            return Math.round(this.getValue() * scaleFactor);
        }

        slider.subscribe("change", function(offsetFromStart) {


            // use the scale factor to convert the pixel offset into a real
            // value
            var actualValue = slider.getRealValue();
			carousel.scrollTo(actualValue, false);
            // update the text box with the actual value
          //  fld.value = actualValue;
		
            // Update the title attribute on the background.  This helps assistive
            // technology to communicate the state change
            Dom.get(bg).title = "";

        });

       
    });
})();









    (function () {
               YAHOO.util.Event.onDOMReady(function (ev) {
             carousel    = new YAHOO.widget.Carousel("gallery", {
                        animation: { speed: 0.5 },
                        numVisible: 1,
                        currentPage: 1,
                        isCircular: true

                });
                        
            carousel.render(); 
    
            carousel.show();  	
            
        });
      
    })();
