
// Absolute Form Processor XE V1.0 : Form Validation System
// Copyright(c)2000 - 2003 XIGLA SOFTWARE
// http://www.xigla.com

function cancelsubmit(msg,element){
	alert(msg);
	element.focus();
	return false
}



function isNumeric(what){
    if (what.search(/^[-+]?\d+(\.\d+)?$/) != -1)
        return true;
    else
        return false;
}

function isInteger(what){
	if (what.search(/^[-+]?[1-9]\d*.?[0]*$/) != -1)
        return true;
    else
        return false;
}


function isEmail(what) {
	// Works
    if (what.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}

function isAlphanumeric(what){
	// ANY alphanumeric string with spaces, commas, dashes.
    if (what.search(/^[a-zA-Z0-9\s.\-]+$/) != -1)
        return true;
    else
        return false;
}

function isAlphabetic(what){
    if (what.search(/^[a-zA-Z\s]+$/) != -1)
        return true;
    else
        return false;
}

function noSpaces(what){
    if (what.search(/\s/) != -1)
        return false;
    else
        return true;
}

function isCC(what){
    if (what.search(/^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$/) != -1)
        return true;
    else
        return false;
}


function xlaAFPvalidate(xlaAFPform){
if (xlaAFPform.name){if (xlaAFPform.name.value==''){return cancelsubmit('Field \'name\' is required',xlaAFPform.name)}}
if (xlaAFPform.social_scecurity_code){if (xlaAFPform.social_scecurity_code.value==''){return cancelsubmit('Field \'social scecurity code\' is required',xlaAFPform.social_scecurity_code)}if (!isInteger(xlaAFPform.social_scecurity_code.value)){return cancelsubmit('Field \'social scecurity code\' is not integer',xlaAFPform.social_scecurity_code)}if (xlaAFPform.social_scecurity_code.value.length>4){return cancelsubmit('Field \'social scecurity code\' cannot contain more than 4 characters.',xlaAFPform.social_scecurity_code)}if (xlaAFPform.social_scecurity_code.value.length<4){return cancelsubmit('Field \'social scecurity code\' cannot contain less than 4 characters.',xlaAFPform.social_scecurity_code)}if (!noSpaces(xlaAFPform.social_scecurity_code.value)){return cancelsubmit('Field \'social scecurity code\' cannot contain spaces.',xlaAFPform.social_scecurity_code)}}
if (xlaAFPform.your_address){if (xlaAFPform.your_address.value==''){return cancelsubmit('Field \'your address\' is required',xlaAFPform.your_address)}}
if (xlaAFPform.filing_for_another_farmer_address){if (xlaAFPform.filing_for_another_farmer_address.value==''){return cancelsubmit('Field \'filing for another farmer address\' is required',xlaAFPform.filing_for_another_farmer_address)}}
if (xlaAFPform.home_phone_1){if (xlaAFPform.home_phone_1.value==''){return cancelsubmit('Field \'home phone 1\' is required',xlaAFPform.home_phone_1)}if (!isInteger(xlaAFPform.home_phone_1.value)){return cancelsubmit('Field \'home phone 1\' is not integer',xlaAFPform.home_phone_1)}if (xlaAFPform.home_phone_1.value.length>3){return cancelsubmit('Field \'home phone 1\' cannot contain more than 3 characters.',xlaAFPform.home_phone_1)}if (xlaAFPform.home_phone_1.value.length<3){return cancelsubmit('Field \'home phone 1\' cannot contain less than 3 characters.',xlaAFPform.home_phone_1)}if (!noSpaces(xlaAFPform.home_phone_1.value)){return cancelsubmit('Field \'home phone 1\' cannot contain spaces.',xlaAFPform.home_phone_1)}}
if (xlaAFPform.home_phone_2){if (xlaAFPform.home_phone_2.value==''){return cancelsubmit('Field \'home phone 2\' is required',xlaAFPform.home_phone_2)}if (!isInteger(xlaAFPform.home_phone_2.value)){return cancelsubmit('Field \'home phone 2\' is not integer',xlaAFPform.home_phone_2)}if (xlaAFPform.home_phone_2.value.length>3){return cancelsubmit('Field \'home phone 2\' cannot contain more than 3 characters.',xlaAFPform.home_phone_2)}if (xlaAFPform.home_phone_2.value.length<3){return cancelsubmit('Field \'home phone 2\' cannot contain less than 3 characters.',xlaAFPform.home_phone_2)}if (!noSpaces(xlaAFPform.home_phone_2.value)){return cancelsubmit('Field \'home phone 2\' cannot contain spaces.',xlaAFPform.home_phone_2)}}
if (xlaAFPform.home_phone_3){if (xlaAFPform.home_phone_3.value==''){return cancelsubmit('Field \'home phone 3\' is required',xlaAFPform.home_phone_3)}if (!isInteger(xlaAFPform.home_phone_3.value)){return cancelsubmit('Field \'home phone 3\' is not integer',xlaAFPform.home_phone_3)}if (xlaAFPform.home_phone_3.value.length>4){return cancelsubmit('Field \'home phone 3\' cannot contain more than 4 characters.',xlaAFPform.home_phone_3)}if (xlaAFPform.home_phone_3.value.length<4){return cancelsubmit('Field \'home phone 3\' cannot contain less than 4 characters.',xlaAFPform.home_phone_3)}if (!noSpaces(xlaAFPform.home_phone_3.value)){return cancelsubmit('Field \'home phone 3\' cannot contain spaces.',xlaAFPform.home_phone_3)}}
if (xlaAFPform.cell_phone_1){if (xlaAFPform.cell_phone_1.value==''){return cancelsubmit('Field \'cell phone 1\' is required',xlaAFPform.cell_phone_1)}if (!isInteger(xlaAFPform.cell_phone_1.value)){return cancelsubmit('Field \'cell phone 1\' is not integer',xlaAFPform.cell_phone_1)}if (xlaAFPform.cell_phone_1.value.length>3){return cancelsubmit('Field \'cell phone 1\' cannot contain more than 3 characters.',xlaAFPform.cell_phone_1)}if (xlaAFPform.cell_phone_1.value.length<3){return cancelsubmit('Field \'cell phone 1\' cannot contain less than 3 characters.',xlaAFPform.cell_phone_1)}if (!noSpaces(xlaAFPform.cell_phone_1.value)){return cancelsubmit('Field \'cell phone 1\' cannot contain spaces.',xlaAFPform.cell_phone_1)}}
if (xlaAFPform.cell_phone_2){if (xlaAFPform.cell_phone_2.value==''){return cancelsubmit('Field \'cell phone 2\' is required',xlaAFPform.cell_phone_2)}if (!isInteger(xlaAFPform.cell_phone_2.value)){return cancelsubmit('Field \'cell phone 2\' is not integer',xlaAFPform.cell_phone_2)}if (xlaAFPform.cell_phone_2.value.length>3){return cancelsubmit('Field \'cell phone 2\' cannot contain more than 3 characters.',xlaAFPform.cell_phone_2)}if (xlaAFPform.cell_phone_2.value.length<3){return cancelsubmit('Field \'cell phone 2\' cannot contain less than 3 characters.',xlaAFPform.cell_phone_2)}if (!noSpaces(xlaAFPform.cell_phone_2.value)){return cancelsubmit('Field \'cell phone 2\' cannot contain spaces.',xlaAFPform.cell_phone_2)}}
if (xlaAFPform.cell_phone_3){if (xlaAFPform.cell_phone_3.value==''){return cancelsubmit('Field \'cell phone 3\' is required',xlaAFPform.cell_phone_3)}if (!isInteger(xlaAFPform.cell_phone_3.value)){return cancelsubmit('Field \'cell phone 3\' is not integer',xlaAFPform.cell_phone_3)}if (xlaAFPform.cell_phone_3.value.length>4){return cancelsubmit('Field \'cell phone 3\' cannot contain more than 4 characters.',xlaAFPform.cell_phone_3)}if (xlaAFPform.cell_phone_3.value.length<4){return cancelsubmit('Field \'cell phone 3\' cannot contain less than 4 characters.',xlaAFPform.cell_phone_3)}if (!noSpaces(xlaAFPform.cell_phone_3.value)){return cancelsubmit('Field \'cell phone 3\' cannot contain spaces.',xlaAFPform.cell_phone_3)}}
if (xlaAFPform.business_phone_1){if (xlaAFPform.business_phone_1.value==''){return cancelsubmit('Field \'business phone 1\' is required',xlaAFPform.business_phone_1)}if (!isInteger(xlaAFPform.business_phone_1.value)){return cancelsubmit('Field \'business phone 1\' is not integer',xlaAFPform.business_phone_1)}if (xlaAFPform.business_phone_1.value.length>3){return cancelsubmit('Field \'business phone 1\' cannot contain more than 3 characters.',xlaAFPform.business_phone_1)}if (xlaAFPform.business_phone_1.value.length<3){return cancelsubmit('Field \'business phone 1\' cannot contain less than 3 characters.',xlaAFPform.business_phone_1)}if (!noSpaces(xlaAFPform.business_phone_1.value)){return cancelsubmit('Field \'business phone 1\' cannot contain spaces.',xlaAFPform.business_phone_1)}}
if (xlaAFPform.business_phone_2){if (xlaAFPform.business_phone_2.value==''){return cancelsubmit('Field \'business phone 2\' is required',xlaAFPform.business_phone_2)}if (!isInteger(xlaAFPform.business_phone_2.value)){return cancelsubmit('Field \'business phone 2\' is not integer',xlaAFPform.business_phone_2)}if (xlaAFPform.business_phone_2.value.length>3){return cancelsubmit('Field \'business phone 2\' cannot contain more than 3 characters.',xlaAFPform.business_phone_2)}if (xlaAFPform.business_phone_2.value.length<3){return cancelsubmit('Field \'business phone 2\' cannot contain less than 3 characters.',xlaAFPform.business_phone_2)}if (!noSpaces(xlaAFPform.business_phone_2.value)){return cancelsubmit('Field \'business phone 2\' cannot contain spaces.',xlaAFPform.business_phone_2)}}
if (xlaAFPform.business_phone_3){if (xlaAFPform.business_phone_3.value==''){return cancelsubmit('Field \'business phone 3\' is required',xlaAFPform.business_phone_3)}if (!isInteger(xlaAFPform.business_phone_3.value)){return cancelsubmit('Field \'business phone 3\' is not integer',xlaAFPform.business_phone_3)}if (xlaAFPform.business_phone_3.value.length>4){return cancelsubmit('Field \'business phone 3\' cannot contain more than 4 characters.',xlaAFPform.business_phone_3)}if (xlaAFPform.business_phone_3.value.length<4){return cancelsubmit('Field \'business phone 3\' cannot contain less than 4 characters.',xlaAFPform.business_phone_3)}if (!noSpaces(xlaAFPform.business_phone_3.value)){return cancelsubmit('Field \'business phone 3\' cannot contain spaces.',xlaAFPform.business_phone_3)}}
if (xlaAFPform.email){if (xlaAFPform.email.value==''){return cancelsubmit('Field \'email\' is required',xlaAFPform.email)}if (!isEmail(xlaAFPform.email.value)){return cancelsubmit('Field \'email\' does not contain a valid e-mail address.',xlaAFPform.email)}}
if (xlaAFPform.types_of_farming){if (xlaAFPform.types_of_farming.value==''){return cancelsubmit('Field \'types of farming\' is required',xlaAFPform.types_of_farming)}}
if (xlaAFPform.program_type){if (xlaAFPform.program_type.value==''){return cancelsubmit('Field \'program type\' is required',xlaAFPform.program_type)}}
if (xlaAFPform.city){if (xlaAFPform.city.value==''){return cancelsubmit('Field \'city\' is required',xlaAFPform.city)}}
if (xlaAFPform.state){if (xlaAFPform.state.value==''){return cancelsubmit('Field \'state\' is required',xlaAFPform.state)}}
if (xlaAFPform.county){if (xlaAFPform.county.value==''){return cancelsubmit('Field \'county\' is required',xlaAFPform.county)}}
if (xlaAFPform.tracking_number){if (xlaAFPform.tracking_number.value==''){return cancelsubmit('Field \'tracking number\' is required',xlaAFPform.tracking_number)}}
if (xlaAFPform.situation){if (xlaAFPform.situation.value==''){return cancelsubmit('Field \'situation\' is required',xlaAFPform.situation)}}
if (xlaAFPform.complaint_type){if (xlaAFPform.complaint_type.value==''){return cancelsubmit('Field \'complaint type\' is required',xlaAFPform.complaint_type)}}
if (xlaAFPform.handling_of_complaint){if (xlaAFPform.handling_of_complaint.value==''){return cancelsubmit('Field \'handling of complaint\' is required',xlaAFPform.handling_of_complaint)}}

}

