<!-- Funciones varias de validacion

// Quita los blancos al inicio y final de la cadena
// Antes de validar, ejecutar sobre el valor del campo
function AllTrim(valor) {
	tmp = valor.replace(/^\s+/, '')
	return tmp.replace(/\s+$/, '')
}

// quita espacions y guiones
function quitaEsp(valor) {
	tmp = valor.replace(/\s+/g,'')
	return tmp.replace(/-/g,'')

}

// Determina si el parametro tiene al menos un caracter no blanco
function esNulo(valor) {
	return !valor.match(/\S/)
}

// Determina si el parametro tiene la longitud minima especificada
function esLongitud(valor, longitud) {
	return (valor.length >= longitud)
}

// Determina si el parametro es un numero entero
function esNumero (valor) {
	return valor.match(/^\d+$/)
	
}

// Determina si el nombre del archivo tiene extension jpg o gif
function esImagen (valor) {
	return (valor.match(/.jp(e)?g$/i) || valor.match(/.gif$/i))
}

// Determima si se cumple con el formato nombre@mail.com[.algo]
function esMail(valor) {
	if (document.all)
		return (valor.match(/^\w+(\.\w+)*(@)(\w+)(\.\w+){1,2}$/))
	else // Netscape y algunos problemas existenciales
		return (valor.match(/^\w+(\.\w+)*(@)(\w+)(\.\w+)(\.\w+)?$/))
	}

function ChecaDatos(forma) {
 with(forma) {
    if (esNulo(et_name.value)) {
     alert("Falto introducir su nombre.  Favor de escribirlo");
     et_name.focus();
     return false;
    }

    if (esNulo(et_op.value)) {
     alert("Falto introducir el texto de su opinion.  Favor de escribirla");
     et_op.focus();
     return false;
    }
    if (et_op.value.length > 1500) {
     alert("El Texto no debe de ser mayor a 1500. Actualmente tiene "+et_op.value.length+" caracteres. Favor de editarlo");
     et_op.focus();
     return false;
    }
    if (!esNulo(tf_correoE.value)){
     if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(tf_correoE.value)) {
      alert("La dirección de Mail no tiene la sintaxis correcta");
      tf_correoE.focus();
      return false;
     }
    }
 }
 return true;
}

function AbreEnviarMail(id_mensaje) {
 window.open("foros_sr_envia_mail.php?p_id_mensaje=" + id_mensaje, "TheRemote", "width=400, height=300, resizable=yes");
}

//-->
