	var windowx = null;

	function toggleBorder (objID,color)
	{
		if (document.layers)
		{
			obj = eval("document." + objID);
		}
		
		else if (document.all)
		{
			obj = eval(objID + ".style");
		}
		
		obj.borderColor = color;
	}
	
	function newWindow(boodschap,new_width,new_height)
	{
	 	windowx = window.open(boodschap,"new_Window","directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,left=500,screenX=500,width="+ new_width +",height="+ new_height +"");
	}
	
	function newWindowWait()
	{
		var winleft = (screen.width - 450) / 2;
		var winUp = (screen.height - 300) / 2;
	 	windowx = window.open("../_system/wacht.htm","new_Window","directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,width=450,height=220, left="+winleft+",top="+winUp);
	}
	
	function newWindowWaitSearch()
	{
		var winleft = (screen.width - 450) / 2;
		var winUp = (screen.height - 300) / 2;
	 	windowx = window.open("../_system/wacht_zoek.htm","new_Window","directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,width=450,height=220, left="+winleft+",top="+winUp);
	}
	
	function newWindowClose ()
	{
		if (windowx)
		{windowx.close();}
	}
	
	function BeamTo(sURL)
	{
		if(sURL)
		{
			parent.location.href = sURL;
		}
	}
	
	function BeamToOpener(sURL)
	{
		if(sURL)
		{
			opener.location.href = sURL;
		}
	}
	
	function adaptForm(i,term)
	{
		k = window.opener.document.form.elements[i];
		k.value = unescape(term);
		k.value = k.value.replace("$","'");		
		window.close();
	}
	
	function checkContextQuery(form)
	{
		var intCheckedField = 0;
		for(var j=0;j<form.length;j++)
		{
			
			var k = form.elements[j];
			if((k.name.substring(2, 3) == '1') || (k.name.substring(2, 3) == '2'))
			{
				k.name = k.name.substring(0, 2);
			}
			if(k.type == "radio")
			{
				if(k.checked)
				{
					intCheckedField++;
				}
			}
		}
		if(intCheckedField > 0)
		{
		return true;
		}
		else
		{
			alert("U moet minstens één begrip uit de onderstaande opsomming aanduiden voor het formulier kan worden verstuurd!");
			return false;
		}
	}
	
	function checkComplexQuery(form)
	{
		var value = 0;
		for(var j=0;j<form.length;j++)
		{
			var k = form.elements[j];
			if((k.type == "text"))
				{
					if(k.value != "")
					{
					value = value + 1;
	
					}
				}
		}
		if (value == 0)
		{
			alert("Gelieve minstens één waarde in één van de velden in te vullen a.u.b.");
			return false;
		}
		else
		{
			return true;
		}
	}
	
	
	function checkSimpleQuery(form)
	{
		var value;
		for(var j=0;j<form.length;j++)
		{
			var k = form.elements[j];
			if((k.type == "text"))
				{
					if(k.value != "")
					{
					value = k.value;
	
					}
					else
					{
						alert("Gelieve een waarde in het invulveld 'zoekterm' in te vullen a.u.b.!");
						return false;
					}
				}
		}
		for(var i=0;i<form.length;i++)
		{
			var e = form.elements[i];
			if(e.type == "hidden" && e.value == "")
			{
				e.value = value;				
			}
		}
		return true;
	}
	
	function checkQuery(form)
	{
		var value;
		var boolSendQuery = true;
		var aantalNietIngevuld = 0;
		for(var j=0;j<form.length;j++)
		{
			var k = form.elements[j];

				if((k.id == "verplicht") && (aantalNietIngevuld == 0))
					{
						if(k.value == "")
						{
							var naamVeld = k.name;
							alert("Gelieve een waarde in het invulveld "+naamVeld+" in te vullen a.u.b.!");
							aantalNietIngevuld = 1;
							var boolSendQuery = false;
						}
					}
		}
		return boolSendQuery;
		
	}
	
	function sendQuery (nummer)
	{
		if(checkQuery(document.forms[nummer - 1]))
		{
			document.forms[nummer - 1].submit();
		}
	}
	
	function sendSimpleQuery (form)
	{
		if (checkSimpleQuery(form))
		{
			document.form.submit();
			newWindowWaitSearch();
		}
	}
	
	function sendContextQuery (form)
	{
		if (checkContextQuery (form))
		{
			document.form.submit();
			newWindowWaitSearch();
		}
	}
	
	function sendComplexQuery (form)
	{
		if (checkComplexQuery (form))
		{
			document.form.submit();
			newWindowWaitSearch();
		}
	}
	
	function controlEmail(email)
	{
			if(String(email.indexOf("@")) == "-1")
			{
				alert("Gelieve een correct e-mail adres in te vullen a.u.b.!");
			}

	}
	
	function sendEmail(email)
	{
		if(String(email.indexOf("@")) == "-1")
		{
			alert("Gelieve een correct e-mail adres in te vullen a.u.b.!");
		}
		else
		{
			document.forms[0].submit();
		}
	}
	
	
	
	
