function getHeight(element)
{
	var height = 0;
	if (element.offsetHeight)
	{
		height = element.offsetHeight;
	}
	else if (element.style.pixelHeight)
	{
		height = element.style.pixelHeight;
	}
	return height;
}

$(document).ready(function()
{
	// Make sure the content is high enough for all the buttons.
	var navigationHeight = getHeight($("#navigation").get(0));
	$("#content").css("display", "none");
	$("#content").css("min-height", (navigationHeight - 63) + "px");
	$("#content").css("display", "block");

	 // Open external links in a new window.
	 $("a").filter(".link").click(function(){
	   return !window.open(this.href);
	 });
	 
 	// Defuscate email addresses.
 	$('a').defuscate();

	 // When an entry is hovered over, show the link as hovered.
	 $(".sf-menu").children("li").hover(
	 	function() {
	 		$(this).addClass("prettyHover");
	 	},
	 	function() {
	 		$(this).removeClass("prettyHover");
	 	}
	 );
	 
	 // When an entry is clicked on, activate the link.
	 $(".sf-menu").children("li").click(
	 	function() {
	 		window.location = $(this).children("a").attr("href");
	 	}
	 );

	// Cycle gallery page.
	$('#slideshow').innerfade({ 
    	speed: 2500,
    	timeout: 5000,
    	runningclass: 'gallery'
  	});
});

