function cambia_pais() {
	document.form1.action='club.php';
	document.form1.submit();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function blancos(txt){
	for(i=0; i<txt.length ; i++) {
		if (txt.charAt(i)!= " "){
			return true;
		}
	}
	return false;
}

function ValidaEmailFull (emailStr) { 
	var checkTLD=0; 
	var knownDomsPat=/ ^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/; 
	var emailPat=/^(.+)@(.+)$/; 
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]"; 
	var validChars="\[^\\s" + specialChars + "\]"; 
	var quotedUser="(\"[^\"]*\")"; 
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; 
	var atom=validChars + '+'; 
	var word="(" + atom + "|" + quotedUser + ")"; 
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); 
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); 
	var matchArray=emailStr.match(emailPat); 
	
	if (matchArray==null) { 
		alert("El email es incorrecto"); 
		return false; 
	} 
	
	var user=matchArray[1]; 
	var domain=matchArray[2]; 
	for (i=0; i<user.length; i++) { 
		if (user.charCodeAt(i)>127) { 
			alert("El email es incorrecto"); 
			return false; 
		} 
	} 
	
	for (i=0; i<domain.length; i++) { 
		if (domain.charCodeAt(i)>127) { 
			alert("El email es incorrecto"); 
			return false; 
		} 
	} 
	
	if (user.match(userPat)==null) { 
		alert("El email es incorrecto"); 
		return false; 
	} 
	
	var IPArray=domain.match(ipDomainPat); 
	if (IPArray!=null) { 
		for (var i=1;i<=4;i++) { 
			if (IPArray>255) { 
				alert("El email es incorrecto"); 
				return false; 
			} 
		} 
		return true; 
	} 
	
	var atomPat=new RegExp("^" + atom + "$"); 
	var domArr=domain.split("."); 
	var len=domArr.length; 
	
	for (i=0;i<len;i++) { 
		if (domArr[i].search(atomPat)==-1) { 
			alert("El email es incorrecto"); 
			return false; 
		} 
	} 
	
	if (checkTLD && domArr[domArr.length-1].length!=2 && 
		domArr[domArr.length-1].search(knownDomsPat)==-1) { 
			alert("El email es incorrecto"); 
			return false; 
	} 
	
	if (len<2) { 
		alert("El email es incorrecto"); 
		return false; 
	}

	return true;
} 

function enviar() {
	if (document.form1.nombre.value=='') {
		alert('Debes ingresar tu Nombre Completo');
		document.form1.nombre.select();
		document.form1.nombre.focus();
		return false;
	}
	if (document.form1.pais.options[document.form1.pais.selectedIndex].value=='') {
		alert('Debes seleccionar el Pais');
		//document.form1.pais.select();
		document.form1.pais.focus();
		return false;
	}
	if (document.form1.no_hay_listado.value=="0") {
		if (document.form1.region.options[document.form1.region.selectedIndex].value=='') {
			alert('Debes seleccionar la Region');
			//document.form1.ciudad.select();
			document.form1.region.focus();
			return false;
		}
		if (document.form1.ciudad.options[document.form1.ciudad.selectedIndex].value=='') {
			alert('Debes seleccionar la Ciudad');
			//document.form1.ciudad.select();
			document.form1.ciudad.focus();
			return false;
		}
	}

	if (document.form1.no_hay_listado.value=="1") {	
		if (document.form1.no_hay_listado.value=='1' && document.form1.otra_ciudad.value=='') {
			alert('Debes ingresar la ciudad');
			document.form1.otra_ciudad.select();
			document.form1.otra_ciudad.focus();
			return false;
		}
	}

	if (document.form1.edad.value=='') {
		alert('Debes ingresar tu edad');
		document.form1.edad.select();
		document.form1.edad.focus();
		return false;
	}
	if (ValidaEmailFull(document.form1.email.value) == false) {
		//alert('Debes ingresar tu email');
		document.form1.email.select();
		document.form1.email.focus();
		return false;
	}
	if (document.form1.email.value!=document.form1.email2.value) {
		alert('Debes ingresar 2 emails iguales');
		document.form1.email.select();
		document.form1.email.focus();
		return false;
	}
	
	document.form1.action = 'club_proc.php';
	
	return true;
}
