var B_ArrSupport = new Array ("NOMBRE","CORREO","EDAD","ESTATURA","PESO","Telefono","FECHA_NAC","COMENTARIOS");

function valida() {
		var cont = 0, cont2 = 0, cont3 = 0, cont4 = 0, cont5 = 0, cont6 = 0;

	    Form = document.frmContacto;
	    for(i = 0; i < Form.elements.length; i++){

	        if(Form.elements[i].type == "checkbox"){
				if(Form.elements[i].name == "accent" ||
				   Form.elements[i].name == "fraxel" ||
				   Form.elements[i].name == "pil" ||
				   Form.elements[i].name == "surgiderm" ||
				   Form.elements[i].name == "therapeutic_ultrasound" ||
				   Form.elements[i].name == "ultrashape" ||
				   Form.elements[i].name == "botox" ||
				   Form.elements[i].name == "lumicell" ||
				   Form.elements[i].name == "skin_resurfacing" ||
				   Form.elements[i].name == "tatoo_removal" ||
				   Form.elements[i].name == "thermage" ||
				   Form.elements[i].name == "vasculight" ||
				   Form.elements[i].name == "abdominoplasty" ||
				   Form.elements[i].name == "buttocks_augmentation" ||
				   Form.elements[i].name == "eye_surgery" ||
				   Form.elements[i].name == "liposculpture" ||
				   Form.elements[i].name == "macs_lift" ||
				   Form.elements[i].name == "rhinoplasty" ||
				   Form.elements[i].name == "breast_augmentation" ||
				   Form.elements[i].name == "chin_surgery" ||
				   Form.elements[i].name == "eyelids_surgery" ||
				   Form.elements[i].name == "lipostructure" ||
				   Form.elements[i].name == "mini_abdominoplastia" ||
				   Form.elements[i].name == "elevation_breast" ||
				   Form.elements[i].name == "rhytidectomy"
				){
		            if(Form.elements[i].checked){cont++;}
				}
			}

			if( Form.elements[i].name == "pregnant" || Form.elements[i].name == "breastfed" ||
				Form.elements[i].name == "mamografia" || Form.elements[i].name == "biopsy" ||
				Form.elements[i].name == "mastectomy" || Form.elements[i].name == "cancer_mama" ||
				Form.elements[i].name == "none_t_treatment"
			  ){
				if(Form.elements[i].checked){cont2++;}
				}

			if( Form.elements[i].name == "FECHA_MAMOGRAFIA" || Form.elements[i].name == "FECHA_BIOPSIA_MAMA" ||
				Form.elements[i].name == "FECHA_MASTECTOMIA" || Form.elements[i].name == "FECHA_CANCER_MAMA" ||
				Form.elements[i].name == "FECHA_ULT_MESTRUACION" || Form.elements[i].name == "ANOMALIAS_MAMOGRAFIA" ||
				Form.elements[i].name == "BIOPSIA_CIRUJANO" || Form.elements[i].name == "MASTECTOMIA_CIRUJANO" ||
				Form.elements[i].name == "ONCOLOGO"
			  ){
				if(Form.elements[i].value){cont2++;}
				}

			if( Form.elements[i].name == "sida" || Form.elements[i].name == "nervioso" ||
				Form.elements[i].name == "lupus" || Form.elements[i].name == "respiratorio" ||
				Form.elements[i].name == "tiroides" || Form.elements[i].name == "hepatitis" ||
				Form.elements[i].name == "sangrado" || Form.elements[i].name == "cancer" ||
				Form.elements[i].name == "esclerodermia" || Form.elements[i].name == "cardiovascular" ||
				Form.elements[i].name == "diabetes" || Form.elements[i].name == "fibromialgia" ||
				Form.elements[i].name == "urinario" || Form.elements[i].name == "hipertension" ||
				Form.elements[i].name == "hipotension" || Form.elements[i].name == "asma" ||
				Form.elements[i].name == "artritis" || Form.elements[i].name == "gastrointestinal" ||
				Form.elements[i].name == "otra_enfermedad" || Form.elements[i].name == "vesicula" ||
				Form.elements[i].name == "none_t_"){
				if(Form.elements[i].checked){cont3++;}
				}

			if( Form.elements[i].name == "aspirin" || Form.elements[i].name == "bufferin" ||
				Form.elements[i].name == "motrin" || Form.elements[i].name == "ibuprofen" ||
				Form.elements[i].name == "cough_pills" || Form.elements[i].name == "thyroid_pills" ||
				Form.elements[i].name == "hormones" || Form.elements[i].name == "bufferin" ||
				Form.elements[i].name == "anticonceptivo" || Form.elements[i].name == "antibiotics" ||
				Form.elements[i].name == "blood_pressure" || Form.elements[i].name == "diabetic_pills" ||
				Form.elements[i].name == "arthritis_pills" || Form.elements[i].name == "phenobarbital" ||
				Form.elements[i].name == "blood_thinners" || Form.elements[i].name == "digalitis" ||
				Form.elements[i].name == "cortisone" || Form.elements[i].name == "dilantin" ||
				Form.elements[i].name == "iron_vitamin_e" || Form.elements[i].name == "sleeping_pills" ||
				Form.elements[i].name == "water_pills" || Form.elements[i].name == "supplements" ||
				Form.elements[i].name == "allergy_pills" || Form.elements[i].name == "otra_medicina" ||
				Form.elements[i].name == "none_t2"
			  ){
				if(Form.elements[i].checked){cont4++;}
				}

			if( Form.elements[i].name == "fuma" || Form.elements[i].name == "toma_cafe" ||
				Form.elements[i].name == "toma_drogas" || Form.elements[i].name == "toma_alcohol" ||
				Form.elements[i].name == "none_t3" 
			 ){
				if(Form.elements[i].checked){cont5++;}
			  }

			if( Form.elements[i].name == "hipertension_fam" || Form.elements[i].name == "diabetes_fam" ||
				Form.elements[i].name == "sangrado_fam" || Form.elements[i].name == "artritis_fam" ||
				Form.elements[i].name == "infartos_fam" || Form.elements[i].name == "cancer_mama_fam" ||
				Form.elements[i].name == "asma_fam" || Form.elements[i].name == "bocio_fam" ||
				Form.elements[i].name == "cancer_fam" || Form.elements[i].name == "otra_enf_fam" ||
				Form.elements[i].name == "none_t4" 
			 ){
				if(Form.elements[i].checked){cont6++;}
			  }



		}

		if(cont == 0){
			alert("ˇYou must select at least one treatment or surgery!");
			Form.accent.focus()
			return false;
		}else{
			if(cont2 == 0){
				alert("This field is required");
				Form.pregnant.focus()
				return false;
			}
			else{
				if(cont3 == 0){
					alert("This field is required ");
					Form.vesicula.focus()
					return false;
				}
				else{
					if(cont4 == 0){
						alert("This field is required ");
						Form.aspirin.focus()
						return false;
					}
					else{
						if(cont5 == 0){
							alert("This field is required");
							Form.fuma.focus()
							return false;
						}
						else{
							if(cont6 == 0){
								alert("This field is required ");
								Form.hipertension_fam.focus()
								return false;
							}
							else{
								return true;
							}
						}
					}
				}
			}
		}

	} 

  function ValidateForm2(forma) {

    if ( 
	     (ValidaControlesNoNulos(forma,B_ArrSupport))&&
		 (ValidaCorreo (forma.CORREO.value))&&
		 (valida())&&
		 (EsValida())
	    )

	{
	  return true
	}
    else {
	  return false
	}
	
	/*
	function ResultadoValidacion(datos) {
	  
	    if ((datos != '0') || (lavar==true)){
		  Habilita(true);		
		  document.frmContacto.submit();
		 } 
		else{		
		alert('El c&oacute;digo es incorrecto sssss, por favor int&eactue;ntalo de nuevo');
		Habilita(true);
          
        }
		var body = document.getElementsByTagName("body")[0];
		var scr = document.getElementById("scriptTemporal");
		body.removeChild(scr);
		
	}

	function cargarDatos() {
			
	    Habilita(false, 'btnValida');
	    var codigo = document.getElementById("codigo").value;
		var url = "http://www.grupobfx.com/seguridad/valida_captcha.php?lavar="+lavar+"&codigo="+codigo;
		var body = document.getElementsByTagName("body")[0];
		var scr = document.createElement("script");
		scr.setAttribute("type","text/javascript");
		scr.setAttribute("src",url);
		scr.setAttribute("id","scriptTemporal");
 		body.appendChild(scr);
		return false;
		
	}
	function Habilita(valor){
	 if (valor)
    	 document.getElementById('btnValida').value ="Validar";
	 else	   
     	 document.getElementById('btnValida').value ="Validando...";
	  document.getElementById('btnValida').disabled = (!valor);
	}
	function ReloadImage(){
	  img = document.getElementById('img')
	  var date = new Date();
	  img.src= img.src + '?v='+date.getTime();
	  return false;
	}*/

	
	
  }
  function ValidaSelect(val)
  {
	var valor=val.value
	if (valor=='')
	{
	alert ("Seleccione un estado");
	val.focus();
	return false;
	}
	else{return true;}
  }
  function ValidaFechaReserva(val)
  {
	var valor=val.value;
	if (valor=='')
	{
	alert ("Seleccione Fecha de Reservaci&oacute;n");
	val.focus();
	return false;
	}
	else{return true;}
	}

  function ValidaFechaReserva_eng(val)
  {
	var valor=val.value;
	if (valor=='')
	{
	alert ("Select Reservation Day");
	val.focus();
	return false;
	}
	else{return true;}
	}


