	
	
	/*
	JS
	--------------------------------------------------------------------------------------------
	@site				sho.com (v5)
	@package		core
	@file				NavUIHelp.js
	@author			dpaul
	@modified		10.13.08	
	@desc				Adds support for IE6 to global navigaton.
	@note				Added an elapsed time check on rolloff in level 3, if too soon it's ignored.
	
	/* =:NavUIHelp
	--------------------------------------------------------------------------------------------*/
	if( typeof SHO == "undefined" ) SHO = new Object();
	
	SHO.NavUIHelp = function()
	{	
		var _elapsed = 0;
		var _activeL3;
		
		/* =:Startup
		  ----------------------------------------------------------------------------------------*/	 
		function init ()
		{
			// quit if not IE6
			if( navigator.userAgent.indexOf( 'MSIE 6.0;' ) == -1 || !$('nav-sho')){ return; }
		
			// sudden death round! remove problematic subnav
			if($('nav-sho').select('#series-sub').length > 0 ){ 
				$('nav-sho').select('#series-sub')[0].remove();
			}
			
			$$('#nav-sho > ul > li').concat( $$('#nav-sho > ul > li > ul > li.sub' )).each( function(li)
			{ 
				Event.observe(li, 'mouseover', function(e)
				{ 
					var lvl =  li.hasClassName('sub') ? 3 : 2;
					if( lvl == 3){ 
						_activeL3 = li.readAttribute('id'); 
					}
					_toggle(li, 'on', lvl );
				});
				
				Event.observe(li, 'mouseout', function(e){ 
					_toggle(li, 'off', li.hasClassName('sub') ? 3 : 2 );
				});
			});
				
			// patch support for psuedo-selectors
			$$('#nav-sho > ul > li > ul > li:first-child').invoke( 'addClassName', 'FIRST' );
			$$('#nav-sho > ul > li > ul > li:last-child').invoke( 'addClassName', 'LAST' );
		}
		
		/* =:Runtime
		  ----------------------------------------------------------------------------------------*/	 		
		function	 _toggle( li, mode, lvl )
		{
			if( mode == 'on' ){ 
				li.addClassName('OVER');
			}
			if( mode == 'off' ){ 
				if(lvl == 3 && !safe()) return;
				li.removeClassName('OVER'); 
			}
		}
		
		function safe()
		{
			var now = new Date().getSeconds();
			var issafe = Math.abs( _elapsed - now ) > 0.0124 ? true : false;
			_elapsed = now;
			return issafe;
		}
		
		/* =:Reveal as Public
		  ----------------------------------------------------------------------------------------*/	   
		return {
			init:init }
	}();
	
	document.observe("dom:loaded", function() { 
		SHO.NavUIHelp.init();
	});	
	
	
