$(function() {
	$('body').removeClass('js-off');
	var $a = $('#nav>ul>li');
	$a.hover(
		function() {
			
			var $t = $(this),
				$links = $t.children('a'),
				subNav = $links.attr("rel");
			
				$links.addClass('hovered');
			
			var getSubNav = $("#" + subNav);
			if(getSubNav.css('display') != 'block')
			{
				
				$("#nav ul li ul").hide();
				if(getSubNav.length)
				{
					getSubNav.fadeIn();
				//	getSubNav.siblings().css('color', '#FD0100');
					
				}
			}
			
		},
		function() {
			$("#nav ul li ul:not(.active-page+ul)").fadeOut();
			$('.hovered').removeClass('hovered');
			$(".active-page+ul").fadeIn();
		}
	
	);
	
	//code to make the footer hit the bottom of the page
	
	var w = $(window),
		mF = $('#main-footer');
	if (w.height() < 1020)
	{
		mF.height(150);
	} else {
		mF.height(mF.height() + mF.offset().top + 80);
	}
	

	//thumbnail gallery
	
	var imgLinks = $('#thumbs').find('a');


	imgLinks.click(function() {
			var $t = $(this);
		
			var imgSrc = $t.attr('href'),
				bigImg = $('#big-img').children('img');
			
			bigImg.fadeOut(500, function() {
				bigImg.hide();
				bigImg.attr('src', imgSrc);
				bigImg.load(function() {
					bigImg.fadeIn();	
				})
			
			});
			return false;
	});
		
;
});
