// DROPDOWNS MAINMENU

startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;


// POPUP SCRIPT

var win = null;

function openPopup(theURL,winName,w,h){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no, resizable=no'
	win = window.open(theURL,winName,settings)
}


// CHECK FORMS

function checkDataReceptenOntvangen(){
	var correct = true
	var regexpemail =/^[a-zA-Z0-9\-\.\_]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; //regexp for e-mail address
	var str = document.contactform.email.value; // value to compare
	
	if (document.contactform.voornaam.value == '') {correct = false; alert("Vul s.v.p. je voornaam in.");document.contactform.voornaam.focus(); return correct}
	if (document.contactform.achternaam.value == '') {correct = false; alert("Vul s.v.p. je achternaam in.");document.contactform.achternaam.focus(); return correct}
	if (regexpemail.test(str) == false){
	
	correct = false; alert("Vul s.v.p een geldig e-mail adres in.");document.contactform.email.focus(); return correct}
	
	return correct;
}

function checkDataReceptenSturen(){
	var correct = true
	var regexpemail =/^[a-zA-Z0-9\-\.\_]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; //regexp for e-mail address
	var str = document.contactform.email.value; // value to compare
	
	if (document.contactform.titel_recept.value == '') {correct = false; alert("Vul s.v.p. een titel voor je recept in.");document.contactform.titel_recept.focus(); return correct}
	if (document.contactform.ingredienten.value == '') {correct = false; alert("Vul s.v.p. de ingrediënten in.");document.contactform.ingredienten.focus(); return correct}
	if (document.contactform.bereiding.value == '') {correct = false; alert("Vul s.v.p. de bereiding van het recept in.");document.contactform.bereiding.focus(); return correct}
	
	if (document.contactform.voornaam.value == '') {correct = false; alert("Vul s.v.p. je voornaam in.");document.contactform.voornaam.focus(); return correct}
	if (document.contactform.achternaam.value == '') {correct = false; alert("Vul s.v.p. je achternaam in.");document.contactform.achternaam.focus(); return correct}
	
	if (document.contactform.adres.value == '') {correct = false; alert("Vul s.v.p. je adres in.");document.contactform.adres.focus(); return correct}
	if (document.contactform.postcode.value == '') {correct = false; alert("Vul s.v.p. je postcode in.");document.contactform.postcode.focus(); return correct}
	if (document.contactform.woonplaats.value == '') {correct = false; alert("Vul s.v.p. je woonplaats in.");document.contactform.woonplaats.focus(); return correct}
	if (regexpemail.test(str) == false){
	
	correct = false; alert("Vul s.v.p een geldig e-mail adres in.");document.contactform.email.focus(); return correct}
	
	return correct;
}

function checkDataEcard(){
	var correct = true
	var regexpemail =/^[a-zA-Z0-9\-\.\_]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; //regexp for e-mail address
	var str = document.send_ecard.senderemail.value; // value to compare
	var str2 = document.send_ecard.ontvangeremail.value; // value to compare
	
	if (document.send_ecard.naam.value == '') {correct = false; alert("Vul s.v.p. je eigen naam in.");document.send_ecard.naam.focus(); return correct}
	if (document.send_ecard.ontvangernaam.value == '') {correct = false; alert("Vul s.v.p. de naam van de ontvanger in.");document.send_ecard.ontvangernaam.focus(); return correct}
	if (regexpemail.test(str) == false){
		correct = false; alert("Vul s.v.p je eigen e-mail adres in.");document.send_ecard.senderemail.focus(); return correct}
	if (regexpemail.test(str2) == false){
		correct = false; alert("Vul s.v.p het e-mail adres van je vriendin in.");document.send_ecard.ontvangeremail.focus(); return correct}
	
	return correct;
}