$(document).ready(function(){
		$(".close").click(function () {$(".popup-bg, .popup").fadeOut("fast");});    
		$(".popopen").click(function () {$(".popup-bg, .popup-wrap, .popup").fadeIn("fast");});  
		$(".back-top").click(function() {
		$("html, body").animate({ scrollTop:0 });
			return false;
		 });


		$(".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");
			});

});

function showAgendaMemo( agendaID )
{
	$.ajax({
	   type: "POST",
	   url: "overzichten/agendadetail.asp",
	   data: "agendaID=" + agendaID + "",
	   success: function(msg)
	   {
			var iScroll = $(document).scrollTop();
		    $(".popup_content").empty();
		    $(".popup_content").prepend(msg);

		    var windows	= getPageSize();
			var body_height = windows[3];
			var body_width = windows[2];
			var bodybackground_height = windows[1];	
			var top_height = (body_height-400)/2;
			var left_width = (body_width-400)/2;

			top_height = top_height+iScroll;
			$(".popup-wrap").each(function ()
			{
				$(this).css("display", "block");
				$(this).css("top", top_height);
			});	
				
			$(".popup-bg").height(windows[1]);
	   }
	 });

	
}


function getPageSize(){
		
		var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = document.body.scrollWidth;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		if (self.innerHeight) {	// all except Explorer
			windowWidth = self.innerWidth;
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}

		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = windowWidth;
		} else {
			pageWidth = xScroll;
		}


		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
		return arrayPageSize;
	}

