jQuery(document).ready(function() {
	$("#stage-carousel").carouFredSel({
		items : {
			visible: 1,
			minimum: 1,
			height: 309, 
			width: 902
		},
		circular : true,
		direction : "left",
		auto: {
			play: true,
			pauseDuration: 6500
		},
		scroll : {
			items           : 1,
			duration        : 1000,                        
			pauseOnHover    : true
		},
		prev : {   
			button : "#prev-slide",
			key : "left"
		},
		next : {
			button : "#next-slide",
			key: "right"
		}		
	});
	
	$('#next-slide').show();
	$('#prev-slide').show();
	$(window).load(function(){
		//$('#next-slide').fadeIn();
		//$('#prev-slide').fadeIn();
		
		for(i=0; i<stage_list.length; i++){
			var img = new Image();
			img.src = stage_list[i];
			var listItem = $('<li></li>').html($(img));
			$('img', listItem).load(function() {
				$('#stage-carousel').trigger('insertItem', [
					this.parentNode,
					'end',
					true,
					0
				]);
			});
		}
	});
});

