$(document).ready(function(){
	
	$(document).ready(function(){ 
		if ( $("ul.sf-menu").length > 0 ) $("ul.sf-menu").superfish(); 
		$('#document *:first-child').css('margin-top', 0);
	}); 

	if (history.length < 1) {
		$('.buttonBack').hide();
	} else {
		$('.buttonBack').bind( 'click', function(e) {
			e.preventDefault();
			history.back();
		})
	}

	$('.titleBlock, .recordImage').hoverIntent( function() {
		fadeAndScroll( $(this).parent().find('.areaAffected'), 'in');
	}, function() {
		fadeAndScroll( $(this).parent().find('.areaAffected'), 'out');
	});
/*
	
	levelBoxes();
	
	$(window).resize(function() {
 	 	levelBoxes();
	});

	
*/
});

function levelBoxes() {
/* 	$('#content').height( $('#wrapper').height() - 200 ); */
	$('#document, .sideColumn').height( $('#content').height() - 34 );
}

function fadeAndScroll(fadeItem, fadeDirection) {

	if (fadeDirection == 'in') {
		 fadeItem.animate({
		    opacity: 1,
		    height: 'toggle'
		  }, 500 );
	} else {
		 fadeItem.animate({
		    opacity: 0,
		    height: 'toggle'
		  }, 500 );
	}


}
