  /* -----------------------------------
     drow-down menu
     ----------------------------------- */

$(document).ready(function(){
  $('#quickbar-nav > ul > li').each(function(i) {
    var timeOut;
    if ($('> ul', this).size() > 0) {
      $(this).hover(function(){
        clearTimeout(timeOut);
        $('#quickbar-nav > ul > li > ul').css('display','none');
        $('> ul', this).css('display','block');
        if ($.browser.msie) {
          var $this_ul = $('> ul', this);
          $this_ul.prepend("<iframe></iframe>");
          $('iframe', this).height($this_ul.get(0).offsetHeight + 'px');
        };
      },function(){  // on mouseOut
        var self = this;
        timeOut = setTimeout(function() {
          $('> ul', self).css('display','none');
          if ($.browser.msie) {
            $(self).find('iframe').remove();  
          };
        },300);
      });
    }
  });

  $('#quickbar-nav > ul > li ul > li').each(function(i) {
    var timeOutSub;
    if ($('> ul', this).size() > 0) {
      $('> a', this).addClass('has-subnav');
      $('> a.active', this).removeClass('has-subnav').addClass('active-has-subnav');

      $(this).hover(function(){ //this part is for mouseOver
        clearTimeout(timeOutSub);
        $(this).parent().find('li:not(this) ul').css('display','none');
        $('> ul', this).css({display:'block',visibility:'visible'});
        if ($.browser.msie) {
          var $this_ul = $('> ul', this);
          $this_ul.prepend("<iframe></iframe>");
          $('iframe', this).height($this_ul.get(0).offsetHeight + 'px');
        };
      },function(){ // on mouseOut
        var self = this;
        timeOutSub = setTimeout(function() {
          $('> ul', self).css({display:'none',visibility:'hidden'});
          if ($.browser.msie) {
            $(self).find('iframe').remove();  
          };
        },300); // end setTimeout
      }); // end mouseOut
    } // end if
  }); // end .each
}); // end document ready
