jQuery(document).ready(function() {
	var step = 1; 
	var current = 0; 
	var maximum = $('#mycarousel ul li').size(); 
//	var maximum = 3; 
	var visible = 1; 
	var speed = 200; 
	var liSize = 962;
	var carousel_height = 385;


	var ulSize = liSize * maximum;   
	var divSize = liSize * visible;  

	$('#mycarousel ul').css("width", ulSize+"px").css("left", -(current * liSize)).css("position", "absolute");

	$('#mycarousel').css("width", divSize+"px").css("height", carousel_height+"px").css("visibility", "visible").css("overflow", "hidden").css("position", "relative"); 


	$("#cnext").click(function() { 
		if(current + step < 0 || current + step > maximum - visible) {return; }
		else {
			current = current + step;
			$('#mycarousel ul').animate({left: -(liSize * current)}, speed, null);
		}
		return false;
	});

	$('#cprev').click(function() { 
		if(current - step < 0 || current - step > maximum - visible) {return; }
		else {
			current = current - step;
			$('#mycarousel ul').animate({left: -(liSize * current)}, speed, null);
		}
		return false;
	});
	
	var p_step = 1;
	var p_current = 0;
	var p_maximum = 7;
	var p_visible = 2;
	var p_speed = 200;
	var p_liSize = 250;
	var p_carousel_height = 250;
	var p_divPadding = 50;

	var p_ulSize = p_liSize * p_maximum;   
	var p_divSize = p_liSize * p_visible + p_divPadding;  

	$('#projectslist ul').css("width", p_ulSize+"px").css("left", -(p_current * p_liSize)).css("position", "absolute");

	$('#projectslist').css("width", p_divSize+"px").css("height", p_carousel_height+"px").css("visibility", "visible").css("overflow", "hidden").css("position", "relative"); 


	$("#pnext").click(function() { 
		if(p_current + p_step < 0 || p_current + p_step > p_maximum - p_visible) {return; }
		else {
			p_current = p_current + p_step;
			$('#projectslist ul').animate({left: -(p_liSize * p_current)}, p_speed, null);
		}
		return false;
	});

	$('#pprev').click(function() { 
		if(p_current - p_step < 0 || p_current - p_step > p_maximum - p_visible) {return; }
		else {
			p_current = p_current - p_step;
			$('#projectslist ul').animate({left: -(p_liSize * p_current)}, p_speed, null);
		}
		return false;
	});

	$('#projectslist ul li').hover ( 
		function() {$('span',this).slideToggle('slow');},
		function() {$('span',this).slideToggle('slow');}		
		);	
});
