/**
 * Custom button state handler for enabling/disabling button state. 
 * Called when the carousel has determined that the previous button
 * state should be changed.
 * Specified to the carousel as the configuration
 * parameter: prevButtonStateHandler
 **/
var handlePrevButtonState = function(type, args) {

    var enabling = args[0];
    var upImage = args[1];
    if(enabling) {
        upImage.src = "images/gore.gif";    
    } else {
        upImage.src = "images/gore1.gif";    
    }
    
};

/**
 * Custom button state handler for enabling/disabling button state. 
 * Called when the carousel has determined that the next button
 * state should be changed.
 * Specified to the carousel as the configuration
 * parameter: nextButtonStateHandler
 **/
var handleNextButtonState = function(type, args) {

    var enabling = args[0];
    var downImage = args[1];
    
    if(enabling) {
        downImage.src = "images/dole.gif";
    } else {
        downImage.src = "images/dole1.gif";
    }
    
};

var handlePrevButtonState2 = function(type, args) {

    var enabling = args[0];
    var leftImage = args[1];
    if(enabling) {
        leftImage.src = "images/mala70px_leva.gif";    
    } else {
        leftImage.src = "images/mala70px_leva1.gif";    
    }
    
};

/**
 * Custom button state handler for enabling/disabling button state. 
 * Called when the carousel has determined that the next button
 * state should be changed.
 * Specified to the carousel as the configuration
 * parameter: nextButtonStateHandler
 **/
var handleNextButtonState2 = function(type, args) {

    var enabling = args[0];
    var rightImage = args[1];
    
    if(enabling) {
        rightImage.src = "images/mala70px_desna.gif";
    } else {
        rightImage.src = "images/mala70px_desna1.gif";
    }
    
};

/**
 * You must create the carousel after the page is loaded since it is
 * dependent on an HTML element (in this case 'mycarousel'.) See the
 * HTML code below.
 **/
var carousel,carousel2; // for ease of debugging; globals generally not a good idea
var pageLoad = function() 
{
    carousel = new YAHOO.extension.Carousel("mycarousel", 
        {
            numVisible:        			5,
            animationSpeed:    			0.15,
            scrollInc:         			5,
            orientation:       			"vertical",     
            navMargin:         			0,
            prevElement:     			"up-arrow",
            nextElement:     			"down-arrow",
            size:              			10,
            prevButtonStateHandler:   handlePrevButtonState,
            nextButtonStateHandler:   handleNextButtonState
        }
		);
	
    carousel2 = new YAHOO.extension.Carousel("mycarousel2", 
        {
            numVisible:        			4,
            animationSpeed:    			0.15,
            scrollInc:         			4,
            navMargin:         			5,
            prevElement:     			"prev-arrow2",
            nextElement:     			"next-arrow2",
            size:              			sumOfPhotos,
            prevButtonStateHandler:   	handlePrevButtonState2,
            nextButtonStateHandler:   	handleNextButtonState2
        }        
    );		
};

YAHOO.util.Event.addListener(window, 'load', pageLoad);