// JavaScript Document

<!-- Original:  Wayne Nolting (w.nolting@home.com) -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

//Begin
var testresults
function checknames() 
{
    var str=document.Opt.Email.value
    var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
    var themessage = "You are required to complete the following fields: ";

    if (filter.test(str))
    {
        if (document.Opt.Email.value!="" && document.Opt.Email2.value!="") 
        {
            if (document.Opt.Email.value!=document.Opt.Email2.value) 
            {
                themessage = themessage + " -  Emails do not match";
            }
        }
        testresults=true
    }
    else
    {
        themessage = themessage + " - Email (you're entry is invalid)";
    }
    if (document.Opt.Firstname.value=="") 
    {
        themessage = themessage + " - First Name";
    }
    if (document.Opt.Lastname.value=="") 
    {
        themessage = themessage + " -  Last Name";
    }
    if (document.Opt.Password.value=="") 
    {
        themessage = themessage + " -  Password";
    }
    if (document.Opt.Password2.value=="") 
    {
        themessage = themessage + " -  Verify Password";
    }

    if (document.Opt.Password.value!="" && document.Opt.Password2.value!="") 
    {
        if (document.Opt.Password.value!=document.Opt.Password2.value) 
        {
            themessage = themessage + " -  Passwords do not match";
        }
    }

    //alert if fields are empty and cancel form submit
    if (themessage == "You are required to complete the following fields: ") 
    {
        if (document.Opt.SponsorID.value=="") 
        {
            document.Opt.SponsorID.value="1";
        }
        document.Opt.allokey.value = "go for gold";
        document.Opt.submit();
    }
    else 
    {
        alert(themessage);
        return false;
    }

}
//End

