/**
 * Sexy Drop Down Menu with CSS & jQuery
 * Tutorial by Soh Tanaka - www.SohTanaka.com
 */
jQuery(document).ready(function($){
    // Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
    $('ul.subnav').parent().append('<span></span>'); 
    // When trigger is hovered...
    $('ul.trigger li span').hover(
        function(){
            // On hover over, add class 'subhover'
            $(this).addClass('subhover'); 
            // Following events are applied to the subnav itself (moving subnav up and down)
            // Drop down the subnav on click
            $(this).parent().find('ul.subnav:first').slideDown('fast').show('slow',
                function(){
                    $(this).height('auto');
                }
            );
            $(this).parent().hover(
                function(){
                },
                function(){	
                    // When the mouse hovers out of the subnav, move it back up
                    $(this).parent().find('ul.subnav').slideUp('fast'); 
                }
            );
		},
		function(){
            // On hover out, remove class 'subhover'
            $(this).removeClass('subhover'); 
        }
    ); 
});

