/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

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: doOpen,   // function = onMouseOver callback (REQUIRED)
         timeout: 200,   // number = milliseconds delay before onMouseOut
         out: doClose    // function = onMouseOut callback (REQUIRED)
    };

    var subMenuMutex=0;
    var currentSubMenu=0;

    function doOpen() {
        $('#submenu_'+$(this).attr('id')).stop().show();
        subMenuMutex=0;
    }

    function doClose() {
        if(!subMenuMutex)
        {
           $('#submenu_'+$(this).attr('id')).stop().hide();
        }
        else
        {
            currentSubMenu = $(this).attr('id');
        }
        
    }
    
    $("ul#pages li").hoverIntent(config);

    $(".submenuitem").mouseover(function(){
        
        subMenuMutex =1;
    });

    $("#flashcontent").mouseover(function(){
       
       $('#submenu_'+currentSubMenu).stop().hide();       
    });

});
