<?php
 
session_start();
$com = "A";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DMMYSQLG.php");
require_once("DFJQUERY.inc");
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<script language="javascript">
$(document).ready(function(){
	function formatItem(row) {
		return " (<strong>" + row[1] + "</strong>)"+row[0];
	}
	$("#tap2").autocomplete('valeryus70000_AU.php',{
		minChars: 1,                 //Caracteres Minimos antes de autocompletar
		//max:3                        //maximo de resultados mostrados, se manda como limit en autosugestion
		delay: 200,                  //Retardo de autocompletar 
		width: 500,                  //ancho del cuadro de despliegue
		highlight: false,            //Resalta letras coincidentes
		autoFill: false,             //autocompleta en texto la posible palabra
		scroll: true,				 //si cuadro tiene barra scroll
		scrollHeight: 300,           //alto del cuadro para el scroll
		formatItem:formatItem,	     //formato de presentacion de las posibles busquedas
		extraParams:{tipBus:'d'}     //Parametros Extra a Mandar en autosugestion
	});
});
</script>

<script language="javascript">
function ocultaMuestra(divVent){
	if(divVent.style.display=='none'){
		divVent.style.display='';

	}else{
		divVent.style.display='none';

	}
}	
	</script>

<body>

<form name="frm1" method="post" action="" enctype="multipart/form-data">
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <table width="668" border="0" align="center">
    <tr>
      <th colspan="4"><div align="center" class="Estilo18">AGREGAR CONTACTO.</div> </th>
    </tr>
    <tr>
      <td  ><span class="Estilo16">TIPO</span></td>
      <td colspan="3" style="#66CCFF"><input name="Submit22" type="Button" class="form" onClick="openpage('valeryus70000_AC.php','_self')" value="Guardar">
      <input name="Submit2" type="Button" class="form" onClick="envia1('valeryus70000_PR.php','_self')" value="Regresar"></td>
    </tr>
    <tr>
      <td  ><span class="Estilo16">NOMBRE</span></td>
      <td width="220" style="#66CCFF"><label>
        <input name="tap2" id="tap2" type="text" tabindex="2"
		  onBlur="may(this)" size="35"
		<?php

			if(isset($_REQUEST['tap2'])){ 
				echo 'value="' . $_REQUEST['tap2'] .  '"';
			}
		?>>
      </label></td>
      <td width="100"  ><span class="Estilo16">APELLIDO</span></td>
      <td width="220" style="#66CCFF"><input name="apellido" type="text" id="apellido" size="35"
	  <?php

			if(isset($_REQUEST['apellido'])){ 
				echo 'value="' . $_REQUEST['apellido'] .  '"';
			}
		?>
	  ></td>
    </tr>
    <tr>
      <td  ><span class="Estilo16">CALLE Y NUMERO </span></td>
      <td style="#66CCFF"><input name="calle" type="text" id="calle" size="25"
	  <?php

			if(isset($_REQUEST['calle'])){ 
				echo 'value="' . $_REQUEST['calle'] .  '"';
			}
		?>
	  ></td>
      <td  ><span class="Estilo16">CODIGO POSTAL </span></td>
      <td style="#66CCFF"><input name="tcp" type="text" onKeyPress="return validar(event)" value="<?php
echo $_REQUEST['tcp'];?>" size="10" maxlength="5" tabindex="27">
        <span class="Estilo1">
        <input name="?3" type="button" class="form" onClick="window.open('DX40000_AG1.php?retPag=valeryus70000_AG.php','popuppage','width=750,height=300,top=100,left=50,scrollbars=yes,menubar=yes,status=yes')" value="...." >
      </span></td>
    </tr>
    <tr>
      <td  ><span class="Estilo16">COLONIA</span></td>
      <td style="#66CCFF"><label></label>
        <label><span class="Estilo1">
        <input type="hidden" name="tcol1" id="tcve" value="<?php
echo $_REQUEST['tcve'];?>">
        <input name="tcol" type="text" id="tcol" value="<?php
echo $_REQUEST['tcol'];?>" size="25" tabindex="26">
      </span></label></td>
      <td  ><span class="Estilo16">PAIS</span></td>
      <td style="#66CCFF"><span class="Estilo1">
        <select name="pais" id="pais" onChange="javascript: document.getElementById('frm1').submit()" tabindex="28">
          <option value="">-----SELECCIONE-----</option>
          <?php
   
		  include("DMMYSQLG.php");
			@$resultado=mysqli_query($con ,"select * from dxpaises");
			if(!isset($_REQUEST['pais'])){
				$dt_paises=mysqli_fetch_array($resultado);
				$selPais=$dt_paises['cve_pais'];
				if(mysqli_num_rows($resultado)>0)
					mysqli_data_seek($resultado,0);		
			}else{
				$selPais=$_REQUEST['pais'];
			}
			while($registro=mysqli_fetch_array($resultado)){
				if($selPais==$registro['cve_pais']){
					echo '<option value="' . $registro['cve_pais'] . '" selected>' . $registro['des_pais'] . '</option>';
				}else{
					echo '<option value="' . $registro['cve_pais'] . '">' . $registro['des_pais'] . '</option>';
				}
				}			
		?>
        </select>
      </span></td>
    </tr>
    <tr>
      <td  ><span class="Estilo16">ESTADO</span></td>
      <td style="#66CCFF"><span class="Estilo1">
        <select name="estados" onChange="javascript: document.getElementById('frm1').submit()" tabindex="29">
          <option  value="">-----SELECCIONE-----</option>
          <?php
  
		@$resultado=mysqli_query($con ,"select * from dxestado where cve_pais='$selPais'");
		if(!isset($_REQUEST['estados'])){
			$dt_estado=mysqli_fetch_array($resultado);
			$selEnt=$dt_estado['cve_estado'];
			if(mysqli_num_rows($resultado)>0)
				mysqli_data_seek($resultado,0);		
		}else{
			$selEnt=$_REQUEST['estados'];
		}
		while($registro=mysqli_fetch_array($resultado)){
			if($selEnt==$registro['cve_estado'] ){ 
				echo '<option value="' . $registro['cve_estado'] . '" selected>' . $registro['des_estado'] . '</option>';
			}else{
				echo '<option value="' . $registro['cve_estado'] . '">' . $registro['des_estado'] . '</option>';
			}
			}
