var J = jQuery.noConflict();  

J.fn.droppy = function() {
  this.each(function() {
    
    var root = this, zIndex = 1000;
    J('ul', this).hide();
    J('ul', this).css("opacity", "0.9");
    function getSubnav(ele) {
      if (ele.nodeName.toLowerCase() == 'li') {
        var subnav = J('> ul', ele);
        return subnav.length ? subnav[0] : null;
      } else {
        return ele;
      }
    }
    
    function getActuator(ele) {
      if (ele.nodeName.toLowerCase() == 'ul') {
        return J(ele).parents('li')[0];
      } else {
        return ele;
      }
    }
    
    function hide() {
      var subnav = getSubnav(this);
      if (!subnav) return;
      J.data(subnav, 'cancelHide', false);
      setTimeout(function() {
        if (!J.data(subnav, 'cancelHide')) {
          J(subnav).slideUp('fast');
        }
      }, 100);
    }
  
    function show() {
      var subnav = getSubnav(this);
      if (!subnav) return;
      J.data(subnav, 'cancelHide', true);
      /*setTimeout(function() {*/
         J(subnav).css({zIndex: zIndex++}).slideDown('fast');
      /*}, 500);*/
      if (this.nodeName.toLowerCase() == 'ul') {
        J(getActuator(this)).addClass('hover');
      }
    }
    
    J('ul, li', this).hover(show, hide);
    J('li', this).hover(
      function() { J(this).addClass('hover'); },
      function() { J(this).removeClass('hover'); }
    );
    
  });
};


     J(function() {
         J('#v2_pulldownmenu').droppy();
         J('#v2_allInAClicMenu').droppy();
     });
