function doNothing()
{
	//Doe niks.
}

function valForm(theForm)
{
	var perm = true;				//permission to submit the form
	var error = "";					//error report
	var rep = true;					//repeat factor (may be used only 1 time)
	var elements = new Array();		//Elements to compare (e.g. password compare)
	var elements_int = new Array();	//Elements to INT compare (e.g. value compare)
	
	//Loop through all objects of the form
	for(var i = 0; i < theForm.elements.length; i++)
	{
		//Object that are required
		if(theForm.elements[i].getAttribute('req') == "TRUE")
		{
			switch(theForm.elements[i].type)
			{
				case "text":
				case "password":
					if(theForm.elements[i].value == '')
					{
						if(rep == true)
						{
							theForm.elements[i].focus();
							rep = false;
						}
						error += theForm.elements[i].getAttribute('infname') + ' is niet ingevuld\n';
						perm = false;
					}
					break;
				case "checkbox":
					if(theForm.elements[i].checked == false)
					{
						error += theForm.elements[i].getAttribute('infname') + ' is niet aangevinkt\n';
						perm = false;
					}
					break;
				case "select-one":
					if(theForm.elements[i].value == "0" || theForm.elements[i].value == "-1" || theForm.elements[i].value == "false")
					{
						error += theForm.elements[i].getAttribute('infname') + ' is niet geselecteerd\n';
						perm = false;
					}
					break;
			}
		}
		
		//Some standard attributes
		if(theForm.elements[i].getAttribute('minlength'))
		{
			if(theForm.elements[i].value.length < theForm.elements[i].getAttribute('minlength') && theForm.elements[i].style.display == "block")
			{
				error += theForm.elements[i].getAttribute('infname') + ' heeft minder dan 4 karakters\n';
				perm = false;
				if(rep == true)
				{
					theForm.elements[i].focus();
					rep = false;
				}
			}
		}
		
		//Objects that have an exception
		switch(theForm.elements[i].getAttribute('excp'))
		{
			case "mail":
				if(theForm.elements[i].value != '')
				{
					if(rep == true)
					{
						theForm.elements[i].focus();
						rep = false;
					}
					var re = new RegExp("[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}", "");
					if(!re.test(theForm.elements[i].value))
					{
						error += theForm.elements[i].getAttribute('infname') + ': ' + theForm.elements[i].value + ' is een onjuist e-mailadres\n';
						perm = false;
					}
				}
				break;
			case "elmt_compare":
				if(rep == true)
				{
					theForm.elements[i].focus();
					rep = false;
				}
				elements.push(theForm.elements[i].value);
				break;
			case "elmt_compare_int":
				if(rep == true)
				{
					theForm.elements[i].focus();
					rep = false;
				}
				elements_int.push(theForm.elements[i].value);
				break;
		}
		
		//Objects that have a special function
		switch(theForm.elements[i].getAttribute('func'))
		{
			case "check_elmt":
				var checkres = true;
				if(rep == true)
				{
					theForm.elements[i].focus();
					rep = false;
				}
				
				for(var k = 0; k < elements.length; k++)
				{
					var pswd = elements[k];
					for(var p = 0; p < elements.length; p++)
					{
						if(pswd != elements[p] && checkres == true)
						{
							error += 'Vergelijking fout\n';
							perm = false;
							checkres = false;
							break;
						}
					}
				}
				break;
			case "check_elmt_int":
				var checkres = true;
				if(rep == true)
				{
					theForm.elements[i].focus();
					rep = false;
				}
				
				var moet_grootste_zijn = elements_int[1];
				var moet_kleinste_zijn = elements_int[0];
				
				if(moet_kleinste_zijn > moet_grootste_zijn)
				{
					error += theForm.elements[i].getAttribute('infname') + ' is niet de grootste\n';
					perm = false;
				}
				break;
		}
	}
	if(perm)
		return true;
	else
	{
		alert(error);
		return false;
	}
}

function in_array(waarde, thearray)
{
	if(thearray)
	{
		if(typeof(thearray) == "object" && thearray.constructor == Array)
		{
			for(var i = 0; i < thearray.length; i++)
			{
				if(thearray[i] == waarde)
					return true;
			}
			return false;
		}
		else
		{
			alert(thearray + " is geen array!");
			return false;
		}
	}
	else
	{
		alert("Array bestaat niet!");
		return false;
	}
}

function getElementsByClassName(classname)
{
    var a = [];
    var re = new RegExp('(^| )'+classname+'( |$)');
    var els = document.getElementsByTagName("*");
    for(var i=0,j=els.length; i<j; i++)
        if(re.test(els[i].className))a.push(els[i]);
    return a;
}

var WS_EXTERNAL_PAGES = "";
function createWindow(sPage, sWidth, sHeight, sStatus)
{
	var centerWidth = (Math.round(window.screen.width / 2)) - (Math.round(sWidth / 2));
	var centerHeight = (Math.round(window.screen.height / 2)) - (Math.round(sHeight / 2));
	var theWindow = window.open(sPage, null, "height=" + sHeight + ", width=" + sWidth + ", top=" + centerHeight + ", left=" + centerWidth + ", status=" + sStatus + ", toolbar=no, menubar=no, location=no");
	theWindow.focus();
}

function changeRegio(obj)
{
	switch(obj.value)
	{
		case "Amsterdam":
			window.location.href = '?page=regios_amsterdam';
			break;
		case "Bollenstreek":
			window.location.href = '?page=regios_bollenstreek';
		case "Brabant":
			window.location.href = '?page=regios_brabant';
		case "De Kempen":
			window.location.href = '?page=regios_dekempen';
		case "Drechtsteden":
			window.location.href = '?page=regios_drechtstede';
		case "Drenthe":
			window.location.href = '?page=regios_drenthe';
		case "Flevoland":
			window.location.href = '?page=regios_flevoland';
		case "Friesland":
			window.location.href = '?page=regios_friesland';
		case "Gooi":
			window.location.href = '?page=regios_gooi';
		case "Graafschap":
			window.location.href = '?page=regios_graafschap';
		case "Groningen":
			window.location.href = '?page=regios_groningen';
		case "Haaglanden":
			window.location.href = '?page=regios_haaglanden';
		case "Leiden":
			window.location.href = '?page=regios_leiden';	
		case "Limburg":
			window.location.href = '?page=regios_limburg';	
		case "Nijmegen":
			window.location.href = '?page=regios_nijmegen';
		case "Noord Holland Noord":
			window.location.href = '?page=regios_noordhollandn';	
		case "Noord Holland Zuid":
			window.location.href = '?page=regios_noordhollandz';	
		case "Rijn en Gouwe":
			window.location.href = '?page=regios_rijnengouwe';
		case "Rivierenland":
			window.location.href = '?page=regios_rivierenland';
		case "Rotterdam":
			window.location.href = '?page=regios_rotterdam';
		case "Salland":
			window.location.href = '?page=regios_salland';
		case "Stedendriehoek (Apeldoorn, Deventer, Zutphen)":
			window.location.href = '?page=regios_stedendriehoek';	
		case "Twente":
			window.location.href = '?page=regios_twente';	
		case "Utrecht":
			window.location.href = '?page=regios_utrecht';
		case "West Friesland":
			window.location.href = '?page=regios_westfriesland';
		case "Werv Gebied":
			window.location.href = '?page=regios_wervgebied';
		case "Westerkwartier":
			window.location.href = '?page=regios_westerkwartier';
		case "Zeeland":
			window.location.href = '?page=regios_zeeland';
		case "Zwolle":
			window.location.href = '?page=regios_zwolle';
	}
}