<?
include("../fnc.php");
enlinea_a();
$tipo="Add";

if($ido){
  $id_op=dec($ido);
  $q=mysql_query("select * from me_opciones where id = $id_op");
  if(mysql_num_rows($q)==0){
    alert("Parámetros incorrectos",$goback);
  }
  $info=mysql_fetch_array($q);
  $tipo="Upd";
}

$id_ca=dec($idc);
$qcat=mysql_query("select * from me_categorias where id = $id_ca");
$infoc=mysql_fetch_array($qcat);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>e-Ducativo - Bienvenido</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../estilo1.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../jsincludes/overlib.js"></script>
<script language="javascript">

function foco(){
  document.form1.txtopcion.focus();
}

function valida(forma){
  var objeto;
  var formulario=document.form1;
  
  objeto=formulario.txtopcion;
  if(objeto.value==""){
   alert("Ingrese la descripción de la opción");
   objeto.focus();
   return (false);
  }

  objeto=formulario.txtlink;
  if(objeto.value==""){
   alert("Ingrese la dirección destino (link)");
   objeto.focus();
   return (false);
  }
  return (true);
}
</script>
<style type="text/css">
<!--
body {
	background-image: url(../images/tema/bg_pagina.png);
}
-->
</style></head>
<body onload="foco();">
<table width="750" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#333333">
  <tr>
    <td bgcolor="#336699">    <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#E5E5E5">
      <tr bgcolor="#FFFFFF">
        <td width="40%"><img src="../images/logo_5.gif" width="300" height="50"></td>
        <td width="60%" background="../images/back_header_admin.gif" bgcolor="#FFFFFF"><div align="right" class="usuario_nombre_enc"><strong><?echo "$unombre $uapellido";?><br>
          </strong>Tiene <?=mensajes($uuser);?> mensaje(s) sin leer</div></td>
      </tr>
      <tr bgcolor="#FFFFFF">
        <td height="15" colspan="2" background="../images/barra_encabezado.gif">&nbsp;</td>
        </tr>
    </table>
      <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="20%" valign="top" background="../images/tema/bg_contenido.png" bgcolor="#FFFFCC"><?php include("menu.php"); ?>&nbsp;</td>
          <td width="80%" valign="top" background="../images/tema/bg_contenido.png" bgcolor="#FFFFCC"><table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#333333">
            <tr align="center" valign="middle" bgcolor="#FFFFCC">
              <td height="20" class="titulo_pagina"><div align="center" class="titulo_pagina">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="65" background="../images/tema/bg_contenido.png">&nbsp;</td>
                    <td background="../images/tema/bg_contenido.png"><div align="center" class="titulo_pagina">
                      <div align="left">MENU <img src="../images/flecha_3.jpg" width="9" height="9"> Administraci&oacute;n de Opciones de Categor&iacute;a </div>
                    </div></td>
                    <td width="65" background="../images/tema/bg_contenido.png"><div align="right"><a href="inicio.php" class="link_parrafo">Inicio<img src="../images/ic_home.png" width="21" height="21" border="0"></a></div></td>
                  </tr>
                </table>
              </div></td>
            </tr>
            <tr>
              <td align="left" valign="top" bgcolor="#FFFFCC"><div align="left" class="parrafo">
                <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td background="../images/tema/bg_contenido.png"><form name="form1" method="post" action="mnt_menu_opcion.php" onsubmit="return valida(this.form1);">
                      <table width="99%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#333333">
                        <tr>
                          <td bgcolor="#FFFFFF"><table width="100%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
                            <tr align="left" valign="middle" bgcolor="#6699CC">
                              <td height="15" colspan="3" class="titulo_formulario"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td width="6%" background="../images/tema/bg_titulo_frm.png"><img src="../images/tema/ic_formularios.png" width="35" height="32"></td>
                                  <td width="94%" background="../images/tema/bg_titulo_frm.png">Informaci&oacute;n de la opci&oacute;n de la categor&iacute;a [
                                    <?=$infoc[categoria];?>
]</td>
                                </tr>
                              </table></td>
                              </tr>
                            <tr align="left" valign="middle" bgcolor="#EEF7FB">
                              <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">Descripci&oacute;n de la Opci&oacute;n:</td>
                              <td width="72%" background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9" class="parrafo"><div align="left">
                                <input name="txtopcion" type="text" class="textbox" id="txtopcion" tabindex="1" size="60" maxlength="255" value="<?=$info[opcion];?>">
                              </div></td>
                              <td width="16%" background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9" class="parrafo"><div align="center"><a href="frm_menu_opciones.php?idc=<?=$idc;?>" class="link_parrafo"><strong>Agregar Nuevo</strong></a></div></td>
                            </tr>
                            <tr align="left" valign="middle" bgcolor="#EEF7FB">
                              <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">Link:</td>
                              <td colspan="2" background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9" class="parrafo"><input name="txtlink" type="text" class="textbox" id="txtlink" tabindex="1" size="75" maxlength="255" value="<?=$info[link];?>"></td>
                            </tr>
                            
                            <tr align="left" valign="middle" bgcolor="#EEF7FB">
                              <td width="12%" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">Orden:</td>
                              <td colspan="2" background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><input name="txtorden" type="text" class="textbox" id="txtorden" tabindex="1" size="11" maxlength="11" value="<?=$info[orden];?>"></td>
                            </tr>
                            <tr align="left" valign="middle" bgcolor="#E8E8E8">
                              <td background="../images/tema/bg_frm_campos.png" class="lbl_campo"><div align="left">Destino:</div></td>
                              <td colspan="2" background="../images/tema/bg_frm_campos.png" class="lbl_formulario"><div align="left">
                                <select name="txttarget" class="textbox" id="txttarget">
                                  <option value="_self" <?if($info[target]=="_self"){echo "selected";}?>>Misma P&aacute;gina</option>
                                  <option value="_blank" <?if($info[target]=="_blank"){echo "selected";}?>>P&aacute;gina Nueva</option>
                                </select>
                              </div></td>
                            </tr>
                            <tr align="left" valign="middle" bgcolor="#E8E8E8">
                              <td colspan="3" background="../images/tema/bg_frm_campos.png" class="lbl_formulario"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                <tr bgcolor="#CFDFEF">
                                  <td width="20%"><div align="left"></div></td>
                                  <td width="30%" align="center" valign="middle"><div align="center">
                                    <input name="Submit" type="submit" class="boton_guardar" tabindex="3" value="Guardar Opci&oacute;n">
                                  </div></td>
                                  <td width="33%" align="center" valign="middle"><div align="center">
                                    <input name="Submit2" type="reset" tabindex="11" class="boton_deshacer" value="Deshacer los cambios">
                                  </div></td>
                                  <td width="17%"><div align="center"><a href="frm_menu_categoria.php?idc=<?=$idc;?>"><img src="../images/regresar_c.png" width="32" height="32" border="0"></a>
                                      <input name="tipo_trn" type="hidden" id="tipo_trn" value="<?=$tipo;?>">
                                      <input name="idc" type="hidden" id="idc" value="<?=$idc;?>">
                                      <input name="ido" type="hidden" id="ido" value="<?=$ido;?>">
                                      <br>
