function validEmail(Emailadres)
{
	invalidChars = " /:,;"

	if (Emailadres == "") 
	{
		return false
	}
	
	for (i=0; i<invalidChars.length; i++) 
	{
		badChar = invalidChars.charAt(i)
		if (Emailadres.indexOf(badChar,0) > -1) 
		{
			return false
		}
	}
	
	atPos = Emailadres.indexOf("@",1)			
	if (atPos == -1) 
	{
		return false
	}
	
	if (Emailadres.indexOf("@",atPos+1) != -1) 
	{
		return false
	}
	periodPos = Emailadres.indexOf(".",atPos)
	if (periodPos == -1) 
	{
		return false
	}
	if (periodPos+3 > Emailadres.length)	
	{
		return false
	}
	return true
}

function CheckIt(Nieuwsbrief) 
{

	if (!validEmail(Nieuwsbrief.Emailadres.value)) 
	{
		alert("Vul een geldig e-mailadres in a.u.b.")
		Nieuwsbrief.Emailadres.focus()
		Nieuwsbrief.Emailadres.select()
		return false
	}
}

function submitIt(Offerte) 
{

	if (Offerte.Naam.value == "") 
	{
		alert("Vul uw achternaam in a.u.b.")
		Offerte.Naam.focus()
		Offerte.Naam.select()
		return false
	}

	if (Offerte.Voorletter.value == "") 
	{
		alert("Vul uw voorletter(s) in.")
		Offerte.Voorletter.focus()
		Offerte.Voorletter.select()
		return false
	}
	
	if (Offerte. Geslacht.value == "") 
	{
		alert("Maak een keuze bij geslacht a.u.b.")
		Offerte.Geslacht.focus()
		return false
	}
	
	if (Offerte. Geboortedatum.value == "") 
	{
		alert("Vul uw geboortedatum in a.u.b.")
		Offerte.Geboortedatum.focus()
		Offerte.Geboortedatum.select()
		return false
	}
	
	if (Offerte.Adres.value == "") 
	{
		alert("Vul uw adres in.")
		Offerte.Adres.focus()
		Offerte.Adres.select()
		return false
	}
	
	if (Offerte.Postcode.value == "")
	 {
		alert("Vul uw postcode in.")
		Offerte.Postcode.focus()
		Offerte.Postcode.select()
		return false
	}
	
	
	if (Offerte.Woonplaats.value == "") 
	{
		alert("Vul uw woonplaats in a.u.b.")
		Offerte.Woonplaats.focus()
		Offerte.Woonplaats.select()
		return false
	}
	
	if (!validEmail(Offerte.Emailadres.value)) 
	{
		alert("Vul een geldig e-mailadres in a.u.b.")
		Offerte.Emailadres.focus()
		Offerte.Emailadres.select()
		return false
	}
	
	if (Offerte. Telefoonnummer.value == "") 
	{
		alert("Vul uw telefoonnummer in a.u.b.")
		Offerte.Telefoonnummer.focus()
		Offerte.Telefoonnummer.select()
		return false
	}
	
	if (Offerte.Nationaliteit.value == "") 
	{
		alert("Vul uw nationaliteit in a.u.b.")
		Offerte.Nationaliteit.focus()
		Offerte.Nationaliteit.select()
		return false
	}
	
	if (Offerte.TypeWoning.value == "") 
	{
		alert("Vul uw type woning in a.u.b.")
		Offerte.TypeWoning.focus()
		return false
	}
	
	if (Offerte.JaarsalarisAanvrager.value == "") 
	{
		alert("Vul uw jaarsalaris in.")
		Offerte. JaarsalarisAanvrager.focus()
		Offerte. JaarsalarisAanvrager.select()
		return false
	}
	
	if (Offerte.DienstverbandAanvrager.value == "") 
	{
		alert("Maak een keuze bij dienstverband a.u.b.")
		Offerte.DienstverbandAanvrager.focus()
		return false
	}
	
	if (Offerte.StatusHypotheek.value == "") 
	{
		alert("Maak een keuze bij status hypotheek a.u.b.")
		Offerte.StatusHypotheek.focus()
		return false
	}
	
	if (Offerte.GewensteHypotheeksom.value == "") 
	{
		alert("Vul een bedrag in bij gewenste hypotheeksom.")
		Offerte.GewensteHypotheeksom.focus()
		Offerte.GewensteHypotheeksom.select()
		return false
	}

	return true
}

function Calculate(Form)
{
	var aanvrager, partner;
	
	if(Form.JaarsalarisAanvrager.value == "")
	{
		alert("Vul een bedrag in bij het jaarsalaris van de aanvrager a.u.b.");
		Form.JaarsalarisAanvrager.select();
		Form.JaarsalarisAanvrager.focus();
	}else
	{
		aanvrager = parseFloat(Form.JaarsalarisAanvrager.value);
		if(Form.JaarsalarisPartner.value == "")
		{
			partner = 0.0;
		}else
		{
			partner = parseFloat(Form.JaarsalarisPartner.value);
		}
		
		alert("Het bedrag van uw maximale hypotheek bedraagt " + ((aanvrager + partner) * 5.5) + " euro.");
	}
	
	return false;
}

function randomfoto()
{
	try{
		var aryimages = new Array('images/lpanel_imghuisjes.jpg', 'images/lpanel_imghuisjes2.jpg', 'images/lpanel_deal.jpg', 'images/lpanel_imghuissnow.jpg');
		links.src = aryimages[Math.floor(Math.random() * aryimages.length)];
	}catch(err){}
	try{
		var aryimages = new Array('images/content_imgbench.jpg', 'images/content_imgwinter.jpg', 'images/content_architecture.jpg', 'images/content_architecture2.jpg', 'images/content_boat-lake.jpg', 'images/content_trees-sky.jpg', 'images/content_lake-sun.jpg');
		rechts.src = aryimages[Math.floor(Math.random() * aryimages.length)];
	}catch(err){}
	try{
		var aryimages = new Array('images/content_imghelpdesk.jpg', 'images/content_imghelpdesk2.jpg');
		helpdesk.src = aryimages[Math.floor(Math.random() * aryimages.length)];
	}catch(err){}
}