$(document).ready(function(){
//	var cproj = -1;
	// Color & Fonts
	$("ul.slider li").each(function(){
		$(this).hover(
			function(){
				$(this).find("a").not("active").css("borderColor", "orange");
				$(this).find("span").css("color", "orange");
			}, function(){
				$(this).find("a").not("active").css("borderColor", "gray");
				$(this).find("span").css("color", "gray");
			});
	});
	
	// This can be removed if the initial HTML does not contain target="_blank"
	$("ul.slider li a").not(':first').each(function(){
		$(this).attr('target', "");
	});
	
	
	// Animate
	$("ul.slider li").click(function(){
		prjid = $(this).attr("id").replace("project", "");
		$(this).find("a").each(function(){
		
			if(!$(this).hasClass('active')) {
				$(this).find("img").css({visibility:"visible"});

				$(this).animate({width:"550px"}, function(){
					$(this).addClass("active").attr('href', $(this).attr('rel'));
				});
			
				$("ul.slider li a.active").animate( {width:"1px"}, function(){
					$(this).removeClass("active").attr('href', 'javascript:void(0)').attr('target', "").find("img").css({visibility:"hidden"});
				});
				
				if (cproj != prjid) {
					$("#prjdetiles"+cproj).fadeOut("fast", function(){
						$("#prjdetiles"+prjid).fadeIn("fast");
					});
					cproj = prjid;
				}
			}
		});

	});
	
	
	
});

