function foco()
{
	if (window.document.frmCheckout.txtUser.value=="") { 
	   window.document.frmCheckout.txtUser.focus(); 
	   } else {
		 window.document.frmCheckout.txtPassword.focus();
	   }
	   
}

function comprobar_novedades ()	
{ 		
		if (window.document.form_novedades.bolEmail.value=="" || isMail(window.document.form_novedades.bolEmail.value)==false){
			alert("Por favor, introduce un e-mail valido:: ej. tu@email.com");
			window.document.form_novedades.bolEmail.select();
			window.document.form_novedades.bolEmail.focus();
			return false;
		}else{
			if (window.document.form_novedades.condiciones.checked==false){
			alert("Por favor, lea y acepte las condiciones antes de confirmar la inscripción al boletín de novedades.");
			return false;
			}else{		
			   return true;					
			}
		}
}

function usuario_email ()	
{ 		
		if (window.document.frmCheckout.hidUserRep.value == "true"){
			alert("Por favor, introduce un usuario diferente ya que este nombre de usuario ya existe");
			return false;
		}else{		
			if (window.document.frmCheckout.hidUserRepEmail.value == "true"){
			alert("Por favor, introduce un email diferente ya que este email de usuario ya existe");
			return false;	
			}else{		
			   return true;					
			}
		}
}

function comprobar_login ()	
{ 		
if (window.document.frmCheckout.txtUser.value=="" || window.document.frmCheckout.txtUser.value.length < 6 || 
		window.document.frmCheckout.txtUser.value.length > 8){
			alert("Por favor, introduce tu nombre de usuario (entre 6 y 8 carácteres)");
			window.document.frmCheckout.txtUser.select();
			window.document.frmCheckout.txtUser.focus();
			return false;
		}else{
		if (window.document.frmCheckout.txtPassword.value=="" || window.document.frmCheckout.txtPassword.value.length < 6 || 
		window.document.frmCheckout.txtPassword.value.length > 8){
			alert("Por favor, introduce tu clave (entre 6 y 8 carácteres)");
			window.document.frmCheckout.txtPassword.select();
			window.document.frmCheckout.txtPassword.focus();
		return false;
		}else{
	           return true;					
		     }
		}
}

function comprobar_clave ()	
{ 		
		if (window.document.frmCheckout.txtPassword.value=="" || window.document.frmCheckout.txtPassword.value.length < 6 || 
			window.document.frmCheckout.txtPassword.value.length > 8){
			alert("Por favor, introduce tu clave (entre 6 y 8 carácteres)");
			window.document.frmCheckout.txtPassword.select();
			window.document.frmCheckout.txtPassword.focus();
		return false;
		}else{
		if (window.document.frmCheckout.txtPasswordRep.value!=window.document.frmCheckout.txtPassword.value  || window.document.frmCheckout.txtPassword.value.length < 6 || 
		window.document.frmCheckout.txtPassword.value.length > 8){
			alert("La clave de confirmación no coincide con la clave anteriormente indicada. Repite la clave por favor.");
			window.document.frmCheckout.txtPasswordRep.select();
			window.document.frmCheckout.txtPasswordRep.focus();
		return false;
		}else{
	           return true;					
		     }
		}
}

function comprobar_email () 
{
if (window.document.frmCheckout.txtEmailRecordatorio.value=="" || isMail(window.document.frmCheckout.txtEmailRecordatorio.value)==false){
			alert("Por favor, introduce un e-mail valido:: ej. tu@email.com para darte de baja en nuestra publicidad ");
			window.document.frmCheckout.txtEmailRecordatorio.select();
			window.document.frmCheckout.txtEmailRecordatorio.focus();
			return false;
			
		}else{
	           return true;					
		}
		
}

