function valiCRMContact(frm) {
	if (frm.from_nom.value == "") {
		alert("Debe ingresar un Nombre.");
		frm.from_nom.focus();
		return false;
	}
	if (frm.from_ape.value == "") {
		alert("Debe ingresar un Nombre.");
		frm.from_ape.focus();
		return false;
	}
	var filtro = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@+([_a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]{2,200}\.[a-zA-Z]{2,6}$/;
	if (!filtro.test(frm.from_email.value)) {
		alert("Debe ingresar un correo válido.");
		frm.from_email.focus();
		return false;
	}
	if (frm.codigo_seg_img.value == "") {
		alert("Debe ingresar el código de seguridad.");
		frm.codigo_seg_img.focus();
		return false;
	}
	
	VerificaCod(frm);
	
	return false;
}


function VerificaCod(frm) {
	var codigo_seg_img = frm.codigo_seg_img.value;
	
	EnviaGet('/cont/crmContacts/tools/verifica_cod.php', "codigo_seg_img="+codigo_seg_img, function () {ImprimeCod(frm)});
}


function ImprimeCod(frm) {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			var Respuesta = http_request.responseText;
			
			if (Respuesta == "<div>1</div>") {
					alert("El código de seguridad es incorrecto.");
					frm.codigo_seg_img.focus();
			} else {
				frm.submit();
			}
		} else {
			alert('There was a problem with the request.');
		}
	}
}


