<!--
// ********************************************************************************
// **Author: Philip Jahmani Chauvet
// **dated:  04/01/2005 -- 07/01/2006
// **Decs:   Form validation utility.
// **(C):    (c) Copyright Aiki Innovations Inc, 04/2005 - 07/2006
// ********************************************************************************
/*
Available Methods:
validField( "field1" , "Field1 is blank" )
validFieldWithLength( "field1" , 3, "Field1 is blank and should be less than 3 char" )
validSSN( "field1" , "Enter a valid SSN" )
validUSPhone( "field1" , "Enter a valid Phone Number" )
validZipCode( "field1" , "Enter a valid ZipCode" )
//-- format parameters are: MMDDYY, MMDDYYYY and YYYYMMDD
validDate( fld , format, msg )
//-- format parameters are: HHMM and HHMMSS
validTime( fld , format, msg )
//-- format parameters are: MMDDYYHHMMSS and MMDDYYHHMMSSSS
validTimeStamp( fld , format, msg )
validEmail( "field1" , "Enter a valid Email" )
*/


/**************************************************/
/***********   Begin: Form Validation           ***/
/**************************************************/
var ACTIVE_FORM = null;

function setActiveForm( form )
{
    ACTIVE_FORM = form;
}


function getField( fld ) {

    if ( ACTIVE_FORM == null )
    {
        alert( "Error: The form object was not set! Use setActiveForm( form ) to set form." );
        return "";
    }

    fld = ACTIVE_FORM.name + "." + fld + ".value";
        //Remove trailing and leading spaces from the field
    return trim( eval( fld ) );
}

function validField( fld , msg ) {
    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0))
    {
        alert( msg );
        return false;
    } else  return true;
}

    /*
     * Field should be less than len
     */
function validFieldWithLength( fld , len, msg ) {
    if ( !validField( fld, msg ) )
        return false;

    theValue = getField( fld );
    if ( theValue.length > len )
    {
        lenmsg = "\nLength should be less than " + len + " characters.";
        alert( msg + lenmsg );
        return false;
    }

    return true;
}


function validSSN( fld , msg ) {
    var themsg = msg + "\n\n" +
                 "SSN format: ###-##-####.\n" +
                 "Example(s):\n" +
                 "  987-12-7654.";

    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0) )
    {
        alert( themsg );
        return false;
    }
    if ( !isSSN( theValue ) )
    {
        alert( themsg );
        return false;
    }

    return true;
}

function validUSPhone( fld , msg ) {
    var themsg = msg + "\n\n" +
                 "Phone format: (###) ###-####.\n" +
                 "(###) is optional. Dash required.\n\n" +
                 "Example(s) without/with extension:\n" +
                 "  (987) 123-7654, or 123-7654.\n" +
                 "  (987) 123-7654 456, or 123-7654X123.";

    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0) )
    {
        alert( themsg );
        return false;
    }
    if ( !isUSPhone( theValue ) )
    {
        alert( themsg );
        return false;
    }

    return true;
}


function validZipCode( fld , msg ) {
    var themsg = msg + "\n\n" +
                 "ZipCode format either:\n" +
                 "  #####, ##### ####, or #####-####.\n" +
                 "POB, -####, is optional.\n\n" +
                 "Example(s):\n" +
                 "  12345, 12345 7892, or 12345-7892.\n";

    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0) )
    {
        alert( themsg );
        return false;
    }
    if ( !isZipCode( theValue ) )
    {
        alert( themsg );
        return false;
    }

    return true;
}


function validDateMMDDYY( fld , msg ) {
    var themsg = msg + "\n\n" +
                 "Date format:\n" +
                 "  MM/DD/YY.\n" +
                 "  MM,DD and YY are two digits.\n" +
                 "  / is required.\n\n" +
                 "Example(s):\n" +
                 "  12/11/98\n";

    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0) )
    {
        alert( themsg );
        return false;
    }
    if ( !isDateMMDDYY( theValue ) )
    {
        alert( themsg );
        return false;
    }

    return true;
}


