//function to valid the online contact us form
function validContact(obj)
{
   var bad = false;
   var errors = "";
   
   if (obj.Name.value.length == 0)
   {
	errors += "The Name field can't be empty.<br>";
	bad = true;
   }
   
   if (obj.Email.value.length == 0)
   {
	errors += "The Email field can't be empty.<br>";
	bad = true;
   }
   else if (!isEmail(obj.Email.value))
   {
	errors += "The Email entered is invalid.<br>";
	bad = true;
   }
   
   if (obj.Captcha.value.length == 0)
   {
	errors += "The Security Code field can't be empty.<br>";
	bad = true;
   }
   
   if (bad)
   {
	error(errors);
	return false;
   }

   return true;
}

function isPhone(p)
{
	var phoneExp = /^\d{3}-\d{3}-\d{4}$/
	return phoneExp.test(p);
}

function isEmail(e)
{
   var emailExp = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
   return emailExp.test(e);
}

function error(msg)
{
	msg = "<span>The Following Errors Occurred:</span><br>" + msg;
	errorsDiv = document.getElementById('errors');
	errorsDiv.innerHTML = msg;
	errorsDiv.style.display = 'block';
}