$(document).ready(function() {

	// hover for the main navigation
	$('#navigation ul li').hover(function() {
		$(this).children('.dd').css({
			'visibility':'visible',
			'display':'block'
		});
	}, function() {
		$(this).children('.dd').css({
			'visibility':'hidden',
			'display':'none'
		});
	});
	
	// toggle the hoverstate element for font color change on navigation and subnav
	$('#navigation ul li .dd ul li').hover(function() {
		$(this).children('a').css({
			'visibility' : 'hidden',
			'display' : 'none'
		});
		$(this).children('a.hoverstate').css({
			'visibility' : 'visible',
			'display' : 'inline-block'
		});
	}, function() {
		$(this).children('a').css({
			'visibility' : 'visible',
			'display' : 'inline-block'
		});
		$(this).children('a.hoverstate').css({
			'visibility' : 'hidden',
			'display' : 'none'
		});
	});
	
	$('.sub-nav p').hover(function() {
		if ($(this).children('a').is('.active')) {
			// do nothing
			// alert('is not set to active');
		} else {
			showHover(this);
		}
	}, function() {
		hideHover(this);
	});
});

function showHover(_id) {
	$(_id).children('a').css({
		'visibility':'hidden',
		'display':'none'
	});
	$(_id).children('a.hoverstate').css({
		'visibility':'visible',
		'display':'inline'
	});
}
function hideHover(_id) {
	$(_id).children('a').css({
		'visibility':'visible',
		'display':'inline'
	});
	$(_id).children('a.hoverstate').css({
		'visibility':'hidden',
		'display':'none'
	});
}
