
function checkcontact(object,CF_this)
    {
    //Returns true if value is a number or is NULL
    //otherwise returns false

    if (object.selectedIndex == 0)
        return true;

	if (object.selectedIndex == 2 && !hasValue(CF_this.f_dayphone, "TEXT" )) {
	    if  (!onError(CF_this.f_dayphone, "If you wish us to contact you at your Daytime Phone Number, Please enter your daytime phone number.")) { return false; } }

	if (object.selectedIndex == 3 && !hasValue(CF_this.f_eveningphone, "TEXT" )) {
	    if  (!onError(CF_this.f_eveningphone, "If you wish us to contact you at your Evening Phone Number, Please enter your evening phone number.")) { return false; } }

    return true
}

function checktheForm(CF_this)
{

	if ( !hasValue(CF_this.f_contactname, "TEXT") ) { if (!onError(CF_this.f_contactname, "You Must Enter A Contact Name.")) { return false; } }

	if ( !hasValue(CF_this.f_preferred, "SELECT") ) { if (!onError(CF_this.f_preferred, "You Must Select Your Preferred Contact.")) { return false; } }

	if  (!checkcontact(CF_this.f_preferred,CF_this)) return false;

	if ( !hasValue(CF_this.f_address, "TEXT") || !hasValue(CF_this.f_city, "TEXT") 
			|| !hasValue(CF_this.f_state, "TEXT") || !hasValue(CF_this.f_zip, "TEXT") ) {  if  (!onError(CF_this.f_address, "Please Enter Your Mailing/Home Address")) { return false; } }

	if ( hasValue(CF_this.f_email, "TEXT") && !checkemail(CF_this.f_email.value) ) { if (!onError(CF_this.f_email, "You Have Entered an Invalid Email Address")) { return false; } }

	if ( hasValue(CF_this.f_dayphone, "TEXT") && !checkphone(CF_this.f_dayphone.value) ) { if (!onError(CF_this.f_dayphone, "You Have Entered an Invalid Daytime Phone Number")) { return false; } }

	if ( hasValue(CF_this.f_eveningphone, "TEXT") && !checkphone(CF_this.f_eveningphone.value) ) { if (!onError(CF_this.f_eveningphone, "You Have Entered an Invalid Evening Phone Number")) { return false; } }

	if ( !hasValue(CF_this.f_comments, "TEXTAREA") ) { if (!onError(CF_this.f_comments, "You Must Enter Your Message")) { return false; } }

return true;
}