//var debug = false; // Op false zetten als we in productie gaan.
var valueStatusbar = ""; // Bevat de oude waarde van de statusbar, ivm reset.

//if(debug)
//{
//	alert("default.js");
//}

// Standaard instellingen voor alle pagina's.
function init()
{
	changeStatusbar(MSG_DEFAULT_STATUSBAR, false);
	return false;
}

// Standaard popup laten zien. De popup wordt automatisch gecentreerd.
function popupWindow(url, width, height)
{
	var defaultWidth = 300;
	var defaultHeight = 300;

	if(width == "")
	{
		width = defaultWidth;
	}

	if(height == "")
	{
		height = defaultHeight;
	}

	var options = "width=" + width + ",height=" + height + ",scrollbars=no,toolbar=no,directories=no,location=no,menubar=no,resizable=yes,status=no";
	var windowResult = window.open(url, "", options);

	if(windowResult != null)
	{
		if(windowResult.screen)
		{
			var x = (screen.availWidth-width)/2;
			var y = (screen.availHeight-height)/2;

			windowResult.moveTo(x, y);
		}

		windowResult.focus();

		//return false;
	}

	return windowResult;
}


function popupModalWindow(url, param, width, height)
{
	var defaultWidth = 300;
	var defaultHeight = 300;

	if(width == "")
	{
		width = defaultWidth;
	}

	if(height == "")
	{
		height = defaultHeight;
	}

	var options = "dialogHeight:" + height + "px; dialogWidth:" + width + "px; center:yes; help:no; resizable:no; scroll:no; status:no";
	var windowResult = window.showModalDialog(url, param, options);

	// ALEX: Als dit gedeelte aan staat, dan gaat het fout met het teruggeven
	// van de windowResult!!
	// Hier moet nog naar gekeken worden. Tot op heden worden de ModalDialogs
	// automatisch gecentreerd.

	//if(windowResult != null)
	//{
		//if(windowResult.screen)
		//{
			//var x = (screen.availWidth-width)/2;
			//var y = (screen.availHeight-height)/2;

			//windowResult.moveTo(x, y);
		//}

		//windowResult.focus();

		//return false;
	//}

	return windowResult;



	//var returnValue = new Object();
	//var defaultOptions = "dialogHeight:" + Height + "px; dialogWidth:" + Width + "px; center:yes; help:no; resizable:no; scroll:no; status:no";

	// Controle of er een pagina is ingesteld
	//if(Page == null)
	//{
		//alert("Dialog error! Page value cannot be empty!");
	//}
	//else
	//{
		//returnValue = window.showModalDialog(Page, window, defaultOptions);
		// window.open(Page, 'window');
	//}
}

//OUD, NOG WEG HALEN!!! ALEX!!
function showPopup(Page, Width, Height)
{
	var returnValue = new Object();
	var defaultOptions = "dialogHeight:" + Height + "px; dialogWidth:" + Width + "px; center:yes; help:no; resizable:no; scroll:no; status:no";

	// Controle of er een pagina is ingesteld
	if(Page == null)
	{
		alert("Dialog error! Page value cannot be empty!");
	}
	else
	{
		returnValue = window.showModalDialog(Page, window, defaultOptions);
		// window.open(Page, 'window');
	}
}

// Statusbar
// reset=false. De melding blijft net zo lang staan totdat de pagina wordt ververst
// of dat de functie opnieuw wordt aangeroepen.
// reset=true. De melding blijft even staan, waarna de oude melding automatisch
// wordt hersteld.
function changeStatusbar(msg, reset)
{
	var statusbar = document.getElementById("statusbar");

	if(statusbar != null)
	{
		if(reset)
		{
			valueStatusbar = statusbar.innerText;
			setTimeout(resetStatusbar, 5000);
		}

		statusbar.innerText = msg;

		return false;
	}

	return false;
}

// Statusbar
function resetStatusbar()
{
	var statusbar = document.getElementById("statusbar");

	if(statusbar != null)
	{
		statusbar.innerText = valueStatusbar;

		return false;
	}

	return false;
}




function Help(page)
{
	alert("Help is nog niet beschikbaar! (" + page + ")");	
}


// HIER NOG NAAR KIJKEN!!!


function buttonHelp(Page)
{
	alert("De help functie voor de pagina '" + Page + "' is momenteel niet beschikbaar. Onze excuus voor het ongemak.");
}