/*
 * Recorta los espacios en blanco a los extremos del texto.
 * Devuelve el texto recortado.
 */
function trim(texto){
	for (var a=0; texto.substring(a,a+1)==" " && a<texto.length; a++);
	for (var b=texto.length; texto.substring(b-1,b)==" " && b>0; b--);
	return (a<=b)?texto.substring(a,b):"";
}


/*
 * Determina si un valor está en el intervalo cerrado [minimo, maximo]
*/
function estaEntre(valor, minimo, maximo){
	return ((valor>=minimo) && (valor<=maximo))? true: false;
}

/*
 * Devuelve el valor seleccionado en una lista de tipo "radio"
 */
function valorRadio(lista)
{
	for(i=0; i<lista.length; i++)
		if(lista[i].checked)
			return lista[i].value;
	return "";
}

/*
 * Devuelve true si es una fecha válida y false si no
 * Nota: el rango de los meses es [1,12]
 */
function esFecha(dia, mes, ano){
	var Fecha=new Date();
	Fecha.setFullYear(ano, mes-1, dia);

	return (Fecha.getDate()==dia) && (Fecha.getMonth()==mes-1) && (Fecha.getFullYear()==ano);
}