function validDateMMDDYYYY( fld , msg ) {
    var themsg = msg + "\n\n" +
                 "Date format:\n" +
                 "  MM/DD/YYYY.\n" +
                 "  MM,DD are two digits, YYYY is four.\n" +
                 "  / is required.\n\n" +
                 "Example(s):\n" +
                 "  12/11/2003\n";

    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0) )
    {
        alert( themsg );
        return false;
    }
    if ( !isDateMMDDYYYY( theValue ) )
    {
        alert( themsg );
        return false;
    }

    return true;
}


/*
 * format parameters are: MMDDYY, MMDDYYYY and YYYYMMDD
 */
function validDate( fld , format, msg ) {

    if ( format == "MMDDYY" )
    {
        return validDateMMDDYY( fld , msg );
    } else if ( format == "MMDDYYYY" )
    {
        return validDateMMDDYYYY( fld , msg );
    } else if ( format == "YYYYMMDD" )
    {
        return validDateYYYYMMDD( fld , msg );
    } else
    {
        alert( format + " is an invalid date format parameter!" );
        return false
    }


    return true;
}


function validDateYYYYMMDD( fld , msg ) {
    var themsg = msg + "\n\n" +
                 "Date format:\n" +
                 "  YYYY/MM/DD.\n" +
                 "  MM,DD are two digits, YYYY is four.\n" +
                 "  / is required.\n\n" +
                 "Example(s):\n" +
                 "  2003/12/23/\n";

    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0) )
    {
        alert( themsg );
        return false;
    }
    if ( !isDateYYYYMMDD( theValue ) )
    {
        alert( themsg );
        return false;
    }

    return true;
}


function validTimeHHMM( fld , msg ) {
    var themsg = msg + "\n\n" +
                 "Time format:\n" +
                 "  HH:MM.\n" +
                 "  HH and MM are two digits.\n" +
                 "  HH value is 0-24, MM is 0-59.\n" +
                 "  : is required.\n\n" +
                 "Example(s):\n" +
                 "  09:15\n";

    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0) )
    {
        alert( themsg );
        return false;
    }
    if ( !isTimeHHMM( theValue ) )
    {
        alert( themsg );
        return false;
    }

    return true;
}



function validTimeHHMMSS( fld , msg ) {
    var themsg = msg + "\n\n" +
                 "Time format:\n" +
                 "  HH:MM:SS.\n" +
                 "  HH,MM and SS are two digits.\n" +
                 "  HH value is 0-24, MM and SS is 0-59.\n" +
                 "  : is required.\n\n" +
                 "Example(s):\n" +
                 "  09:15:59\n";

    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0) )
    {
        alert( themsg );
        return false;
    }
    if ( !isTimeHHMMSS( theValue ) )
    {
        alert( themsg );
        return false;
    }

    return true;
}


/*
 * format parameters are: MMDDYYHHMMSS and MMDDYYHHMMSSSS
*/
function validTimeStamp( fld , format, msg ) {

    if ( format == "MMDDYYHHMMSS" )
    {
        return validTimeStampMMDDYYHHMMSS( fld , msg );
    } else if ( format == "MMDDYYYYHHMMSS" )
    {
        return validTimeStampMMDDYYYYHHMMSS( fld , msg );
    } else
    {
        alert( format + " is an invalid time format parameter!" );
        return false;
    }

    return true;
}

function validTimeStampMMDDYYHHMMSS( fld , msg ) {
    var themsg = msg + "\n\n" +
                 "TimeStamp format:\n" +
                 "  MM/DD/YY HH:MM:SS.\n" +
                 "  MM,DD and YY are two digits.\n" +
                 "  HH,MM and SS are two digits.\n" +
                 "  HH value is 0-24, MM and SS is 0-59.\n" +
                 "  / and : is required.\n\n" +
                 "Example(s):\n" +
                 "  12/11/98 09:15:59\n";

    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0) )
    {
        alert( themsg );
        return false;
    }
    if ( !isTimeStampMMDDYYHHMMSS( theValue ) )
    {
        alert( themsg );
        return false;
    }

    return true;
}


function validTimeStampMMDDYYYYHHMMSS( fld , msg ) {
    var themsg = msg + "\n\n" +
                 "TimeStamp format:\n" +
                 "  MM/DD/YYYY HH:MM:SS.\n" +
                 "  MM,DD are two digits, YYYY is four.\n" +
                 "  HH,MM and SS are two digits.\n" +
                 "  HH value is 0-24, MM and SS is 0-59.\n" +
                 "  / and : is required.\n\n" +
                 "Example(s):\n" +
                 "  12/11/2003 09:15:59\n";

    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0) )
    {
        alert( themsg );
        return false;
    }
    if ( !isTimeStampMMDDYYYYHHMMSS( theValue ) )
    {
        alert( themsg );
        return false;
    }

    return true;
}



