// JavaScript Document

var winEnquete = null;

function enquete()
{
	if ( !winEnquete || winEnquete.closed )
	{
		winEnquete = window.open("/enquete/enquete.php", "lifwebenquete", "width=644,height=600,resizable=yes,scrollbars=yes,location=no,menubar=no,status=no,toolbar=no");
		winEnquete.focus();
	}
}

function enquete2()
{
	if ( !winEnquete || winEnquete.closed )
	{
		winEnquete = window.open("/enquete/enquete2.php", "lifnbenquete", "width=644,height=550,resizable=yes,scrollbars=yes,location=no,menubar=no,status=no,toolbar=no");
		winEnquete.focus();
	}
}

function aonclick()
{
	/*
	var a = document.body.getElementsByTagName("A");
	for ( var i = 0; i < a.length; ++i )
		a[i].onclick = enquete2;
	*/
}

function checkEmail( veld ) {
	//kijk naar formaat: name@site.nl
	var objRegExp  = /^([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])$/;
	if( veld.value==null || veld.value == "" )
		return false;
	else if( objRegExp.test(veld.value)==false) {
		veld.focus();
		veld.value = "";
		alert("Ingevoerde e-mail is ongeldig.\nProbeer het nog een keer");
		return false;
	}
	else
		return true;
}

function submitPage() {
	
	var string = "";

	if ( document.abo.voornaam.value == "" )
		string += "\n - Voornaam";
	if ( document.abo.achternaam.value == "" )
		string += "\n - Achternaam";
	/*
	if ( !document.abo.geboren_d.selectedIndex || !document.abo.geboren_m.selectedIndex || !document.abo.geboren_j.selectedIndex )
		string += "\n - Geboortedatum";
	*/
	if ( !document.abo.betaalwijze.selectedIndex )
		string += "\n - Betaalwijze";
	if ( document.abo.rekeningnr.value == "" )
		string += "\n - Rekeningnummer";
	if ( document.abo.straat.value == "" )
		string += "\n - Straat";
	if ( document. abo.huisnr.value == "" )
		string +="\n - Nummer";
	if ( document.abo.postcode.value == "" )
		string += "\n - Postcode";
	if ( document.abo.plaats.value == "" )
		string += "\n - Plaats";

	if ( string.length ) {
		window.alert("U bent vergeten waardes in te voeren voor:" + string);
	} else {
		document.abo.submit();
	}

}

function submitMailenwin() {
	
	var string = "";

	if ( document.mailenwin.oplossing.value == "" )
		string += "\n - Oplossing";
	if ( document.mailenwin.voornaam.value == "" )
		string += "\n - Voornaam";
	if ( document.mailenwin.achternaam.value == "" )
		string += "\n - Achternaam";
	/*
	if ( !document.mailenwin.geboren_d.selectedIndex || !document.mailenwin.geboren_m.selectedIndex || !document.mailenwin.geboren_j.selectedIndex )
		string += "\n - Geboortedatum";
	*/
	if ( document.mailenwin.straat.value == "" )
		string += "\n - Straatnaam" 
	if ( document.mailenwin.huisnr.value == "" )
		string += "\n - Huisnummer" 
	if ( document.mailenwin.postcode.value == "" )
		string += "\n - Postcode" 
	if ( document.mailenwin.plaats.value == "" )
		string += "\n - Woonplaats" 
	if ( document.mailenwin.fb.value == "" )
		string += "\n - Anti-spam" 
	if ( !document.mailenwin.abonnee[0].checked && !document.mailenwin.abonnee[1].checked )
		string += "\n - Abonnee" 
	
	if ( string.length ) {
		window.alert("U bent vergeten waardes in te voeren voor:" + string);
	} else {
		document.mailenwin.submit();
	}

}

function setUppercase( veld ){
	veld.value=veld.value.replace().toUpperCase();
}


function contactPage(){
			var string
			var correct
			correct = true;
			string 	= "";
			if (document.contact.naam.value == "" ){
				string+="\n - naam" 
				correct = false;
			}
			if (document.contact.mail.value == "" ){
				string+="\n - mail" 
				correct = false;
			}
			if (document.contact.inhoud.value == "" ){
				string+="\n - inhoud" 
				correct = false;
			}

		if (correct==true){
			document.contact.submit();
		}
		else {
			alert("U bent vergeten waardes in te voeren voor:"+string);
		}
}

function forumPage(){

	var string = "";
	var correct = true;

	if ( document.forum.naam.value == '' ) {
		string += "\n - naam" ;
		correct = false;
	}
	if (document.forum.titel.value == '' ) {
		string += "\n - titel" ;
		correct = false;
	}
	if (document.forum.inhoud.value == '' ) {
		string += "\n - inhoud" ;
		correct = false;
	}

	if ( correct ) {
		document.forum.submit();
	} else {
		alert("U bent vergeten waarden in te voeren voor:" + string);
	}

}

function forumonderwerpPage(){

	var string = "";
	var correct = true;

	if ( document.forumonderwerp.onderwerp.value == '' ) {
		string += "\n - onderwerp";
		correct = false;
	}
	if (document.forumonderwerp.inhoud.value == '' ) {
		string += "\n - omschrijving";
		correct = false;
	}

	if ( correct ) {
		document.forum.submit();
	} else {
		alert("U bent vergeten waarden in te voeren voor:" + string);
	}

}

function checkPostcode( veld ) {
	//kijk naar formaat: 1234AB
	var objRegExp  = /^\d{4} ?[a-zA-Z]{2}$/;
	if( veld.value==null || veld.value == "" )
		return false;
	else if( objRegExp.test(veld.value)==true ) {
		veld.value=veld.value.replace(' ','').toUpperCase();
		return true;
	}
	else {
		veld.focus();
		veld.value="";
		alert("Ingevoerde postcode is ongeldig (0000AA).\nProbeer het nog een keer");
		return false;
	}
}

function setFotoHuis(str){
	document.foto.src= str;
}

function setTopic_Forum(id){
	window.location = "forum.php?topic="+id.value;
}

var ord = Math.random() * 10000000000000000;

