<?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>

 	  	
<body onLoad = "self.focus (); document.frm1.agdescrip.focus ()">
<div align="center">
<form name="frm1" method="post" action="" enctype="multipart/form-data">
  <p>&nbsp;</p>
  <div id="width_wrapper" align="center">
  <table width="585" align="center">
    <tr>
      <td colspan="5" class="titulo"><div align="center">AGREGAR COMPA&Ntilde;IA</div> </th>
    </tr>
    <tr>
      <th width="90" height="33"  ><div align="left"><span class="Estilo16">NOMBRE DE COMPA&Ntilde;IA </span></div></th>
      <td colspan="3" style="#A15E8D"><input name="tap2" id="tap2" type="text" tabindex="2"
		  onBlur="may(this)" size="50"
		<?php

			if(isset($_REQUEST['tap2'])){ 
				echo 'value="' . $_REQUEST['tap2'] .  '"';
			}
		?>></td>
    </tr>
    <tr>
      <th  ><div align="left"><span class="Estilo16">DESCRIPCION</span></div></th>
      <td style="#A15E8D"><input name="agdescrip" type="text" id="agdescrip" value="<?php
echo $_REQUEST['agdescrip'];?>" size="25" onBlur="may(this)"/></td>
      <th width="97"  ><div align="left"><span class="Estilo17"><strong>RFC</strong></span></div></th>
      <td width="308" style="#A15E8D"><input name="arfc" type="text" id="arfc" value="<?php
echo $_REQUEST['arfc'];?>" size="30" onBlur="may(this)"/></td>
    </tr>
    <tr>
      <th  ><div align="left"><span class="Estilo16">DIRECCION</span></div></th>
      <td style="#A15E8D"><input id="adireccion" type="text" name="adireccion" size="25" value="<?php
echo $_REQUEST['adireccion'];?>" onBlur="may(this)"/></td>
      
      <th  ><div align="left"><span class="Estilo17"><strong>COLONIA</strong></span></div></th>
      <td style="#A15E8D"><input type="hidden" name="tcol1" id="tcve" value="<?php
echo $_REQUEST['tcve'];?>">
        <input name="tcol" type="text" id="tcol" size="30" value="<?php
echo $_REQUEST['tcol'];?>"></td>
    </tr>
    <tr>
      <th  ><div align="left"><span class="Estilo16">No EXTERIOR </span></div></th>
      <td style="#A15E8D"><input id="no_ext" type="text" name="no_ext" size="25" value="<?php
echo $_REQUEST['no_ext'];?>" onBlur="may(this)"/></td>
      
      <th  ><div align="left"><span class="Estilo16">CODIGO POSTAL </span></div></th>
      <td style="#A15E8D"><input name="tcp" type="text" onKeyPress="return validar(event)" value="<?php
echo $_REQUEST['tcp'];?>" size="15" maxlength="5">
        <input name="?" type="button" class="original" onClick="window.open('DX40000_AG1.php?retPag=cat_empresas_AG.php','popuppage','width=750,height=300,top=100,left=50,scrollbars=yes,menubar=yes,status=yes')" value="..." ></td>
    </tr>
    <tr>
      <th  ><div align="left"><span class="Estilo17"><strong>PAIS</strong></span></div></th>
      <td style="#A15E8D"><select name="pais" id="pais" onChange="javascript: document.getElementById('frm1').submit()">
        <option value="">------Selecciona------</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></td>
     
      <th  ><div align="left"><span class="Estilo16">ESTADO</span></div></th>
      <td style="#A15E8D"><select name="estados" onChange="javascript: document.getElementById('frm1').submit()">
        <option  value="">--Selecciona--</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></td>
    </tr>
    <tr>
      <th  ><div align="left"><span class="Estilo17"><strong>DELEGACION O MUNICIPIO</strong></span></div></th>
      <td style="#A15E8D"><select name="tmun" id="tmun" >
        <option  value="">--Selecciona--</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></td>
      <th colspan="8"  ><div align="center" class="Estilo17"><strong>OBSERVACIONES</strong></div></th>
      </tr>
    <tr>
      <th  ><div align="left"><span class="Estilo16">TELEFONO</span></div></th>
      <td style="#A15E8D"><input name="atelefono" type="text" id="atelefono" value="<?php
echo $_REQUEST['atelefono'];?>"/></td>
      
      <td colspan="2" rowspan="4"  ><label>
		<div align="center">
		  <textarea name="pobser" cols="25" rows="5" id="pobser"
	  onBlur="may(this)"><?php

				if(isset($_POST['pobser'])){ //este es el truco
					echo $_POST['pobser'];
				}
			?>
		</textarea>
		    </div>
      </label></td>
    </tr>
    <tr>
      <th  ><div align="left"><span class="Estilo16">E-MAIL</span></div></th>
      <td style="#A15E8D"><input name="amail" type="text" id="amail" value="<?php
echo $_REQUEST['amail'];?>" size="30"/></td>
      </tr>
    <tr>
      <th  ><div align="left"><span class="Estilo16">NOMBRE DEL CONTACTO</span></div></th>
      <td style="#A15E8D"><input name="acontacto" type="text" id="acontacto" value="<?php
echo $_REQUEST['acontacto'];?>" size="30" onBlur="may(this)"/></td>
    </tr>
    <tr>
      <th  ><div align="left"><span class="Estilo17"><strong>FAX</strong></span></div></th>
      <td style="#A15E8D"><input name="afax" type="text" id="afax" value="<?php
echo $_REQUEST['afax'];?>" size="30"/></td>
    </tr>
      <tr>
        <td   colspan="5" class="titulo"><div align="center">
          <input name="Submit22" type="Button" class="original" onClick="openpage('cat_empresas_AC.php','_self')" value="Guardar">
          <input name="Submit2" type="Button" class="bot_WsW" onClick="envia1('cat_empresas_PR.php','_self')" value="Regresar">
        </div></td>
      </tr>
    </table>
	</div>
</form>
</div>
</body>
</html>
<?php
 mysqli_close($con);//258-->180?>
