function fn_ValidarIngreso ()
{
	if (trim (document.frm_Datos.txt_Nombre.value) == "")
	{
		alert ("Debe completar su nombre y apellido.");
		document.frm_Datos.txt_Nombre.focus ();
		return false;
	}
	if (trim (document.frm_Datos.txt_Email.value) == "")
	{
		alert ("Debe completar su e-mail.");
		document.frm_Datos.txt_Email.focus ();
		return false;
	}		
	if (fn_ValidarEmailValido (document.frm_Datos.txt_Email.value, false) == false)
	{
		alert ("El e-mail ingresado es inv" + String.fromCharCode (225) + "lido.");
		document.frm_Datos.txt_Email.focus ();
		return false;
	}		
	if (fn_QuitarBasuraExtremos (document.frm_Datos.txt_Comentarios.value) == "")
	{
		alert ("Debe ingresar el mensaje.");
		document.frm_Datos.txt_Comentarios.focus ();
		return false;
	}
	
	return true;
}

function fn_Enviar ()
{
	if (fn_ValidarIngreso ())
	{
		fn_BloquearBotones ();

		document.frm_Datos.txt_HacerEnviar.value = "-1";
		
		document.body.onbeforeunload = "";
		document.frm_Datos.action = "contacto_procesar.php";
		document.frm_Datos.target = "iframeSubmit";
		document.frm_Datos.submit ();
	}
}

function fn_BloquearBotones ()
{
	document.getElementById ("tablaExterior").style.cursor = 'wait';
	
	document.frm_Datos.btn_Enviar.style.cursor = 'wait';
	document.frm_Datos.btn_Enviar.disabled = true;

	document.frm_Datos.btn_Volver.style.cursor = 'wait';
	document.frm_Datos.btn_Volver.disabled = true;
}

function fn_HabilitarBotones ()
{
	document.frm_Datos.btn_Enviar.style.cursor = 'pointer';
	document.frm_Datos.btn_Enviar.disabled = false;

	document.frm_Datos.btn_Volver.style.cursor = 'pointer';
	document.frm_Datos.btn_Volver.disabled = false;

	document.getElementById ("tablaExterior").style.cursor = 'default';		
}

function fn_ResultadoEnvioMail (envioOk)
{
	if (envioOk)
	{
		fn_BloquearBotones ();
		window.location.href = "./contacto_ok.php?" + document.frm_Datos.txt_QueryString.value;
	}
	else
		alert ("Se produjo un error al enviar los datos del formulario.");
}

function fn_Volver ()
{
	fn_BloquearBotones ();
	window.location.href = document.frm_Datos.txt_DestinoRetorno.value;
}
