<!--
function validateForm(theForm)
{
	theForm.realname.style.backgroundColor="white";
	theForm.email.style.backgroundColor="white";
	theForm.email_address.style.backgroundColor="white";
	theForm.arrival_day.style.backgroundColor="white";
	theForm.arrival_month.style.backgroundColor="white";
	theForm.arrival_year.style.backgroundColor="white";
	theForm.number_nights_staying.style.backgroundColor="white";
	theForm.number_of_adults.style.backgroundColor="white";
	theForm.double_rooms.style.backgroundColor="white";
	theForm.twin_rooms.style.backgroundColor="white";
	theForm.triple_rooms.style.backgroundColor="white";
	theForm.family_rooms.style.backgroundColor="white";
	theForm.single_rooms.style.backgroundColor="white";
	theForm.using_vouchers.style.backgroundColor="white";

	var error=false;

	if(!validRequired(theForm.realname,"Name"))
  	{
    	error=true;
    }
    else if(!validRequired(theForm.email,"E-mail Address"))
  	{
    	error=true;
    }
    else if(!validEmail(theForm.email,"E-mail Address"))
  	{
    	error=true;
    }
    else if(!validRequired(theForm.email_address,"Confirm E-mail Address"))
  	{
    	error=true;
    }
    else if(!validEmail(theForm.email_address,"Confirm E-mail Address"))
  	{
    	error=true;
    }
    else if(!validEmailComparison(theForm.email,theForm.email_address,"E-mail Address","Confirm E-mail Address"))
  	{
    	error=true;
    }
    else if(!validDay(theForm.arrival_day))
  	{
   		error=true;
    }
    else if(!validMonth(theForm.arrival_month))
  	{
   		error=true;
    }
    else if(!validYear(theForm.arrival_year))
  	{
   		error=true;
    }
	else if(!validNights(theForm.number_nights_staying))
  	{
   		error=true;
    }
    else if(!validAdults(theForm.number_of_adults))
  	{
   		error=true;
    }
    else if(!validRoomsSelected(theForm.double_rooms,theForm.twin_rooms,theForm.triple_rooms,theForm.family_rooms,theForm.single_rooms))
  	{
   		error=true;
    }
    else if(!validVouchers(theForm.using_vouchers))
  	{
   		error=true;
    }

    if(error!=true)
    {
		theForm.submit();
    }
}

function validRequired(formField,fieldLabel)
{
	var result=true;
  	if(formField.value==null || formField.value==" " || formField.value.length==0)
  	{
   	 	alert('Please enter a value for the "' + fieldLabel + '" field."');
      	formField.style.backgroundColor="red";
    	formField.focus();
    	result=false;
  	}
  	return result;
}

function validEmail(formField,fieldLabel)
{
	var result=false;
	if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(formField.value))
	{
		result=true;
	}
	else
	{
		alert('Invalid e-mail format for the "' + fieldLabel + '" field');
    	formField.style.backgroundColor="red";
    	formField.focus();
	}
	return result;
}

function validEmailComparison(formField1,formField2,fieldLabel1,fieldLabel2)
{
	var result=true;
  	if(formField1.value.toLowerCase() != formField2.value.toLowerCase())
  	{
		alert('The "' + fieldLabel1 + '" field and the "' + fieldLabel2 + '" field do not match');
		formField1.style.backgroundColor="red";
		formField2.style.backgroundColor="red";
		formField1.focus();
    	result=false;
	}
	return result;
}

function validDay(formField)
{
	var result=true;
	if(formField.value=="Day")
  	{
   	 	alert('Please indicate the day of your arrival at Cill Bhreac House');
      	formField.style.backgroundColor="red";
    	formField.focus();
    	result=false;
  	}
  	return result;
}

function validMonth(formField)
{
	var result=true;
	if(formField.value=="Month")
  	{
   	 	alert('Please indicate your month of arrival at Cill Bhreac House');
      	formField.style.backgroundColor="red";
    	formField.focus();
    	result=false;
  	}
  	return result;
}

function validYear(formField)
{
	var result=true;
	if(formField.value=="Year")
  	{
   	 	alert('Please indicate your year of arrival at Cill Bhreac House');
      	formField.style.backgroundColor="red";
    	formField.focus();
    	result=false;
  	}
  	return result;
}

function validNights(formField)
{
	var result=true;
  	if(formField.value=="0")
  	{
   	 	alert('Please indicate the number of nights that you wish to stay at Cill Bhreac House for');
      	formField.style.backgroundColor="red";
    	formField.focus();
    	result=false;
  	}
  	return result;
}

function validAdults(formField)
{
	var result=true;
  	if(formField.value=="0")
  	{
   	 	alert('Please indicate the number of adults that are in your party');
      	formField.style.backgroundColor="red";
    	formField.focus();
    	result=false;
  	}
  	return result;
}

function validRoomsSelected(formField1,formField2,formField3,formField4,formField5)
{
	var result=true;
  	if(formField1.value=="0" && formField2.value=="0" && formField3.value=="0" && formField4.value == "0" && formField5.value=="0")
  	{
   	 	alert('Please indicate what type of room(s) you require');
      	formField1.style.backgroundColor="red";
      	formField2.style.backgroundColor="red";
		formField3.style.backgroundColor="red";
		formField4.style.backgroundColor="red";
		formField5.style.backgroundColor="red";
    	formField1.focus();
    	result=false;
  	}
  	return result;
}

function validVouchers(formField)
{
	var result=true;
  	if(formField.value=="Yes/No")
  	{
   	 	alert('Please indicate whether or not you intend using vouchers for payment');
      	formField.style.backgroundColor="red";
    	formField.focus();
    	result=false;
  	}
  	return result;
}
//-->
