
	var currentElement;
	
	function showNav(html,x,y) {
		jQuery('#side-nav-middle').html('<ul>' + html + '</ul>');
		jQuery('#side-nav').show();
		jQuery('#side-nav').css({left: x, top: y -1});
		clearTimeout(navTimer);
		jQuery('#side-nav a').hover(
			function () {
				clearTimeout(navTimer);
  			},
			function () {
				navTimer = setTimeout("hideNav()",200);
				//was 800
  			}
		);		
	}
	
	function hideNav() {
		jQuery('#side-nav').hide();
		jQuery(currentElement).removeClass('tophover');
	}
	
	function getCssValue(e,prop) {
		 num = parseInt(jQuery(e).css(prop), 10);
		 if (isNaN(num)) return 0;
		 return num;
	}
	
	var navTimer;
	jQuery(document).ready(function() {
		jQuery('#left-col a.top').hover(
			function () {
				clearTimeout(navTimer);			
				jQuery('#left-col a.top').removeClass('tophover');
				currentElement = jQuery(this);
				jQuery(this).addClass('tophover');
				var offset = jQuery(this).offset();
				totalWidth = jQuery(this).width();
				totalWidth += getCssValue(this,"paddingLeft");
				totalWidth += getCssValue(this,"paddingRight");
				totalWidth += getCssValue(this,"marginLeft");
				totalWidth += getCssValue(this,"marginRight");	
				showNav(jQuery(this).parent().find('ul').html(),offset.left + totalWidth,offset.top);
  			},
			function () {
				navTimer = setTimeout("hideNav()",200);
				//was 800
  			}
		);
	});

