<?php require_once('Connections/cn.php'); ?>
<?php
session_start();

//Evita que se cargue la p�gina desde el navegador.

//Captura el tipo de usuario que se quiere registrar.  
$userType= $_GET['userType'];
if ($userType=='alumno') {
    $tipo='Estudiante';
}
if ($userType=='docente') {
    $tipo='Docente';
}
if ($userType=='admin') {
    $tipo='Personal Administrativo';
}
	

?>	

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" http-equiv="content-type" content="text/html">
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<title>sadce-registro de usuarios</title>

<style type="text/css">
  body {
    background-color: #FFFFFF;
    color: #004080;
    font-family: Arial;
    font-size: 12px;
  }
  .bd {
    background-color: #FFFFFF;
    color: #004080;
    font-family: Arial;
    font-size: 12px;
  }
  .tbl {
    background-color: #FFFFFF;
  }
  a:link { 
    color: #FF0000;
    font-family: Arial;
    font-size: 12px;
  }
  a:active { 
    color: #0000FF;
    font-family: Arial;
    font-size: 12px;
  }
  a:visited { 
    color: #800080;
    font-family: Arial;
    font-size: 12px;
  }
  .hr {
    background-color: #336699;
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  .hr1 {
    background-color: #336699;
    color: #FFFFFF;
    font-family: Arial;
    font-size: 18px; 
	height:40px;
  }
  a.hr:link {
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  a.hr:active {
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  a.hr:visited {
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  .dr {
    background-color: #FFFFFF;
    color: #000000;
    font-family: Arial;
    font-size: 12px;
  }
  .sr {
    background-color: #FFFFCF;
    color: #000000;
    font-family: Arial;
    font-size: 12px;
  }
.style1 {font-size: 12px}
.style5 {font-size: 16px; }
#tablaLogin{
  margin-right:auto;
  margin-left:auto;
  border:2px solid #ccc;
  margin-top:50px;
}
.style9 {background-color: #336699; color: #FFFFFF; font-family: Arial; font-size: 16px; font-weight: bold; }
</style>
</head>

<body>
<?php
  $userType= $_GET['userType'];
?>  
<form action="usuarios.php?userType=<?php echo $userType ?>&a=registrar" method="post" name ="addUsuario" onSubmit="return validar_registro()">
<input type="hidden" name="userType" value="<?php echo $userType; ?>">
  <table width="40%" border="0" align="center" cellpadding="0" cellspacing="0" class="bd" id="tablaLogin">
  <tr><td colspan="2" align="center" valign="middle" class="hr1">Registro de <?php echo $tipo; ?></td>
  </tr>
  <tr>
    <td width="30%">&nbsp;</td>
    <td width="70%">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2"><div align="center" class="style5">
      C&eacute;dula o Pasaporte&nbsp; 
    </div></td>
  </tr>
  <tr>
    <td colspan="2" align="center" class="style1"><input name="id_usuario" type="text" id="id_usuario" size="12" maxlength="12">
      <iframe name="frameUser" id="frameUser" with="0" height="0" frameborder="0" ></iframe></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2"><div align="center">
<input type="submit" name="action" value="Registrarse" />
    </div></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
</table>
</form>
</body>
</html>

<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>	
	 
<script type="text/javascript">
	
function validar_registro()
{
  if(document.addUsuario.id_usuario.value==""){
	alert("El campo <<Cédula o Pasaporte>> es obligatorio");
	document.addUsuario.id_usuario.focus();
	return false;
	}
  return true;
}
</script>
	
<script type="text/javascript">	

function verificar_usuario(id_usuario, tipo_usuario)
{
  
  if (id_usuario!="") {
	  url="validar_usuario.php?id_usuario="+id_usuario+"&tipo_usuario="+tipo_usuario;
	  frameUser.location=url;
  }
}
</script>


