function extendHoverState() {
	jQuery('#pmenu li.main').hover(
		function() { jQuery(this).children('a.mainAnchor').addClass('over'); },
		function() { jQuery(this).children('a.mainAnchor').removeClass('over'); }
	);
	jQuery('#pmenu li.sub').hover(
		function() { jQuery(this).children('a.subAnchor').addClass('over'); },
		function() { jQuery(this).children('a.subAnchor').removeClass('over'); }
	);

	jQuery('#navWrapper').hover(
		function() { setLastNavItem(null); 
		},
		function() { 
			if(getLastNavItem()) {
				if (getLastNavItem().parent().attr('id') != currentSubNav.parent().attr('id')) {
					getLastNavItem().stop().fadeOut(250, function() {
					currentSubNav.stop().css("opacity","").fadeIn(250);
					});
				}
			} else {
				currentSubNav.stop().css("opacity","").fadeIn(250);
			}
		}
	);
}
function centerSubNav(parent) {
	var parent = jQuery(parent);
	var child = jQuery(parent).children('ul').eq(0);
	if (child.length > 0) {
		var parentLeft = jQuery(parent).offset().left - navOffset;
		var parentCenter = Math.floor(parentLeft + (jQuery(parent).width() / 2)); // relative to navWrapper offset
		var childWidth = getChildWidth(child);
		
		//
		var newChildLeft = Math.floor((parentLeft - navOffset)*-1);
		if ((newChildLeft + childWidth) > navWidth) {
			newChildLeft = (navWidth - childWidth) - buffer;
		}
		if (newChildLeft < buffer) { newChildLeft = buffer; }
		// child node is absolutely positioned relative to parent, so its left offset is 0
		// We must compensate for this...
		newChildLeft=0;
		newChildLeft -= parentLeft;
		//
		jQuery(child).css('margin-left', newChildLeft + "px");

	}
}