/* ---------------------- */
  function ValidateForm(forma) {
    if ( 
	     (ValidaControlesNoNulos(forma,B_ArrSupport))&&
		 (ValidaCorreo (document.formInfo.CORREO.value))
	    )

	{
	  return true
	}
    else {
	  return false
	}
  }
/* ------------------------------------------------------   */
  function ValidateForm_eng(forma) {
    if ( 
	     (ValidaControlesNoNulos_eng(forma,B_ArrSupport))&&
		 (ValidaCorreo_eng (document.formInfo.CORREO.value))
	    )

	{
	  return true
	}
    else {
	  return false
	}
  }

/* ------------------------------------------------------  */
  var B_ArrSupport2 = new Array ("NOMBRE","CORREO","TELEFONO","HORA");
  function ValidateFormReserva(forma) {
    if ( 
	     (ValidaControlesNoNulos(forma,B_ArrSupport2))&&
		 (ValidaCorreo (document.formInfo.CORREO.value))&&
		 (ValidaFechaReserva (document.formInfo.reservar))
	    )

	{
	  return true
	}
    else {
	  return false
	}
  }
/* -------------------------------- */
  var B_ArrSupport2 = new Array ("NOMBRE","CORREO","TELEFONO","HORA");
  function ValidateFormReserva_eng(forma) {
    if ( 
	     (ValidaControlesNoNulos_eng(forma,B_ArrSupport2))&&
		 (ValidaCorreo_eng (document.formInfo.CORREO.value))&&
		 (ValidaFechaReserva_eng (document.formInfo.reservar))
	    )

	{
	  return true
	}
    else {
	  return false
	}
  }




