﻿//helper functions

function stop(e) {
	if (!e) e = window.event;
	(e.stopPropagation) ? e.stopPropagation() : e.cancelBubble = true;
	(e.preventDefault) ? e.preventDefault() : e.returnValue = false;
	return false;
}

function prevDef(e) {
	if (!e) e = window.event;
	(e.preventDefault) ? e.preventDefault() : e.returnValue = false;
	return false;
}    

function log(message) {
	if (typeof console != 'undefined' && typeof console.log != 'undefined') {
		console.log(message);
	}
};

$(document).ready(function () {

	//Remove noJs bodyclass
	$("body").removeClass("noJs").addClass("activeJs");
	//start slideShow
	
	
		//dropdown
    $("#subnav li").hover(function(){    
        $(this).addClass("hover");
        $('ul:first',this).css('visibility', 'visible');    
    }, function(){    
        $(this).removeClass("hover");
        $('ul:first',this).css('visibility', 'hidden');    
    });
    $("#subnav li ul li:has(ul)").find("a:first").append(" &raquo; ");
		

});



$(function() {
    var delay = 400;
    
    function hideMenu() {
        if (!$('.custom_button').data('in') && !$('.hover_menu').data('in') && !$('.hover_menu').data('hidden')) {
            $('.hover_menu').fadeOut('fast');
            $('.custom_button').removeClass('active');
            $('.hover_menu').data('hidden', true);
        }
    }
    
    $('.custom_button, .hover_menu').mouseenter(function() {
        $('.hover_menu').fadeIn('fast');
        $('.custom_button').addClass('active');
        $(this).data('in', true);
        $('.hover_menu').data('hidden', false);
    }).mouseleave(function() {
        $(this).data('in', false);
        setTimeout(hideMenu, delay);
    });    
    
});




    
