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(){
	
	// Tweak height of main content div.
	var navHeight = getHeight($("#navigation").get(0));
	$("#content").css("display", "none");
	$("#content").css("min-height", (navHeight + 65) + "px");
	$("#content").css("display", "block");

	 // 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");
	 	}
	 );
	 
	 // Open external links in a new window.
	 $("a").filter(".link").click(function(){
	   return !window.open(this.href);
	 });

	// Cycle logos.
	$('#slideshow').innerfade({ 
    	speed: 2500,
    	timeout: 5000,
    	runningclass: 'gallery'
  	});

	 // Add map.
	 var map = $("#map");
	 if (map)
	 {
	 	$.create("iframe", {"src" : "http://www.salonguineapig.co.uk/location/Absolute Nails and Beauty/-1.1792391/52.679123/7/350/300/", "width" : "355", "height" : "350"}).appendTo(map);
	 }
	 
	 // Limit the width of the header to the width of the browser window.
	 $("#header").css("display", "none");
	 $("#header").css("width", window.width);
	 $("#header").css("max-width", window.width);
	 $("#header").css("display", "block");

    // Use Facebox for gallery images.
	jQuery(document).ready(function($) {
	  $('a[rel*=facebox]').facebox(); 
	});
});