/************************************************ 
DBSPTech.com 
-----------------------------
Scripts de validaci&oacute;n para DBSP
Todos los derechos reservados (R)
************************************************/


// variables globales
var Explorador = navigator.appName;







/******************************************************************************
  funcion ValidaEntero
  Esta funci&oacute;n valida que el texto capturado dentro de un control de texto sea
  un n&uactue;mero entero.
******************************************************************************/

function ValidaEntero(evento) {
	var Tecla;
	var valido=false;

	if (Explorador.indexOf("Explorer",0) != -1) {
		Tecla = evento.keyCode;
	} else {
		Tecla=evento.which;
	}
	if (((Tecla > 47) && (Tecla < 58)) || (Tecla==8) || (Tecla==13) ||
	    (Tecla==45) ) {
		valido=true;
	}
	if (Explorador.indexOf("Explorer",0) != -1) {
		if (!valido) {
			evento.keyCode = "";
		}
	}
	return valido;
}




/******************************************************************************
  funcion ValidaNatural
  Esta funci&oacute;n valida que el texto capturado dentro de un control de texto sea
  un n&uactue;mero Natural o cero.
******************************************************************************/

function ValidaNatural(evento) {
	var Tecla;
	var valido=false;

	if (Explorador.indexOf("Explorer",0) != -1) {
		Tecla = evento.keyCode;
	} else {
		Tecla=evento.which;
	}
	if (((Tecla > 47) && (Tecla < 58)) || (Tecla==8) || (Tecla==13)) {
		valido=true;
	}
	if (Explorador.indexOf("Explorer",0) != -1) {
		if (!valido) {
			evento.keyCode = "";
		}
	}
	return valido;
}







