/**
 * 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 leftImage = document.getElementById("prev-arrow");
	
    if(enabling) {
        leftImage.style.backgroundImage = "url(images/layout/arrow-prev.gif)";
		leftImage.style.color = "#003F6D";
    } else {
        leftImage.style.backgroundImage = "url(images/layout/arrow-prev-off.gif)";  
		leftImage.style.color = "#CCCCCC";  
    }
    
};

/**
 * 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 rightImage = document.getElementById("next-arrow");
	
    if(enabling) {
        rightImage.style.backgroundImage = "url(images/layout/arrow-next.gif)";
		rightImage.style.color = "#003F6D";
    } else {
        rightImage.style.backgroundImage = "url(images/layout/arrow-next-off.gif)";
		rightImage.style.color = "#CCCCCC";
    }
};


/**
 * 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; // for ease of debugging; globals generally not a good idea
var pageLoad = function() 
{
    carousel = new YAHOO.extension.Carousel("mycarousel", 
        {
            numVisible:        2,
            animationSpeed:   .15,
            scrollInc:         2,
            prevElement:     "prev-arrow",
            nextElement:     "next-arrow",
            size:              6,
            prevButtonStateHandler:   handlePrevButtonState,
            nextButtonStateHandler:   handleNextButtonState
        }
    );

};

YAHOO.util.Event.addListener(window, 'load', pageLoad);*/
