// jDiv - a jQuery plugin
// (c) Skyrocket Labs
// http://www.skyrocketlabs.com
// fred@skyrocketlabs.com
// Created: 10.24.2009
// Last updated: 02.06.2010

// DISPLAYS HIDDEN DIVS AS SUBMENUS ON HOVER

$(document).ready(function() {
        var hide = false;
        // Shows the DIV on hover with a fade in
		$("#cms").hover(function(){          
		   if (hide) clearTimeout(hide);
            $("#hidden-cms").fadeIn();
            // The main nav menu item is assigned the 'active' CSS class
			$(this).addClass("active");
        }, function() {
            // Fades out the DIV and removes the 'active' class from the main nav menu item
			hide = setTimeout(function() {$("#hidden-cms").fadeOut("slow");});
			$("#cms").removeClass("active");
        });
		// Ensures the DIV displays when your mouse moves away from the main nav menu item
        $("#hidden-cms").hover(function(){
            if (hide) clearTimeout(hide);
            $("#cms").addClass("active");
        }, function() {
            // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
			hide = setTimeout(function() {$("#hidden-cms").fadeOut("slow");});
			$("#hidden-cms").stop().fadeIn();
			$("#cms").removeClass("active");
        });
	});

$(document).ready(function() {
        var hide = false;
        // Shows the DIV on hover with a fade in
		$("#vms").hover(function(){          
		   if (hide) clearTimeout(hide);
            $("#hidden-vms").fadeIn();
            // The main nav menu item is assigned the 'active' CSS class
			$(this).addClass("active");
        }, function() {
            // Fades out the DIV and removes the 'active' class from the main nav menu item
			hide = setTimeout(function() {$("#hidden-vms").fadeOut("slow");});
			$("#vms").removeClass("active");
        });
		// Ensures the DIV displays when your mouse moves away from the main nav menu item
        $("#hidden-vms").hover(function(){
            if (hide) clearTimeout(hide);
            $("#vms").addClass("active");
        }, function() {
            // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
			hide = setTimeout(function() {$("#hidden-vms").fadeOut("slow");});
			$("#hidden-vms").stop().fadeIn();
			$("#vms").removeClass("active");
        });
	});
