jQuery(document).ready(function() {
	
	$("#menu li").hover(function() {
		$(this).find('a:first').addClass('hover');
	},function() {
		$(this).find('a:first').removeClass('hover');
	});
	$("#menu li.dropdown").hover(function() {
		if ($(this).find('.submenu_box').is(':hidden')) {
			$(this).find('.submenu_box').show();
			var pos = $(this).offset();
			$(this).find('.submenu_box').css({
				top: (pos.top+27) + "px",
				position: 'absolute'
			});
		}
	},function() {
		if ($(this).find('.submenu_box').is(':visible')) {
			$(this).find('.submenu_box').hide();
		}
	});
	
	$('#sendmail').submit(function() {
		$.ajax({
			url: $(this).attr('action'),
			type: $(this).attr('method'),
			data: $(this).serialize(),
			success: function(response) {
				alert(response);
			}
		});
		return false;
	});
	
	$('div.eventproduktion div.section').hover(function() {
		$(this).addClass('hover');
	},function() {
		$(this).removeClass('hover');
	});
	$('div.eventproduktion div.section').click(function() {
		location.href=$(this).find('a').attr('href');
	});
	
	/*
	$(".nav a")
        .mouseover(function() { 
        
        	var menuId = jQuery(this).attr("id");
        	if ($(this).hasClass("dropdown") && $(".nav #sub"+menuId).is(":visible")) {
        	} else {
						$(this).addClass("hover");
					}
					
					if ($(this).hasClass("dropdown")) {
					
						if (jQuery(".nav #sub"+menuId).length) {
						
						if (jQuery(".nav #sub"+menuId).is(":hidden")) {
					
						var pos = jQuery("#"+menuId).offset();
						var width = jQuery("#"+menuId).width();
						jQuery(".submenu_box").hide();
						jQuery("#sub"+menuId).css({
							top: (pos.top+27) + "px",
							left: pos.left + "px"
						});
						jQuery("#sub"+menuId).show();
						
						jQuery(document).click(function() {
							jQuery(".submenu_box").hide();
							$("#menu_07").removeClass("hover");
							$("#menu_08").removeClass("hover");
						});
						
						} else {
						
						jQuery("#sub"+menuId).hide();
					
						}
					
						}
					}
					
        })
        .mouseout(function() {
        
        	var menuId = jQuery(this).attr("id");
					if ($(this).hasClass("dropdown") && $(".nav #sub"+menuId).is(":visible")) {
					} else {
						$(this).removeClass("hover");
					}
					
					
					
        })
        .click(function() {
        	if ($(this).hasClass("dropdown")) {
        		var menuId = jQuery(this).attr("id");
					
						if (jQuery(".nav #sub"+menuId).length) {
						
							if (jQuery(".nav #sub"+menuId).is(":hidden")) {
						
								var pos = jQuery("#"+menuId).position();
								var width = jQuery("#"+menuId).width();
								jQuery(".submenu_box").hide();
								jQuery("#sub"+menuId).css({
									top: (pos.top+27) + "px",
									left: pos.left + "px"
								});
								jQuery("#sub"+menuId).slideDown("fast");
								
								jQuery(document).click(function() {
									jQuery(".submenu_box").hide();
									$("#menu_07").removeClass("hover");
									$("#menu_08").removeClass("hover");
								});
						
							} else {
							
								jQuery("#sub"+menuId).slideUp("fast");
						
							}
	
							return false;
					
						}
					}
				});
				
		
	$(".aktuellt-content").hover(function() {
		$(this).addClass("hover");
	},function() {
		$(this).removeClass("hover");
	});*/

});
