$(document).ready(function(){ 
	// Create some next and previous buttons.
	$('#promo-buttons-bottom').html('<a id="previous-promo" href="#prev">Previous</a> <a id="next-promo" href="#next">Next</a>');
	
	$("div#promo-buttons-bottom a#next-promo").each(function(z) {
		$(this).bind("click", function(){
		
			current = $("#scroller").css("width");
			current = current.substr(0, (current.length-2));	
			max = ((parseInt(current)-41)/183)-3;
			
			num = $("#scroller").attr("class");
			num = parseInt(num.substr(4));
			
			if(num < max){
				num = num + 1;
				$("#scroller").attr("class", "num_"+num);
				$.post('inc/button_click_connector.php', { value: "ro"});
			}
			
			width = (41-(num*183));
			
			$("#scroller").animate({ left: width}, 750);
			
			return false;
		});
	});
	
	$("div#promo-buttons-bottom a#previous-promo").each(function(z) {
		$(this).bind("click", function(){	
			num = $("#scroller").attr("class");
			num = parseInt(num.substr(4));
			if(num > 0){
				num = num - 1;
				$("#scroller").attr("class", "num_"+num);
				$.post('inc/button_click_connector.php', { value: "ro"});
			}
			
			width = (41-(num*183));
					
			$("#scroller").animate({ left: width}, 750);
			return false;
		});
	});
	
});
