$(document).ready(function() {
	$('.arrow-prev').hover(function() {
		$(this).addClass('arrow-prev-hover');
	}, function() {
		$(this).removeClass('arrow-prev-hover');
	});

	$('.arrow-next').hover(function() {
		$(this).addClass('arrow-next-hover');
	}, function() {
		$(this).removeClass('arrow-next-hover');
	});

	$('.arrow-prev').click(function() {
		var scrollwidth = $('#rotating-items').css("left");

		var num = parseFloat(scrollwidth, 10);

		var newwidth = num + (117*6);
		var unit = 'px';
		
		

		if(newwidth > 0) {

		} else {
			//$('#rotating-items').css('left', newwidth + unit);
			$('#rotating-items').animate({left: newwidth}, 1500);
		}
		//$('#rotating-items').css('left', newwidth + unit);

	});

	$('.arrow-next').click(function() {
		var scrollwidth = $('#rotating-items').css("left");

		var num = parseFloat(scrollwidth, 10);

		var newwidth = num - (117*6);
		var unit = 'px';
		
		templength = $('.rotating-item').length;
		newtemplength = templength / 6;
		
		temptotallength = newtemplength.toFixed(0) - 1;
		
		totallength = 702 * temptotallength;
		
		totallength = -totallength;
		
		//alert(newwidth+" "+totallength);
		
		if(newwidth < totallength) {
			
		} else {
			$('#rotating-items').animate({left: newwidth}, 1500);
		}

		//$('#rotating-items').css('left', newwidth + unit);
		

	});
	
});