//<script language=Javascript>

function DoPopup (theURL, X, Y){
	var winl = (screen.width - X) / 2;
	var wint = (screen.height - Y) / 2;

	newwin = window.open(theURL,'','width='+X+',top='+wint+',height='+Y+', left='+winl);
	newwin.focus();
}

function DoPopupScroll (theURL, X, Y){
	var winl = (screen.width - X) / 2;
	var wint = (screen.height - Y) / 2;

	newwin = window.open(theURL,'','scrollbars, width='+X+',top='+wint+',height='+Y+', left='+winl);
	newwin.focus();
}

function printSpecial(printReadyElem){
	if (document.getElementById != null)
	{
		var html = "<HTML>\n<HEAD>\n<TITLE>Afdrukken</TITLE>";
			html += "<link REL='StyleSheet' TYPE='Text/CSS' HREF='/system/stylesheets/print.css'>\n";
			html += "\n</HEAD>\n<BODY leftmargin=0 topmargin=0>\n";
		
		
		if(printReadyElem == null){
			var printReadyElem = document.getElementById("printReady");
		}
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html = strReplaceAll(html, "<!--printonly-", "");
		html = strReplaceAll(html, "-printonly-->", "");

		html = strReplaceAll(html, "<!--bannermeldos-->", "<img src='/system/images/bannermeldos.gif'>");
		html = strReplaceAll(html, "<!--bannerslaapstoornissen-->", "<img src='/system/images/bannerslaapstoornissen.gif'>");
		
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Sorry, het maken van de print versie is mislukt. U heeft mogelijk een recentere browser nodig.\nDownload suggesties:\n - www.microsoft.com/ie\n - www.mozilla.org (Netscape gebruikers)");
	}
}

var gAutoPrint = true; // Flag for whether or not to automatically call the print function

function strReplaceAll(str,strFind,strReplace)
{
    var returnStr = str;
    var start = returnStr.indexOf(strFind);
    while (start>=0)
    {
        returnStr = returnStr.substring(0,start) + strReplace + returnStr.substring(start+strFind.length,returnStr.length);
        start = returnStr.indexOf(strFind,start+strReplace.length);
    }
    return returnStr;
}


/*
* Deze functie controleert of er een optie is gekozen met een bepaalde waarde uit een groep radiobuttons 
*/

function checkRadio(ObjectRef){
	var gevonden = 0;
	for (Counter=0; Counter < ObjectRef.length; Counter++){
			if ( ObjectRef[Counter].checked ) {
				gevonden = 1;
				var Waarde = ObjectRef[Counter].value}
	}
	if (gevonden == 1) { return Waarde; } else { return false; }
}


/*
* Deze functie controleert of een tekstveld is ingevuld (lengte groter dan 0) 
*/
function checkText(ObjectRef){
	if (ObjectRef.value.length > 0) { return true; } else { return false; }
}
