// JavaScript Document// Valida Email
 function validarEmail(email) {
 if(email.length <= 0){
  return false;
 }
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) 
     return false;
    if(splitted[1] != null ) {
       var regexp_user=/^\"?[\w-_\.]*\"?$/;
       if(splitted[1].match(regexp_user) == null) 
        return false;
    }
    if(splitted[2] != null) {
     var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
       if(splitted[2].match(regexp_domain) == null) {
      var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
      if(splitted[2].match(regexp_ip) == null) 
       return false;
       }
       return true;
    }
 return false;
}

function ValidarFecha(Cadena){
	// VALIDA FECHA EL FORTATO QUE DEBE RECIEBIR ES DD-MM-YYY
	
	var Fecha= new String(Cadena)	// Crea un string
	var RealFecha= new Date()	// Para sacar la fecha de hoy
	// Cadena Ao
	var Ano= new String(Fecha.substring(Fecha.lastIndexOf("-")+1,Fecha.length))
	// Cadena Mes
	var Mes= new String(Fecha.substring(Fecha.indexOf("-")+1,Fecha.lastIndexOf("-")))
	// Cadena Da
	var Dia= new String(Fecha.substring(0,Fecha.indexOf("-")))

	// Valido el ao
	if (isNaN(Ano) || Ano.length<4 || parseFloat(Ano)<1900){
        //	alert('Ao invlido')
		return false
	}
	// Valido el Mes
	if (isNaN(Mes) || parseFloat(Mes)<1 || parseFloat(Mes)>12){
		//alert('Mes invlido')
		return false
	}
	// Valido el Dia
	if (isNaN(Dia) || parseInt(Dia, 10)<1 || parseInt(Dia, 10)>31){
		//alert('Da invlido')
		return false
	}
	if (Mes==4 || Mes==6 || Mes==9 || Mes==11 || Mes==2) {
		if (Mes==2 && Dia > 28 || Dia>30) {
		//	alert('Da invlido')
			return false
		}
	}
	
  //para que envie los datos, quitar las  2 lineas siguientes
  //alert("Fecha correcta.")
 //return true	
}