<?

include("../fnc.php");

enlinea_a();



if($idgrado){

 $idgrado=base64_decode($idgrado);

// echo $idgrado;

 $qver=mysql_query("select * from grados where id = '$idgrado'");

 if(mysql_num_rows($qver)==0){

  alert("El grado no existe","javascript:history.go(-1)");

 }else{

  $info=mysql_fetch_array($qver);

  $tipo="Update";

 }

}else{

 $tipo="Add";

}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>e-Ducativo - Administraci&oacute;n grados escolares</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>

<style type="text/css">
<!--
body {
	background-image: url(../images/tema/bg_pagina.png);
}
-->
</style></head>



<body>

<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>

<table width="750" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#333333">

  <tr>

    <td>    <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" bgcolor="#FFFFCC">

        <tr>

          <td width="20%" valign="top" bgcolor="#FFFFCC"><?php include("menu.php"); ?>&nbsp;</td>

          <td width="80%" valign="top"><table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#333333">

            <tr align="center" valign="middle" bgcolor="#FFFFCC">

              <td width="8%" height="20" class="titulo_pagina"><div align="center" class="titulo_pagina"></div></td>

              <td class="titulo_pagina"><strong>ADMINISTRACION DE GRADOS ESCOLARES </strong></td>

              <td width="8%" class="titulo_pagina"><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>

            <tr>

              <td colspan="3" align="left" valign="top" bgcolor="#FFFFCC"><div align="left" class="parrafo">

                <form name="form1" method="post" action="mnt_grado.php">

                  <table width="99%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000099">

                    <tr>

                      <td bgcolor="#ECE9D8"><table width="100%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">

                          <tr bgcolor="#6699CC">

                            <td colspan="2" class="titulo_seccion"><div align="left" class="titulo_formulario">Informaci&oacute;n del grado escolar </div></td>

                          </tr>

                          <tr>

                            <td width="9%" align="left" valign="middle" bgcolor="#CFDFEF" class="lbl_campo">Grado</td>

                            <td width="91%" bgcolor="#ECF2F9"><div align="left">

                              <input name="txtgrado" type="text" class="textbox" id="txtcarnet3" value="<?=$info[grado];?>" size="70" maxlength="50">

                              <a href="#" onMouseOver="return overlib('Ingrese un nombre que identifique al grado. <br><br><strong>Ejemplos:</strong><br>-Primero Primaria<br>-Quinto Perito Contador');" onmouseout="return nd();"><img src="../images/con_info.png" width="16" height="16" border="0"></a></div></td>

                            </tr>

                          <tr>

                            <td align="left" valign="middle" bgcolor="#CFDFEF" class="lbl_campo">Jornada</td>

                            <td bgcolor="#ECF2F9">

                            <select name="txtjornada" class="textbox" id="txtjornada">

                              <?

                              $qjornadas=mysql_query("select * from jornadas");

                              while($ijornada=mysql_fetch_array($qjornadas)){

                                echo "<option value='{$ijornada[id]}'>{$ijornada[jornada]}</option>";

                              }

                              ?>

                            </select>

                            <span class="lbl_buscar"><strong><a href="#" onMouseOver="return overlib('Seleccione la jornada a la que pertenece el grado');" onmouseout="return nd();"><img src="../images/con_info.png" width="16" height="16" border="0"></a></strong></span></td>

                          </tr>

                          <tr>

                            <td width="9%" align="left" valign="middle" bgcolor="#CFDFEF" class="lbl_campo">Nivel</td>

                            <td bgcolor="#ECF2F9"><div align="left"><span class="lbl_buscar"><strong>

                              <select name="txtnivel" class="textbox" id="txtnivel">

                              <?

                               if($tipo=="Update"){

                                $qniveles=mysql_query("select * from niveles where id = {$info[nivel]}");

                                $iniveles=mysql_fetch_array($qniveles);

                                echo "<option value='".$iniveles[id]."' class='selected_option'>ACTUAL: {$iniveles[nivel]}</option>";

                               }



                               $qniveles=mysql_query("select * from niveles order by id");

                               while($iniveles=mysql_fetch_array($qniveles)){

                                echo "<option value='".$iniveles[id]."'>{$iniveles[nivel]}</option>";

                               }

                              ?>

                              </select>

                              <a href="#" onMouseOver="return overlib('Seleccione el nivel al que pertenece el grado');" onmouseout="return nd();"><img src="../images/con_info.png" width="16" height="16" border="0"></a>

                              <input name="idgrado" type="hidden" id="idgrado" value="<?=base64_encode($idgrado);?>">

                              </strong></span>

                            </div></td>

                          </tr>

                          <tr bgcolor="#CFDFEF">

                            <td colspan="2" align="left" valign="middle" class="lbl_campo"><table width="100%"  border="0" cellspacing="1" cellpadding="5">

                              <tr>

                                <td width="20%"><input name="sid" type="hidden" id="sid" value="<?=$sid;?>">

                                    <input name="tipo_trn" type="hidden" id="tipo_trn" value="<?=$tipo;?>"></td>

                                <td width="25%"><div align="center">

                                    <input name="Submit" type="submit" class="boton_guardar" value="<?if($tipo=="Update"){echo "Guardar los cambios";}else{echo "Agregar";}?>">

                                </div></td>

                                <td width="25%"><div align="center">

                                    <input name="Submit2" type="reset" class="boton_deshacer" value="Deshacer los cambios">

                                </div></td>

                                <td width="20%">&nbsp;</td>

                              </tr>

                            </table></td>

                            </tr>

                      </table></td>

                    </tr>

                  </table>

                  <br>

                  <a href="inicio.php"><img src="../images/regresar_c.png" width="32" height="32" border="0"></a> <br>

                  <strong>Salir</strong>

                </form>

                </div></td>

              </tr>

          </table></td>

        </tr>

    </table>    </td>

  </tr>

</table>

</body>

</html>