function validEmail( fld , msg ) {
    var themsg = msg + "\n\n" +
                 "Email format:\n" +
                 "  xxx@xxxx.com, or xxx@[999.99.9999].\n" +
                 "  @ and IP format [] is required.\n\n" +
                 "Example(s):\n" +
                 "  wowwow@myplace.com or\n";
                 "  wowwow@[123.22.2222] or\n";
                 "  wowwow@[123-22-2222]\n";

    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0) )
    {
        alert( themsg );
        return false;
    }
    if ( !isValidEmail( theValue ) )
    {
        alert( themsg );
        return false;
    }

    return true;
}


function validDouble( fld , number, decimal, msg ) {
    var themsg = msg + "\n\n" +
                 "Double format is:\n" +
                 "  ###.### - where # is a digit\n" +
                 "    with " + number + " number's, a decimal, followed by " + decimal + " decimals.\n" +
                 "Example(s):\n" +
                 "  100.00\n";

    theValue = getField( fld );
    if ( (theValue.value == "") || (theValue.length == 0) )
    {
        alert( themsg );
        return false;
    }

    if ( !isDouble( theValue ) )
    {
        alert( themsg );
        return false;
    }

    fldNumber = theValue.substring( 0, theValue.indexOf( '.' ) ) ;
    if ( fldNumber.length > number )
    {
        lenmsg = "\n    * The number before the decimal should be less than " + number + " digits.";
        alert( themsg + lenmsg );
        return false;
    }

    if ( theValue.indexOf( '.' ) > 0 )
    {
        fldDecimal = theValue.substring( theValue.indexOf( '.' )+1, theValue.length ) ;
        if ( fldDecimal.length <= 0 )
        {
            theValue = theValue.substring( 0, theValue.length-1 ) ;
        } else if ( fldDecimal.length > decimal )
        {
            lenmsg = "\n    * The number after the decimal should be less than " + decimal + " digits.";
            alert( themsg + lenmsg );
            return false;
        }
    }

    return true;
}


function validInteger( fld , number, msg ) {
    var themsg = msg + "\n\n" +
                 "Integer format is:\n" +
                 "  [-]###, where # is a digit and [-] means optional minus sign.\n" +
                 "  Value are >= -2147483648 and <= 2147483647.\n" +
                 "Example(s):\n" +
                 "  32306\n";

    theValue = getField( fld );
    if ( !isInteger( theValue ) )
    {
        alert( themsg );
        return false;
    }

    fldNumber = theValue.substring( 0, theValue.indexOf( '.' ) ) ;
    if ( fldNumber.length > number )
    {
        lenmsg = "\n    * The number before the decimal should be less than " + number + " digits.";
        alert( themsg + lenmsg );
        return false;
    }

    return true;
}


/**************************************************/
/***********   End: Form Validation             ***/
/**************************************************/



/**************************************************/
/***********   Begin: Validation Functions      ***/
/**************************************************/
function isSSN( s )
{
    if ( s == null )
        return false;

    var ssn = s.replace( /-/g, "" );
    if ( !isDigits( ssn ) )
        return false;

    if ( ssn.length != 9 )
        return false;

    var reg = /^(\d){3}(-|)(\d){2}(-|)(\d){4}/;
    var ar = reg.exec( s );
    if ( ar == null )
        return false;

    return true;
}

function isUSPhone( s )
{
    var beginphonewithbracket = /^(\((\d){3}\))( \d|\d)/;
    var beginphonewithoutbracket = /^\d/;
    var phonenumber = /^.*(\d){3}(-|)(\d+){4}( \d+|\d+|X\d+|x\d+|)$/;

    var beginningok = true;
    if ( !beginphonewithbracket.exec( s ) && !beginphonewithoutbracket.exec( s ) )
    {
        beginningok = false;
        return false;
    }

    if ( beginningok && !phonenumber.exec( s ) )
        return false;

    return true;
}