/******************************************************************************
  funcion ValidaFlotante
  Esta funci&oacute;n valida que el texto capturado dentro de un control de texto sea
  un n&uactue;mero real.
******************************************************************************/

function ValidaFlotante(evento, control) {
	var Tecla;
	var valido=false;

	if (Explorador.indexOf("Explorer",0) != -1) {
		Tecla = evento.keyCode;
	} else {
		Tecla=evento.which;
	}
	if (((Tecla > 47) && (Tecla < 58)) || (Tecla==8) || (Tecla==13) || 
	    (Tecla==45) || (Tecla==46)) {
    	if ( (Tecla==46) && (control.value.indexOf(".")!= -1 ) ) {
    	  valido = false 
    	 }
    	 else {
    	   valido = true;
    	 }		 
	}
	if (Explorador.indexOf("Explorer",0) != -1) {
		if (!valido) {
			evento.keyCode = "";
		}
	}
	return valido;
}







/******************************************************************************
  funcion ValidaFecha
  Esta funci&oacute;n valida que el texto capturado dentro de un control de texto 
  tenga la estructura de una fecha. Debe complementarse con ValidaFechaExiste
  antes de realizar el submit de la forma.
******************************************************************************/

function ValidaFecha (evento,control) {
	var Tecla;
	var valido=false;

	if (Explorador.indexOf("Explorer",0) != -1) {
		Tecla = evento.keyCode;
	} else {
		Tecla=evento.which;
	}

	if (((Tecla > 47) && (Tecla < 58)) || (Tecla==8) || (Tecla==13)) {
		valido=true;
	} else if (Tecla==47) {
		//Valida que no haya dos caracteres "/"
		var i=0;
		var posicion=0;
		var valor=control.value;
		var dia=0;
		var strDia="";
		while (valor.indexOf("/") != -1) {
			i++;
			posicion=valor.indexOf("/");
			valor=valor.substring(posicion+1, valor.length);
		}
		if (i==2) {
			alert("La fecha no puede contener tres veces el caracter /");
			valido=false;
		} else if (i==1) {
			if (valor=="") {
				alert("El mes es inv&aacute;lido");
				strDia=control.value;
				strDia=strDia.substring(0, posicion);
				control.value="";
				valido=false;
			} else {
				mes = parseFloat(valor);
				strDia=control.value;
				strDia=strDia.substring(0, posicion);
				dia = parseFloat(strDia);
				if (mes > 0 && mes < 13) {
					//Ahora valida el mes contra el dia
					if ( mes==4 || mes==6 || mes==9 || mes==11) {
						if ( dia > 30 ) {						
							alert("Este mes no tiene "+ dia + " d&iacute;as");
							//control.value="";
							valido=false;
						} else {
							valido=true;
						}
					} else if (mes==2) {
						if (dia > 29) {
								alert("Este mes no tiene "+ dia + " d&iacute;as");
								//control.value="";
								valido=false;
							} else {
								valido=true;
							}
					} else {
						valido=true;
					}
				} else {
					alert("El mes es inv&aacute;lido");
					//control.value="";
					valido=false;
				}
			}
		} else if (i==0) {
			//Este es el primer caracter "/"
			if (valor=="") {
				alert("El d&iacute;a es inv&aacute;lido");
				//control.value="";
				valido=false;
			} else {
				//valida el dia
				dia=parseFloat(valor);
				if ((dia==0) || (dia > 31)) {
					alert("El d&iacute;a es inv&aacute;lido");
					//control.value="";
					valido=false;
				} else {
					valido=true;
				}
			}
		}
	}
	if (Explorador.indexOf("Explorer",0) != -1) {
		if (!valido) {
			evento.keyCode = "";
		}
	}
	return valido;
}






