function validateContactForm()
{
	theForm = document.forms.contactform;

	companyValue = theForm.company.value;
	contactpersonValue = theForm.contactperson.value;
	phonenumberValue = theForm.phonenumber.value;
	emailValue = theForm.email.value;

	doContact = theForm.doContact;
	messageValue = theForm.message.value;

	var sendError = 0;

	//companyValue
	if ( companyValue == "")
	{
		markRed ( "companyTxt", true );
		sendError += 1;
	}
	else
	{
		markRed ( "companyTxt", false );
	}

	//contactpersonValue
	if ( contactpersonValue == "")
	{
		markRed ( "contactpersonTxt", true );
		sendError += 1;
	}
	else
	{
		markRed ( "contactpersonTxt", false );
	}

	//phonenumberValue
	if ( phonenumberValue == "")
	{
		markRed ( "phonenumberTxt", true );
		sendError += 1;
	}
	else
	{
		markRed ( "phonenumberTxt", false );
	}

	//emailValue
	if ( emailValue == "" || (! isValidEmail ( emailValue ) ) )
	{
		markRed ( "emailTxt", true );
		sendError += 1;
	}
	else
	{
		markRed ( "emailTxt", false );
	}

	//doContact
	if ( !isRadioChecked ( doContact ) )
	{
		markRed ( "doContactTxt", true );
		sendError += 1;
	}
	else
	{
		markRed ( "doContactTxt", false );
	}

	//messageValue
	if ( messageValue == "")
	{
		markRed ( "messageTxt", true );
		sendError += 1;
	}
	else
	{
		markRed ( "messageTxt", false );
	}

	if (sendError == 0)
	{
		//form correct, send it
		theForm.submit();
	}
	else
	{
		theFormMsg = document.getElementById( "formMsg" );
		theFormMsg.innerHTML = "<br/><i>Niet alle velden zijn correct ingevuld.</i>";
		theFormMsg.className = "formError";
	}
}

function markRed(element, doMark)
	{
	element = document.getElementById(element);
	if(doMark)
	{
		element.className = "formError";
	}
	else
	{
		element.className = "";
	}
}

function isValidEmail(str) {
	return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}

function isRadioChecked (item)
{
	for( var i=0; i<item.length; i++)
	{
		if ( item[i].checked )
		{
			return true;
			break;
		}
	}
}
//-->