function isZipCode( s )
{
    var zip = /^(\d){5}((-| )((\d){4})|)$/;
    if ( !zip.exec( s ) )
        return false;

    return true;
}

function isDateMMDDYY( s )
{
    var tdate = /^(\d){1,2}\/(\d){1,2}\/(\d){2}$/;
    if ( !tdate.exec( s ) )
        return false;

        //Get the month
    var pos = s.indexOf("/");
    var pos2 = s.indexOf( "/", pos+1 );
    var tmonth = s.substring( 0, pos );
    var tday = s.substring( pos+1, pos2 );
    var tyear = s.substring( pos2+1, s.length );

    var intMonth = getInt( tmonth );
    if ( intMonth < 1 || intMonth >= 13 )
        return false;

    var monthLimit = MONTHDAYS[ intMonth ];
    if ( intMonth == 2 )
    {
        monthLimit = leapYear( tyear );
    }

    var intDay = getInt( tday );
    if ( intDay < 1 || intDay > monthLimit )
        return false;

    return true;
}

function isDateMMDDYYYY( s )
{
    var tdate = /^(\d){1,2}\/(\d){1,2}\/(\d){4}$/;
    if ( !tdate.exec( s ) )
        return false;

        //Get the month
    var pos = s.indexOf("/");
    var pos2 = s.indexOf( "/", pos+1 );
    var tmonth = s.substring( 0, pos );
    var tday = s.substring( pos+1, pos2 );
    var tyear = s.substring( pos2+1, s.length );

    var intMonth = getInt( tmonth );
    if ( intMonth < 1 || intMonth >= 13 )
        return false;

    var monthLimit = MONTHDAYS[ intMonth ];
    if ( intMonth == 2 )
    {
        monthLimit = leapYear( tyear );
    }

    var intDay = getInt( tday );
    if ( intDay < 1 || intDay > monthLimit )
        return false;

    return true;
}

function isDateYYYYMMDD( s )
{
    var tdate = /^(\d){4}\/(\d){1,2}\/(\d){1,2}$/;

    if ( !tdate.exec( s ) )
        return false;

        //Get the month
    var pos = s.indexOf("/");
    var pos2 = s.indexOf( "/", pos+1 );
    var tyear = s.substring( 0, pos );
    var tmonth = s.substring( pos+1, pos2 );
    var tday = s.substring( pos2+1, s.length );

    var intMonth = getInt( tmonth );
    if ( intMonth < 1 || intMonth >= 13 )
        return false;

    var monthLimit = MONTHDAYS[ intMonth ];
    if ( intMonth == 2 )
    {
        monthLimit = leapYear( tyear );
    }

    var intDay = getInt( tday );
    if ( intDay < 1 || intDay > monthLimit )
        return false;

    return true;
}

function isTimeHHMM( s )
{
    var FIFTYNINE = 59;
    var HOUR24 = 24;
    var ttime = /^(\d){2}\:(\d){2}$/;

    if ( !ttime.exec( s ) )
        return false;

        //Get the month
    var pos = s.indexOf(":");
    var thr = s.substring( 0, pos );
    var tmin = s.substring( pos+1, s.length );

    var intHr = parseInt( thr );
    if ( intHr < 0 || intHr > HOUR24 )
        return false;

    var intMin = parseInt( tmin );
    if ( intMin < 0 || intMin > FIFTYNINE )
        return false;

    if ( intHr == 24 && intMin > 0 )
        return false;

    if ( intMin < 0 || intMin > FIFTYNINE )
        return false;


    return true;
}

function isTimeHHMMSS( s )
{
    var FIFTYNINE = 59;
    var HOUR24 = 24;
    var ttime = /^(\d){2}\:(\d){2}\:(\d){2}$/;

    if ( !ttime.exec( s ) )
        return false;

        //Get the month
    var pos = s.indexOf(":");
    var pos2 = s.indexOf( ":", pos+1 );
    var thr = s.substring( 0, pos );
    var tmin = s.substring( pos+1, pos2 );
    var tsec = s.substring( pos2+1, s.length );

    var hourmin = thr + ":" + tmin;
    if ( !isTimeHHMM( hourmin ) )
        return false;

    var intSec = parseInt( tsec );
    if ( intSec < 0 || intSec > FIFTYNINE )
        return false;

    return true;
}

