
// 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.First_Name){if (xlaAFPform.First_Name.value==''){return cancelsubmit('Field \'First Name\' is required',xlaAFPform.First_Name)}if (xlaAFPform.First_Name.value.length>12){return cancelsubmit('Field \'First Name\' cannot contain more than 12 characters.',xlaAFPform.First_Name)}}
if (xlaAFPform.Last_Name){if (xlaAFPform.Last_Name.value==''){return cancelsubmit('Field \'Last Name\' is required',xlaAFPform.Last_Name)}if (xlaAFPform.Last_Name.value.length>12){return cancelsubmit('Field \'Last Name\' cannot contain more than 12 characters.',xlaAFPform.Last_Name)}}
if (xlaAFPform.Address){if (xlaAFPform.Address.value==''){return cancelsubmit('Field \'Address\' is required',xlaAFPform.Address)}if (xlaAFPform.Address.value.length>20){return cancelsubmit('Field \'Address\' cannot contain more than 20 characters.',xlaAFPform.Address)}}
if (xlaAFPform.City){if (xlaAFPform.City.value==''){return cancelsubmit('Field \'City\' is required',xlaAFPform.City)}if (xlaAFPform.City.value.length>20){return cancelsubmit('Field \'City\' cannot contain more than 20 characters.',xlaAFPform.City)}}
if (xlaAFPform.State){if (xlaAFPform.State.value==''){return cancelsubmit('Field \'State\' is required',xlaAFPform.State)}if (xlaAFPform.State.value.length>15){return cancelsubmit('Field \'State\' cannot contain more than 15 characters.',xlaAFPform.State)}}
if (xlaAFPform.Country){if (xlaAFPform.Country.value==''){return cancelsubmit('Field \'Country\' is required',xlaAFPform.Country)}if (xlaAFPform.Country.value.length>20){return cancelsubmit('Field \'Country\' cannot contain more than 20 characters.',xlaAFPform.Country)}}
if (xlaAFPform.Zip){if (xlaAFPform.Zip.value==''){return cancelsubmit('Field \'Zip\' is required',xlaAFPform.Zip)}if (xlaAFPform.Zip.value.length>16){return cancelsubmit('Field \'Zip\' cannot contain more than 16 characters.',xlaAFPform.Zip)}}
if (xlaAFPform.Telephone){if (xlaAFPform.Telephone.value==''){return cancelsubmit('Field \'Telephone\' is required',xlaAFPform.Telephone)}if (xlaAFPform.Telephone.value.length>16){return cancelsubmit('Field \'Telephone\' cannot contain more than 16 characters.',xlaAFPform.Telephone)}}
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.Email.value.length>26){return cancelsubmit('Field \'Email\' cannot contain more than 26 characters.',xlaAFPform.Email)}}
if (xlaAFPform.What_is_your_high_school_graduation_year){if (xlaAFPform.What_is_your_high_school_graduation_year.value.length>18){return cancelsubmit('Field \'What is your high school graduation year\' cannot contain more than 18 characters.',xlaAFPform.What_is_your_high_school_graduation_year)}}
if (xlaAFPform.Comments){if (xlaAFPform.Comments.value.length>200){return cancelsubmit('Field \'Comments\' cannot contain more than 200 characters.',xlaAFPform.Comments)}}

}

