/**
 * Copyright (c) 2006-2007, Bill W. Scott
 * All rights reserved.
 *
 * This work is licensed under the Creative Commons Attribution 2.5 License. To view a copy 
 * of this license, visit http://creativecommons.org/licenses/by/2.5/ or send a letter to 
 * Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.
 *
 * This work was created by Bill Scott (billwscott.com, looksgoodworkswell.com).
 * 
 * The only attribution I require is to keep this notice of copyright & license 
 * in this original source file.
 *
 * Version 0.6.1 - 07.08.2007
 *
 */

/**
 * Standard Configuration. It is advised that this section NOT be modified as the
 * carousel.js expects the behavior outlined below.
 **/
.carousel-component { 
	position:relative;
	overflow:hidden;   /* causes the clipping */
	display:none; /* component turns it on when first item is rendered */
	
}
				
.carousel-component ul.carousel-list { 
	width:10000000px;
	position:relative;
	z-index:1; 
}

.carousel-component .carousel-list li { 
	float:left;
	list-style:none;
	overflow:hidden;
	
    
}

/**
 * VERTICAL CAROUSEL DEFAULTS
 **/
.carousel-component .carousel-vertical li { 
	margin-bottom:0px;

	/* Fix for extra spacing in IE */
	float:left;
    clear:left;  
	
	/* Force the LI to respect the HEIGHT specified */
	overflow:hidden;
	display:block;
}

/* For vertical carousel, not set, width defaults to auto */
/* Note if you explicitly set width to auto, this might cause */
/* problems with Safari... as in up/down button not working in some examples. */	 
.carousel-component ul.carousel-vertical {
/*	width:auto;*/
}

.carousel-component .carousel-clip-region { 
	overflow:hidden; /* Secret to the clipping */
	margin:0px auto;
	position:relative; 
}

/**
 * ==============================================================================
 * Safe to override. It is safe to override background, padding, margin, color,
 * text alignment, fonts, etc. Define a separate CSS file and override your style
 * preferences.
 **/

.carousel-component { 
	background:#e2edfa;
	padding:0px;
	-moz-border-radius:6px;
	color:#618cbe;
}
.carousel-component ul.carousel-list { 
	margin:0px;
	padding:0px;
	line-height:0px;
}
.carousel-component .carousel-list li { 
	text-align:center;
	margin:0px;
	padding:0px;
	font:10px verdana,arial,sans-serif;
	color:#666;
}
.carousel-component .carousel-vertical li { 
}
.carousel-component ul.carousel-vertical { 
}

.carousel-component { 
	    padding:8px 16px 4px 16px;
	    margin:0px;
	}
	
	.carousel-component .carousel-list li { 
	    margin:4px;
	    width:79px; /* img width is 75 px from flickr + a.border-left (1) + a.border-right(1) + 
	                   img.border-left (1) + img.border-right (1)*/
	    height:93px; /* image + row of text (87) + border-top (1) + border-bottom(1) + margin-bottom(4) */
	    /*    margin-left: auto;*/ /* for testing IE auto issue */
	}
	
	.carousel-component .carousel-list li a { 
	    display:block;
	    border:1px solid #e2edfa;
	    outline:none;
	}
	
	.carousel-component .carousel-list li a:hover { 
	    border: 1px solid #aaaaaa; 
	}
	
	.carousel-component .carousel-list li img { 
	    border:1px solid #999;
	    display:block; 
	}
	                                
	.carousel-component .carousel-prev { 
	    position:absolute;
	    top:40px;
	    z-index:3;
	    cursor:pointer; 
	    left:5px; 
	}
	
	.carousel-component .carousel-next { 
	    position:absolute;
	    top:40px;
	    z-index:3;
	    cursor:pointer; 
	    right:5px; 
	}
	
	
	/**
 	* 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 = "http://billwscott.com/carousel/images/left-enabled.gif";    
	    } else {
        	leftImage.src = "http://billwscott.com/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 = "http://billwscott.com/carousel/images/right-enabled.gif";
	    } else {
        	rightImage.src = "http://billwscott.com/carousel/images/right-disabled.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; // for ease of debugging; globals generally not a good idea
	var pageLoad = function() 
	{
	    carousel = new YAHOO.extension.Carousel("mycarousel", 
	        {
	        	
	        	revealAmount:      0, // nb de pix visibles de la prochaine/pr?c?dente image (cach?e donc)
	        	numVisible:        3,
	            animationSpeed:    0.15,
	            scrollInc:         3,
	            navMargin:         20,
	            prevElement:     "prev-arrow",
	            nextElement:     "next-arrow",
	            size:              19, // nb d'images max
	            prevButtonStateHandler:   handlePrevButtonState,
	            nextButtonStateHandler:   handleNextButtonState
	        }
	    );
	};

	YAHOO.util.Event.addListener(window, 'load', pageLoad);