/*
Required Fields
u_email2
u_password2
u_password_confirm2
u_firstname
u_lastname

Validated Optional Fields
bill_address_1
bill_address_2
bill_city
bill_zip
phone_office
phone_cell
phone_fax
ship_address_1
ship_address_2
ship_city
ship_zip
*/


function verify(s)
{
	isName  = /^[A-Za-z'\-\ ]+$/;
	isValidString = /^[A-Za-z0-9'@\ \/\n\/\r\-\.\,\:\\\_\/\(\)\ #]+$/;
	isPhone =	/^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$/;
	isZipCode = /^(\d{5})|([A-Za-z]\d[A-Za-z]\d[A-Za-z]\d)$/;


	if (document.forms[1])
	{

		var msg = "Error: Missing or Incorrect Information!\n";
		var error_msg = "";

		//u_firstname
        /*=============================================================================*/
		if ((document.form1.u_firstname.value == "") || (document.form1.u_firstname.value == null))
		{
			error_msg += "\n \* First Name is a REQUIRED Field.";
		}
		else
		{
			if (!isValidString.test(document.form1.u_firstname.value))
				error_msg += "\n \* Data Entered in the First Name Field is INVALID";
		}
        /*=============================================================================*/

		//u_lastname
        /*=============================================================================*/
		if ((document.form1.u_lastname.value == "") || (document.form1.u_lastname.value == null))
		{
			error_msg += "\n \* Last Name is a REQUIRED Field.";
		}
		else
		{
			if (!isValidString.test(document.form1.u_lastname.value))
				error_msg += "\n \* Data Entered in the Last Name Field is INVALID";
		}
        /*=============================================================================*/

		//u_email2
        /*=============================================================================*/
		if ((document.form1.u_email.value == "") || (document.form1.u_email.value == null))
		{
			error_msg += "\n \* Email is a REQUIRED Field.";
		}
		else
		{
			if (!isValidString.test(document.form1.u_email.value))
				error_msg += "\n \* Data Entered in the Email Field is INVALID";
		}
        /*=============================================================================*/

		//u_password2
        /*=============================================================================*/
		if ((document.form1.u_password.value == "") || (document.form1.u_password.value == null))
		{
			error_msg += "\n \* Password is a REQUIRED Field.";
		}
        /*=============================================================================*/
		
		//u_password_confirm2
        /*=============================================================================*/
		if ((document.form1.u_password_confirm.value == "") || (document.form1.u_password_confirm.value == null))
		{
			error_msg += "\n \* Shipping Address is a REQUIRED Field.";
		}
        /*=============================================================================*/

		//password compare
        /*=============================================================================*/
		if (document.form1.u_password.value != document.form1.u_password_confirm.value)
		{
			error_msg += "\n \* Password and Password Confirmation Do Not Match.";
		}
        /*=============================================================================*/

		//bill_address_1
        /*=============================================================================*/
		if ((document.form1.bill_address_1.value == "") || (document.form1.bill_address_1.value == null))
		{
            //Empty is OK
		}
		else
		{
			if (!isValidString.test(document.form1.bill_address_1.value))
				error_msg += "\n \* Data Entered in the Billing Address Field is INVALID";
		}
        /*=============================================================================*/

		//bill_address_2
        /*=============================================================================*/
		if ((document.form1.bill_address_2.value == "") || (document.form1.bill_address_2.value == null))
		{
            //Empty is OK
		}
		else
		{
			if (!isValidString.test(document.form1.bill_address_2.value))
				error_msg += "\n \* Data Entered in the Second Billing Address Field is INVALID";
		}
        /*=============================================================================*/

		//bill_city
        /*=============================================================================*/
		if ((document.form1.bill_city.value == "") || (document.form1.bill_city.value == null))
		{
            //Empty is OK
		}
		else
		{
			if (!isValidString.test(document.form1.bill_city.value))
				error_msg += "\n \* Data Entered in the Billing City Field is INVALID";
		}
        /*=============================================================================*/
		
		//bill_zip
        /*=============================================================================*/
		if ((document.form1.bill_zip.value == "") || (document.form1.bill_zip.value == null))
		{
            //Empty is OK
		}
		else
		{
			if (!isValidString.test(document.form1.bill_zip.value))
				error_msg += "\n \* Data Entered in the Billing Zip Field is INVALID";
		}
        /*=============================================================================*/
		
		//bill_address_1
        /*=============================================================================*/
		if ((document.form1.bill_address_1.value == "") || (document.form1.bill_address_1.value == null))
		{
            //Empty is OK
		}
		else
		{
			if (!isValidString.test(document.form1.bill_address_1.value))
				error_msg += "\n \* Data Entered in the Billing Address Field is INVALID";
		}
        /*=============================================================================*/
		
		//phone_office
        /*=============================================================================*/
		if ((document.form1.phone_office.value == "") || (document.form1.phone_office.value == null))
		{
            //Empty is OK
		}
		else
		{
			if (!isPhone.test(document.form1.phone_office.value))
				error_msg += "\n \* Data Entered in the Office Phone Field is INVALID";
		}
        /*=============================================================================*/
		
		//phone_cell
        /*=============================================================================*/
		if ((document.form1.phone_cell.value == "") || (document.form1.phone_cell.value == null))
		{
            //Empty is OK
		}
		else
		{
			if (!isPhone.test(document.form1.phone_cell.value))
				error_msg += "\n \* Data Entered in the Cell Phone Field is INVALID";
		}
        /*=============================================================================*/

		//phone_fax
        /*=============================================================================*/
		if ((document.form1.phone_fax.value == "") || (document.form1.phone_fax.value == null))
		{
            //Empty is OK
		}
		else
		{
			if (!isPhone.test(document.form1.phone_fax.value))
				error_msg += "\n \* Data Entered in the Fax Number Field is INVALID";
		}
        /*=============================================================================*/
		
		//ship_address_1
        /*=============================================================================*/
		if ((document.form1.ship_address_1.value == "") || (document.form1.ship_address_1.value == null))
		{
            //Empty is OK
		}
		else
		{
			if (!isValidString.test(document.form1.ship_address_1.value))
				error_msg += "\n \* Data Entered in the Shipping Address Field is INVALID";
		}
        /*=============================================================================*/
		
		//ship_address_2
        /*=============================================================================*/
		if ((document.form1.ship_address_2.value == "") || (document.form1.ship_address_2.value == null))
		{
            //Empty is OK
		}
		else
		{
			if (!isValidString.test(document.form1.ship_address_2.value))
				error_msg += "\n \* Data Entered in the Second Shipping Address Field is INVALID";
		}
        /*=============================================================================*/
		
		//ship_city
        /*=============================================================================*/
		if ((document.form1.ship_city.value == "") || (document.form1.ship_city.value == null))
		{
            //Empty is OK
		}
		else
		{
			if (!isValidString.test(document.form1.ship_city.value))
				error_msg += "\n \* Data Entered in the Billing City Field is INVALID";
		}
        /*=============================================================================*/

		//ship_zip
        /*=============================================================================*/
		if ((document.form1.ship_zip.value == "") || (document.form1.ship_zip.value == null))
		{
            //Empty is OK
		}
		else
		{
			if (!isValidString.test(document.form1.ship_zip.value))
				error_msg += "\n \* Data Entered in the Billing Zip Field is INVALID";
		}
        /*=============================================================================*/

		if (error_msg)
		{
			alert(msg+error_msg);
				return false;
		}
    }
}

