//******************************
function validateSelect(el, txt)
{
	var ix = el.selectedIndex;

	if(ix == 0)
	{
		alert("Seleccione un(a) "+txt);
		el.focus();
		ix = -1;
	}
	
	return ix;
}


//**************************************
function validateText(el, txt, len, num)
{
	var tmp, z = true;

	tmp = el.value;

	if(tmp.length < len)z = false;
	if(num && isNaN(tmp))z = false;

	if(z == false)
	{
		if(num)num = "dígitos";
		else num = "caracteres";

		alert("Ingrese correctamente el campo "+txt+" ("+len+" "+num+")");
		el.focus();
	}
	
	return z;
}


//***************************
function validateEmail(email)
{
	var test = true;

	if(email.value != "")
	{
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value)))
		{
			test = false;
			alert("La dirección de correo electrónico ingresada\n " + email.value + "\nes incorrecta. Verifique.");
			email.focus();
		}
	}
	else
	{
		test = false;
		alert("Debe ingresar un email.");
		email.focus();
	}

	return test;
}


function escribirTexto(f, t)
{
	if(document.all)document.getElementById(f).innerText = t
	else document.getElementById(f).textContent = t
}
