/* js for package: std-layout */



/*-----------------------------------------------------------------------------------------*/
/*      MEGA MENU        */
/*-----------------------------------------------------------------------------------------*/


$(document).ready(function() {

	//$('.MegaMenuContent').show();

/*
	$(".reserve #special-menu li").each(function(){
		
		$(this).mouseover(function(){
			//alert('hallo');
			//alert($(this).parent());
			$(this).find(".MegaMenuContent").show('slow');
		});
		
		$(this).mouseout(function(){
			//alert('hallo');
			//alert($(this).parent());
			$(this).find(".MegaMenuContent").hide('slow');
		});	
		
	});

*/

	$("#main-menu li.MegaMenuLink").each(function(){
	    	
            var distance = 0;
            var time = 25;
            var hideDelay = 10;

            var hideDelayTimer = null;

            var beingShown = false;
            var shown = false;
            var trigger = $('a.MegaMenuLink', this);
            var info = $('.MegaMenuContent', this).css('opacity', 0);

	   //$(this).css('position', 'absolute');
	
		
	
            $([trigger.get(0), info.get(0)]).mouseover(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
		
                if (beingShown || shown) {
                    // don't trigger the animation again
                    return;
                } else {
                    // reset position of info box
                    beingShown = true;
		        trigger.addClass("under");
                    info.css({
                        //top: 0,
                        //left: 0,
                        display: 'block'
                    }).animate({
                        top: '-=' + distance + 'px',
                        opacity: 1
                    }, time, 'swing', function() {
                        beingShown = false;
                        shown = true;
                    });
                }

                return false;
            }).mouseout(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
		
                hideDelayTimer = setTimeout(function () {
                    hideDelayTimer = null;
			trigger.removeClass("under");
                    info.animate({
                        top: '-=' + distance + 'px',
                        opacity: 0
                    }, time, 'swing', function () {
                        shown = false;
                        info.css('display', 'none');
                    });

                }, hideDelay);

                return false;
            });
        });


});

/*-----------------------------------------------------------------------------------------*/
/*              */
/*-----------------------------------------------------------------------------------------*/


