$(document).ready(function()   
{	 
	
	$("#home_nav").hover(
		function() {
			var navigation = document.getElementById("nav");
			var links = navigation.getElementsByTagName("a");	
			// set all the links classes to nothing
			for(var i=0; i<links.length; i++)	
			links[i].className = "off";
			
			$("#seaside_living_subnav").stop().animate({height: 0}, 200);
		}
	);

	$("#seaside_living_nav").hover(
		function() {
			var navigation = document.getElementById("nav");
			var links = navigation.getElementsByTagName("a");	
			// set all the links classes to nothing
			for(var i=0; i<links.length; i++)	
			links[i].className = "off";
			// set selected link as selected
			$(this).removeClass("off");
			$(this).addClass("on");
			
			$("#seaside_living_subnav").stop().animate({height: 70}, 200);
		}
	);
	$("#seaside_living_subnav").mouseleave(
		function() {
			$(this).stop().animate({height: 0}, 300);
			$("#seaside_living_nav").removeClass("on");
		}
	);
	
	$("#documents_nav").hover(
		function() {
			var navigation = document.getElementById("nav");
			var links = navigation.getElementsByTagName("a");	
			// set all the links classes to nothing
			for(var i=0; i<links.length; i++)	
			links[i].className = "off";
			
			$("#seaside_living_subnav").stop().animate({height: 0}, 200);
		}
	);
	
	$("#news_nav").hover(
		function() {
			var navigation = document.getElementById("nav");
			var links = navigation.getElementsByTagName("a");	
			// set all the links classes to nothing
			for(var i=0; i<links.length; i++)	
			links[i].className = "off";
			
			$("#seaside_living_subnav").stop().animate({height: 0}, 200);
		}
	);
	
	$("#gallery_nav").hover(
		function() {
			var navigation = document.getElementById("nav");
			var links = navigation.getElementsByTagName("a");	
			// set all the links classes to nothing
			for(var i=0; i<links.length; i++)	
			links[i].className = "off";
			
			$("#seaside_living_subnav").stop().animate({height: 0}, 200);
		}
	);
	
	$("#contact_nav").hover(
		function() {
			var navigation = document.getElementById("nav");
			var links = navigation.getElementsByTagName("a");	
			// set all the links classes to nothing
			for(var i=0; i<links.length; i++)	
			links[i].className = "off";
			
			$("#seaside_living_subnav").stop().animate({height: 0}, 200);
		}
	);
});