	$(document).ready(function()
	 {
		
		var childrenSize = $('#project-list ul').children('li').size();
		var i = 0;
		var speed = "normal";
		var block = $('#project-list');
		var first = block.position();
		
		for(i = 1; i <= childrenSize; i++)
		 {
			$('#project-list li:nth-child('+i+')').attr("id",i);
			$('#project-shortcuts li:nth-child('+i+') a').attr("rel",i);
			//.prepend("<div class='numbers'>"+i+"</div>")
		 }
		 
		var current = 1; // the picture to start on
		const width = $('#project-list li:nth-child(1)').width() + 41; // picture width
		
		//var calcHeight = $('#project-list li:nth-child('+current+')').height();
		//$("#project-container").css('height',calcHeight);
		
		// INITIALIZATION
		$('#project-shortcuts li:nth-child('+current+') a').addClass("highlighted");
		$('#project-list li:nth-child('+current+')').addClass("active"); // initialize
		//var starter = $('#project-shortcuts li:nth-child('+current+') a').attr("rel");
		//var startPos = -(starter * width) + 300 + width;
		//block.animate({"left":startPos},speed);	

		// MASTER CONTROLS
		$('#masterNEXT').click(function(){
			$('#project-list li:nth-child('+current+')').removeClass("active");
			$('#project-shortcuts li:nth-child('+current+') a').removeClass("highlighted");
			
			if(current == childrenSize)	{ current = 1; }
			else						{ current++; }
			
			var neueOffset = -(current * width) + 300 + width;
			block.animate({"left":neueOffset},speed);
			
			$('#project-list li:nth-child('+current+')').addClass("active");
			$('#project-shortcuts li:nth-child('+current+') a').addClass("highlighted");
			
			return false;
		});
		
		$('#masterPREV').click(function(){
			$('#project-list li:nth-child('+current+')').removeClass("active");
			$('#project-shortcuts li:nth-child('+current+') a').removeClass("highlighted");
			
			if(current == 1)	{ current = childrenSize; }
			else				{ current--; }
			
			var neueOffset = -(current * width) + 300 + width;
			block.animate({"left":neueOffset},speed);
			
			$('#project-list li:nth-child('+current+')').addClass("active");
			$('#project-shortcuts li:nth-child('+current+') a').addClass("highlighted");
			
			return false;
		});
		
		// SHORTCUT NAVIGATION
		$('#project-shortcuts li a').click(function(){
			$('#project-shortcuts li a').removeClass("highlighted");
			$(this).addClass("highlighted");
			var thisRel = $(this).attr('rel');
			var shortOffset = -(thisRel * width) + 300 + width;
			block.animate({"left":shortOffset},speed);
			$('#project-list li:nth-child('+current+')').removeClass("active");
			current = thisRel;
			$('#project-list li:nth-child('+current+')').addClass("active");
			return false;
		});
		
	 });