var iValorSalidaRF;
var CFG_SalidaRF = "cfg.io.rf.freq";
var DEF_SalidaRF = "0";
var CONST_SalidaRF_SinSalida = "No usar RF";

function Pag_Config_SalidaRF_Show() {
	iValorSalidaRF = parseInt(getToken(CFG_SalidaRF, DEF_SalidaRF));
	Pag_Config_Show();
	document.getElementById("Pag_Config_Form").innerHTML = 
		 '<table width="390px" height="455px" cellpadding="10" cellspacing="10" style="table-layout: fixed; background-image: url(fondo_frame.png); background-repeat: no-repeat;">'
		+'	<tr height="20px"><td width="310px"/></tr>'
		+'	<tr height="33px"><td width="310px" class="font15">Seleccione el canal RF que desea utilizar para visualizar la salida de este equipo</td></tr>'
		+'	<tr height="33px" valign="top"><td width="310px" id="Pag_Config_SalidaRF_Valor" style="background-position: 0px 5px; background-image: url(cursor_updown.png); background-repeat: no-repeat;" class="font16">' + ((iValorSalidaRF == 0) ? CONST_SalidaRF_SinSalida : iValorSalidaRF + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;") + '</td></tr>'
		+'	<tr height="33px"/>'
		+'	<tr height="33px" valign="top"><td class="font16" style="background-position: 2px 12px; background-image: url(botonera.png); background-repeat: no-repeat;"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No usar RF<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Guardar<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cancelar</td></tr>'
		+'	<tr/>'
		+'</table>';
	cPaginaVisible = "Pag_Config_SalidaRF";
}

function Pag_Config_SalidaRF_Close() {
	Pag_Config_Show(OPC_Config_SalidaRF);
}

function ActualizarConfigSalidaRF(iValor) {
	if (iValor == 1) {
		iValor = 21;
	} else if (iValor < 21) {
		iValor = 0;
	} else if (iValor < 69) {
	} else {
		iValor = 69;
	}
	iValorSalidaRF = iValor;
	if (iValorSalidaRF == 0) {
		document.getElementById("Pag_Config_SalidaRF_Valor").innerHTML = CONST_SalidaRF_SinSalida;
	} else {
		document.getElementById("Pag_Config_SalidaRF_Valor").innerHTML = iValorSalidaRF + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	}
}

function Pag_Config_SalidaRF_KeyDown(keyChar) {
	try {
		switch (keyChar) {
			case KEY_RIGHT:
			case KEY_0: case KEY_1:
			case KEY_2: case KEY_3:
			case KEY_4: case KEY_5:
			case KEY_6: case KEY_7:
			case KEY_8: case KEY_9:
				return 0;
			case KEY_RED:
				ActualizarConfigSalidaRF(0);
				return 0;
			case KEY_DOWN:
				ActualizarConfigSalidaRF(iValorSalidaRF-1);
				return 0;
			case KEY_UP:
				ActualizarConfigSalidaRF(iValorSalidaRF+1);
				return 0;
			case KEY_GREEN:
				setToken(CFG_SalidaRF, iValorSalidaRF);
				Pag_Config_SalidaRF_Close();
				return 0;
			case KEY_BLUE:
			case KEY_LEFT:
			case KEY_BACK:
				Pag_Config_SalidaRF_Close();
				return 0;
		}
	} catch(ex) {
		alert("Pag_Config_SalidaRF_KeyDown: " + ex);
	}
	return 1;
}