function comprobar ()	
{ 
	
		if (window.document.frmCheckout.txtUser.value==""  || window.document.frmCheckout.txtUser.value.length < 6 || 
		window.document.frmCheckout.txtUser.value.length > 8){
			alert("Por favor, introduce tu nombre de usuario (entre 6 y 8 carácteres)");
			window.document.frmCheckout.txtUser.select();
			window.document.frmCheckout.txtUser.focus();
			return false;
		}else{
		if (window.document.frmCheckout.txtPassword.value=="" || window.document.frmCheckout.txtPassword.value.length < 6 || 
		window.document.frmCheckout.txtPassword.value.length > 8){
			alert("Por favor, introduce tu clave (entre 6 y 8 carácteres)");
			window.document.frmCheckout.txtPassword.select();
			window.document.frmCheckout.txtPassword.focus();
		return false;
		}else{
		if (window.document.frmCheckout.txtPasswordRep.value!=window.document.frmCheckout.txtPassword.value  || window.document.frmCheckout.txtPassword.value.length < 6 || 
		window.document.frmCheckout.txtPassword.value.length > 8){
			alert("La clave de confirmación no coincide con la clave anteriormente indicada. Repite la clave por favor.");
			window.document.frmCheckout.txtPasswordRep.select();
			window.document.frmCheckout.txtPasswordRep.focus();
		return false;		
		}else{	
						
		if (window.document.frmCheckout.txtEMAIL.value=="" || isMail(window.document.frmCheckout.txtEMAIL.value)==false){
			alert("Por favor, introduce un e-mail valido:: ej. tu@email.com en la informacion de pago");
			window.document.frmCheckout.txtEMAIL.select();
			window.document.frmCheckout.txtEMAIL.focus();
			return false;			
		}else{		
					var DivDestino = window.document.getElementById("DivDestino");
                    var a = DivDestino.innerHTML;
										      														
                    if (a.substring(16,28)=='Este USUARIO') {
                                 alert ("Este USUARIO ya existe cambialo por favor.");
								 window.document.frmCheckout.txtUser.select();
								 window.document.frmCheckout.txtUser.focus();
   							     return false;
				    }            
                    var DivDestino2 = window.document.getElementById("DivDestino2");
                    var a = DivDestino2.innerHTML;
										//alert(a.substring(17,27));
				   if (a.substring(17,27)=='Este EMAIL') {
                                 alert ("Este EMAIL ya existe cambialo por favor.");
								 window.document.frmCheckout.txtEMAIL.select();
								 window.document.frmCheckout.txtEMAIL.focus();
   							     return false;
				   }  				   		                     
			 	
		     }													
		}
		}
		}
               
}
			


function IsNumeric(strString)
	   //  check for valid numeric strings	
	   {
	   var strValidChars = "0123456789.";
	   var strChar;
	   var blnResult = true;

	   //  test strString consists of valid characters listed above
	   for (i = 0; i < strString.length && blnResult == true; i++)
	      {
	      strChar = strString.charAt(i);
	      if (strValidChars.indexOf(strChar) == -1)
		 {
		 blnResult = false;
		 }
	      }
	   return blnResult;
	    }

	function isMail(Cadena) 
	{

		Punto = Cadena.substring(Cadena.lastIndexOf('.') + 1, Cadena.length)			
		Dominio = Cadena.substring(Cadena.lastIndexOf('@') + 1, Cadena.lastIndexOf('.')) 	
		Usuario = Cadena.substring(0, Cadena.lastIndexOf('@'))	
		Reserv = "@/º\"\'+*{}\\<>?¿[]áéíóú#·¡!^*;,: àèìòù¨äëïöüÿñÁÉÍÓÚÀÈÌÒÙÄËÏÖÜÑ~%&¬()="
		valido = true
		
		// verifica qie el Usuario no tenga un caracter especial
		for (var Cont=0; Cont<Usuario.length; Cont++) {
			X = Usuario.substring(Cont,Cont+1)
			if (Reserv.indexOf(X)!=-1)
				valido = false
		}

		// verifica qie el Punto no tenga un caracter especial
		for (var Cont=0; Cont<Punto.length; Cont++) {
			X=Punto.substring(Cont,Cont+1)
			if (Reserv.indexOf(X)!=-1)
				valido = false
		}
				
		// verifica qie el Dominio no tenga un caracter especial
		for (var Cont=0; Cont<Dominio.length; Cont++) {
			X=Dominio.substring(Cont,Cont+1)
			if (Reserv.indexOf(X)!=-1)
				valido = false
			}

		// Verifica la sintaxis básica.....
		if (Punto.length<2 || Dominio <1 || Cadena.lastIndexOf('.')<0 || Cadena.lastIndexOf('@')<0 || Usuario<1) {
			valido = false
		}
		if (valido) {
			<!---//alert('Email válido.')--->
			return true
		} else {
			<!---//alert('Email no válido.')--->
			return false
		}
	}

