$(document).ready(function(){
	var section;
	var active = false;
	var height;

	
	$("#nav > li, #dropdown-menu ul").mouseover(function(){

			if($(this).is("#nav > li") == true || $(this).is("#dropdown-menu ul") == true){
				section = $(this).attr("class");
			}
			
			height = $("#dropdown-menu ."+ section).height() * 3;
			$("#dropdown-menu ."+ section +"-child > ul").show();
			$("#dropdown-menu ."+ section +"-child > ul").stop().animate({"top": "100px"}, 300, "linear"); //show the dropdown menu
	  	});
	  	
	  	
	$("#nav > li, #dropdown-menu ul, #dropdown-menu ul ul").mouseout(function(){
	  		oldsection = section;
	  		$("#dropdown-menu ."+ oldsection +"-child > ul").stop().animate({"top": "-"+height+"px"}, 300, "linear", function(){
	  			active = false;
	  			//$("#dropdown-menu ."+ oldsection +"-child > ul").hide();
	  		});
	  	});
	
	
	$("#dropdown-menu li li").hover(function(){
		$(this).children("ul").show();
	}, function(){
		$(this).children("ul").hide();
	})
	
	heightx = $("#content").height();
	newx = Math.floor((heightx/10))*10;
	diff = heightx - newx;
	diff = 5 - diff;
	newHeight = heightx + diff;
	$(".bottom").css({'margin-top': '-'+diff});
	
});
