/* 
menu.js
Script for opening and closing the dropdown menus
Author: Aidan Curran
loosely based on http://www.noupe.com/tutorial/drop-down-menu-jquery-css.html
*/

jQuery(document).ready(function(){  

  /*jQuery("ul.sub-menu").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.sub-menu*)  */
  jQuery("ul#menu-main-menu li").mouseenter(togglemenu); 
  /*jQuery("a.navtitle").removeAttr("href"); */
  
  function togglemenu() {
      //Following events are applied to the subnav itself (moving subnav up and down)  
      jQuery(this).find("ul.sub-menu").slideDown('fast'); //Drop down the subnav on click
      /*jQuery(this).find("span").addClass("subhover");*/

      jQuery(this).mouseleave(function() {  
          jQuery(this).parent().find("ul.sub-menu").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up  
          /*jQuery(this).find("span").removeClass("subhover");*/
      });  
  }  
  
});

