﻿function IsContactFormValid()
{
	var bValid = true;
	if(!checkRFV(document.frmContact.tbMessage, document.getElementById('rfMessage'), true)) { bValid = false; }
	if(!checkRFV(document.frmContact.tbEmail, document.getElementById('rfEmail'), true)) { bValid = false; }
	if(!checkRFV(document.frmContact.tbName, document.getElementById('rfName'), true)) { bValid = false; }
	if(bValid)
	{
		document.frmContact.submit();
	}
}
function checkRFV(cValidate, rfvMsg)
{
    return checkRFV(cValidate, rfvMsg, false);
}
function checkRFV(cValidate, rfvMsg, bFocus)
{
	var bVisible = '';
	if(cValidate.value.length == 0)
	{
		bVisible = 'required';
		if(bFocus)
		{
		    cValidate.focus();
		}
	}
	return makeVisible(bVisible, rfvMsg);
}
function makeVisible(bVisible, rfvControl)
{
	rfvControl.className = bVisible;
	return bVisible == '';
}