$(document).ready(function(){




// global menu

	$(".menu ul li:first").addClass('home-button');


	$(".menu ul li").hover(function()
		{
		$(this).children("ul").show();
		},function()
		{
		$(this).children("ul").fadeOut('fast');
		}
	);
	


	// higlight parent of submenu
	$(".menu ul ul").hover(function()
		{
		$(this).parent("li").addClass('current_rollover_parent');
		},function()
		{
		$(this).parent("li").removeClass('current_rollover_parent');
		}
	);




	// disable the top menu items and get the href of the first child element
	$('.menu ul li.page-item-348 a').not('.menu ul li.page-item-348 ul a').click(function(event)
		{
		event.preventDefault();
		window.location = $(this).next('ul').find('a').attr('href');
		}
	);
	$('.menu ul li.page-item-354 a').not('.menu ul li.page-item-354 ul a').click(function(event)
		{
		event.preventDefault();
		window.location = $(this).next('ul').find('a').attr('href');
		}
	);
	$('.menu ul li.page-item-379 a').not('.menu ul li.page-item-379 ul a').click(function(event)
		{
		event.preventDefault();
		window.location = $(this).next('ul').find('a').attr('href');
		}
	);
	





// frontpage-carousel

	$('#frontpage-carousel').cycle(
		{ 
    	fx:			"fade", 
    	speed:		1000, 
    	timeout:	5500,
		pause:		1,
		random:		1
		}
	);	
//	$('.frontpage-carousel-item').hover(function()
//		{
//		$(this).find('.more-info').stop(true, true).fadeIn();
//		}, function()
//		{
//		$(this).find('.more-info').stop(true, true).fadeOut();
//		}
//	);
	
	
	
	
// telefoonnummer
	
	$('#footer a.telefoonnummerBttn').click(function(event)
		{
		event.preventDefault();
		$('#telefoonnummer').animate({opacity: 'toggle'}, 'fast');
		}
	);
	$('#telefoonnummerCloseBttn a').click(function(event)
		{
		event.preventDefault();
		$('#telefoonnummer').animate({opacity: 'toggle'}, 'fast');
		}
	);


	// center the div
	$("#telefoonnummer").css({left: $(window).width()/2-425});
	// center the content while the user resizes the window
	$(window).resize(function()
		{
		$('#telefoonnummer').css({left: $(window).width()/2-425});
		}
	);


	$('#telefoonnummerCloseBttn a').css({ opacity: '0.3' });
	$('#telefoonnummerCloseBttn a').hover(function()
		{
		$(this).css({ opacity: '1'});
		}, function()
		{
		$(this).css({ opacity: '0.3'});
		}
	);






	
	
	
//google map contact page

	$('a#map-open-button').click(function(event)
		{
		event.preventDefault();
		if ($(this).data('currentState'))
			{
			$('#map').animate({opacity: 'toggle'}, 'fast');
			$(this).data('currentState', false); 
			} else {
			$('#map').css({ display: 'none' });
			$('#map').css({ top: '0' });
			$('#map').animate({opacity: 'toggle'}, 'fast');
			$(this).data('currentState', true);
			}
		}
	);
	$('#map-close-button a').click(function(event)
		{
		event.preventDefault();
		$('#map').animate({opacity: 'toggle'}, 'fast');
		$('#overlay').remove();			
		}
	);
	
		

	
	
	
	
});