var current = 0;	   
var count	
function sliderReady() {
	window.setInterval('navigate()', 8000);	
}

$(document).ready(function() {
	$('#rina em').hide();
	sliderReady();
	count = $('.item').length; 
	var innerWidth = 866 * count;
	$('#inner_container').css('width',innerWidth);
	
	$('.next').click(function() {
		navigate('next'); // sets a value for "direction" in the function below
	});
	$('.prev').click(function() {
		navigate('prev'); // sets a value for "direction" in the function below
	});
	
	// for rina link on footer
	//$("#rina a").hover(function() {
	//  $(this).next("em").animate({opacity: "show", bottom: "-75"}, "slow");
	//}, function() {
	//  $(this).next("em").animate({opacity: "hide", bottom: "-85"}, "fast");
	//});

});

function navigate(direction) { // pulls "direction" from the function calls above
	if (direction=='prev') { // if what we've clicked on in jquery sets navigate to "prev"
		if (current > 0 ) { // if we are not on the first item
		  current--; // removes 1 from current item we are on for use in our calculation in the animate
		} else { // if we are on 0, or the first item
		  current = count-1; // sets our current variable to our max count, and subtracts 1 because it's 10 based
		}
	} else { // if what we've clicked on in jquery is not prev
		if (current < count-1 ) { // if we are not on the last; length is 10 based, so we subtract 1 from the count variable
		  current++; // adds 1 to current
		} else { // if we are at the max count, or the last item
		  current = 0; // resets current to 0	
		}
	}
	$('#inner_container').animate({
		marginLeft :'-'+ (current * 867) +'px'
		},5000); // animate left or right depending on the if statement
}