/******************************************************************************
  funcion URLHint
  Esta funci&oacute;n muestra un hint en la barra de estatus del explorador. 
******************************************************************************/


 function URLHint (Mensaje){
   window.defaultStatus = '';
   window.status = Mensaje;
 }



/******************************************************************************
  funcion SeleccionaControl
  Esta funci&oacute;n selecciona un control dentro de la forma. 
******************************************************************************/
 
 function SeleccionaControl (Control) {
   Control.focus();
   Control.select(); 
 }

 
 
 
 
/******************************************************************************
  funcion RevisaSeleccion
  Esta funci&oacute;n revisa que al menos un radio button o check box este 
  seleccionado dentro de una forma.  
******************************************************************************/
 
 
 function RevisaSeleccion(Forma,Mensaje)  {    
    var ElIdx = "";	
    for (var i = 0; i <Forma.elements.length; i++) {
      if (Forma.elements[i].checked == true)  {  
        ElIdx = Forma.elements[i].value;
      }    

    }    
    if (ElIdx == "")  {
      alert (Mensaje);
    }
    return ElIdx;
  }





/******************************************************************************
  funcion ValidaControlesFecha
  Esta funci&oacute;n valida que un arreglo de controles de tipo fecha contenga
  valores de fecha v&aacute;lidos.
******************************************************************************/


  function ValidaControlesFecha (Forma,Arreglo) {
     for (var i = 0; i < Forma.elements.length; i++) {  	
       if (EstaEnArreglo(Forma.elements[i].name,Arreglo)) {
            	if (!EsFecha(Forma.elements[i].value)) {
                    alert ("Este campo debe contener una fecha v&aacute;lida (DD/MM/AAAA)!");
                    Forma.elements[i].focus()
                    Forma.elements[i].select()	
                    return false           
                }         
       }         
     }
    return true;
  }
  

/******************************************************************************
  funcion ValidaControlesNoNulos
  Esta funci&oacute;n valida que un arreglo de controles no tenga valores nulos.
  
******************************************************************************/
  
  
  function ValidaControlesNoNulos(Forma,Arreglo) {
     for (var i = 0; i < Forma.elements.length; i++) {  	
       if (EstaEnArreglo(Forma.elements[i].name,Arreglo)) {
            	if (EsVacio(Forma.elements[i].value)) {
                    alert ("This field is required.");
                    Forma.elements[i].focus()
                    Forma.elements[i].select()	
                    return false           
                }         
       }         
     }
    return true;
  }

  


/******************************************************************************
  funcion Mayusculas
  Esta funci&oacute;n convierte el texto de un control a mayusculas
******************************************************************************/

function Mayusculas (Control) {
  Control.value=Control.value.toUpperCase();

}





/******************************************************************************
  funcion Minusculas
  Esta funci&oacute;n convierte el texto de un control a mayusculas
******************************************************************************/

function Minusculas (Control) {
  Control.value=Control.value.toLowerCase();

}




