
$(document).ready(function(){

	$(".project_desc li div").hide();


	$(".bigProject").css("left", "1150px"); 
	var current_id;
	var selected; 
	//$(".body2").hide();

	$(".body2").animate({
		opacity: 1
	}, 500, function(){
		
		$(".body2").slideDown("fast", function(){
		$(".body2").animate({
			width: "980px",
			height: "408px"
		}, 500, function(){
			$(".project_list").fadeIn("fast"); 

		}); 
		}); 
	}); 


	$(".p_item").hover(function(){
		if (selected!="Y")
		{
			$(this).children("label").css("color", "#FFF"); 
			$(this).animate({
			
				backgroundColor: "#535353",
				opacity: 1 
			}, {duration:800, queue:false}); 
		}
	}, function(){
		if (selected!="Y")
		{
			$(this).children("label").css("color", "#e0e0e0"); 
			$(this).animate({
				backgroundColor: "#2d2d2d",
				opacity: 0.7
			}, {duration:800, queue:false}); 
		}
	}); 	

	$(".p_item").click(function(){
		selected="Y"; 
		var id=$(this).attr("id");
	
		
		$(".flexcroll").animate({
			marginLeft: "-980px", 
			opacity: 0 
		}, 500, showProject(id));	
	
	});

	$(".backto").click(function(){
		
		$(".p_item").css({
				backgroundColor: "#2d2d2d",
				opacity: 0.7
		});



		$(".bigProject").animate({
			marginLeft: "30px", 
			opacity: 0
		}, 500, function(){
			

		}); 
		
			$(".flexcroll").animate({
				marginLeft: "10px",
				opacity: 1
			}, {queue:false, duration:300}); 

				
		selected="N"; 	
	

	});

	$(".leftButton").click(function(){
		var id=this.id; 
		moveProjects(id); 
		
	}); 

	$(".rightButton").click(function(){
		var id=this.id; 
		moveProjects(id); 
		
	}); 



	function moveProjects(id)
	{
		
		$(current_id).hide("slow");
		showProject(id);

	}

	function showProject(id)
	{
		id="#p_"+id;
		current_id=id;	


		$(id).show();
		$(id).animate({
			marginLeft: "-1140px",
			opacity: 1
		}, {duration:500, queue:false}); 
	
	
	} 


	$(".picture_list").click(function(){
		var id="#"+$(this).attr("id")+"_p";
		var parent_id="#"+$(this).parent().attr("id")+"_img";
		$(parent_id).find(".primary").removeClass('primary').addClass('hide');
		
		//$(".primary").removeClass('primary').addClass('hide');
		$(id).removeClass('hide').addClass('primary');
		
		
	}); 


	
}); 


