//This script is used to check the registration form 
//fields(member_register.asp)


function checkEntries(theForm)

    {
        // Ensure something has been entered for a username
        if (theForm.txtMemberNo.value == "")
        {
            alert('You must provide a Member Number to register.');
            theForm.txtMemberNo.focus();
            return false;
        }
	//Validating drop down box for Club
	if (theForm.lstClub.options[0].selected == true)
  	{
    	    alert('Please select your Club from the drop-down list.');
	    theForm.lstClub.focus();
            return false;  	
	}
	//validating zip entry	
	if (theForm.txtBillingZip.value == "")
  	{
            alert('You must include an accurate zip to register.');
	    theForm.txtBillingZip.focus();
            return false;   
	}
     
	//validating First Name
	if (theForm.txtFirstName.value == "")
  	{
            alert('Please enter your First Name.');
	    theForm.txtFirstName.focus();
            return false;   
	}
	//validating Last Name
	if (theForm.txtLastName.value == "")
  	{
            alert('Please enter your Last Name.');
	    theForm.txtLastName.focus();
            return false;   
	}
	//validating email entry	
	if (theForm.txtEmail.value == "")
  	{
            alert('You must include an accurate E-mail address to register.');
	    theForm.txtEmail.focus();
            return false;   
	}
  	//validating proper email entry
	if ((theForm.txtEmail.value.indexOf ('@',0) == -1 ||
   	theForm.txtEmail.value.indexOf ('.',0) == -1) &&
   	theForm.txtEmail.value != "")
  	{
    	    alert('Please verify that your E-mail address is valid.');
  	
	    theForm.txtEmail.focus();
            return false;
	}
	//validating userid
	if (theForm.txtUserID.value == "")
  	{
            alert('Please create a UserId.');
	    theForm.txtUserID.focus();
            return false;   
	}
	if (theForm.txtUserID.value.length < 6)
        {
            alert('User ID must be at least six characters.');
            theForm.txtUserID.focus();
            theForm.txtUserID.select();
            return false;
        }
	if (!theForm.txtUserID.value.match(/^[a-zA-Z0-9]+$/))
	{
            alert('Special characters and spaces are not allowed for User ID.');
	    theForm.txtUserID.focus();
            return false;   
	}

        // Ensure something has been entered for a password
        else if (theForm.txtPassword.value == "")
        {
            alert('You must provide a password to register');
            theForm.txtPassword.focus();
            return false;
        }

        // Ensure the password is at least 6 characters
        else if (theForm.txtPassword.value.length < 6)
        {
            alert('The password must be at least six characters');
            theForm.txtPassword.focus();
            theForm.txtPassword.select();
            return false;
        }

        // If the confirmation passowrd doesn't match the original password,
        // show an error message, set focus back to the field, and highlight 			
	//the entry.
        else if (theForm.txtPassword1.value != theForm.txtPassword.value)
        {
            alert('Passwords do not match. Please enter again!');
            theForm.txtPassword1.focus();
            theForm.txtPassword1.select();
            return false;
        }

	//Select a valid question for securityquestion1

	if (theForm.txtSecurityQuestion1.value == "")
  	{
    	    alert('Please enter a question for security question 1.');
	    theForm.txtSecurityQuestion1.focus();
            return false;  	
	}
	// Ensure something has been entered for securityanswer1
        if (theForm.txtSecurityAnswer1.value == "")
        {
            alert('You must provide an answer to security question 1 for registering.');
            theForm.txtSecurityAnswer1.focus();
            return false;
        }
	//Select a valid question for securityquestion2

	if (theForm.txtSecurityQuestion2.value == "")
  	{
    	    alert('Please enter a question for security question 2.');
	    theForm.txtSecurityQuestion2.focus();
            return false;  	
	}
	// Ensure something has been entered for securityanswer2
        if (theForm.txtSecurityAnswer2.value == "")
        {
            alert('You must provide an answer to security question 2 for registering.');
            theForm.txtSecurityAnswer2.focus();
            return false;
        }
	
        return true;
    }
    

  
  

