
/* MENU */

var previous_submenu;
var subsubmenu = "";

/*
*/
function showSubMenu(id)
{
	hideSubMenu(previous_submenu);
	
	if(id == "")
		hideSubSubMenu(subsubmenu);
	
	hideSelects("hidden");
	
	var submenu = document.getElementById(id);
	
	if(submenu != null)
	{
		submenu.style.display = "block";
		
		previous_submenu = id;
	}	
}

/*
*/
function hideSubMenu(id)
{
	var submenu = document.getElementById(id);
	
	hideSelects("visible");
	
	if(submenu != null)
	{
		submenu.style.display = "none";
	}
}

/*
*/
function showSubSubMenu(object, id)
{
	menu = document.getElementById(id);
	
	if(menu != null)
	{
		coords = findXandY(object);
		
		menu.style.display = "block";
		
		if(coords[0] != 0 && coords[1] != 0 && menu.style.left == "" && menu.style.top == "")
		{
			menu.style.left = (coords[0] + 48) + "px";
			menu.style.top  = (coords[1] - 146) + "px";
		}
		
		document.getElementById("a_" + id).style.backgroundColor = "#636d89";
	}
		
	if(subsubmenu != "" && subsubmenu != id)
		hideSubSubMenu(subsubmenu);
	
	subsubmenu = id;
}

/*
*/

function hideSubSubMenu(id)
{
	if(document.getElementById(id) != null)
	{
		document.getElementById(id).style.display = "none";
		document.getElementById("a_" + id).style.backgroundColor = "";
	}
}

/*
*/
function hideSelects(action) 
{ 
	if (action!='visible'){ action = 'hidden'; }
	
	if (navigator.appName.indexOf("MSIE")) 
	{		
		for (var S = 0; S < document.forms.length; S++)
		{
			for (var R = 0; R < document.forms[S].length; R++) 
			{
				if (document.forms[S].elements[R].options) 
				{
					document.forms[S].elements[R].style.visibility = action;
				}
			}
		} 
	}
}

/* IN / UIT KLAPPEN */

/*
*/
function switchTableRow(id)
{	
	var tablerow = document.getElementById("tablerow_" + id);
	var button   = document.getElementById("switchbutton_" + id);
	
	if(tablerow.style.display == ($.browser.msie && $.browser.version == '7.0' ? 'block' : "table-row"))
	{
		tablerow.style.display = "none";
		button.src             = ROOT_PATH + "image/pointer.gif";
	}
	else
	{
		tablerow.style.display = ($.browser.msie && $.browser.version == '7.0' ? 'block' : "table-row");
		button.src             = ROOT_PATH + "image/pointer_turned.gif";			
	}
}


/* VERJAARDAGKALENDER */

var huidige_jarigen = 0;

/*
*/
function toonJarigen(id)
{
	var jarigen     = document.getElementById("jarigen_" + id);
	var dag_jarigen = document.getElementById("dag_" + id);	
	
	if(huidige_jarigen > 0)
		verbergJarigen(huidige_jarigen);
	
	jarigen.style.display = "block";
	dag_jarigen.style.backgroundColor = "#dddddd";
	
	huidige_jarigen = id;
}

/*
*/
function verbergJarigen(id)
{
	var jarigen     = document.getElementById("jarigen_" + id);
	var dag_jarigen = document.getElementById("dag_" + id);	
	
	jarigen.style.display = "none";
	dag_jarigen.style.backgroundColor = "";
}


/* RESIZE WEBSITE */

function resizePage()
{
	var page_obj    = document.getElementById("page");
	var middle_obj  = document.getElementById("middle");
	var content_obj = document.getElementById("content");
	var footer_obj  = document.getElementById("footer");
	
	if(content_obj.clientHeight < document.body.clientHeight - 250)
	{      
	  footer_obj.style.position = "absolute";
	}
	
	/**/
	if(page_obj.clientHeight != 174)
	{
		middle_obj.style.height  = (page_obj.clientHeight - 430);  
		content_obj.style.height = (page_obj.clientHeight - 430);
	}
	else
	{
		middle_obj.style.height  = "100%";
		content_obj.style.height = "100%";
	}
	/**/
}

/* X AND Y POSITION */
	
function findXandY(obj)
{	 
	var curleft = 0;
	var curtop = 0;
		
	if (obj.offsetParent) 
	{
		curleft = obj.offsetLeft;
		curtop  = obj.offsetTop;
		
		while (obj = obj.offsetParent) 
		{
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
	}
	
	return new Array(curleft,curtop);
}