/******************************************************************************
  Funciones de soporte para las funciones principales.
******************************************************************************/



  function EstaEnArreglo(Elemento, Arreglo) {
    for (var i = 0; i < Arreglo.length; i++) {  	
      if (Arreglo[i]==Elemento) {        
          return true
      }         
    }
    return false  
  }



  
  function EsVacio(Cadena) {
    if (Cadena == "" || Cadena == null) {
      return true
    }
  
   for (var i = 0; i < Cadena.length; i++) {
      var Caracter = Cadena.substring(i, i + 1)
      if (Caracter!=" " && Caracter!="\t" && Caracter!="\n") {
        return false
      }
   }
  
    return true
  }


  
  
   function EsFecha(Fecha) {
   
     var Dia= SubcadenaDelim(Fecha,"/",0,1)
     var Mes= SubcadenaDelim(Fecha,"/",1,2)
     var Anio= SubcadenaDelim(Fecha,"/",2,3)
     
     if (EsVacio(Fecha)) {
          return true		
     }
   
     if ( (!ValidaDia(Dia)) || (!ValidaMes(Mes)) || (!ValidaAnio(Anio)) ) { 	
          return false;
     }     
   
     return(EsFechaCalendarioGregoriano(Dia,Mes,Anio,Fecha) ) 
   }
   
   
   
   
   
   function EsNumero(Cadena) {
   
     if (Cadena == "" || Cadena == null) {
       return true
     }
   
     for (var i = 0; i < Cadena.length; i++) {
       var Caracter = Cadena.substring(i, i + 1)
       if (Caracter < "0" || Caracter > "9") {
         return false
       }
     }
     return (!(Cadena.length==0))
   }


   
   function EnRango(Cadena, Min, Max) {
     var num = parseInt(Cadena)
     if (num < Min || num > Max) {
      return false
     }
     return true
   }
   
   
   function EliminaCeros(Cadena) {
     var Resultado = Cadena
     while (Resultado.substring(0,1) == "0") {
      Resultado = Resultado.substring(1,Resultado.length)
     }
     return Resultado
   }
   
   
   function ValidaCampoNumerico(Campo,Min,Max) {
     var Entrada = EliminaCeros(Campo)
   
     if ((!EsNumero(Entrada)) || (!EnRango(Entrada,Min,Max)) || EsVacio(Entrada) ) {
         return false
     }
   
     return true
   }
     
     
	 
   function ValidaDia(Campo) {
     return (ValidaCampoNumerico(Campo,1,31))
   }
   
   function ValidaMes(Campo) {
     return (ValidaCampoNumerico(Campo,1,12))
   }
   
   function ValidaAnio(Campo) {
     return (ValidaCampoNumerico(Campo,1900,9999))
   }
   
   
   
   
    function FechaCalendarioGregoriano(Dia,Mes,Anio) {
        var DiaMaximo=0;
        var MesAux=parseInt(Mes)
    
        if (Mes==1 || Mes==3 || Mes==5 || Mes==7 || Mes==8 || Mes==10 || Mes==12) {
           DiaMaximo=31
        }
        else {
           if (Mes==2) {
               if ((Anio % 4)==0 && Anio!=1900) {
                    DiaMaximo=29
               }
               else {
                    DiaMaximo=28
               }
           }
           else {
               DiaMaximo=30
           }
        }
    
        return(parseInt(Dia)<=DiaMaximo)
    }
   
   
    
    
    function EsFechaCalendarioGregoriano(Dia,Mes,Anio,Control) {
        var Mensaje="La fecha " +Dia+"/"+Mes+"/"+Anio+ " no existe."
    
        if(FechaCalendarioGregoriano(Dia,Mes,Anio)) {
            return(true)    
        }
        else {
             alert(Mensaje)
             return false
       }
    
    }   
	
	
	
    function SubcadenaDelim(Cadena,Delimitador,Inicio,Fin) {
      var AparDelim=0
      var Subcadena=""
      for (var i = 0; i < Cadena.length; i++) {
        var Caracter = Cadena.substring(i, i + 1)
    
        if (Caracter==Delimitador) {
            AparDelim++
        }
     
        if ((AparDelim>=Inicio) && (AparDelim<Fin) ) {
            if (!(Caracter==Delimitador)) {
               Subcadena= Subcadena+Caracter
            }
        } 
        
        if (AparDelim==Fin) {
            return(Subcadena)
        }          
      }	
      return (Subcadena)  	
    }


