/**
 * 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 = args[1];
	if(enabling) {
		leftImage.src = "/lib/carousel/images/left-enabled.gif";	
	} else {
		leftImage.src = "/lib/carousel/images/left-disabled.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 rightImage = args[1];
	
	if(enabling) {
		rightImage.src = "/lib/carousel/images/right-enabled.gif";
	} else {
		rightImage.src = "/lib/carousel/images/right-disabled.gif";
	}
	
};
var pageLoad = function() 
{
	var carousel = new YAHOO.extension.Carousel("dhtml-carousel", 
		{
			numVisible:        3,
			animationSpeed:   .10,
			scrollInc:         1,
			navMargin:         40,
			prevElementID:     "prev-arrow",
			nextElementID:     "next-arrow",
			size:              carousel_numphotos,
			prevButtonStateHandler:   handlePrevButtonState,
			nextButtonStateHandler:   handleNextButtonState,
			autoPlay: 5000,
			wrap: true
		}
	);
};
// YAHOO.util.Event.addListener(window, 'load', pageLoad);
var carousel_load = new domFunction(pageLoad);