<? 
$nivel = $_GET["nivel"];
$nombrevar =$_GET["nombreuser"];
$hoy=date("d-m-Y");
$ano=date("Y");
?>
    <script src="../../jquery.js"></script>
    <script>
$(document).ready(function(){
// Demo 5
$('#identidad').Rut({
  on_error: function(){ alert('Rut incorrecto'); },
  format_on: 'keyup' 
});
$("#content > ul").tabs();
});

function cerrar() {
			window.close();
		}
		
</script>  
 <script type="text/javascript" src="../js/jquery-1.6.2.js"></script>
  <script src="../js/jquery.Rut.js" type="text/javascript"></script>
  <script type="text/javascript" src="../js/funciones/scripts.js"></script>
  <script type="text/javascript">

 //He aqui la magia de AJAX gracias al Framework JQuery!
  $(document).ready(function(){
	  //programamos el vento click del boton enviar del formulario
	  $("#enviar").click(function() {
		  
		  //Variables del formulario
		  var ide=frm_add.identidad.value;
		  var nom=frm_add.nombre.value;
		 
		  var dir=frm_add.dir.value;
		  
	
		  var fon=frm_add.fono.value;
		  var cor=frm_add.correo.value;
		  var nivel=frm_add.nivel.value;
		  var pass=frm_add.pass.value;
	
		   
		  //preguntamos si no hay campos vacios
		  if(ide!="" && nom!="" &&  dir!="" && pass!="" && nivel!="" && pass!="" )
		  {
		      //Enviamos mediante el metodo post de JQuery $.post("archivo.php",{parametros}, callback);
		      $.post("add_reg.php", {enviar:frm_add.enviar.value, identidad:ide, nombre:nom, dir:dir, fono:fon, correo:cor, nivel:nivel, pass:pass}, function(output){
			    //El parametro output, recibe como salida lo generado por el script php
				alert(output);
				//con esta linea limpiamos el formulario
				document.frm_add.reset();
		      });
		  }
		  else
		  {
			  alert("Campos obligatorios (*) vacios!");
		  }
	  });
  });
</script>
<!DOCTYPE html>
<html dir="ltr" lang="en-US"><head><!-- Created by Artisteer v4.3.0.60745 -->
    <meta charset="utf-8">
    <title>Home</title>
    <meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no, width = device-width">

    <!--[if lt IE 9]><script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <link href="../../../style.css" rel="stylesheet" type="text/css" media="screen">
    <!--[if lte IE 7]><link rel="stylesheet" href="../../style.ie7.css" media="screen" /><![endif]-->
    <link rel="stylesheet" href="../../../style.responsive.css" media="all">


    <script src="../../../jquery.js"></script>
    <script src="../../../script.js"></script>
    <script src="../../../script.responsive.js"></script>



<style>.art-content .art-postcontent-0 .layout-item-0 { margin-bottom: 10px;  }
.art-content .art-postcontent-0 .layout-item-1 { border-right-style:solid;border-right-width:1px;border-right-color:#C4C6BD; padding-right: 10px;padding-left: 10px;  }
.ie7 .art-post .art-layout-cell {border:none !important; padding:0 !important; }
.ie6 .art-post .art-layout-cell {border:none !important; padding:0 !important; }

</style>

 <script src="../../jquery.js"></script>
<script type="text/javascript" src="../js/jquery-1.6.2.js"></script>
<script type="text/javascript" src="../js/funciones/scripts.js"></script>
<link rel="stylesheet" href="../menu/styles.css" />  

</head>
<body>
<div id="art-main">
    <div class="art-sheet clearfix">

<div class="art-layout-wrapper">
                <div class="art-content-layout">
                    <div class="art-content-layout-row">
                      <div class="art-layout-cell art-content"><article class="art-post art-article">
                                
                                                
                                <div class="art-postcontent art-postcontent-0 clearfix"><div class="art-content-layout-wrapper layout-item-0">
<div class="art-content-layout">
    <div class="art-content-layout-row">
    <div class="art-layout-cell layout-item-1" style="width: 100%" >
 
       <h3>Agregar usuarios</h3>
     <fieldset><legend>Nuevo Registro </legend>
       <form id="frm_add" name="frm_add" method="post">
   <table width="514">
    
     <tr>
       <td width="145" height="32">R.U.T:</td>
       <td width="557"><input type="text" name="identidad" id="identidad"  /></td>
     </tr>
     <tr>
       <td height="15"><label>NOMBRE:</label></td>
       <td><input type="text" name="nombre" id="nombre" /></td>
     </tr>
     <tr>
       <td height="26">DIRECCION:</td>
       <td><input type="text" name="dir" id="dir" /></td>
     </tr>
      <tr>
       <td height="13"><label>FONO:</label></td>
       <td><input type="text" name="fono" id="fono" /></td>
     </tr>
      <tr>
        <td height="2">CORREO: </td>
        <td><input type="text" name="correo" id="correo" /></td>
      </tr>
      <tr>
        <td height="0">CONTRASEÑA:</td>
        <td><input type="password" name="pass" id="pass" /></td>
      </tr>
      <tr>
        <td height="0">NIVEL:</td>
        <td>
          <select name="nivel" id="nivel">
            <option value="1">ADMINISTRADOR</option>
            <option value="2">CAJERO</option>
            <option value="3">VENDEDOR</option>
          </select></td>
      </tr>
     <tr>
       <td colspan="2" align="right">
         <input type="button" id="enviar" name="enviar" value="Guardar" class="art-button" />
         <input type="reset" id="cancel" name="cancel" value="Cancelar" class="art-button" />
         <input type="submit" value="Cerrar ventana" class="art-button" onClick="cerrar()" /></td>
     </tr>
     </table>
</form>
        </fieldset>    
                                  
    </div>
    </div>
</div>
</div>
</div>


</article></div>
                    </div>
                </div>
            </div><footer class="art-footer">
<p><br></p>
<p>Copyright © <? echo $ano ?>. All Rights Reserved.</p>
</footer>

    </div>
    <p class="art-page-footer"><a href="http://www.virtualsurchile.cl" target="_blank">Informatica Francisco Arias E.I.R.L.</a></p>
</div>


</body></html>