

function submitForm() {

	var formOk = true;
	var theMissingElement;
	var theMessage;
	
	for (var i=0; i < document.newreactionform.elements.length; i++) {
		document.newreactionform.elements[i].style.backgroundColor = "#ffffff";
	}
	
	if (document.newreactionform.author.value == "") {
		theMessage = "Je naam ontbreekt. Klik op OK en vul een naam in.";
		theMissingElement = document.newreactionform.author;
		formOk = false;
	}
	if (document.newreactionform.title.value == "") {
		theMessage = "De titel ontbreekt. Klik op OK en vul een titel in.";
		theMissingElement = document.newreactionform.title;
		formOk = false;
	}
	if (document.newreactionform.body.value == "") {
		theMessage = "De reactie ontbreekt. Klik op OK en vul een reactie in.";
		theMissingElement = document.newreactionform.body;
		formOk = false;
	}
	if (formOk) {
		document.newreactionform.submit();
	} else {
		theMissingElement.style.backgroundColor = "#ffccff";
		alert(theMessage);
		
	}

}

function isValidContactForm(objForm)
{
	strAlert = "";

	if (objForm.strFullName.value == "") {
		strAlert += "> Naam\n";
	}
	
	if ( (objForm.strEmailAddress.value == "") || (objForm.strEmailAddress.value.indexOf("@") == -1) ) {
		strAlert += "> E-mail adres\n";
	}
	
	if (objForm.strQuestion.value == "") {
		strAlert += "> Vraag\n";
	}
	
	if (strAlert != "") {
		alert("De volgende velden zijn niet goed ingevuld:\n"+ strAlert);
		return false;
	} else {
		return true;
	}
}

function isValidBestelForm(objForm, strLang)
{
	strAlert = "";
	
	if (strLang == "NL") { 
		strAlertIntro = "De volgende velden zijn niet goed ingevuld";
	} else {
		strAlertIntro = "Please fill out the following fields";
	}
	
	
	if (objForm.strHowMany.value == "") {
		strAlert += "> "+ getLabelValue(objForm, 'lblHowMany') +" \n";
	}
	
	if (objForm.strFullName.value == "") {
		strAlert += "> "+ getLabelValue(objForm, 'lblFullName') +" \n";
	}
	
	if ((objForm.strEmailAddress.value == "") || (objForm.strEmailAddress.value.indexOf("@") == -1)) {
		strAlert += "> "+ getLabelValue(objForm, 'lblEmailAddress') +" \n";
	}
	
	if (objForm.strStreet.value == "") {
		strAlert += "> "+ getLabelValue(objForm, 'lblStreet') +"  \n";
	}
	
	if (objForm.strZipCode.value == "") {
		strAlert += "> "+ getLabelValue(objForm, 'lblZipCode') +"  \n";
	}
	
	if (objForm.strCity.value == "") {
		strAlert += "> "+ getLabelValue(objForm, 'lblCity') +"  \n";
	}
	
	if (objForm.strCountry.value == "") {
		strAlert += "> "+ getLabelValue(objForm, 'lblCountry') +"  \n";
	}
	
	if (strAlert != "") {
		alert(strAlertIntro + ":\n"+ strAlert);
		return false;
	} else {
		return true;
	}
}



function getLabelValue(objForm, strLabelID)
{
	objElement = document.getElementById(strLabelID);
	strLabelValue = objElement.innerText;
	
	return strLabelValue;
}