Regresar a Categor&iacute;as
                                  </div></td>
                                </tr>
                              </table></td>
                            </tr>
                          </table></td>
                        </tr>
                        <tr>
                          <td bgcolor="#FFFFFF">&nbsp;</td>
                        </tr>
                        <tr>
                          <td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="1" cellpadding="1">
                            <tr>
                              <td colspan="3" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td width="6%" background="../images/tema/bg_titulo_frm.png"><img src="../images/tema/ic_editar.png" width="35" height="32"></td>
                                  <td width="94%" background="../images/tema/bg_titulo_frm.png" class="titulo_formulario">Opciones existentes para esta categor&iacute;a </td>
                                </tr>
                              </table></td>
                              </tr>
                            <tr>
                              <td width="41%" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF"><div align="center"><strong>Descripci&oacute;n de la Opci&oacute;n </strong></div></td>
                              <td width="40%" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF"><div align="center" class="lbl_campo">Link</div></td>
                              <td width="19%" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF"><div align="center"><strong>Acciones</strong></div></td>
                            </tr>
                            <?
                            $qcategorias=mysql_query("select * from me_opciones where categoria = $id_ca order by orden");
                            while($icat=mysql_fetch_array($qcategorias)){
                            $i++;
                            ?>
                            <tr>
                              <td bgcolor="#ECF2F9"><img src="../images/cuad_1.png" width="9" height="9"><?=$i.".";?> <?=$icat[opcion];?></td>
                              <td bgcolor="#ECF2F9"><?=$icat[link];?></td>
                              <td bgcolor="#ECF2F9"><div align="center"><a href="frm_menu_opciones.php?ido=<?=enc($icat[id])."&idc=$idc";?>" class="link_parrafo">Modificar</a></div></td>
                            </tr>
                            <?}?>
                          </table></td>
                        </tr>
                      </table>
                    </form></td>
                  </tr>
                </table>
              </div></td>
              </tr>
          </table></td>
        </tr>
    </table>    </td>
  </tr>
</table>
</body>
</html>
