$(document).ready(function(){

  // behaviors and modifications for portfolio pages
  if ( $(".piece").length ) {

    //center floated content element and keep it centered
  	var itemwidth = $(".piece").outerWidth(1);
  	$("#container").width( parseInt( $(window).width() / itemwidth ) * itemwidth );
  	$(window).resize(function() {
  		$("#container").width( parseInt( $(window).width() / itemwidth ) * itemwidth );	
  	});

    //lightbox
  	$(".piece a").colorbox({ maxHeight:"98%", current:"{current}/{total}", maxWidth:"99%" });
  	
  	//hovers
  	$(".piece a").hover(function() {
  		$(this).parent(".piece").stop(true,true).fadeTo(200,1);
  	}, function() {
  		$(this).parent(".piece").stop(true,true).fadeTo(500,0.6);
  	});
  	
	} //end portfolio if
	  
});
