
(function($){
  '$:nomunge';
  
  var cache = {},
    

    doTimeout = 'doTimeout',
    

    aps = Array.prototype.slice;
  
 
  $[doTimeout] = function() {
    return p_doTimeout.apply( window, [ 0 ].concat( aps.call( arguments ) ) );
  };
  
  $.fn[doTimeout] = function() {
    var args = aps.call( arguments ),
      result = p_doTimeout.apply( this, [ doTimeout + args[0] ].concat( args ) );
    
    return typeof args[0] === 'number' || typeof args[1] === 'number'
      ? this
      : result;
  };
  
  function p_doTimeout( jquery_data_key ) {
    var that = this,
      elem,
      data = {},
      
      method_base = jquery_data_key ? $.fn : $,
      
      args = arguments,
      slice_args = 4,
      
      id        = args[1],
      delay     = args[2],
      callback  = args[3];
    
    if ( typeof id !== 'string' ) {
      slice_args--;
      
      id        = jquery_data_key = 0;
      delay     = args[1];
      callback  = args[2];
    }
    
    if ( jquery_data_key ) {
      

      elem = that.eq(0);
      elem.data( jquery_data_key, data = elem.data( jquery_data_key ) || {} );
      
    } else if ( id ) {

      data = cache[ id ] || ( cache[ id ] = {} );
    }
    
    data.id && clearTimeout( data.id );
    delete data.id;
    

    function cleanup() {
      if ( jquery_data_key ) {
        elem.removeData( jquery_data_key );
      } else if ( id ) {
        delete cache[ id ];
      }
    };
    
    function actually_setTimeout() {
      data.id = setTimeout( function(){ data.fn(); }, delay );
    };
    
    if ( callback ) {

      data.fn = function( no_polling_loop ) {

        if ( typeof callback === 'string' ) {
          callback = method_base[ callback ];
        }
        
        callback.apply( that, aps.call( args, slice_args ) ) === true && !no_polling_loop

          ? actually_setTimeout()
          
          : cleanup();
      };
      
      actually_setTimeout();
      
    } else if ( data.fn ) {

      delay === undefined ? cleanup() : data.fn( delay === false );
      return true;
      
    } else {

      cleanup();
    }
    
  };
  
})(jQuery);

 jQuery(document).ready(function() {
 
	var navVersion = navigator.userAgent.match(/MSIE \d\.\d+/) 
	if (navVersion == 'MSIE 7.0' || navVersion == 'MSIE 7.1') {
		$('#startCat li:has(ul)').each(function(){
			var hovered = $(this);

		hovered
			.mouseover(function(e){
			  hovered.doTimeout('main-nav', 450, over, e.target);
			}).mouseout(function(){
			  hovered.doTimeout('main-nav', 450, out);
			});
	  
			function over(elem) {
				hovered.addClass('on-top').find('#hiddenCat').show();
				return false;
			};
		  
			function out(elem) {
				hovered.removeClass('on-top').find('#hiddenCat').hide(0);
			};
		});
	}
	
	else {
	
			$('#startCat li:has(ul)').each(function(){
			var hovered = $(this);

		hovered
			.mouseover(function(e){
			  hovered.doTimeout( 'main-nav', 400, over, e.target );
			}).mouseout(function(){
			  hovered.doTimeout( 'main-nav', 400, out );
			});
	  
			function over(elem) {
				hovered.find('#hiddenCat').show();
			};
		  
			function out(elem) {
				hovered.find('#hiddenCat').hide();
			};
		});
	}
});
