// Easing equation, borrowed from jQuery easing plugin
// http://gsgd.co.uk/sandbox/jquery/easing/
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

jQuery(function( $ ){
	$(".sub").click(function () {
	var current2=$(this).attr("id");
	var description = ".description"+current2;
	var current3= ".g"+current2;
	var current4= "g"+current2;
	var current2= "#g"+current2;
	var left= ".left"+$(this).attr("id");	
	var right= ".right"+$(this).attr("id");
		
	$(".sub").removeClass("active");
	$(this).addClass("active");
	$(".project_parent li").fadeTo(0,.8);
	$(".0").parent().fadeTo(0,1);
	$(".0").fadeTo(0,0);
	
	$("#info").slideDown("slow");
	$(".description").slideUp("fast");
	$(description).slideDown("slow");
		
		
	$('#slideshow').serialScroll({
		items:current3+" li a",
		offset:-289,
		start:0, //as we are centering it, start at the 2nd
		duration:1200,
		constant:false,
		duration:1000,
		force:true,
		stop:true,
		lock:false,
		cycle:true, //don't pull back once you reach the end
		easing:'easeOutQuart', //use this easing equation for a funny effect
		jump: true //click on the images to scroll to them
		});
	
		var current=$(this).attr("id");
		var container = $('#gg1');
		var target = $("#g"+current);
		var slideleft = $("#slideshow");
		
		$('#slideshow').trigger('goto',[0]);
		
		var container = (container.offset().top);
		var target = (target.offset().top);
		var move = (container - target);
		
				
		$(current2).removeClass(current4);
		
	$('#slideshow_container').animate({top:move},1000);
	});
});
