var t = '';

$(document).ready(function () {

  $('.menuitem').hover(function (e)  {
  
    /*if (t != "") {
      clearTimeout(t);
    }*/

    
    var mid = $(this).attr('id').split("_")[1];
    
    /* vertical */
    var pos = $(this).position();
    
    var mw = $(this).outerWidth();
    
    $('#menu2_'+mid).css("left",pos.left+'px');
    
    $('#menu2_'+mid).css("min-width",mw+'px');
    
    if ($(this).children('a').hasClass('selected')) {
      $('#menu2_'+mid).css("top",pos.top+40+'px');
    }
    else {
      $('#menu2_'+mid).css("top",pos.top+36+'px');
    }
    
    /* end vertical */
    
    if ($('#menu2_'+mid).css("display") == "block") {
          
    }
    else {
      hideMenu();
    }
    
    $('#menu2_'+mid).css("display","block");
    
    /*
    t = setTimeout(function(){
      hideMenu();                                     
    }, 4000); */

    return
  });
  
  $('#container').hover(function (e) {
    return
  },
  function (e) {
    hideMenu(); 
  });
  
  $('.menu2_vert').hover(function (e) {
    return
  },
  function (e) {
    hideMenu(); 
  });
  
  function hideMenu() {
  
    if ($('.menu2').length > 0) {
    
      $('.menu2').css("display","none");
    }
    
    if ($('.menu2_vert').length > 0) {
    
      $('.menu2_vert').css("display","none");
    }    
  
    return
  
  }


});
