<?php
 
session_start();
include("DMMYSQLG.php");
include("DF30000.inc");
//if(!isset($_POST['ra_reg'])) echo '<meta content="1; url=DZ30000_PR.php"  HTTP-EQUIV="REFRESH">';
if(isset($_POST["m1"])){
	include("DSA2000.php");
}

include("DFJQUERY.inc");
include("DFSELMAN.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() {
	$.ajaxSetup({
		  type: "POST",
		  url: getAjaxSource(),
		  async:false
	});
	getCountries();
	getStates(document.getElementById('tcve_pais').value);
	getDelMuns(document.getElementById('tcve_pais').value,document.getElementById('tcve_estado').value);
	//setDefaults();
	setActions();
});


function setDefaults(){
	var objPaises= new SelectManager('paises');
	var objEstados=new SelectManager('estados');
	var objDelMun=new SelectManager('delMun');
	var lpais=document.getElementById('tcve_pais').value;
	var lestado=document.getElementById('tcve_estado').value;
	var ldelmun=document.getElementById('tcve_delmun').value;
	objPaises.selectOption({value:lpais});
	objEstados.selectOption({value:lestado});
	objDelMun.selectOption({value:ldelmun});
}

function getAjaxSource(){
	return 'DZ30000_MO-SRV.php';
}

function getCountries(){
	var objPais= new SelectManager('paises');
	var objEstados= new SelectManager('estados');
	var objDelMun= new SelectManager('delMun');
	objEstados.dropOptions(1,objEstados.getLength());
	objDelMun.dropOptions(1,objDelMun.getLength());
	$.post(getAjaxSource(),
		{ getCountries: '34' },
		function(datos) {
			objPais.clearOptions();
			objPais.addOptions(eval(datos));
		}
	);
	
}

function getStates(country){
	var objEstados= new SelectManager('estados');
	var objDelMun= new SelectManager('delMun');
	//var objColCiu= new SelectManager('colCiu');
	
	objDelMun.dropOptions(1,objDelMun.getLength());
	//objColCiu.dropOptions(1,objColCiu.getLength());
	$.post(
		getAjaxSource(),
		{
		getStates:'',codPais:country},
		function(datos) {
			objEstados.clearOptions();
			objEstados.addOptions(eval(datos));
		}//termina funcion tratado datos
	);//termina post
}

function getDelMuns(country,state){
	var objDelMun= new SelectManager('delMun');
	//var objColCiu= new SelectManager('colCiu');
	
	//objColCiu.dropOptions(1,objColCiu.getLength());
	$.post(
		getAjaxSource(),
		{
		getDelMun:'',codPais:country,codEstado:state},
		function(datos) {
			objDelMun.clearOptions();
			objDelMun.addOptions(eval(datos));
		}//termina funcion tratado datos
	);//termina post
}

function getColCius(country,state,delMun){
	var objColCiu= new SelectManager('colCiu');
	$.post(
		getAjaxSource(),
		{
		getColCiu:'',codPais:country,codEstado:state,codDelMun:delMun},
		function(datos) {
			objColCiu.clearOptions();
			objColCiu.addOptions(eval(datos));
		}//termina funcion tratado datos
	);//termina post
}
function setActions(){
	$('#paises').change(function(){
		var objPais= new SelectManager('paises');
		var lpais=document.getElementById('tcve_pais');
		var lestado=document.getElementById('tcve_estado');
		var ldelmun=document.getElementById('tcve_delmun');
		
		lpais.value=objPais.getSelectedValue();
		lestado.value='';
		ldelmun.value='';
		getStates(lpais.value);
	});
	
	$('#estados').change(function(){
		var objEstado= new SelectManager('estados');
		var lpais=document.getElementById('tcve_pais');
		var lestado=document.getElementById('tcve_estado');
		var ldelmun=document.getElementById('tcve_delmun');
		
		lestado.value=objEstado.getSelectedValue();
		ldelmun.value='';
		getDelMuns(lpais.value,lestado.value);
	
	});

	$('#delMun').change(function(){
		var objDelMun= new SelectManager('delMun');
		var lpais=document.getElementById('tcve_pais');
		var lestado=document.getElementById('tcve_estado');
		var ldelmun=document.getElementById('tcve_delmun');
		
		ldelmun.value=objDelMun.getSelectedValue();
		//getDelMuns(lpais.value,lestado.value,ldelmun.value);
	});

}

-->
//Termina en Carga 
</script>