/******************************************************************************
  funcion MuestraHint
  Esta funci&oacute;n muestra un hint flotante.
******************************************************************************/
  function MuestraHint(current,evento,msg,tipo)
  {
    if (document.all){ 
      if(tipo==1){
         document.all.Hint.innerHTML = '<marquee>'+msg+'</marquee>';   
      }else{
         document.all.Hint.innerHTML = msg;
      }
      if(event.clientX+document.body.scrollLeft<500){
         document.all.Hint.style.pixelLeft=event.clientX+document.body.scrollLeft+10
      }else{
         document.all.Hint.style.pixelLeft=event.clientX+document.body.scrollLeft-150
      }
      document.all.Hint.style.pixelTop=event.clientY+document.body.scrollTop+10
      document.all.Hint.style.visibility="visible"
    }else if (document.layers){
      document.Hint.document.nstip.document.write('<b>'+msg+'</b>')
      document.Hint.document.nstip.document.close()
      document.Hint.document.nstip.left=0
      currentscroll=setInterval("scrolltip()",100)
      document.Hint.left=evento.pageX+10
      document.Hint.top=evento.pageY+10
      document.Hint.visibility="show"
    }
   
  }
  function EscondeHint()
  {
    if(document.all){
      Hint.style.visibility="hidden";
    }else if(document.layers){
      clearInterval(currentscroll)
      document.Hint.visibility="hidden"
    }
  }

/******************************************************************************
  funcion ValidaCorreo
  Esta funci&oacute;n verifica que el correo introducido sea correcto.
******************************************************************************/

function ValidaCorreo(correo){
  var i=1
  var final = correo.length
  var valido = false
  if(final>0){
    if((EsLetra(correo.charAt(0)))){ 
       var token = correo.charAt(i)
       while((i<final)&&(token!='@')&&((EsLetra(token))||(EsNumero(token))||(token=='.')||(token=='-')||(token=='_'))){
          i++;   
          token = correo.charAt(i);
       }
       if ((token == '@')&&(correo.charAt(i+1)!= '.')&&((i+1)<final)){
          i++;   
          token = correo.charAt(i)
          while((i<final)&&(token!='.')&&((EsLetra(token))||(EsNumero(token))||(token=='-')||(token=='_'))){
              i++;   
              token = correo.charAt(i)
          }
          if((token == '.')&&(correo.charAt(i+1)!='.')&&((i+1)<final)){
            i++;   
            token = correo.charAt(i)
            while((i<final)&&(token!='.')&&((EsLetra(token))||(EsNumero(token)||(token=='-')||(token=='_')))){
               i++;   
               token = correo.charAt(i)
            }
            if (i>=final){
               return true
            }else{
               if ((token == '.')&&((i+1)<final)){
                 i++;   
                 token = correo.charAt(i)
                 while((i<final)&&((EsLetra(token))||(EsNumero(token))||(token=='-')||(token=='_'))){
                   i++;   
                   token = correo.charAt(i)
                 }
                 if(i>=final){
                    return true
                 }else{
                    alert('Hay algo mal despu&eactue;s del segundo punto')
                    return false
                 }
               }else{
                  alert('Hay un simbolo desconocido despu&eactue;s del primer punto')
                  return false
               }
            }
          }else{
             alert('No tiene punto, o hay algun s&iacute;mbolo no valido')
             return false
          }
       }else{
          alert('There is no  \'@\', domain, or valid symbol error.')
          return false
       }
    }else{
       alert('El comienzo del correo es invalido')
       return false;
    }
  }else{
     return true;
  }
}

