<!-- CAPTCHA -->	
    function TestCaptcha(valSession, valCaptcha)
    {
	
	var tmpSession;
	tmpSession = trim(valSession);	
	var tmpCaptcha = trim(valCaptcha);
	if (tmpCaptcha.length == 0)
	{
	    alert ('Please enter the security code.');
	    window.document.Form1.captchacode.focus();
	    return false;
	}
	else
	   return true;
    }

    function RefreshImage(valImageId) {
        var objImage = document.images[valImageId];
        if (objImage == undefined) {
            return;
        }
        var now = new Date();
        objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
    }
<!-- CAPTCHA -->    

function CheckForm1(){
  var cFirstName, cLastName, cAddress, cCity, cState, cZip, cPhone, cEmail;
    with(window.document.Form1)
    {
		cFirstName = FirstName;
		cLastName = LastName;
		cAddress = Address;
		cCity = City;
		cState = State;
		cZip = Zip;
		cPhone = Phone;
		cEmail = Email;

    }
	
	if(trim(cFirstName.value) == '')
    {
        alert('Please enter your First Name.');
        cFirstName.focus();
        return false;
    }
	
	if(trim(cLastName.value) == '')
    {
        alert('Please enter your Last Name.');
        cLastName.focus();
        return false;
    }
	
	if(trim(cAddress.value) == '')
    {
        alert('Please enter your Address.');
        cAddress.focus();
        return false;
    }
	
	if(trim(cCity.value) == '')
    {
        alert('Please enter your City.');
        cCity.focus();
        return false;
    }
	
	if(document.Form1.State.selectedIndex == 0) {
		alert("Please select your State.");
		cState.focus();
		return false;
	}
	
	if(trim(cZip.value) == '')
    {
        alert('Please enter your Zip/ Postal Code.');
        cZip.focus();
        return false;
    }
	
	if(trim(cPhone.value) == '' || cPhone.value=="(xxx) xxx-xxxx")
    {
        alert('Please enter your Phone Number.');
        cPhone.focus();
        return false;
    }
	
	if(trim(cEmail.value) == '')
    {
        alert('Please enter your E-mail Address.');
        cEmail.focus();
        return false;
    }
	
	if(document.Form1.Email.value.indexOf("@") < 0) {
		alert("Please enter a Valid E-mail Address.");
		cEmail.focus();
		return false;
	}
	
	if(document.Form1.Email.value.indexOf(".") < 0) {
		alert("Please enter a Valid E-mail Address.");
		cEmail.focus();
		return false;
	}
	
<!-- CAPTCHA -->
	var isValidCaptcha = TestCaptcha("ASPCAPTCHA", document.Form1.captchacode.value);
	if (isValidCaptcha == true)
		return true;
	else
		return false;
<!-- CAPTCHA -->	
	
}
function trim(str)
{
    return str.replace(/^\s+|\s+$/g,'');
}

function clearText(thefield) {
  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
} 
function replaceText(thefield) {
  if (thefield.value=="") { thefield.value = thefield.defaultValue }
}
