// FUNCTIE AANMELDING
var filter = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,4})(\]?)$/; // valid

function controleerloginform(theForm)
{
if (theForm.soort.selectedIndex == 0)
	{
	if(theForm.Voornaam_p.value=='')
	{
	alert('Voornaam invullen a.u.b.');
	theForm.Voornaam_p.focus( );
	return false;
	}
	else if(theForm.Achternaam_p.value=='')
	{
	alert('Achternaam invullen a.u.b.');
	theForm.Achternaam_p.focus( );
	return false;
	}
	else if(theForm.Straat_p.value=='')
	{
	alert('Adres invullen a.u.b.');
	theForm.Straat_p.focus( );
	return false;
	}
	else if(theForm.Nummer_p.value=='')
	{
	alert('Nummer invullen a.u.b.');
	theForm.Nummer_p.focus( );
	return false;
	}
	else if(theForm.Postcode_p.value=='')
	{
	alert('Postcode invullen a.u.b.');
	theForm.Postcode_p.focus( );
	return false;
	}
	else if(theForm.Woonplaats_p.value=='')
	{
	alert('Plaats invullen a.u.b.');
	theForm.Woonplaats_p.focus( );
	return false;
	}
	else if(theForm.telefoon_p.value=='')
	{
	alert('Telefoon invullen a.u.b.');
	theForm.telefoon_p.focus( );
	return false;
	}
	else if(theForm.Emailadres_p.value=='')
	{
	alert('Emailadres invullen a.u.b.');
	theForm.Emailadres_p.focus( );
	return false;
	}
	else if (!filter.test(theForm.Emailadres_p.value))
	{
	alert ("Voer een geldig e-mail adres in.");
	theForm.Emailadres_p.focus();
	return false;
	}
	else if(theForm.Emailadres2_p.value=='')
	{
	alert('Herhaling emailadres invullen a.u.b.');
	theForm.Emailadres2_p.focus( );
	return false;
	}
	else if (!filter.test(theForm.Emailadres2_p.value))
	{
	alert ("Voer een geldig e-mail adres in.");
	theForm.Emailadres2_p.focus();
	return false;
	}
	else if(theForm.Emailadres_p.value != theForm.Emailadres2_p.value)
	{
	alert('Emailadressen  zijn niet hetzelfde.');
	theForm.Emailadres_p.focus( );
	return false;	
	}
	else if(theForm.voorwaarden_p.checked== false)
	{
	alert('Leveringsvoorwaarden accepteren a.u.b.');
	theForm.voorwaarden_p.focus( );
	return false;	
	}
}
if (theForm.soort.selectedIndex == 1)
	{
	if(theForm.bedrijfnaam_t.value=='')
	{
	alert('Bedrijfsnaam invullen a.u.b.');
	theForm.bedrijfnaam_t.focus( );
	return false;
	}
	else if(theForm.btw_t.value=='')
	{
	alert('BTW nummer invullen a.u.b.');
	theForm.btw_t.focus( );
	return false;
	}
	else if(theForm.Voornaam_t.value=='')
	{
	alert('Voornaam invullen a.u.b.');
	theForm.Voornaam_t.focus( );
	return false;
	}
	else if(theForm.Achternaam_t.value=='')
	{
	alert('Achternaam invullen a.u.b.');
	theForm.Achternaam_t.focus( );
	return false;
	}
	else if(theForm.Straat_t.value=='')
	{
	alert('Straat naam invullen a.u.b.');
	theForm.Straat_t.focus( );
	return false;
	}
	else if(theForm.Nummer_t.value=='')
	{
	alert('Nummer invullen a.u.b.');
	theForm.Nummer_t.focus( );
	return false;
	}
	else if(theForm.Postcode_t.value=='')
	{
	alert('Postcode invullen a.u.b.');
	theForm.Postcode_t.focus( );
	return false;
	}
	else if(theForm.Woonplaats_t.value=='')
	{
	alert('Plaats invullen a.u.b.');
	theForm.Woonplaats_t.focus( );
	return false;
	}
	else if(theForm.Telefoon_t.value=='')
	{
	alert('Telefoonnummer invullen a.u.b.');
	theForm.Telefoon_t.focus( );
	return false;
	}
	else if(theForm.Emailadres_t.value=='')
	{
	alert('Emailadres invullen a.u.b.');
	theForm.Emailadres_t.focus( );
	return false;	
	}
	else if(theForm.Emailadres2_t.value=='')
	{
	alert('Emailadres 2 X invullen a.u.b.');
	theForm.Emailadres2_t.focus( );
	return false;	
	}
	else if(theForm.Emailadres_t.value != theForm.Emailadres2_t.value)
	{
	alert('Emailadressen  zijn niet hetzelfde.');
	theForm.Emailadres_t.focus( );
	return false;	
	}
	else if(theForm.voorwaarden_t.checked == false)
	{
	alert('Accepteer de verklaring a.u.b.');
	theForm.voorwaarden_t.focus( );
	return false;	
	}
}

}   

function controleerloginaanvraag(theForm)
{
if (theForm.loginsoort.selectedIndex == 0)
	{
		if(theForm.email_p.value=='')
		{
		alert('Emailadres invullen a.u.b.');
		theForm.email_p.focus( );
		return false;
		}
		else if (!filter.test(theForm.email_p.value))
		{
		alert ("Voer een geldig e-mail adres in.");
		theForm.email_p.focus();
		return false;
		}
	}
if (theForm.loginsoort.selectedIndex == 1)
	{
		if(theForm.email_t.value=='')
		{
		alert('Emailadres invullen a.u.b.');
		theForm.email_t.focus( );
		return false;
		}
		else if (!filter.test(theForm.email_t.value))
		{
		alert ("Voer een geldig e-mail adres in.");
		theForm.email_t.focus();
		return false;
		}
		else if(theForm.btw_t.value=='')
		{
		alert('BTW nummer invullen a.u.b.');
		theForm.btw_t.focus( );
		return false;
		}
	}
}


function controleerverzendform()
{
	if(verzend.verzendmethode[0].checked ==false && verzend.verzendmethode[1].checked ==false)
	{
	alert('Verzendmethode invullen a.u.b.');
	return false;
	}
	else
	{
	verzend.submit( );
	}
}   

function controleerbetaalform()
{
	if(betaal.betaalmethode[0].checked == false && betaal.betaalmethode[1].checked == false && betaal.betaalmethode[2].checked == false)
	{
	alert('betaalmethode invullen a.u.b.');
	return false;
	}
	else
	{
	betaal.submit( );
	}
}   
function showafleveradres( show ) {
	if ( show == false ) {
		document.getElementById('afleveradres').style.display='block';
	} else {
		document.getElementById('afleveradres').style.display='none';
	}
}
function showkaartje( show ) {
	if ( show == false ) {
		document.getElementById('kaartje').style.display='none';
	} else {
		document.getElementById('kaartje').style.display='block';
	}
}

function check_searchform(theForm)
{
		if (theForm.searchquery.value == '')
		{
			alert("Vul een zoekwoord in a.u.b.")
			theForm.searchquery.focus();
			return false;
		}
}