/******************************************************************************
  funcion EsLetra
  Devuelve true si el caracter recibido es una letra.
******************************************************************************/

function EsLetra(letra){
   if(((letra>='A') && (letra<='Z')) ||((letra>='a')&&(letra<='z'))){
      return true;
   }else{
      return false;
   }
}
/******************************************************************************
  funcion EsNumero
  Devuelve true si el caracter recibido es un n&uactue;mero.
******************************************************************************/

function EsNumero(numero){
   if((numero>='0') && (numero<='9')){
      return true;
   }else{
      return false;
   }
}


/******************************************************************************
  funcion Valida Numero telefonico
  Valida que contenga los 10 numeros del telefono
******************************************************************************/
function validarEntero2(valor){
     valor = parseInt(valor)
      if (isNaN(valor)) {
            return false;
      }else{
            return true;
      }
}










function validatelefono(tel)
{
var numero = /[0-9]/;
var c=0;	
var length = tel.value.length;
var valor= tel.value;
if (length >= 10)
{
   for (i=0;i<length;i++)
   {
	  value=valor.substring(i, i + 1);
	  if (numero.test(value))
   	  {
	   	 c++;
   	  }
   }
   if (c >= 10)
   {
	  return true;
   }   
   if (c<10)
   {
	alert("Poner numero telefonico con lada - 10 numeros");   
   }
}
else
{
   alert("Poner numero telefonico con lada - 10 numeros");
}
tel.focus();
return false;
}

function ValidaCorreo_eng(correo){
  var i=1
  var final = correo.length
  var valido = false
  if(final>0){
    if((EsLetra(correo.charAt(0)))){ 
       var token = correo.charAt(i)
       while((i<final)&&(token!='@')&&((EsLetra(token))||(EsNumero(token))||(token=='.')||(token=='_'))){
          i++;   
          token = correo.charAt(i);
       }
       if ((token == '@')&&(correo.charAt(i+1)!= '.')&&((i+1)<final)){
          i++;   
          token = correo.charAt(i)
          while((i<final)&&(token!='.')&&((EsLetra(token))||(EsNumero(token))||(token=='_'))){
              i++;   
              token = correo.charAt(i)
          }
          if((token == '.')&&(correo.charAt(i+1)!='.')&&((i+1)<final)){
            i++;   
            token = correo.charAt(i)
            while((i<final)&&(token!='.')&&((EsLetra(token))||(EsNumero(token)||(token=='_')))){
               i++;   
               token = correo.charAt(i)
            }
            if (i>=final){
               return true
            }else{
               if ((token == '.')&&((i+1)<final)){
                 i++;   
                 token = correo.charAt(i)
                 while((i<final)&&((EsLetra(token))||(EsNumero(token))||(token=='_'))){
                   i++;   
                   token = correo.charAt(i)
                 }
                 if(i>=final){
                    return true
                 }else{
                    alert('There is something wrong after the second dot')
                    return false
                 }
               }else{
                  alert('There is an inknown symbol after the first dot')
                  return false
               }
            }
          }else{
             alert('Dot missing, Or invalid symbol')
             return false
          }
       }else{
          alert('There is no \'@\', domain, ie there is a not valid symbol')
          return false
       }
    }else{
       alert('The email beginning is invalid')
       return false;
    }
  }else{
     return true;
  }
}


  
  function ValidaControlesNoNulos_eng(Forma,Arreglo) {
     for (var i = 0; i < Forma.elements.length; i++) {  	
       if (EstaEnArreglo(Forma.elements[i].name,Arreglo)) {
            	if (EsVacio(Forma.elements[i].value)) {
                    alert ("This field is required.");
                    Forma.elements[i].focus()
                    Forma.elements[i].select()	
                    return false           
                }         
       }         
     }
    return true;
  }