/*
 * Name            :  Hidden jQuery Menu for Minimalist Design
 * Author's Name   :  Jeremie Tisseau
 * Site            :  http://web-kreation.com  
 * version         :  0.1 
 * Requires        :  jQuery 1.3.2
 * Date            :  Sept 8th, 2009
 *
 * License         :  Creative Commons Attribution-Share Alike 2.0 France License
 *                    http://creativecommons.org/licenses/by-sa/2.0/fr/
 *                    Feel free to do whatever you'd like with this, just please give credit where credit is do.
 */

// ##################################
//Variables
// YOU CAN EDIT BELOW

var navFadeOutDelay = 3000; // Set delay for drop down to slide down (in ms)
var slideDownDelay = 100; // Set delay for drop down to slide down (in ms)
var jj = jQuery.noConflict();

// DO NOT EDIT BELOW THIS LINE
// ##################################



jj(document).ready(function(){
		
	// Plugin: Delay
	// http://tech.apt.no/2009/04/01/delay-in-jquery/
	(function(jj){
		jQuery.fn.delay = function(millis,callBack){
			var object = jj(this);
			jj.extend(object,{callBack:callBack});
			return window.setTimeout(function() {
				object.callBack();
				return object;
			}, millis);
		}
	})(jQuery);
	

	// Navigation:
	// requires jquery.event.hover-1.0 plugin : http://blog.threedubmedia.com/2008/08/eventspecialhover.html 	
	var nav = {count:0};

	jj("#header .nav-enabled").show(); //hide navigation on page load. 
	jj(function(){
		jj('#header').bind('hover',function(){ // On mouseenter, hide title and show navigation
	        jj("#header .nav-disabled").hide();
	        jj("#header .nav-enabled").fadeIn();
			nav.count += 1;
		}).bind('hoverend',function(){ // On mouseleave, fade out navigation and show title
			var tmp = nav.count;
			  
		});
	});
	
	
	// Drop Down Navigation
	jj("ul.dropdown").parent().addClass("btn"); // hide sub-navigation on page load and adds class to li in topnav
	
	jj("ul.nav li.btn").hover(function() { 
		jj(this).find("ul.dropdown").slideDown(slideDownDelay).show(); //Slide subnav down on mouseenter
	}, function(){
		jj(this).find("ul.dropdown").slideUp(200); //Slide subnav up on mouseleave
	}); 
		

});
