(function($){
	$(document).ready(function(){		
		
		function addMega(){ $(this).children('.dropdown').slideDown("fast"); $(this).addClass('hover'); }
	    function removeMega(){ $(this).children('.dropdown').slideUp("fast"); $(this).removeClass('hover'); }
		var megaConfig = {
			 interval: 75,
			 sensitivity: 4,
			 over: addMega,
			 timeout: 450,
			 out: removeMega
		};
		
$("#megamenu > li > a").hover(
			function () { 
				$("#megamenu li .dropdown").not( $(this).parent().children(".dropdown")).hide(); 
				$("#megamenu li").not( $(this).parent()).removeClass('hover');
			}, function () { }
		);

    	$("#megamenu li").hoverIntent(megaConfig);
	
		$("#country-select > a").click( function() {
			if( $('#country-select').hasClass('expanded') ) {
				$('#country-select').removeClass('expanded');
				$('#country-select ul').slideUp("fast");
			}
			else {
				$('#country-select ul').slideDown("fast");
				$('#country-select').addClass('expanded');
			}
		});
	});
})(jQuery);