<body>
<form name="frm1" action="" method="post" >
<table width="818"  align="center">
  <tr>
    <th align = center colspan=6 class=\"titulo\">CATALOGO DE EMPRESAS</th>
  </tr>
  <tr class="tragre">
    <td width="167">Siglas:</td>
    <td colspan="5"><input name="tsiglas" type="text" id="tsiglas" /></td>
  </tr>
  <tr class="tragre">
    <td>Razon Social:</td>
    <td colspan="5"><input name="tnom_emp" type="text" id="tnom_emp" /></td>
  </tr>
  <tr class="tragre">
    <td>Giro Comercial: </td>
    <td colspan="5"><input name="tgiro" type="text" id="tgiro" /></td>
  </tr>
  <tr class="tragre">
    <td>Calle:</td>
    <td width="149"><input name="tcalle" type="text" id="tcalle" /></td>
    <td width="131">No.Ext:</td>
    <td width="144"><input name="tno_ext" type="text" id="tno_ext" /></td>
    <td width="43">No.Int:</td>
    <td width="144"><input name="tno_int" type="text" id="tno_int" /></td>
  </tr>
  <tr class="tragre">
    <td>Entre Calle:</td>
    <td><input name="tentre_call" type="text" id="tentre_call" /></td>
    <td>Y:</td>
    <td colspan="3"><input name="ty_calle" type="text" id="ty_calle" /></td>
  </tr>
  <tr class="tragre">
    <td>Telefono:</td>
    <td><input name="ttelefono01" type="text" id="ttelefono01" /></td>
    <td>Fax:</td>
    <td><input name="tfax01" type="text" id="tfax01" /></td>
    <td>E-mail:</td>
    <td><input name="temail01" type="text" id="temail01" /></td>
  </tr>
  <tr class="tragre">
    <td>Colonia:</td>
    <td><input name="tdes_col" type="text" id="tdes_col" /></td>
    <td>Codigo Postal:</td>
    <td colspan="3"><input name="tcod_pos" type="text" id="tcod_pos" /></td>
  </tr>
  <tr class="tragre">
    <td>Pais:</td>
    <td><input name="tcve_pais" type="hidden" id="tcve_pais" />
      <select name="paises" id="paises">
      </select>
      </td>
    <td>Ciudad/Estado:</td>
    <td colspan="3"><input name="tcve_estado" type="hidden" id="tcve_estado" />
      <select name="estados" id="estados">
      </select>
      </td>
  </tr>
  <tr class="tragre">
    <td>Delegacion/Municipio:</td>
    <td colspan="5"><input name="tcve_delmun" type="hidden" id="tcve_delmun" />
      <select name="delMun" id="delMun">
      </select>
      </td>
  </tr>
  <tr class="tragre">
    <td>R.F.C:</td>
    <td><input name="trfc" type="text" id="trfc" /></td>
    <td>Camara:</td>
    <td colspan="3"><input name="tcamara" type="text" id="tcamara" /></td>
  </tr>
  <tr class="tragre">
    <td>I.M.S.S:</td>
    <td><input name="timss" type="text" id="timss" /></td>
    <td>Fecha de Alta:</td>
    <td colspan="3"><input name="tfec_alta" readonly type="text" id="tfec_alta" value="<?php
 if(!isset($_POST['tfec_alta']))echo date('d/m/Y');?>"/> 
	<input name="bot" id="bot" type="image" value=" ... " src="logos/cal4.jpg"/>
   <script type="text/javascript">
  	Calendar.setup(
    	{
      		inputField  : "tfec_alta",        // ID of the input field
      		ifFormat    : "%d/%m/%Y",    // the date format
      		button      : "bot"      // ID of the button
    	}
  	);
   </script></td>
  </tr>
  <tr class="tragre">
    <td>Infonavit:</td>
    <td><input name="tinfonavit" type="text" id="tinfonavit" /></td>
    <td>Fecha de Baja:</td>
    <td colspan="3"><input name="tfec_baja" readonly type="text" id="tfec_baja" value="<?php
 if(!isset($_POST['tfec_alta']))echo '00/00/0000';?>"/>
		<input name="bot1" id="bot1" type="image" value=" ... " src="logos/cal4.jpg"/>
   <script type="text/javascript">
  	Calendar.setup(
    	{
      		inputField  : "tfec_baja",        // ID of the input field
      		ifFormat    : "%d/%m/%Y",    // the date format
      		button      : "bot1"      // ID of the button
    	}
  	);
   </script>
	</td>
  </tr>
  <tr class="tragre">
    <td>Afore:</td>
    <td><input name="tafore" type="text" id="tafore" /></td>
    <td>Notas:</td>
    <td colspan="3"><input name="tnotas" type="text" id="tnotas" /></td>
  </tr>
  <tr>
    <th align = center colspan=6 class=\"titulo\">DATOS REPRESENTANTE LEGAL
        </div></th>
  </tr>
  <tr class="tragre">
    <td>Nombre:</td>
    <td><input name="tnom_repleg" type="text" id="tnom_repleg" /></td>
    <td>Apellido Paterno:</td>
    <td colspan="3"><input name="tapp_repleg" type="text" id="tapp_repleg"></td>
  </tr>
  <tr class="tragre">
    <td>Apellido Materno: </td>
    <td><input name="tapm_repleg" type="text" id="tapm_repleg"></td>
    <td>R.F.C:</td>
    <td colspan="3"><input name="trfc_repleg" type="text" id="trfc_repleg" /></td>
    </tr>
  <tr class="tragre">
    <td>Curp:</td>
    <td colspan="5"><input name="tcurp_repleg" type="text" id="tcurp_repleg" /></td>
  </tr>
  <tr>
    <th align = center colspan=6 class=\"titulo\">INFORMACION BASE DE DATOS
        </div></th>
  </tr>
  <tr class="tragre">
    <td>Nombre Base De Datos:</td>
    <td><input name="tdbname1" type="text" id="tdbname1" /></td>
    <td>&nbsp;</td>
    <td colspan="3">&nbsp;</td>
  </tr>
  <tr class="tragre">
    <td>Nombre Usuario:</td>
    <td><input name="tdbuser1" type="text" id="tdbuser1" /></td>
    <td>Contrase&ntilde;a:</td>
    <td colspan="3"><input name="tdbpass1" type="password" id="tdbpass1" /></td>
  </tr>
  <tr class="tragre">
    <td colspan="6"><div align="center">
      <input type="button" name="Submit" value="Agregar" onClick="openpage('DZ31000.php','_self')"/ >
      &nbsp;&nbsp;
       
      <input type="button" name="Submit3" value="Regresar" onClick="openpage('DZ30000_PR.php','_self')">
      
      &nbsp;&nbsp;
      <input type="reset" name="Submit2" value="Limpiar" />
      &nbsp;&nbsp;</div></td>
  </tr>
</table>
</form>
</body>
</html>