?>
        </select>
      </span></td>
      <td  ><span class="Estilo16">DELEGACION O MUNICIPIO </span></td>
      <td style="#66CCFF"><span class="Estilo1">
        <select name="tmun" id="tmun" tabindex="30" >
          <option  value="">-----SELECCIONE-----</option>
          <?php
 
		@$resultado=mysqli_query($con ,"select * from dxdelmun where cve_estado='$selEnt' and cve_pais='$selPais'");
		if(!isset($_REQUEST['tmun'])){
			$dt_delmun=mysqli_fetch_array($resultado);
			$selDelMun=$dt_delmun['cve_delmun'];
			if(mysqli_num_rows($resultado)>0)
				mysqli_data_seek($resultado,0);		
		}else{
			$selDelMun=$_REQUEST['tmun'];
		}
		while(@$registro=mysqli_fetch_array($resultado)){
			if($selDelMun==$registro['cve_delmun']){ 
				echo '<option value="' . $registro['cve_delmun'] . '" selected>' .$registro['des_delmun'] . '</option>';
			}else{
				echo '<option value="' . $registro['cve_delmun'] . '">' . $registro['des_delmun'] . '</option>';
			}
		}
?>
        </select>
      </span></td>
    </tr>
    <tr>
      <td  ><span class="Estilo16">TELEFONO DE EMERGENCIAS</span></td>
      <td style="#66CCFF"><input name="tel_eme" type="text" id="tel_eme" size="25"
	  <?php

			if(isset($_REQUEST['tel_eme'])){ 
				echo 'value="' . $_REQUEST['tel_eme'] .  '"';
			}
		?>
	  ></td>
      <td  ><span class="Estilo16">TELEFONO CASA</span></td>
      <td style="#66CCFF"><input name="tel_casa" type="text" id="tel_casa" size="25"
	  <?php

			if(isset($_REQUEST['tel_casa'])){ 
				echo 'value="' . $_REQUEST['tel_casa'] .  '"';
			}
		?>
	  ></td>
    </tr>
    <tr>
      <td width="100"  ><span class="Estilo16">CELULAR</span></td>
      <td colspan="3" style="#66CCFF"><label>
        <input name="celular" type="text" id="celular" size="25"
		<?php

			if(isset($_REQUEST['celular'])){ 
				echo 'value="' . $_REQUEST['celular'] .  '"';
			}
		?>
		>
      </label></td>
    </tr>
    <tr>
      <td  ><span class="Estilo16">TELEFONO EXTRA 1 </span></td>
      <td style="#66CCFF"><label>
        <input name="tel_1" type="text" id="tel_1" size="25"
		<?php

			if(isset($_REQUEST['tel_1'])){ 
				echo 'value="' . $_REQUEST['tel_1'] .  '"';
			}
		?>
		>
      </label></td>
      <td  ><span class="Estilo16">TELEFONO EXTRA 2 </span></td>
      <td style="#66CCFF"><input name="tel_2" type="text" id="tel_2" size="25"
	  <?php

			if(isset($_REQUEST['tel_2'])){ 
				echo 'value="' . $_REQUEST['tel_2'] .  '"';
			}
		?>
	  ></td>
    </tr>
    <tr>
      <td  ><span class="Estilo16">CORREO ELECTRONICO </span></td>
      <td colspan="3" style="#66CCFF"><span class="Estilo17">
        <label>
        <input name="correo" type="text" id="correo" size="40"
		<?php

			if(isset($_REQUEST['correo'])){ 
				echo 'value="' . $_REQUEST['correo'] .  '"';
			}
		?>
		>
        </label>
      </span></td>
    </tr>
    <tr>
      <td  ><span class="Estilo16">NOTAS</span></td>
      <td colspan="3" style="#66CCFF"><span class="Estilo1 Estilo17">
        <textarea name="notas" cols="29" rows="3" id="notas"
	  onBlur="may(this)"><?php

				if(isset($_POST['notas'])){ //este es el truco
					echo $_POST['notas'];
				}
			?>
        </textarea>
      </span></td>
    </tr>
  </table>
  <div id="divVent" style="display:">
  </div>
</form>
</body>
</html>
<?php
 mysqli_close($con);?>
