
function validateEmail(email) {
	invalidChars = " /:,;"        

	for (i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i)

			if (email.indexOf(badChar, 0) > -1) {
				return false
			}
		}

		

		atPos = email.indexOf("@", 1)
			if (atPos == -1) {
				return false
			}

		

			if(email.indexOf("@", atPos+1) > -1) {
				return false
			}

		
			periodPos = email.indexOf(".", atPos)
	
			if(periodPos == -1) {
				return false
			}


			if (periodPos+3 > email.length) {
				return false
			}


			return true

		
}



function verifydata()
{
var zipvar, dob_var
 
var message = "The following data is missing:  " ;


if (blankfield(document.check_out.FirstName.value))
    {
     if(message == "The following data is missing:  ")
       {
        message += "First Name";
       }
     else
       {
        message += ", Last Name";
       }
    }


if (blankfield(document.check_out.LastName.value))
    {
     if(message == "The following data is missing:  ")
       {
        message += "Last Name";
       }
     else
       {
        message += ", Last Name";
       }
    }
	
	
if (blankfield(document.check_out.address.value))
    {
     if(message == "The following data is missing:  ")
       {
        message += "Address";
       }
     else
       {
        message += ", Address";
       }
    }
	
	
if (blankfield(document.check_out.city.value))
    {
     if(message == "The following data is missing:  ")
       {
        message += "City";
       }
     else
       {
        message += ", City";
       }
    }
	
	
if (blankfield(document.check_out.zip.value))
    {
     if(message == "The following data is missing:  ")
       {
        message += "Zip";
       }
     else
       {
        message += ", Zip";
       }
    }

if (blankfield(document.check_out.Country.value))
    {
     if(message == "The following data is missing:  ")
       {
        message += "Country";
       }
     else
       {
        message += ", Country";
       }
    }
	
	
if (blankfield(document.check_out.email.value))
    {
     if(message == "The following data is missing:  ")
       {
        message += "Email";
       }
     else
       {
        message += ", Email";
       }
    }

if (blankfield(document.check_out.UserName.value))
    {
     if(message == "The following data is missing:  ")
       {
        message += "User Name";
       }
     else
       {
        message += ", User Name";
       }
    }

if (blankfield(document.check_out.Password.value))
    {
     if(message == "The following data is missing:  ")
       {
        message += "Password";
       }
     else
       {
        message += ", Password";
       }
    }
	
if (blankfield(document.check_out.Password2.value))
    {
     if(message == "The following data is missing:  ")
       {
        message += "Verify Password";
       }
     else
       {
        message += ", Verify Password";
       }
    }





	

	
	
	
if (document.check_out.Password.value != document.check_out.Password2.value)
    {
     if(message == "The following data is missing:  ")
       {
        message += "The password and verify password must match";
       }
     else
       {
        message += ", The password and verify password must match";
       }
    }
	
	
	
	



		if (! validateEmail(document.check_out.email.value)) {       
			alert ("You will need to enter a valid email address!");        
			document.check_out.email.focus();
			document.check_out.email.value = "";
			return false;
		}	




   if (message != "The following data is missing:  ")
       {	
                  alert(message);
                  return false;

       }








return true;
}


function not_a_num (s,l)
{
for (var c=0; c < l; c++)
     {
      var ch = s.substring(c, c+1)
      if (ch < "0" || ch > "9") 
         {
          return true;
         }
     }
return false;
}


function blankfield(fieldvalue)
{
  var c,x;
  fieldvalue = fieldvalue + " ";
  if (fieldvalue == " ")
     {
      return true;
     } 
  for(x = 0; x < fieldvalue.length; x++)
  {
   c = fieldvalue.charAt(x);
   if(c != " ")
     {
      return false;
      x = fieldvalue.length;
     }
  }
return true;
}


