var CFG_PuertaEnlace = "cfg.ip.gateway";
var DEF_PuertaEnlace = "192.168.1.1";

function Pag_Red_PuertaEnlace_Show() {
	Pag_Red_Show();
	//document.getElementById("Pag_Red").style.backgroundImage = "url(fondo_completo.png)";
	document.getElementById("Pag_Red_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">Introduzca la dirección IP de la puerta de enlace</td></tr>'
		+'	<tr height="33px" align="top"><td width="310px" id="Pag_Red_PuertaEnlace_Valor" style="background-position: 0px 5px; background-image: url(cursor_datos.png); background-repeat: no-repeat;" class="font16">' + getToken(CFG_PuertaEnlace, DEF_PuertaEnlace) + '|&nbsp;&nbsp;&nbsp;</td></tr>'
		+'	<tr height="33px" valign="top"><td id="Pag_Red_PuertaEnlace_Info" class="font16"/></td></tr>'
		+'	<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;Borrar<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Guardar<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Para introducir un punto (.)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cancelar</td></tr>'
		+'	<tr/>'
		+'</table>';
	cPaginaVisible = "Pag_Red_PuertaEnlace";
}

function Pag_Red_PuertaEnlace_Close() {
	Pag_Red_Show(OPC_Red_PuertaEnlace);
}

function Pag_Red_PuertaEnlace_KeyDown(keyChar) {
	var cTemp;
	var cTemp2;
	try {
		if (NumberInput_KeyDown("Pag_Red_PuertaEnlace", keyChar) == 0) {
			return 0;
		} else switch (keyChar) {
			case KEY_YELLOW:
				cTemp = document.getElementById("Pag_Red_PuertaEnlace_Valor").innerHTML;
				cTemp = cTemp.slice(0,-19);
				document.getElementById("Pag_Red_PuertaEnlace_Valor").innerHTML = cTemp + ".|&nbsp;&nbsp;&nbsp;";
				return 0;
			case KEY_GREEN:
				cTemp = document.getElementById("Pag_Red_PuertaEnlace_Valor").innerHTML;
				cTemp = cTemp.slice(0,-19);
				setToken(CFG_PuertaEnlace, cTemp);
				Pag_Red_PuertaEnlace_Close();
				return 0;
			case KEY_BLUE:
			case KEY_LEFT:
			case KEY_BACK:
				Pag_Red_PuertaEnlace_Close();
				return 0;
		}
	} catch(ex) {
		alert("Pag_Red_PuertaEnlace_KeyDown: " + ex);
	}
	return 1;
}