function isTimeStampMMDDYYHHMMSS( s )
{
    var pos = s.indexOf(" ");
    var tdate = s.substring( 0, pos );
    var ttime = s.substring( pos+1, s.length );

    //alert( tdate + " " + tdate.length );
    //alert( ttime + " " + ttime.length );

    if ( !isDateMMDDYY( tdate ) )
        return false;

    if ( !isTimeHHMMSS( ttime ) )
        return false;

    return true;
}

function isTimeStampMMDDYYYYHHMMSS( s )
{
    var pos = s.indexOf(" ");
    var tdate = s.substring( 0, pos );
    var ttime = s.substring( pos+1, s.length );

    //alert( tdate + " " + tdate.length );
    //alert( ttime + " " + ttime.length );

    if ( !isDateMMDDYYYY( tdate ) )
        return false;

    if ( !isTimeHHMMSS( ttime ) )
        return false;

    return true;
}

function isInValidEmail( s )
{
    var doubleAmpersand = /(@.*@)/;
    var doubleDot = /(\.*\.)/;
    var AmpersandDot = /(@\.)/;
    var DotAmpersand = /(\.@)/;
    var BeginDot = /(^\.)/;
    var BeginAmpersand = /(^@)/;
    var NoAmpersand = /^(.*@.*\..*)|(\[.*\])/;

    if ( !NoAmpersand.exec( s ) &&
         ( doubleAmpersand.exec( s ) || doubleDot.exec( s ) ||
         AmpersandDot.exec( s ) || DotAmpersand.exec( s ) ||
         BeginDot.exec( s ) || BeginAmpersand.exec( s ) ||
         hasWhiteSpace( s ) )
       )
        return true;

    return false;
}

function isValidEmail( s )
{
    var validBegin = /^.+@/;
    var validAfterAmperNonIP = /[a-zA-Z0-9]+\.([a-zA-Z]{2,3})$/;
    var validAfterAmperIP = /\[[0-9]{1,3}(\-|\.)[0-9]{1,3}(\-|\.)[0-9]{1,3}\]$/;

    if ( !isInValidEmail( s ) && validBegin.exec( s ) && ( validAfterAmperNonIP.exec( s ) || validAfterAmperIP.exec( s ) ) )
        return true;

    return false;
}


/**************************************************/
/***********    End: Validation Functions       ***/
/**************************************************/


/********************************************/
/***********  Begin: Base Functions       ***/
/********************************************/
var MONTHDAYS = new Array(12);
MONTHDAYS[1] = 31;
MONTHDAYS[2] = 29;
MONTHDAYS[3] = 31;
MONTHDAYS[4] = 30;
MONTHDAYS[5] = 31;
MONTHDAYS[6] = 30;
MONTHDAYS[7] = 31;
MONTHDAYS[8] = 31;
MONTHDAYS[9] = 30;
MONTHDAYS[10] = 31;
MONTHDAYS[11] = 30;
MONTHDAYS[12] = 31;

function isDigit( c )
{
    var reg = /^\d$/
    var ar = reg.exec( c );
    if ( ar != null )
        return true;

    return false;
}

function trim(str)
{
    return str.replace( /^\s*/, "" ).replace( /\s*$/, "" );
}

function isDigits( s )
{
    var reg = /^(-|)\d+$/;
    var ar = reg.exec( s );
    if ( ar != null )
        return true;

    return false;
}

function isLowercase( s )
{
    var reg = /[^ABCDEFGHIJKLMNOPQRSTUV]/;
    var ar = reg.exec( s );
    if ( ar != null )
        return true;

    return false;
}

function isUppercase( s )
{
    var reg = /[^abcdefghijklmnopqrstuv]/;
    var ar = reg.exec( s );
    if ( ar != null )
        return true;

    return false;
}

function isDouble( s )
{
    var reg = /^(-|)(\d+).((\d+)|)$/;
    var ar = reg.exec( s );
    if ( ar != null )
        return true;

    return false;
}

function isNumber( s )
{
    return isDigits( s );
}

function isInteger( s )
{
    if ( !isDigits( s ) )
        return false;

    var ival = getInt( s );
    if ( !( ival >= -2147483648 && ival <= 2147483647 ) )
        return false

    return true;
}

