function resetErrors()
{
	hideErrorText();
		
	resetError("valstrOption01");
	resetError("valstrOption02");
	resetError("valstrName");
	resetError("valstrEmail");
	resetError("valstrCAPTCHA");
	resetError("valblnConfirm");
}


function validateForm()
{
	var strOption01 = document.FRM.strOption01;
	var strOption02 = document.FRM.strOption02;
	var strName = document.FRM.strName;
	var strEmail = document.FRM.strEmail
	var blnConfirm = document.FRM.blnConfirm;
	
	var strCAPTCHA = document.FRM.strCAPTCHA;
	var strErrorText = "";
		
	resetErrors();
	
	if (strOption01.selectedIndex == 0)
	{
		strErrorText += "- make a selection in option 1<br/>";
		setError("valstrOption01");
	}
	
	if (strOption02.selectedIndex == 0)
	{
		strErrorText += "- make a selection in option 2<br/>";
		setError("valstrOption02");
	}
	
	if (strName.value.length == 0)
	{
		strErrorText += "- the field 'name' is not filled in<br/>";
		setError("valstrName");
	}
	
	if (strEmail.value.length == 0)
	{
		strErrorText += "- the field 'email' is not filled in<br/>";
		setError("valstrEmail");
	}
	else
	{
		if (!isEmail(strEmail.value))
		{
			strErrorText += "- the field 'email' is not a valid email address<br/>";
			setError("valstrEmail");
		}
	}
	
	if (!blnConfirm.checked)
	{
		strErrorText += "- please check the 'I agree' option<br/>";
		setError("valblnConfirm");
	}
	
	if (strCAPTCHA.value.length == 0)
	{
		strErrorText += "- the field 'control characters' is not filled in<br/>";
		setError("valstrCAPTCHA");
	}
			
	if (strErrorText.length > 0)
	{
		showErrorText(strErrorText + "<a href=\"#\" onclick=\"Hide(\'ctnrJavascriptError\');\">close</a>");
		
		return false;
	}
	else
	{
		document.FRM.submit();
		
		return true;
	}
}

function initPage(intErrorID)
{
	resetErrors();
	
	switch(intErrorID)
	{
		case -1 :
			setError("valstrCAPTCHA");
			showErrorText("The field 'control characters' was not filled in correctly.");
			break;
	}
	
	document.FRM.strName.focus();
}

