﻿$(document).ready(function()
{
	$('#TopNavMenu').CSSDropDownMenu();
	setPageHeight();
	$(window).resize(function() {
	  setPageHeight();
	});
	highlightCurrentParentCategory();
});
function highlightCurrentParentCategory()
{
	var cat = '';
	cat = $.getUrlVar('Category')//.substring(1,4);
	if(cat)
	{
		cat = cat.substring(1,4);
		var links = $('#TopNavMenu > ul > li > a');
		for(var i = 0; i < links.length; i++)
		{
			if($(links).eq(i).attr('href').indexOf(cat) > -1)
			{
				$(links).eq(i).parent().addClass('Selected');
				break;
			}
		}
	}
}

function setPageHeight()
{
	var viewportHeight = $(window).height();
	var navHeight = $('#navmain1').height();
	var contentHeight = $('#content').height();
	var footerHeight = $('#footer').height();
	var totalSiteHeight = navHeight + contentHeight + footerHeight;
	if(viewportHeight > totalSiteHeight)
	{
		var requiredContentHeight = viewportHeight - footerHeight - navHeight;
		$('#content').css({'height':requiredContentHeight + 'px'})
	}
}

