////////////////CAPTCHA REFRESH//////////////////////////////
function refreshCaptcha()
{
	var f = document.getElementById('iframe2');
	f.contentWindow.location.reload(true);
}
//////////////END CAPTCHA REFRESH////////////////////////////


// function called from onsubmit in form tag
function validate2_form(thisform)
{
	
////////////////CAPTCHA VALIDATION//////////////////////////////
	if (window.frames['captchaFrame2'].document.forms[0].captchaCode.value != thisform.captcha.value)
	{alert('Security Code does not match.');thisform.captcha.focus();return false;}
////////////END CAPTCHA VALIDATION//////////////////////////////

with (thisform)
{

///////////////Begin validation statements///////////////////////////////////////

//validate text field or text area for null by calling validate_required function
if (validate_required(clientName,"Name must be filled out.")==false)
  {clientName.focus();return false;} 
 
if (validate_required(clientPhone,"Phone must be filled out.")==false)
  {clientPhone.focus();return false;}   

// validate email address is in valid format by calling validate_email function 
if (validate_email(email,"Not a valid e-mail address.")==false)
  {email.focus();return false;}



///////////////End validation statements///////////////////////////////////////

}

}

function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {alert(alerttxt);return false;}
else {return true}
}
}
 
function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false;}
else {return true;}
}
}
