// 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

function dropdown( id, hiddenid, hide ) {
	// Shows the DIV on hover with a fade in
	$("#" + id).hover(function(){        
		   if (hide) clearTimeout(hide);
		   $("#" + hiddenid).stop(false, true).slideDown();
         // The main nav menu item is assigned the 'active' CSS class
			$(this).addClass("current");
     }, function() {
         // Fades out the DIV and removes the 'active' class from the main nav menu item
			hide = setTimeout(function() {$("#" + hiddenid).stop(false, true).slideUp("fast");});
			$("#" + id).removeClass("current");
     });
		// Ensures the DIV displays when your mouse moves away from the main nav menu item
	$("#" + hiddenid).hover(function(){
         if (hide) clearTimeout(hide);
         $("#" + id).addClass("current");
     }, function() {
         // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
			hide = setTimeout(function() {$("#" + hiddenid).slideUp("fast");});
			$("#" + hiddenid).stop(false, true).fadeIn();
			$("#" + id).removeClass("current");
     });
}

$(document).ready(function() {

        var hide1 = Object(false);
        var hide2 = Object(false);
        
		dropdown("wines-menu", "wine-hidden-div", hide2);
		dropdown("menu1", "hidden-div", hide1);

	});
