jQuery(document).ready(function(){

    var config = {
     sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)
     interval: 200, // number = milliseconds for onMouseOver polling interval
     over: inOut, // function = onMouseOver callback (REQUIRED)
     timeout: 500, // number = milliseconds delay before onMouseOut
     out: out // function = onMouseOut callback (REQUIRED)
};

    jQuery('#mainlevel_mainMenu > li:not(:last)').addClass('hasSep');

    // wipe out any hrefs on main menu items, if JS is disabled, they should link to the page
    jQuery('#mainlevel_mainMenu > li:has(ul) > a').attr('href','javascript:void(0)');
    //jQuery('#mainlevel_mainMenu > li > a').hoverIntent(config);
    jQuery('#mainlevel_mainMenu > li:has(ul) > a').toggle(inOut,out);
    jQuery('.open > a').attr('href','javascript:void(0)').live('click',function(){ inOut();return false; }); //click to close
    jQuery('body').click(function(){ inOut(); });
});


    function inOut(){
        // sort out what gets opened or closed
        jQuery('#mainlevel_mainMenu ul').addClass('close');
        if (jQuery(this).parent().find('ul').length > 0){
            jQuery(this).parent().addClass('open').find('ul').removeClass('close').addClass('open');
        }
        // do it
        jQuery('#mainlevel_mainMenu ul.close').slideUp().removeClass('open').parent().removeClass('open').prev().addClass('hasSep');

        if (jQuery('#mainlevel_mainMenu ul.open').css('display')=='none'){
            jQuery('#mainlevel_mainMenu ul.open').slideDown().removeClass('open');
            jQuery('#mainlevel_mainMenu li.open').prev().removeClass('hasSep');
        } else {
            jQuery('#mainlevel_mainMenu li.open').prev().addClass('hasSep');
            jQuery('#mainlevel_mainMenu ul.open').slideUp().removeClass('open').parent().removeClass('open');
        }
    }
    function out(){};


