$(document).ready(function()
	{
		$('.box .top').hover (
			function() {
				$(this).find('.contentheader').show();
			});
		$('.box .top .contentheader').click (function() {
			$(this).closest('.box').find('.contentlogin').toggle();
		});
		$(".hoofditem").hover(
		 	function()
			{
			  $(this).addClass("hoofditem_hover");
			},

			function()
			{
			  $(this).removeClass("hoofditem_hover");
			});  	
		
		  $('.hoofitem_content').hide();	
		  
		  $.each($(".visited"),function()
			{
			 	$(this).css("display", "block");	
			});

		  $('.hoofditem').click(
		  		function()
				{	
					$.each($(".icon"),function()
					{
					 	$(this).children(".icon").removeClass("icon2");
					});
					
					if($(this).next(".hoofitem_content").css("display") == 'block')
					{
						$(this).children(".icon").removeClass("icon2");
						$(this).next().slideUp("slow");						
					}
					else
					{	
						$.each($(".icon"),function()
						{
							$(this).removeClass("icon2");
						});
						$.each($(".hoofitem_content"), function()
							{
							 	$(this).hide();
							});
						$(this).children(".icon").addClass("icon2");
						$(this).next().slideDown("slow");
						$(this).next().css("display", "block");
					}				
				}
			);

			$(".hoofitem_content li").hover(
		 	function()
			{
			  $(this).addClass("hoofitem_content_hover");
			},

			function()
			{
			  $(this).removeClass("hoofitem_content_hover");
			});
			
			$.get("opmaak/agenda.asp", function(data){
		  
				$("#agenda_block").append(data);

			});
			$.get("overzichten/kalender.asp", function(data){
		  
				$("#kalender").append(data);

			});
		
			showStartNewsFlash();

			 var dotCounter = 0;
			
			 var intId = setInterval(showNewsItem,7000);
				
			function showNewsItem()
			{
				if (dotCounter < 4)
				{
					var counter = 0;
					$(".nieuwsflash_left_block").each(function ()
					{
						if (counter == dotCounter)
						{
							$(".nieuwsflash_left_block").hide();
							$(this).show();
						}
						counter++;
					});

					
					dotCounter++;
				}
				else
				{
					$(".nieuwsflash_left_block").hide();
					$(".nieuwsflash_left_block:first").show();
					dotCounter = 0;
				}
				
			}
				
			$(".nieuwsflash_right_block").click( function()
			{
				var numMessageShow = $(this).find(".numMessage").val();
				
				$(".nieuwsflash_left_block").hide();
				
				var counter = 0;
				$(".nieuwsflash_left_block").each(function ()
				{
					if (counter == numMessageShow)
					{
						$(this).show();
					}
					counter++;
				});

			});

});

function addJA()
{
	$("#news_header_title").append("JA");
}

function showStartNewsFlash() 
{
	var counter = 0;

	$(".nieuwsflash_right_block").each(function ()
	{
		$(this).append('<input type="hidden" class="numMessage" value="' + counter + '" />');
		
		counter++;
	});

	var counter = 0;
	$(".nieuwsflash_left_block").each(function ()
	{
		if (counter > 0)
		{
			$(this).hide();
		}

		counter++;	
	});
}

function getMonth( maand, jaar )
{
	 $.ajax({
	   type: "POST",
	   url: "opmaak/agenda.asp",
	   data: "maand=" + maand + "&jaar=" + jaar + "",
	   success: function(msg){
		   $("#agenda_block").empty();
		   $("#agenda_block").append(msg);
	   }
	 });

}
function getMonth2( maand, jaar )
{
	 $.ajax({
	   type: "POST",
	   url: "overzichten/kalender.asp",
	   data: "maand=" + maand + "&jaar=" + jaar + "",
	   success: function(msg){
		   $("#kalender").empty();
		   $("#kalender").append(msg);
	   }
	 });

}

function hover( variable ) 
{

	var omschrijving	=	$(variable).children(".agenda_omschrijving").text();
	
	//Empty Div
	$(variable).children(".tooltip").empty();
	//Fill Div With Value
	$(variable).children(".tooltip").append(omschrijving);
	//Show Div
	$(variable).children(".tooltip").show();
}

function hoverout( variable )
{
	//Hide Div
	$(variable).children(".tooltip").hide();
	//Empty Div
	$(variable).children(".tooltip").empty();
}
