/*Funcion de control de foco en formularios*/
function gano (campo) {
	document.getElementById (campo).style.background="#D5FF1E";
}

function pierdo (campo) {
	document.getElementById (campo).style.background="#FFFFFF";
}

function contieneNum (valor) {
	for (i = 0; i < valor.length; i++) {
		cacho = valor.substring (i, i + 1);
		if (!isNaN(cacho)) {
			return true;
		}
	}
}

function contiene (cadena, valor) {
	var res = 0;
	for (i = 0; i < cadena.length; i++) {
		cacho = cadena.substring (i, i + 1);
		if (cacho == valor) {
			res++;
		}
	}
	return res;
}

function estaVivo (fecha) {
	var ano = fecha.substring (fecha.length - 4, fecha.length);
	if (isNaN(ano)) {
		return false;
	}
	var value = parseFloat(ano);
	var hoy = new Date ();
	if (value < hoy.getFullYear() - 90 ||
		value > hoy.getFullYear() - 18) {
		return false;
	}
	return true;
}

function enFoco (campo) {
	document.getElementById (campo).style.color="#999999";
	document.getElementById (campo+"a").style.backgroundColor="#D5FF1E";
	document.getElementById (campo+"b").style.backgroundColor="#D5FF1E";
	document.getElementById (campo+"c").style.backgroundColor="#D5FF1E";
}

function sinFoco (campo) {
	document.getElementById (campo).style.color="#000000";
	document.getElementById (campo+"a").style.backgroundColor="#F8F8F8";
	document.getElementById (campo+"b").style.backgroundColor="#F8F8F8";
	document.getElementById (campo+"c").style.backgroundColor="#F8F8F8";
}

function enFoco2 (campo) {
	document.getElementById (campo).style.color="#999999";
	document.getElementById (campo+"a").style.backgroundColor="#D5FF1E";
}

function sinFoco2 (campo) {
	document.getElementById (campo).style.color="#000000";
	document.getElementById (campo+"a").style.backgroundColor="#F8F8F8";
}