<!--
/*
	Formulieren checker en ETC. 
	---------------------------
*/

function CheckProvincie(Obj){
	document.Menu.submit()
}

function CheckPrijs(Obj)
{
MinLen = document.Menu.WaardeMin.length;
MaxLen = document.Menu.WaardeMax.length;

WaardeMin = document.Menu.WaardeMin.value;
WaardeMax = document.Menu.WaardeMax.value;

ObjChange = Obj.name;

if(WaardeMin >= WaardeMax && ObjChange == 'WaardeMin')
	{
	 for (i = 0; i <= MaxLen; i++)
		{
		 if(document.Menu.WaardeMax[i].value > WaardeMin)
			{
			 document.Menu.WaardeMax[i].selected = true;
			 return false
			}
		}
	}

if( WaardeMax <= WaardeMin && ObjChange == 'WaardeMax')
	{
	 for (i = 0; i < MinLen; i++)
		{
		 if(document.Menu.WaardeMin[i].value < WaardeMax)
			{
			 document.Menu.WaardeMin[i].selected = true;
			}
		}
	}

}

//opener voor locatienet
function OpenVenster()
{
	url = document.all("URL").value;
	newWindow = window.open( url,"","scrollbars=yes,status=yes,resizable=yes,toolbar=yes,width=650,height=450");
}

function SubmitForm()
{
	document.Menu.action = 'index_projecten.asp';
	document.Menu.method = 'get';
	document.Menu.submit()
}

function GoOpvragen()
{
	URL = ("./Inschrijven/OpvragenGegevens.asp");
	window.open(URL,'Aanmeldingsgegevens','status=no,Width=435,Height=175,help=no,scrollbars=no, resizable=no');
}

// inschrijven bestaand
function GoInschrijfBestaand()
{

	if ( document.BestaandForm.Postcode.value.length != 4 || document.BestaandForm.Postcode_2.value.length != 2){
		alert('Postcode a.u.b. volledig invullen.');
		document.BestaandForm.Postcode.focus()
		return false}

	if ( document.BestaandForm.Nummer.value.length < 1){
		alert('Huisnummer a.u.b. invullen.');
		document.BestaandForm.Nummer.focus()
		return false}

	if (CheckCijfers()==false){
		return false}

	if (CheckLetters()==false){
		return false}

	if (GoCheckEmail()==false){
		return false}

}

function CheckCijfers()
{

	ZIP = document.BestaandForm.Postcode.value;

	if (  ZIP.match(/^[0-9]{0,4}$/i) == null ){
		alert("Invoerveld mag alleen cijfers bevatten.");
		document.BestaandForm.Postcode.value = '';
		return false		}

	if(document.BestaandForm.Postcode.value.length == 4){
 			document.BestaandForm.Postcode_2.focus()}

}

function CheckLetters()
{
	ZIP = document.BestaandForm.Postcode_2.value;
		if ( ZIP.match(/^[a-z]{0,2}$/i) == null ){
			alert("Invoerveld mag alleen letters bevatten.");
			document.BestaandForm.Postcode_2.value = '';
			return false}
		else{
			document.BestaandForm.Postcode_2.value = document.BestaandForm.Postcode_2.value.toUpperCase().replace(/([^A-Z])/g,"");}

		if(document.BestaandForm.Postcode_2.value.length == 2){
 			 document.BestaandForm.Nummer.focus();}

}

function CheckCijfersNummer()
{
	Nummer = document.BestaandForm.Nummer.value;
			if (  Nummer.match(/^[0-9]{0,25}$/i) == null ){
				alert("Invoerveld mag alleen cijfers bevatten.");
				document.BestaandForm.Nummer.value = '';
				return false}
}

function GoCheckEmail()
{
checkEmail = document.BestaandForm.Email.value;

	if ( (checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))){
		 alert("E-mail bevat geen geldig E-Mailadres.");
		 document.BestaandForm.Email.value = '';
		 document.BestaandForm.Email.focus()
		 return false}

}



// inschrijven toekomstig
function GoInschrijf()
{

var CheckKeuzeGo =  document.ToeKomstForm.GaVerder.value;

if(CheckKeuzeGo > 1){
	var ZetCounter = 0;
	var Lcount = document.ToeKomstForm.TDPID.length;

	for (i = 0; i < Lcount ; i++)
	{
		if( document.ToeKomstForm.TDPID[i].checked){
			ZetCounter = 1;}
			}

		if(ZetCounter == 0){
			alert('Wilt U een keuze maken waarvoor u zicht wilt inschrijven.');
			return false}
	}


if(CheckKeuzeGo == 1){
	 document.ToeKomstForm.TDPID.checked = true;}
	
if (document.ToeKomstForm.Postcode.value.length != 4 || document.ToeKomstForm.Postcode_2.value.length != 2){
	alert('Postcode a.u.b. volledig invullen.');
	document.ToeKomstForm.Postcode.focus()
	return false}

if ( document.ToeKomstForm.Nummer.value.length < 1){
	alert('Huisnummer a.u.b. invullen.');
	document.ToeKomstForm.Nummer.focus()
	return false}

	
if (toeCheckCijfers()==false){
	return false}

if (toeCheckLetters()==false){
	return false}

if (toeGoCheckEmail()==false){
	return false}

document.ToeKomstForm.submit();
}

function toeCheckCijfers()
{
	ZIP = document.ToeKomstForm.Postcode.value;
			if (  ZIP.match(/^[0-9]{0,4}$/i) == null ){
				alert("Invoerveld mag alleen cijfers bevatten.");
				document.ToeKomstForm.Postcode.value = '';
				return false}

		if(document.ToeKomstForm.Postcode.value.length == 4){
 			 document.ToeKomstForm.Postcode_2.focus();}

}

function toeCheckLetters()
{
	ZIP = document.ToeKomstForm.Postcode_2.value;
		if ( ZIP.match(/^[a-z]{0,2}$/i) == null ){
			alert("Invoerveld mag alleen letters bevatten.");
			document.ToeKomstForm.Postcode_2.value = '';
			return false}
		else{
		document.ToeKomstForm.Postcode_2.value = document.ToeKomstForm.Postcode_2.value.toUpperCase().replace(/([^A-Z])/g,"");}

		if(document.ToeKomstForm.Postcode_2.value.length == 2){
 			 document.ToeKomstForm.Nummer.focus();}
}

function toeCheckCijfersNummer()
{
	Nummer = document.ToeKomstForm.Nummer.value;
			if (  Nummer.match(/^[0-9]{0,25}$/i) == null ){
				alert("Invoerveld mag alleen cijfers bevatten.");
				document.ToeKomstForm.Nummer.value = '';
				return false}
}

function toeGoCheckEmail()
{
checkEmail = document.ToeKomstForm.Email.value;

	if ( (checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) {
		 alert("E-mail bevat geen geldig E-Mailadres.");
		 document.ToeKomstForm.Email.value = '';
		 document.ToeKomstForm.Email.focus()
		return false}
}


// -->
