// 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
		$("#menu1").hover(function(){          
		   if (hide) clearTimeout(hide);
            $("#hidden-div1").show();
            // 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-div1").hide();});
			$("#menu1").removeClass("active");
        });
		// Ensures the DIV displays when your mouse moves away from the main nav menu item
        $("#hidden-div1").hover(function(){
            if (hide) clearTimeout(hide);
            $("#menu1").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-div1").hide();});
			$("#hidden-div1").stop().show();
			$("#menu1").removeClass("active");
        });
        
        var hide2 = false;
        // Shows the DIV on hover with a fade in
		$("#menu2").hover(function(){          
		   if (hide2) clearTimeout(hide2);
            $("#hidden-div2").show();
            // 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
			hide2 = setTimeout(function() {$("#hidden-div2").hide();});
			$("#menu2").removeClass("active");
        });
		// Ensures the DIV displays when your mouse moves away from the main nav menu item
        $("#hidden-div2").hover(function(){
            if (hide2) clearTimeout(hide2);
            $("#menu2").addClass("active");
        }, function() {
            // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
			hide2 = setTimeout(function() {$("#hidden-div2").hide();});
			$("#hidden-div2").stop().show();
			$("#menu2").removeClass("active");
        });
        
        
        var hide3 = false;
        // Shows the DIV on hover with a fade in
		$("#menu3").hover(function(){          
		   if (hide2) clearTimeout(hide3);
            $("#hidden-div3").show();
            // 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
			hide3 = setTimeout(function() {$("#hidden-div3").hide();});
			$("#menu3").removeClass("active");
        });
		// Ensures the DIV displays when your mouse moves away from the main nav menu item
        $("#hidden-div3").hover(function(){
            if (hide3) clearTimeout(hide3);
            $("#menu3").addClass("active");
        }, function() {
            // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
			hide3 = setTimeout(function() {$("#hidden-div3").hide();});
			$("#hidden-div3").stop().show();
			$("#menu3").removeClass("active");
        });

        var hide5 = false;
        // Shows the DIV on hover with a fade in
		$("#menu5").hover(function(){          
		   if (hide5) clearTimeout(hide5);
            $("#hidden-div5").show();
            // 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
			hide5 = setTimeout(function() {$("#hidden-div5").hide();});
			$("#menu5").removeClass("active");
        });
		// Ensures the DIV displays when your mouse moves away from the main nav menu item
        $("#hidden-div5").hover(function(){
            if (hide5) clearTimeout(hide5);
            $("#menu5").addClass("active");
        }, function() {
            // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
			hide5 = setTimeout(function() {$("#hidden-div5").hide();});
			$("#hidden-div5").stop().show();
			$("#menu5").removeClass("active");
        });
        
});

