


$(document).ready(function() {
						   	
	//$('#promosList span:first').addClass('currentPromo');
	
	$('.promosList-caption').css({bottom:-125, opacity: 0.4});
	
	// MOUSE OVERS	
	$('#promosCenter span').hover(
		function () {
			$('#promosList-' + this.id).css({bottom:-0});
			//alert('he');
			//$(this).animate({opacity: 0.9}, 1000);
		}, 	
		function () {
			//$(this).animate({opacity: 1.0}, 1000);
			$('#promosList-' + this.id).css({bottom:-125});	
		}
	);
	
	//  LEFT BUTTON
	$("#promosLeft").click(function() {
      movePromos();
    });

	//  RIGHT BUTTON
	$("#promosRight").click(function(){
      movePromos();
    });
	
	// TIMED ROTATE
	rotatePromos(4300);

});


function movePromos() {
	
	var promoFirst = $('#promosList span:first');
	
	var promoWidth = promoFirst.width()
	
	promoFirst.animate({"width": "0px"}, 400, function() { $(this).appendTo('#promosList').css('width', promoWidth); });	

}



function rotatePromos(speed) {
	
	var timer2 = setInterval('movePromos()',speed);
	
	//pause the slideshow on mouse over
	$('#promos').hover(
		function () {
			clearInterval(timer2);
		}, 	
		function () {
			timer2 = setInterval('movePromos()',speed);	
		}
	);
	
}

