﻿/**
*	"Social Evaluator publiekssite"
*	------------------------------------
*	Fier Concept & Design B.V. Utrecht
*   Auteur: GEST
*
*	This file contains mostly UI related javascript functions.
*   Methods rely on the JQuery library.
*	
*/



jQuery(document).ready(function() {
    initMenu();	
});

function initMenu() {
    var timeout = 750;
    var t = false;

    // Show submenu on main menu item hover
    jQuery('.mm-ul .mm-li').hover(function() {
        // Hide all other submenus
        jQuery(this).siblings().find('.sm').hide();
        // Remove all "active" from all other main items
        jQuery(this).siblings().removeClass("hover");
        // Add hover to current item
        jQuery(this).not(".active").addClass("hover");
        
        // Return if there are no submenu items
        if (jQuery(this).find(".sm-li").length == 0) return;
        
        // Show current submenu        
        jQuery(this).find('.sm').show();
        t = jQuery(this).find('.sm').data('timer');
        if (t)
            clearTimeout(t);
    }, function() {
        var elem = jQuery(this).find('.sm');
        var elem2 = jQuery(this);
        t = setTimeout(function() {
            elem.hide(); // hide  submenu('s)	
            elem2.removeClass("hover"); //  remove hover class of main menu item
        }, timeout);
        elem.data('timer', t);
    });

    /*
    // Hover style for mainmenu items    
    jQuery(".mm .mm-li").hover(function() {
    jQuery(this).addClass("hover");
    }, function() {
    jQuery(this).removeClass("hover");
    });

    // Hover style for submenu items
    jQuery(".sm li").hover(function() {
    jQuery(this).addClass("hover");
    }, function() {
    jQuery(this).removeClass("hover");
    });
    */
}

	
