<?php require_once('Connections/cn.php'); ?>
<?php
session_start();
mysql_select_db($database_cn, $cn);
$query_rstCarreras = "SELECT id_carrera, nombre_carrera FROM carreras ORDER BY nombre_carrera ASC";
$rstCarreras = mysql_query($query_rstCarreras, $cn) or die(mysql_error());
$row_rstCarreras = mysql_fetch_assoc($rstCarreras);
$totalRows_rstCarreras = mysql_num_rows($rstCarreras);

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

<title>sadce--menu de constancias</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="css/main.css" rel="stylesheet" type="text/css">

<style type="text/css">
<!--
.style1 {color: #004080}
-->
</style>
</head>

<body>
	  <form name="form1">
	    <table width="55%" border="0" align="center" style="border:1px solid #ccc;">
	      <tr id="titulo1" >
	        <td colspan="2"><div align="center" class="Estilo1">M&oacute;dulo de Constancias </div></td>
          </tr>
	      <tr>
	        <td width="245">&nbsp;</td>
            <td width="314"><iframe name="comando" id="comando" frameborder="0" width="0" height="0"></iframe></td>
          </tr>
	      
	      <tr>
	        <td align="left"><div align="right"><span class="style1">Tipo de Constancias</span>: </div></td>
	        <td align="left"><select name="tipo" id="tipo">
	          <option value="0" selected>Seleccione...</option>
	          <option value="1">Constancias de Culminaci&oacute;n de Estudios</option>
	          <option value="2">Acta de Grado</option>
	          <option value="3">Autenticaci&oacute;n de T&iacute;tulo</option>
	          <option value="4">Constancia de Estudios</option>
	          </select>	        </td>
          </tr>
	      <tr>
	        <td align="left"><div align="right" class="style1">Documento Id:</div></td>
			  <td align="left"><input name="cedula" id="cedula" type="text" value="" size="8" maxlength="8" onblur="verificar(this.value)"  onkeypress="return soloNum(event)"></td>
	      </tr>
	      <tr>
	        <td><div align="right" class="style1">Programa:</div></td>
            <td><select name="id_carrera" id="id_carrera">
              <?php
do {  
?>
              <option value="<?php echo $row_rstCarreras['id_carrera']?>"><?php echo $row_rstCarreras['nombre_carrera']?></option>
              <?php
} while ($row_rstCarreras = mysql_fetch_assoc($rstCarreras));
  $rows = mysql_num_rows($rstCarreras);
  if($rows > 0) {
      mysql_data_seek($rstCarreras, 0);
	  $row_rstCarreras = mysql_fetch_assoc($rstCarreras);
  }
?>
            </select>
</td>
	      </tr>
	      <tr>
	        <td colspan="2"><div align="center">
	          <input name="cmdimprimir" type="button" class="style2" id="cmdimprimir" value="Imprimir" onClick="imprimir()">
	        </div></td>
          </tr>
	      <tr>
	        <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
</form>
</body>
</html>
<?php
mysql_free_result($rstCarreras);
?>
<script type="text/javascript">
	function imprimir()
	{

			tipo=document.form1.tipo.value;
			cedula=document.form1.cedula.value;
			if(tipo==0){
				alert("Debe Seleccionar el Tpo de Constancia");
				return;
			}

			if(cedula==''){
				alert("Debe ingresar la c�dula");
				return;
			}
			if(tipo==1){
				url="./dompdf/constancias/constancia_culminacion.php?cedula="+cedula;
				window.open(url);
			}
			if(tipo==2){
				url="./dompdf/constancias/acta209.php?cedula="+cedula;
				window.open(url);
			}
			if(tipo==3){
				url="./dompdf/constancias/autenticacion.php?cedula="+cedula;
				window.open(url);
			}
			if(tipo==4){
				url="./dompdf/constancias/constancia_estudios.php?cedula="+cedula;
				window.open(url);
			}
			
			
	}
	function verificar(cedula)
	{
		if(cedula==""){return;}
		comando.location="verificar_alumno.php?cedula="+cedula;
	}

</script>
<script type="text/javascript">
	var nav4 = window.Event ? true : false;
	function soloNum(evt)
	{	
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57, ','= 44, '.'= 46
		var key = nav4 ? evt.which : evt.keyCode;	
		//var str=obj.value;
	
		return (key == 8 || key == 13 || (key >= 48 && key <= 57));
	}
</script>