function isByte( s )
{
    if ( !isDigits( s ) )
        return false;

    var ival = parseInt( s );
    if ( !( ival >= -128 && ival <= 127 ) )
        return false

    return true;
}

function isShort( s )
{
    if ( !isDigits( s ) )
        return false;

    var ival = parseInt( s );
    if ( !( ival >= -32768 && ival <= 32767 ) )
        return false

    return true;
}

function isLong( s )
{
    if ( !isDigits( s ) )
        return false;

    var ival = parseInt( s );
    if ( !( ival >= -9223372036854775808 && ival <= 9223372036854775807 ) )
        return false

    return true;
}

//Test is timestamp
//alert( isTimeStampMMDDYYYYHHMMSS("02/28/2005 11:22:33") );
//alert( isTimeStampMMDDYYHHMMSS("02/28/2004 11:22:33") );
//alert( isDateMMDDYY("02/28/03") );

function isEmpty( s )
{
    return ( (s == null) || (s.length == 0) );
}

function isWhiteSpace( c )
{
    var reg = /\s/;
    var ar = reg.exec( c );
    if ( ar != null )
        return true;

    return false;
}

function hasWhiteSpace( s )
{
    var reg = /\s+/;
    var ar = reg.exec( s );
    if ( ar != null )
        return true;

    return false;
}

function leapYear( year )
{
    return ( ( (year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) ? 29 : 28 );
}


function getInt( valint )
{
        //Get rid of the initial 0 to avoid error
    if ( valint.length >= 2 && valint.indexOf("0") == 0 )
        valint = valint.substring( 1, valint.length );

    return parseInt( valint );
}

/********************************************/
/***********    End: Base Functions       ***/
/********************************************/



/********************************************/
/***********        Begin: Test           ***/
/********************************************/
/*
//Test is digit
alert( isDigit("1") );
alert( isDigit("a") );
alert( isDigit("") );
alert( isDigit(" ") );
alert( isDigit("9") );

//Test trim
var str = trim( "    1" );
alert(  str + " " +  str.length );
str = trim( "a " );
alert(  str + " " +  str.length );
str = trim( "a b  " );
alert(  str + " " +  str.length );
str = trim( " aaa " );
alert(  str + " " +  str.length );
str = trim( "  " );
alert(  str + " " +  str.length );


alert( isWhiteSpace("") );
alert( isWhiteSpace("\t") );
alert( isWhiteSpace("a") );
alert( isWhiteSpace("c") );
alert( isWhiteSpace("1") );
alert( isWhiteSpace(" ") );

alert( hasWhiteSpace("") );
alert( hasWhiteSpace("dsd\t") );
alert( hasWhiteSpace("aas") );
alert( hasWhiteSpace("cd11") );
alert( hasWhiteSpace("11322") );
alert( hasWhiteSpace("ads ") );


//Test isNumber
alert( isNumber("1234") );
alert( isNumber("12 ") );
alert( isNumber(" 12") );
alert( isNumber(" abc") );
alert( isNumber(" ab111") );
alert( isNumber("99923939") );

//Test if Email
//alert( isValidEmail( "abc@[229.111.2]" ) );
//alert( isValidEmail( "22@2bd.ss" ) );


alert( isInValidEmail("@@") );
alert( isInValidEmail("..") );
alert( isInValidEmail("@.") );
alert( isInValidEmail(".@") );
alert( isInValidEmail(".") );
alert( isInValidEmail("@") );
alert( isInValidEmail("aaaaasdafds") );
alert( isInValidEmail("s @sdafds") );
alert( isInValidEmail(" ") );
alert( isInValidEmail("aaa@sds.aaa") );

alert( isUSPhone( "(123)1231234" ) );
alert( isUSPhone( "(123) 1231234" ) );
alert( isUSPhone( "(123) 12234" ) );
alert( isUSPhone( "123-1234" ) );
alert( isUSPhone( "1231234" ) );


//Test is zipcode
alert( isZipCode("55552-2323") );


//Test is date
//alert( isDateMMDDYY("02/28/03") );
//alert( isDateMMDDYYYY("02/28/2003") );
//alert( isDateYYYYMMDD("2004/02/29") );


//Test is timestamp
alert( isTimeHHMMSS("59:21:29") );

*/
/********************************************/
/***********         End: Test            ***/
/********************************************/


//-->

