function validate_club(){

form_array = document.castle_club.elements;

for(i=0;i<form_array.length;i++){


if (form_array[i].value == "") {

  if(form_array[i].name == "middle_initial"){
    	return true;
    }

document.castle_club[form_array[i].name].focus();
alert("Please fill in "+form_array[i].name);

return false;

}




  if(form_array[i].name == "email"){
    
    ampersand_and_dot_ok = "false";
    var temp = form_array[i].value;
    var email_addy=form_array[i].value;
    email_addy=email_addy.toUpperCase();
    var find_ampersand = temp.indexOf("@");
    
    if(find_ampersand != -1){
     var find_dotending = temp.substring((find_ampersand+1),temp.length);
     var find_dot = find_dotending.indexOf(".");
     if(find_dot != -1){
      ampersand_and_dot_ok = "true";
     }
    }
    
    if(form_array[i].value == ""){
     document.castle_club[form_array[i].name].focus();
     alert("Please enter your email address.");
     return false;
    }
    if(ampersand_and_dot_ok != "true"){
     document.castle_club[form_array[i].name].focus();
     alert("Please check to see if the e-mail address you entered is correct.");
     return false; 
    }
   }

   if(form_array[i].name == "verify_email"){
    
    ampersand_and_dot_ok = "false";
    var temp = form_array[i].value;
    var vemail_addy=form_array[i].value;
    vemail_addy=vemail_addy.toUpperCase();
    
    var find_ampersand = temp.indexOf("@");
    
    if(find_ampersand != -1){
     var find_dotending = temp.substring((find_ampersand+1),temp.length);
     var find_dot = find_dotending.indexOf(".");
     if(find_dot != -1){
      ampersand_and_dot_ok = "true";
     }
    }
    
    if(form_array[i].value == ""){
     document.castle_club[form_array[i].name].focus();
     alert("Please verify your email address.");
     return false;
     }
    else if (vemail_addy!=email_addy) {
        document.castle_club[form_array[i].name].focus();
        alert("Email Addresses do not match");
        return false;
    }
    if(ampersand_and_dot_ok != "true"){
     document.castle_club[form_array[i].name].focus();
     alert("Please check to see if the e-mail address you entered is correct.");
     return false; 
    }
   }
   
 

if(form_array[i].name == "Gender"){

	if(form_array[i].checked == false){
	
	i++
	
	if(form_array[i].checked == false){
	
	alert("Please select your Gender");
	location.href="ccc_signup.asp#gender";
	return false
	}
	
	}


}

if(form_array[i].name == "birthmonth" && form_array[i].value=="none") {

document.castle_club[form_array[i].name].focus();
alert("Please fill in "+form_array[i].name);


return false
}
if(form_array[i].name == "birthday" && form_array[i].value=="none") {

document.castle_club[form_array[i].name].focus();
alert("Please fill in "+form_array[i].name);

return false
}
if(form_array[i].name == "birthyear" && form_array[i].value=="none") {

document.castle_club[form_array[i].name].focus();
alert("Please fill in "+form_array[i].name);

return false
}

//if(form_array[i].name == "anniversarymonth" && form_array[i].value=="none") {

//document.castle_club[form_array[i].name].focus();
//alert("Please fill in "+form_array[i].name);


//return false
//}

//if(form_array[i].name == "anniversaryday" && form_array[i].value=="none") {

//document.castle_club[form_array[i].name].focus();
//alert("Please fill in "+form_array[i].name);

//return false
//}

//if(form_array[i].name == "anniversaryyear" && form_array[i].value=="none") {

//document.castle_club[form_array[i].name].focus();
//alert("Please fill in "+form_array[i].name);

//return false
//}


if(form_array[i].name == "Prize"){

	if(form_array[i].checked == false){
	
	i++
	
	if(form_array[i].checked == false){
	i++
	if(form_array[i].checked == false){
		
	alert("Please select your Prize Preference");
	location.href="ccc_signup.asp#gender";
	return false
	}
	}
	}


}

if(form_array[i].name == "state" && form_array[i].value=="none") {

document.castle_club[form_array[i].name].focus();
alert("Please fill in "+form_array[i].name);


return false
}
if(form_array[i].name == "residence_state" && form_array[i].value=="none") {

document.castle_club[form_array[i].name].focus();
alert("Please fill in "+form_array[i].name);

return false
}

}
 return

}







function isEven (n) {
  return n % 2 == 0;
}
function isOdd (n) {
  return n % 2 != 0;
}



function mailing(){
chkbox = chkbox + 1;

state = isEven(chkbox);

if (state == true){

document.castle_club.residence_address.value = "";
document.castle_club.residence_city.value = "";
document.castle_club.residence_state.value = "";
document.castle_club.residence_zip.value = "";
document.castle_club.residence_telephone.value = "";}


else {


document.castle_club.residence_address.value = document.castle_club.address.value;
document.castle_club.residence_city.value = document.castle_club.city.value;
document.castle_club.residence_state.value = document.castle_club.state.value;
document.castle_club.residence_zip.value = document.castle_club.zip.value;
document.castle_club.residence_telephone.value = document.castle_club.telephone.value;

}


}