var portfolio_state = "closed";

$(document).ready(function() {

	$('.boxgrid').hover(function(){
		$(".cover", this).stop().animate({top:'180px',opacity:'1'},{queue:false,duration:150});
		$(".image", this).stop().animate({top:'-30px',opacity:'1'},{queue:false,duration:150});
	}, function() {
		$(".cover", this).stop().animate({top:'300px',opacity:'0'},{queue:false,duration:150});
		$(".image", this).stop().animate({top:'0px',opacity:'0.5'},{queue:false,duration:150});
	});

	$("span.showmore").click(function() {
		if(portfolio_state == "open") {
			var spantext = "(+ Click here to view all portfolio items)";
			var h = 300;
			portfolio_state = "closed";
			$('html,body').animate({scrollTop: $("html").offset().top},600);
			}
		else {
			var spantext = "(– Click here to view only the most recent items)";
			var h = $("#p-container").height();
			portfolio_state = "open";
			$('html,body').animate({scrollTop: $("#portfolio").offset().top-70},600);
			}
		$("#portfolio").animate({ height: h+"px" }, 400 );
		$("span.showmore").text(spantext);
		});
	});
