// JavaScript Document

function validreg(security){ 
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if (document.reg_form.name.value==""){ 
       alert("Please enter your full name.") 
       document.reg_form.name.focus() 
       return 0; 
    }
	if (document.reg_form.address.value==""){ 
       alert("Please enter your address.") 
       document.reg_form.address.focus() 
       return 0; 
    }
	if (document.reg_form.city.value==""){ 
       alert("Please enter your city.") 
       document.reg_form.city.focus() 
       return 0; 
    }
	if (document.reg_form.provience_state.value==""){ 
       alert("Please enter your state or province.")
	   document.reg_form.provience_state.focus()
       return 0; 
    }
	if (document.reg_form.zipcode.value==""){ 
       alert("Please enter a ZIP or Postal Code.")
	   document.reg_form.zipcode.focus()
       return 0; 
    }
	if (document.reg_form.country.selectedIndex==0){ 
       alert("Please select your country.")
	   document.reg_form.country.focus()
       return 0; 
    }
	if (document.reg_form.email.value==""){ 
       alert("Please enter your e-mail address.")
	   document.reg_form.email.focus()
       return 0; 
    }
	if (document.reg_form.email.value!=document.reg_form.confirmemail.value){ 
       alert("Please reenter your e-mail address correctly.")
	   document.reg_form.confirmemail.focus()
       return 0; 
    }
	if(!document.reg_form.email.value.match(emailExp)){
		alert("Please enter a valid e-mail address.")
		document.reg_form.email.focus()
		return 0;
	}	
	if (document.reg_form.newpassword.value==""){ 
       alert("Please enter a password.")
	   document.reg_form.newpassword.focus()
       return 0; 
    }
	if(document.reg_form.newpassword.value.length < 8){
       alert("You must enter at least 8 characters in the password field.");
       return 0;
	}  
   if (document.reg_form.newpassword.value!=document.reg_form.confpassword.value){ 
       alert("Please reenter your password correctly.")
	   document.reg_form.confpassword.focus()
       return 0; 
    }
	if ((document.reg_form.plan.selectedIndex==0) && (document.reg_form.promocode.value=="") ){ 
       alert("Please select a subscription plan or enter promo code.") 
	   document.reg_form.plan.focus()
       return 0; 
    }
	if (document.reg_form.seccode.value==""){ 
       alert("Please type the security code shown.") 
       document.reg_form.seccode.focus() 
       return 0; 
    }
	if (document.reg_form.seccode.value!=security){ 
       alert("Please check the security code.") 
       document.reg_form.seccode.focus() 
       return 0; 
    }
	if (document.reg_form.plan.value==1){ 
      	document.getElementById('reg_form').action = 'onetimember.php';
    }
	
    //el formulario se envía 
    document.reg_form.submit();
	document.reg_form.submit_btn.disabled=true;
}

function validpromo(security){ 
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if (document.reg_form.name.value==""){ 
       alert("Please enter your full name.") 
       document.reg_form.name.focus() 
       return 0; 
    }
	if (document.reg_form.address.value==""){ 
       alert("Please enter your address.") 
       document.reg_form.address.focus() 
       return 0; 
    }
	if (document.reg_form.city.value==""){ 
       alert("Please enter your city.") 
       document.reg_form.city.focus() 
       return 0; 
    }
	if (document.reg_form.provience_state.value==""){ 
       alert("Please enter your state or province.")
	   document.reg_form.provience_state.focus()
       return 0; 
    }
	if (document.reg_form.zipcode.value==""){ 
       alert("Please enter a ZIP or Postal Code.")
	   document.reg_form.zipcode.focus()
       return 0; 
    }
	if (document.reg_form.country.selectedIndex==0){ 
       alert("Please select your country.")
	   document.reg_form.country.focus()
       return 0; 
    }
	if (document.reg_form.email.value==""){ 
       alert("Please enter your e-mail address.")
	   document.reg_form.email.focus()
       return 0; 
    }
	if (document.reg_form.email.value!=document.reg_form.confirmemail.value){ 
       alert("Please reenter your e-mail address correctly.")
	   document.reg_form.confirmemail.focus()
       return 0; 
    }
	if(!document.reg_form.email.value.match(emailExp)){
		alert("Please enter a valid e-mail address.")
		document.reg_form.email.focus()
		return 0;
	}	
	if (document.reg_form.newpassword.value==""){ 
       alert("Please enter a password.")
	   document.reg_form.newpassword.focus()
       return 0; 
    }
	if(document.reg_form.newpassword.value.length < 8){
       alert("You must enter at least 8 characters in the password field.");
       return 0;
	}  
   if (document.reg_form.newpassword.value!=document.reg_form.confpassword.value){ 
       alert("Please reenter your password correctly.")
	   document.reg_form.confpassword.focus()
       return 0; 
    }
	if (document.reg_form.seccode.value==""){ 
       alert("Please type the security code shown.") 
       document.reg_form.seccode.focus() 
       return 0; 
    }
	if (document.reg_form.seccode.value!=security){ 
       alert("Please check the security code.") 
       document.reg_form.seccode.focus() 
       return 0; 
    }

    //el formulario se envía 
    document.reg_form.submit();
	document.reg_form.submit_btn.disabled=true;
}


function validregtab(security){ 
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if (document.reg_form.name.value==""){ 
       alert("Please enter your full name.") 
       document.reg_form.name.focus() 
       return 0; 
    }
	if (document.reg_form.address.value==""){ 
       alert("Please enter your address.") 
       document.reg_form.address.focus() 
       return 0; 
    }
	if (document.reg_form.city.value==""){ 
       alert("Please enter your city.") 
       document.reg_form.city.focus() 
       return 0; 
    }
	if (document.reg_form.provience_state.value==""){ 
       alert("Please enter your state or province.")
	   document.reg_form.provience_state.focus()
       return 0; 
    }
	if (document.reg_form.zipcode.value==""){ 
       alert("Please enter a ZIP or Postal Code.")
	   document.reg_form.zipcode.focus()
       return 0; 
    }
	if (document.reg_form.country.selectedIndex==0){ 
       alert("Please select your country.")
	   document.reg_form.country.focus()
       return 0; 
    }
	if (document.reg_form.email.value==""){ 
       alert("Please enter your e-mail address.")
	   document.reg_form.email.focus()
       return 0; 
    }
	if (document.reg_form.email.value!=document.reg_form.confirmemail.value){ 
       alert("Please reenter your e-mail address correctly.")
	   document.reg_form.confirmemail.focus()
       return 0; 
    }
	if(!document.reg_form.email.value.match(emailExp)){
		alert("Please enter a valid e-mail address.")
		document.reg_form.email.focus()
		return 0;
	}	
	if (document.reg_form.newpassword.value==""){ 
       alert("Please enter a password.")
	   document.reg_form.newpassword.focus()
       return 0; 
    }
	if(document.reg_form.newpassword.value.length < 8){
       alert("You must enter at least 8 characters in the password field.");
       return 0;
	}  
   if (document.reg_form.newpassword.value!=document.reg_form.confpassword.value){ 
       alert("Please reenter your password correctly.")
	   document.reg_form.confpassword.focus()
       return 0; 
    }
	if (document.reg_form.seccode.value==""){ 
       alert("Please type the security code shown.") 
       document.reg_form.seccode.focus() 
       return 0; 
    }
	if (document.reg_form.seccode.value!=security){ 
       alert("Please check the security code.") 
       document.reg_form.seccode.focus() 
       return 0; 
    }
	
    //el formulario se envía 
    document.reg_form.submit();
	document.reg_form.submit_btn.disabled=true;
}