<?
   session_start();
  require('../valtiempoinact.php');
  require('../conectar.php');
  $usuario_nivel=$_SESSION['usuario_nivel'];
  $usuario_login=$_SESSION['usuario_login'];
  
  $prospecto=mysql_query("select * from rentas where id_renta='$_GET[id]'",$db_conexion);
  if($rpro=mysql_fetch_array($prospecto))
  {
   $id_renta=$rpro['id_renta'];
   $id_cliente=$rpro['id_cliente'];
   $id_gerente=$rpro['id_gerente'];
   $id_coordinador=$rpro['id_coordinador'];
   $id_ejecutivo=$rpro['id_ejecutivo'];
   $prospeccion=$rpro['prospeccion'];
   $medio=$rpro['medio'];
   $submedio=$rpro['submedio'];
   $califica=$rpro['califica'];
   $motivo_nocal=$rpro['motivo_nocal'];
   $razon_ni=$rpro['razon_ni'];
   $id_departamento=$rpro['id_departamento'];
   $id_complejo=$rpro['id_complejo'];
   $fecha=$rpro['fecha'];
   $hora_registro=$rpro['hora_registro'];
   $dia_inicio=$rpro['dia_inicio'];
   $dia_salida=$rpro['dia_salida'];
   $fecha_apartado=$rpro['fecha_apartado'];
   $deposito=$rpro['deposito'];
   $hospedaje=$rpro['hospedaje'];
   $perextcama=$rpro['perextcama'];
   $per_extra=$rpro['per_extra'];
   $garage=$rpro['garage'];
   $camaextra=$rpro['camaextra'];
   $cuna=$rpro['cuna'];
   $mascota=$rpro['mascota'];
   $subtotal=$rpro['subtotal'];
   $impuesto=$rpro['impuesto'];
   $otros=$rpro['otros'];
   $total=$rpro['total'];
   $tipomoneda=$rpro['tipomoneda'];
   $formarenta=$rpro['formarenta'];
   $estmtostatus=$rpro['estmtostatus'];
   $camaexstatus=$rpro['camaexstatus'];
   $cunastatus=$rpro['cunastatus'];
   $mascotastatus=$rpro['mascotastatus'];
   $cuotainvitado=$rpro['cuotainvitado'];
   $noPersonas=$rpro['noPersonas'];
   $no_anios=$rpro['no_anios'];
   $no_meses=$rpro['no_meses'];
   $no_sem=$rpro['no_sem'];
   $no_dias=$rpro['no_dias'];
   $diasapartado=$rpro['diasapartado'];
   $ubicacionactual=$rpro['ubicacionactual'];
   $factura=$rpro['factura'];
   $tipopago=$rpro['tipopago'];
   $formapago=$rpro['formapago'];
   $limpieza=$rpro['limpieza'];
   $kit_B=$rpro['kit_B'];
   $fecha_cierre=$rpro['fecha_cierre'];
   $status_renta=$rpro['status_renta'];
   $seguimiento=$rpro['seguimiento'];
   $descuento=$rpro['descuento'];
   $autoriza_desc=$rpro['autoriza_desc'];
   $motivo_desc=$rpro['motivo_desc'];
   $tipo_renta=$rpro['tipo_renta'];
   $client_cierre=$rpro['client_cierre'];
  }
  
  $datos_cliente=mysql_query("select * from clientes where id_cliente='$id_cliente'",$db_conexion); 
	if($rd=mysql_fetch_array($datos_cliente))
	 {
	   $nombre=$rd['nombre'];
	   $ap=$rd['a_pat'];
	   $am=$rd['a_mat'];
	   $email=$rd['email'];
	   $intacc1=$rd['intacc1'];
	   $coco1=$rd['coco1'];
	   $aco1=$rd['aco1'];
	   $num1=$rd['num1'];
	   $intacc2=$rd['intacc2'];
	   $coco2=$rd['coco2'];
	   $aco2=$rd['aco2'];
	   $num2=$rd['num2'];
	   $suestado=$rd['estado'];
	   $edad=$rd['edad'];
	   $motivo_viaje=$rd['motivo_viaje'];
	   $sexo=$rd['sexo'];
	 }
	 
	 $edo=mysql_query("select * from lista_estados where id='$suestado'",$db_conexion);
    if($redo=mysql_fetch_array($edo))
	 {
	    $idedo=$redo['id'];
	    $suedo=$redo['opcion'];
	 }	 
	 
	 $depa=mysql_query("select * from departamentos where id_departamento='$id_departamento'",$db_conexion);
	 if($rdep=mysql_fetch_array($depa))
	 {
	  $clave_depto=$rdep['clave'];
	  $id_complejo=$rdep['id_complejo'];
	 }
	 
	 $complejo=mysql_query("select * from complejo where id_complejo='$id_complejo'",$db_conexion);
	 if($rcom=mysql_fetch_array($complejo))
	 {
	  $nombre_complejo=$rcom['nombre'];
	 }
	 
/*	 
function generaPaises()
  {	 
  
  require('../conectar.php');
  
   $prospecto2=mysql_query("select * from rentas where id_renta='$_GET[id]'",$db_conexion);
   if($rpro2=mysql_fetch_array($prospecto2))
   {
   $id_cliente2=$rpro2['id_cliente'];
   }
   
    $datos_cliente2=mysql_query("select * from clientes where id_cliente='$id_cliente2'",$db_conexion); 
	if($rd2=mysql_fetch_array($datos_cliente2))
	 {
	   $supais=$rd2['pais']; 
	 }
	 
  $elpais=mysql_query("select * from lista_paises where id='$supais'",$db_conexion);
    if($rpais=mysql_fetch_array($elpais))
     {
		 $elpais=$rpais['opcion'];
		 $idpais=$rpais['id'];
	 }
    
	if($idpais!=0)
    {
	 $consulta=mysql_query("select id,opcion from lista_paises where id='$idpais'",$db_conexion);	
	 $registro=mysql_fetch_row($consulta);
	 echo $registro[1];
	
	$consulta=mysql_query("select id,opcion from lista_paises where id<>'$idpais'",$db_conexion);
	mysql_close();
    
	// Voy imprimiendo el primer select compuesto por los paises
	
	echo "<select name='paises' id='paises' onChange='cargaContenido(this.id)' style='width:129px'>";
	echo "<option value='$idpais' selected='selected'>$elpais</option>";

	while($registro=mysql_fetch_row($consulta))
	{
		echo "<option value='".$registro[0]."'>".$registro[1]."</option>";
	}
	echo "</select>";
	
	} else {
	
	$consulta=mysql_query("select id,opcion from lista_paises",$db_conexion);
	mysql_close();
    
	// Voy imprimiendo el primer select compuesto por los paises
	
	echo "<select name='paises' id='paises' onChange='cargaContenido(this.id)' style='width:129px'>";
	while($registro=mysql_fetch_row($consulta))
	{
		echo "<option value='".$registro[0]."'>".$registro[1]."</option>";
	}
	echo "</select>";
	
	}

}
*/
$url = "http://www.dolar.mx/tipo-de-cambio-sat/";
$palabra = "Tipo de Cambio SAT";
$x = 1;
$fd = @fopen($url, "r");
while($line=@fgets($fd,1000))
     {
      $pos = strpos ($line, $palabra);
	  if($pos)
	    {
		 $glosa = " ";
		 $line2=fgets($fd,1000);
		 $valor=strip_tags($glosa.trim($line2));
		 function fPasarNumero($str)
		 {
		  $caracteres ="%[^0-9 \. \- ]%";
		  $str=preg_replace($caracteres,"",$str);
		  return $str;
		 }
		 $convmxn=fPasarNumero($valor);
		 $convmxn=str_replace(" ","",$convmxn);
		 $convmxn=round($convmxn,2);
		}
     }
	 @fclose($fd);
?>
<script language='javascript'>
function capacidad()
{
 var noper=document.forma.npers.value; 
 var clave=document.forma.clavedep.value;
 $.post("capacidad_deptos.php", { cap: noper, idepa: clave}, function(data){
$("#mensaje").html(data);
 });
}

function verifica()
{
 var fcierrea=document.forma.fecha_cierre_anterior.value;
 var fcierre=document.forma.testinput.value;
 $.post("verifica_fecha_modificar.php", { fca: fcierrea, fc: fcierre},function(data) {$("#alerta_fecha").html(data);}); 
}

function validamail(mail)
    {
	 div = document.getElementById('msgmail');
     div.style.display ='';
     $.post("valmail.php", { email:mail}, function(data){
     $("#msgmail").html(data);
     });
    }
function ndias(){
     var fechain= document.forma.fr.value;
	 var fechafin= document.forma.fr2.value;	
	 $.post("nodias.php", { fini: fechain, ffin: fechafin}, function(data){
	 $("#totdias").html(data);
	 });
}	
</script>
<script language='javascript'>
function mostrar() {
div = document.getElementById('flotante');
div.style.display ='';
div2 = document.getElementById('cargando');
div2.style.display ='';
var no = forma.nombre.value;
var ap = forma.ap.value;
var am = forma.am.value;
var em = forma.mail.value;
var cmf = forma.comfr.value;
var pts = forma.ts.value;
var pms = forma.ms.value;
var pct = forma.ct.value;
var pcc = forma.cc.value;
var ptp = forma.tp.value;
var fi = forma.fr.value;
var ff = forma.fr2.value;
var pres = forma.presupuesto.value;
var est = forma.estmnto.value;
var cmex = forma.camaex.value;
var cun = forma.cuna.value;
var mskt = forma.mascota.value;
$.post("disponibles.php", { nombre: no, apat: ap, amat: am, mail: em, comfr: cmf, ts: pts, ms: pms, ct: pct, cc: pcc, tp: ptp, fini: fi, ffin: ff, presup: pres, esta: est, camaex: cmex, cuna: cun, mascota: mskt}, function(data){
$("#flotante").html(data);
 });
}
function cerrar() {
div = document.getElementById('flotante');
div.style.display='none';
}
</script>
<script language='javascript'>
function validar(contenido){
	document.forma.depto.length=0; 
	document.forma.depto2.length=0; 
	document.forma.depto.options[0] = new Option("-----COORDINADOR-----","","defaultSelected",""); 
	document.forma.depto2.options[0]=new Option("-----EJECUTIVO-----","","defaultSelected","");
	var indice=1; 

<? 
$sql_depto = "SELECT id_empleado,gerente,nombre,a_pat,a_mat from empleados where puesto='4' and fechabaja='0000-00-00'"; 
$rs_depto = mysql_query($sql_depto); 
if(mysql_num_rows($rs_depto)>0) 
  { 
   while($row_depto = mysql_fetch_assoc($rs_depto)) 
		{ 
?> 
		 if(contenido=='<?=$row_depto["gerente"]?>') 
		   { 
			document.forma.depto.options[indice] = new Option("<?=$row_depto["nombre"]." ".$row_depto["a_pat"]." ".$row_depto["a_mat"];?>","<?=$row_depto["id_empleado"]?>"); 
			indice++; 
			} 
<? 
		} 
   } 
?>  
}

function validar2(contenido) 
{ 
//alert(contenido); 
document.forma.depto2.length=0; 
document.forma.depto2.options[0] = new Option("-- EJECUTIVO --","","defaultSelected","");
var indice=1; 
<? 
$sql_depto = "SELECT * from empleados where puesto='5' and fechabaja='0000-00-00'"; 
$rs_depto = mysql_query($sql_depto); 
if(mysql_num_rows($rs_depto)>0) 
{ 
while($row_depto = mysql_fetch_assoc($rs_depto)) 
{ 
?> 
if(contenido=='<?=$row_depto["coordinador"]?>') 
{ 
document.forma.depto2.options[indice] = new Option("<?=$row_depto["nombre"]." ".$row_depto["a_pat"]." ".$row_depto["a_mat"];?>","<?=$row_depto["id_empleado"]?>"); 
indice++; 
} 

<? 
}}
 
?> 
}  
</script>

<script language='javascript'>
function validarmedio(contenido){
    //alert(contenido); 
	document.forma.submedio.length=0; 
	document.forma.submedio.options[0] = new Option("--SUBMEDIO--","","defaultSelected",""); 
	var indice=1; 
	

<?
$sql_depto = "SELECT idsubmedio,idcanal,subcanal from submedio"; 
$rs_depto = mysql_query($sql_depto); 
if(mysql_num_rows($rs_depto)>0) 
  { 
   while($row_depto = mysql_fetch_assoc($rs_depto)) 
		{ 
?> 
		 if(contenido=='<?=$row_depto["idcanal"]?>') 
		   { 
			document.forma.submedio.options[indice] = new Option("<?=$row_depto["subcanal"];?>","<?=$row_depto["idsubmedio"]?>"); 
			indice++; 
			} 
<? 
		} 
   } 
?>  
}
</script>
<link rel="stylesheet" type="text/css" href="select_dependientes.css">
<script type="text/javascript" src="select_dependientes.js"></script>
<script language="javascript" src="js/formasdepago.js"></script>

<!--ESTILO DEL AREA DE TRABAJO -->
<link id="rs-styleWidget" href="../../calendario/WidgetClass.css" type="text/css" rel="stylesheet"><link id="rs-styleUI" href="../../calendario/jquery-ui-1.css" type="text/css" rel="stylesheet"><style media="screen" type="text/css">#rs-iuqb {color: ;font-family: Arial;font-size:11px}</style><style media="screen" type="text/css">#rs-iuqb a:link {text-decoration:none;color: #B5AA33}</style><style media="screen" type="text/css">#rs-iuqb a:visited {text-decoration:none;color: #B5AA33}</style><style media="screen" type="text/css">#rs-iuqb a:hover {text-decoration:none;color: #B5AA33}</style><style media="screen" type="text/css">#rs-iuqb a:active {text-decoration:none;color: #B5AA33}</style><style media="screen" type="text/css">#rs-iuqb input {font-family: Arial}</style><style media="screen" type="text/css">#rs-iuqb select {font-family: Arial}</style><style media="screen" type="text/css">#rs-iuqb .rs-eventWrapper {background-color: #265565;}</style><script src="../../calendario/ga.js" async="" type="text/javascript"></script><script id="rs-WidgetHotelIuserQB_load" src="../../calendario/WidgetHotelIuserQB_load.js" type="text/javascript"></script>

<!-- estilo de inputs-->
<script>function foco(elemento) {elemento.style.border = "2px solid #000000";}function no_foco(elemento) {elemento.style.border = "1px solid #CCCCCC";}</script>
<!-- marcador en input-->
<style>    
input::-webkit-input-placeholder {
    color:#c00;
    font-weight: bold;
}
input:-moz-placeholder {
    color:#c00;
    font-weight: bold;
}
</style>

<!--solo numeros en input-->
</script>
    <script language="javascript">
    var nav4 = window.Event ? true : false;
    function IsNumber(evt){
    // Backspace = 8, Enter = 13, ’0' = 48, ’9' = 57, ‘.’ = 46
    var key = nav4 ? evt.which : evt.keyCode;
    return (key <= 13 || (key >= 48 && key <= 57) || key == 46);
    }
</script>
<script language="javascript">
function desasignar()  
{
 document.forma.deparprop.value="";
 document.forma.clavedep.value="";
 document.forma.fin.value="";
 document.forma.ffi.value="";
 document.forma.iddep.value="";
 document.forma.compl.value="";
 document.forma.deposito.value="0";
 document.forma.persext.value="0";
 document.forma.monto.value="0";
 document.forma.subtotal2.value="0";
 document.forma.iva2.value="0";
 document.forma.total2.value="0";
 document.forma.tipomoneda.value="USD";
 document.forma.ts2.value="";
 document.forma.ms2.value="";
 document.forma.ct2.value="";
 document.forma.cc2.value="";
 document.forma.tp2.value="";
 document.forma.ts2.checked=0;
 document.forma.ms2.checked=0;
 document.forma.ct2.checked=0;
 document.forma.cc2.checked=0;
 document.forma.tp2.checked=0;
 }
</script>
<script language="javascript">
function checa(val)
{
var prop = val;
switch (prop)
       {
	    case "ts":
 document.forma.ms2.value="";
 document.forma.ct2.value="";
 document.forma.cc2.value="";
 document.forma.tp2.value="";
 document.forma.ms2.checked=0;
 document.forma.ct2.checked=0;
 document.forma.cc2.checked=0;
 document.forma.tp2.checked=0;
 break;
       case "ms":
 document.forma.ts2.value="";
 document.forma.ct2.value="";
 document.forma.cc2.value="";
 document.forma.tp2.value="";
 document.forma.ts2.checked=0;
 document.forma.ct2.checked=0;
 document.forma.cc2.checked=0;
 document.forma.tp2.checked=0;
 break;
      case "ct":
 document.forma.ts2.value="";
 document.forma.ms2.value="";
 document.forma.cc2.value="";
 document.forma.tp2.value="";
 document.forma.ts2.checked=0;
 document.forma.ms2.checked=0;
 document.forma.cc2.checked=0;
 document.forma.tp2.checked=0;
 break;
      case "cc":
 document.forma.ts2.value="";
 document.forma.ms2.value="";
 document.forma.ct2.value="";
 document.forma.tp2.value="";
 document.forma.ts2.checked=0;
 document.forma.ms2.checked=0;
 document.forma.ct2.checked=0;
 document.forma.tp2.checked=0;
 break;
      case "tp":
 document.forma.ts2.value="";
 document.forma.ms2.value="";
 document.forma.ct2.value="";
 document.forma.cc2.value="";
 document.forma.ts2.checked=0;
 document.forma.ms2.checked=0;
 document.forma.ct2.checked=0;
 document.forma.cc2.checked=0;
 break;
	   }
}
</script>
<script language="javascript">
function hide()
{
var text = document.forma.comfr;
var label1 = document.forma.label;
var comfr = document.forma.frequerido;
var fr = document.forma.fr;
var fr2 = document.forma.fr2;
var nic = document.forma.nic;
var nit = document.forma.nit;
var tst = document.forma.tst;
var mst = document.forma.mst;
var ctt = document.forma.ctt;
var cct = document.forma.cct;
var tpt = document.forma.tpt;
var tst2 = document.forma.tst2;
var mst2 = document.forma.mst2;
var ctt2 = document.forma.ctt2;
var cct2 = document.forma.cct2;
var tpt2 = document.forma.tpt2;
var tst3 = document.forma.tst3;
var mst3 = document.forma.mst3;
var ctt3 = document.forma.ctt3;
var cct3 = document.forma.cct3;
var tpt3 = document.forma.tpt3;
var ts = document.forma.ts;
var ms = document.forma.ms;
var ct = document.forma.ct;
var cc = document.forma.cc;
var tp = document.forma.tp;
var presupuestot = document.forma.presupuestot;
var presupuesto = document.forma.presupuesto;
var ncal = document.forma.ncal;
var mncal = document.forma.mncal;
var causa = document.forma.causa;
var anadirmnq = document.forma.anadirmnq;
var anadirni = document.forma.anadirni;
var causani = document.forma.causani;
var estmtotx=document.forma.estmtotx;
var camaextx = document.forma.camaextx;
var cunatx = document.forma.cunatx;
var mascotatx = document.forma.mascotatx;
var invitadotx = document.forma.invitadotx;
var estmnto = document.forma.estmnto;
var camaex = document.forma.camaex;
var cuna = document.forma.cuna;
var mascota = document.forma.mascota;
var invitado = document.forma.invitado;
var npers= document.forma.npers;
var nper= document.forma.nper;
var desc= document.forma.descto;
var descto= document.forma.descuento;
var data="";
var huespedes = document.getElementById('huespedes');
if(document.forma.combo.value == "NQ")
{
$("#totdias").html(data);
document.forma.comfr.value="";
document.forma.fr.value="";
document.forma.fr2.value="";
document.forma.nic.value="";
document.forma.ts.checked=false;
document.forma.ms.checked=false;
document.forma.ct.checked=false;
document.forma.cc.checked=false;
document.forma.tp.checked=false;
document.forma.presupuesto.value="";
document.forma.causa.value="";
npers.value="";

huespedes.style.display ='none';
text.style.visibility = "hidden";
label1.style.visibility = "hidden";
comfr.style.visibility = "hidden";
fr.style.visibility = "hidden";
fr2.style.visibility = "hidden";
npers.style.visibility = "hidden";
nper.style.visibility = "hidden";
desc.style.visibility="hidden";
descto.style.visibility="hidden";
nic.style.visibility = "hidden";
nit.style.visibility = "hidden";
tst.style.visibility = "hidden";
mst.style.visibility = "hidden";
ctt.style.visibility = "hidden";
cct.style.visibility = "hidden";
tpt.style.visibility = "hidden";
tst2.style.visibility = "hidden";
mst2.style.visibility = "hidden";
ctt2.style.visibility = "hidden";
cct2.style.visibility = "hidden";
tpt2.style.visibility = "hidden";
tst3.style.visibility = "hidden";
mst3.style.visibility = "hidden";
ctt3.style.visibility = "hidden";
cct3.style.visibility = "hidden";
tpt3.style.visibility = "hidden";
ts.style.visibility = "hidden";
ms.style.visibility = "hidden";
ct.style.visibility = "hidden";
cc.style.visibility = "hidden";
tp.style.visibility = "hidden";
estmtotx.style.visibility = "hidden";
camaextx.style.visibility = "hidden";
cunatx.style.visibility = "hidden";
mascotatx.style.visibility = "hidden";
invitadotx.style.visibility = "hidden";
estmnto.style.visibility = "hidden";
camaex.style.visibility = "hidden";
cuna.style.visibility = "hidden";
mascota.style.visibility = "hidden";
invitado.style.visibility = "hidden";
presupuestot.style.visibility = "hidden";
presupuesto.style.visibility = "hidden";
ncal.style.visibility = "visible";
mncal.style.visibility = "visible";
disponibles.style.visibility = "hidden";
causa.style.visibility="visible";
anadirmnq.style.visibility="visible";
anadirni.style.visibility="hidden";
causani.style.visibility="hidden";
}
else
{
document.forma.mncal.value="";
text.style.visibility = "visible";
label1.style.visibility = "visible";
ncal.style.visibility = "hidden";
mncal.style.visibility = "hidden";
causa.style.visibility = "hidden";
anadirmnq.style.visibility="hidden";
}
}
</script>

<script language="javascript">
function califica()
{
var text = document.forma.frequerido;
var fr = document.forma.fr;
var fr2 = document.forma.fr2;
var nit = document.forma.nit;
var nic = document.forma.nic;
var tst = document.forma.tst;
var mst = document.forma.mst;
var ctt = document.forma.ctt;
var cct = document.forma.cct;
var tpt = document.forma.tpt;
var tst2 = document.forma.tst2;
var mst2 = document.forma.mst2;
var ctt2 = document.forma.ctt2;
var cct2 = document.forma.cct2;
var tpt2 = document.forma.tpt2;
var ts = document.forma.ts;
var ms = document.forma.ms;
var ct = document.forma.ct;
var cc = document.forma.cc;
var tp = document.forma.tp;
var anadirni = document.forma.anadirni;
var causani = document.forma.causani;
var estmtotx=document.forma.estmtotx;
var camaextx = document.forma.camaextx;
var cunatx = document.forma.cunatx;
var mascotatx = document.forma.mascotatx;
var invitadotx = document.forma.invitadotx;
var estmnto = document.forma.estmnto;
var camaex = document.forma.camaex;
var cuna = document.forma.cuna;
var mascota = document.forma.mascota;
var invitado = document.forma.invitado;
var presupuestot = document.forma.presupuestot;
var presupuesto = document.forma.presupuesto;
var npers= document.forma.npers;
var nper= document.forma.nper;
var desc= document.forma.descto;
var descto= document.forma.descuento;
var data="";
var huespedes = document.getElementById('huespedes');
if(document.forma.comfr.value == "LP")
{
$("#totdias").html(data);
document.forma.fr.value="";
document.forma.fr2.value="";
document.forma.nic.value="";
document.forma.presupuesto.value="";
document.forma.ts.checked=false;
document.forma.ms.checked=false;
document.forma.ct.checked=false;
document.forma.cc.checked=false;
document.forma.tp.checked=false;
document.forma.ts.value="";
document.forma.ms.value="";
document.forma.ct.value="";
document.forma.cc.value="";
document.forma.tp.value="";
document.forma.causa.value="";
npers.value="";

huespedes.style.display ='none';
text.style.visibility = "visible";
fr.style.visibility = "visible";
fr2.style.visibility = "visible";
npers.style.visibility = "visible";
nper.style.visibility = "visible";
desc.style.visibility="visible";
descto.style.visibility="visible";
tst.style.visibility = "visible";
mst.style.visibility = "visible";
ctt.style.visibility = "visible";
cct.style.visibility = "visible";
tpt.style.visibility = "visible";
tst2.style.visibility = "visible";
mst2.style.visibility = "visible";
ctt2.style.visibility = "visible";
cct2.style.visibility = "visible";
tpt2.style.visibility = "visible";
tst3.style.visibility = "visible";
mst3.style.visibility = "visible";
ctt3.style.visibility = "visible";
cct3.style.visibility = "visible";
tpt3.style.visibility = "visible";
ts.style.visibility = "visible";
ms.style.visibility = "visible";
ct.style.visibility = "visible";
cc.style.visibility = "visible";
tp.style.visibility = "visible";

estmtotx.style.visibility = "visible";
camaextx.style.visibility = "visible";
cunatx.style.visibility = "visible";
mascotatx.style.visibility = "visible";
invitadotx.style.visibility = "hidden";
estmnto.style.visibility = "visible";
camaex.style.visibility = "visible";
cuna.style.visibility = "visible";
mascota.style.visibility = "visible";
invitado.style.visibility = "hidden";

presupuestot.style.visibility = "visible";
presupuesto.style.visibility = "visible";
nit.style.visibility = "hidden";
nic.style.visibility = "hidden";
disponibles.style.visibility = "visible";
anadirni.style.visibility="hidden";
causani.style.visibility="hidden";
}
if(document.forma.comfr.value == "CP")
{
$("#totdias").html(data);
document.forma.fr.value="";
document.forma.fr2.value="";
document.forma.nic.value="";
document.forma.presupuesto.value="";
document.forma.ts.value="";
document.forma.ms.value="";
document.forma.ct.value="";
document.forma.cc.value="";
document.forma.tp.value="";
document.forma.ts.checked=false;
document.forma.ms.checked=false;
document.forma.ct.checked=false;
document.forma.cc.checked=false;
document.forma.tp.checked=false;
document.forma.causa.value="";
npers.value="";

huespedes.style.display ='none';
text.style.visibility = "visible";
fr.style.visibility = "visible";
fr2.style.visibility = "visible";
npers.style.visibility = "visible";
nper.style.visibility = "visible";
desc.style.visibility="visible";
descto.style.visibility="visible";
tst.style.visibility = "visible";
mst.style.visibility = "visible";
ctt.style.visibility = "visible";
cct.style.visibility = "visible";
tpt.style.visibility = "visible";
tst2.style.visibility = "visible";
mst2.style.visibility = "visible";
ctt2.style.visibility = "visible";
cct2.style.visibility = "visible";
tpt2.style.visibility = "visible";
tst3.style.visibility = "visible";
mst3.style.visibility = "visible";
ctt3.style.visibility = "visible";
cct3.style.visibility = "visible";
tpt3.style.visibility = "visible";
ts.style.visibility = "visible";
ms.style.visibility = "visible";
ct.style.visibility = "visible";
cc.style.visibility = "visible";
tp.style.visibility = "visible";

estmtotx.style.visibility = "visible";
camaextx.style.visibility = "visible";
cunatx.style.visibility = "visible";
mascotatx.style.visibility = "visible";
invitadotx.style.visibility = "hidden";
estmnto.style.visibility = "visible";
camaex.style.visibility = "visible";
cuna.style.visibility = "visible";
mascota.style.visibility = "visible";
invitado.style.visibility = "hidden";

presupuestot.style.visibility = "visible"; 
presupuesto.style.visibility = "visible";
nit.style.visibility = "hidden";
nic.style.visibility = "hidden";
disponibles.style.visibility = "visible";
anadirni.style.visibility="hidden";
causani.style.visibility="hidden";
}
if(document.forma.comfr.value == "NI")
{
$("#totdias").html(data);
nit.style.visibility = "visible";
nic.style.visibility = "visible";
text.style.visibility = "hidden";
fr.style.visibility = "hidden";
fr2.style.visibility = "hidden";
npers.style.visibility = "hidden";
nper.style.visibility = "hidden";
desc.style.visibility="hidden";
descto.style.visibility="hidden";
tst.style.visibility = "hidden";
mst.style.visibility = "hidden";
ctt.style.visibility = "hidden";
cct.style.visibility = "hidden";
tpt.style.visibility = "hidden";
tst2.style.visibility = "hidden";
mst2.style.visibility = "hidden";
ctt2.style.visibility = "hidden";
cct2.style.visibility = "hidden";
tpt2.style.visibility = "hidden";
tst3.style.visibility = "hidden";
mst3.style.visibility = "hidden";
ctt3.style.visibility = "hidden";
cct3.style.visibility = "hidden";
tpt3.style.visibility = "hidden";
ts.style.visibility = "hidden";
ms.style.visibility = "hidden";
ct.style.visibility = "hidden";
cc.style.visibility = "hidden";
tp.style.visibility = "hidden";
estmtotx.style.visibility = "hidden";
camaextx.style.visibility = "hidden";
cunatx.style.visibility = "hidden";
mascotatx.style.visibility = "hidden";
invitadotx.style.visibility = "hidden";
estmnto.style.visibility = "hidden";
camaex.style.visibility = "hidden";
cuna.style.visibility = "hidden";
mascota.style.visibility = "hidden";
invitado.style.visibility = "hidden";
presupuestot.style.visibility = "hidden";
presupuesto.style.visibility = "hidden";
disponibles.style.visibility = "hidden";
anadirni.style.visibility="visible";
causani.style.visibility="visible";
}
}
</script language="javascript">

<script>
function motivos()
	{ 
	 var causa = document.forma.causa;
     if(document.forma.mncal.value == 'BUSCA OTRA UBICACION' || document.forma.mncal.value == 'OTRA')
		{
		 causa.style.visibility = "visible";
		}else{
		 document.forma.causa.value="";
		 causa.style.visibility = "hidden";
		}
	}
</script>

<!--Crea Inputs dinamicos -->
<script type="text/javascript">
<!--
var num=1;
function crear() {
var ncapacidad=document.forma.cap.value;
var nlimite=document.forma.lim.value;
var perextras=document.forma.npers.value;
var totalextras=perextras-ncapacidad;
var nmax=totalextras; 
var valor=""; 
var valorap=""; 
var valoram=""; 
  if(num<=nmax){
  //num++;
  fi = document.getElementById('fiel'); // 1
  contenedor = document.createElement('div'); // 2
  contenedor.id = 'div'+num; // 3
  fi.appendChild(contenedor); // 4
  
  //para ap
  eleap = document.createElement('input'); // 5
  eleap.type = 'text'; // 6
  eleap.value = 'Apellido Paterno'+num;
  eleap.name = 'ap'+num; // 6
  eleap.id = 'ap'+num;
  valorap='Apellido Paterno'+num;
  eleap.addEventListener("focus",function(){if(this.value==valorap){this.value=""}},false);
  eleap.addEventListener("blur",function(){if(this.value==""){this.value=valorap}},false);
  contenedor.appendChild(eleap); // 7
  //para am
  eleam = document.createElement('input'); // 5
  eleam.type = 'text'; // 6
  eleam.value = 'Apellido Materno'+num;
  eleam.name = 'am'+num; // 6
  eleam.id = 'am'+num;
  valoram='Apellido Materno'+num;
  eleam.addEventListener("focus",function(){if(this.value==valoram){this.value=""}},false);
  eleam.addEventListener("blur",function(){if(this.value==""){this.value=valoram}},false);
  contenedor.appendChild(eleam); // 7
  //para nombre
  ele = document.createElement('input'); // 5
  ele.type = 'text'; // 6
  ele.value = 'Nombre'+num;
  ele.name = 'fil'+num; // 6
  ele.id = 'fil'+num;
  valor='Nombre'+num;
  ele.addEventListener("focus",function(){if(this.value==valor){this.value=""}},false);
  ele.addEventListener("blur",function(){if(this.value==""){this.value=valor}},false);
  contenedor.appendChild(ele); // 7
    
  ele = document.createElement('input'); // 5
  ele.type = 'button'; // 6
  ele.value = 'Borrar(-)'; // 8
  ele.name = 'div'+num; // 8
  ele.onclick = function () {borrar(this.name)} // 9
  contenedor.appendChild(ele); // 7  
  num=num+1;  
   }
   /* if(num>19){
	  num=0;
	}*/
	
 
}
function borrar(obj) {
  // alert(num);
  dis=false;
  fi = document.getElementById('fiel'); // 1 
  fi.removeChild(document.getElementById(obj)); // 10
   if(num==1){
  dis= false ? '' : 'none';
  tab=document.getElementById('tab');
  tab.getElementsByTagName('tr')[2].style.display=dis;
  dis=true;
  //w=0;
 }/*else{
    dis= true ? '' : 'none';
  tab=document.getElementById('tab');
  tab.getElementsByTagName('tr')[2].style.display=dis;
  //num=0;
  //dis=false;
   alert(dis+"-"+ num);
   //w=0;
 }*/
 num=num-1;
  }
  

w=0;
function tabla() {
 w++;
  if(w==1){
	 /* fi = document.getElementById('fiel'); // 1
	  contenedor = document.createElement('div'); // 2
	  contenedor.id = 'div'+w; // 3
	  fi.appendChild(contenedor); // 4*/
	 //para tabla
	  var tabla = document.getElementById("tab");
	  var tbody = document.createElement("tbody");
	  var tr = document.createElement("TR");
	  for (var j=0; j<1; j++) {			
	  var td = document.createElement("TD");
		tr.appendChild(td);
		
		var td2 = document.createElement('td');
		tr.appendChild(td2);
		
		var td3 = document.createElement('td');
		tr.appendChild(td3);
		}
				
		tbody.appendChild(tr);
		tabla.appendChild(tbody);
		
		td.setAttribute("width","129");
		td.setAttribute("bgcolor","#660000");
		td.setAttribute("class","mainfontbold");
		td.setAttribute("align","left");
		td.setAttribute("style","color:#FFFFFF");
		textNode = document.createTextNode("Apellido Paterno");
		td.appendChild(textNode);
		
		td2.setAttribute("width","129");
		td2.setAttribute("bgcolor","#660000");
		td2.setAttribute("class","mainfontbold");
		td2.setAttribute("align","left");
		td2.setAttribute("style","color:#FFFFFF");
		textNode = document.createTextNode("Apellido Materno");
		td2.appendChild(textNode);
		  
		td3.setAttribute("width","129");
		td3.setAttribute("bgcolor","#660000");
		td3.setAttribute("class","mainfontbold");
		td3.setAttribute("align","left");
		td3.setAttribute("style","color:#FFFFFF");
		textNode = document.createTextNode("Nombre(s)");
		td3.appendChild(textNode);  
		  //contenedor.appendChild(t); // 7
		  //w=2;
		}
}
--> 
</script>

<script type="text/javascript">
<!--
function anadir(frm) {
   if(frm.agregar.value == ''){
      alert('No puedes Introducir opciones en blanco');
   }else{
  opt = new Option(frm.agregar.value,frm.agregar.value);
  frm.motviaje.options[frm.motviaje.options.length] = opt;
  frm.agregar.value = '';
  }
}
 function anadirtipopros(frm) { 
  if(frm.agregartpros.value == ''){
      alert('No puedes Introducir opciones en blanco');
   }else{
  optagrepros = new Option(frm.agregartpros.value,frm.agregartpros.value);
  frm.tipoprospeccion.options[frm.tipoprospeccion.options.length] = optagrepros;
  frm.agregartpros.value = '';
  }
 }

 function anadirmotnq(frm) { 
  if(frm.causa.value == ''){
      alert('No puedes Introducir opciones en blanco');
   }else{
  optmnq = new Option(frm.causa.value,frm.causa.value);
  frm.mncal.options[frm.mncal.options.length] = optmnq;
  frm.causa.value = '';
  }
 }
 
   function anadirmedio(frm) { 
  if(frm.agregarmedio.value == ''){
      alert('No puedes Introducir opciones en blanco');
   }else{
  optmnq = new Option(frm.agregarmedio.value,frm.agregarmedio.value);
  frm.medio.options[frm.medio.options.length] = optmnq;
  frm.agregarmedio.value = '';
  }
 }
 
 function anadirsubmedio(frm) { 
  if(frm.agregarsubmedio.value == ''){
      alert('No puedes Introducir opciones en blanco');
   }else{
  optmnq = new Option(frm.agregarsubmedio.value,frm.agregarsubmedio.value);
  frm.submedio.options[frm.submedio.options.length] = optmnq;
  frm.agregarsubmedio.value = '';
  }
 } 
 
 function anadircni(frm) { 
  if(frm.causani.value == ''){
      alert('No puedes Introducir opciones en blanco');
   }else{
  optni = new Option(frm.causani.value,frm.causani.value);
  frm.nic.options[frm.nic.options.length] = optni;
  frm.causani.value = '';
  }
 }
-->
</script>

<!--Combos dependientes -->
<script language="javascript" src="js/jquery-1.2.6.min.js"></script>
<!--CALENDARIO ESTANCIA ACTUAL-->
<LINK rel="stylesheet" type="text/css" href="calendario/calendar.css" 
media="screen">
<SCRIPT type="text/javascript" src="calendario/mootools-1.2.5-core-yc.js"></SCRIPT>
<!--<SCRIPT type="text/javascript" src="calendario/mootools-1.2.5.1-more-yc.js"></SCRIPT>-->
<!--<SCRIPT type="text/javascript" src="calendario/slideshowjc-yc.js"></SCRIPT>
<SCRIPT type="text/javascript" src="calendario/_class.noobSlide.packed.js"></SCRIPT>-->
<SCRIPT type="text/javascript" src="calendario/calendar.js"></SCRIPT>
<SCRIPT type="text/javascript" src="calendario/calendar-en.js"></SCRIPT>
<SCRIPT type="text/javascript" src="calendario/calendar-setup.js"></SCRIPT>
<!--TERMINA CALENDARIO ACTUAL ESTANCIA-->
<!-- estilo de botones-->
<link rel="stylesheet" type="text/css" href="css/botones_bonitos.css" />

<!-- PARA LA FECHA DE CIERRE -->
<script language="javascript" src="calendario_cierre/calendar_db.js"></script>
<link type="text/css" href="calendario_cierre/calendar.css" rel="stylesheet" />
<!-- PARA LA FECHA DE CIERRE -->

</head>
<div id="bkmsg" style="position:fixed;width:100%;height:100%;display:none;background:url(images/bkmsg.png);left:-10px;top:-10px;z-index:500;" ></div>
<!-- FORMULARIO DE REGISTRO DE EMPLEADOS-->						
	<div id="rs-iuqb">	
		<div id="content">      
            <div id="wrapper">
                <div id="steps">
                    <form name="forma" action="prospectos_modificar.php" method="post" onsubmit="javascript:return validalomod();">
                    <input type="hidden" name="id_cliente" value="<?php echo $id_cliente; ?>" />
                    <input type="hidden" name="id_renta" value="<?php echo $id_renta; ?>" />
                        <fieldset class="step">
                            <legend><strong>DATOS DEL CLIENTE</strong></legend>
                            <p>
							 <table style="font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em;text-align:right">
							  <tr>                 
								<td>
                                &nbsp;&nbsp;<label for="ap"><font color="#F30">*</font>Apellido Paterno:</label>
                                </td>
								<td>
								<input id="ap" name="ap" type="text" AUTOCOMPLETE=OFF onChange="javascript:this.value=this.value.toUpperCase();" onFocus="foco(this);" onBlur="no_foco(this);" value="<?php echo $ap; ?>" disabled="disabled">
                                </td>
							    <td>
                                &nbsp;&nbsp;<label for="am">Apellido Materno:</label>
                                </td>
								<td>
								<input id="am" name="am" type="text" AUTOCOMPLETE=OFF onChange="javascript:this.value=this.value.toUpperCase();" onFocus="foco(this);" onBlur="no_foco(this);" value="<?php echo $am; ?>" disabled="disabled">
                            	</td>
								<td>
								 <label  for="nombre"><font color="#F30">*</font>Nombre(s):</label>
                                </td>
								<td>
								<input id="nombre" name="nombre" type="text" AUTOCOMPLETE=OFF onChange="javascript:this.value=this.value.toUpperCase();"  onFocus="foco(this);" onBlur="no_foco(this);" value="<?php echo $nombre; ?>" disabled="disabled"/>
                                </td>
							  </tr>
							  <tr>
							   <td>
							    <label for="pais"><font color="#F30">*</font>País:</label>
							   </td>
							   <td>
                               <?php
                               $prospecto2=mysql_query("select * from rentas where id_renta='$_GET[id]'",$db_conexion);
                               if($rpro2=mysql_fetch_array($prospecto2))
                               {
                               $id_cliente2=$rpro2['id_cliente'];
                               }
                               
                                $datos_cliente2=mysql_query("select * from clientes where id_cliente='$id_cliente2'",$db_conexion); 
                                if($rd2=mysql_fetch_array($datos_cliente2))
                                 {
                                   $supais=$rd2['pais']; 
                                 }
                                 
                              $elpais=mysql_query("select * from lista_paises where id='$supais'",$db_conexion);
                                if($rpais=mysql_fetch_array($elpais))
                                 {
                                  $elpais=$rpais['opcion'];
                                  $idpais=$rpais['id'];
                                 
                                  $consulta=mysql_query("select * from lista_paises where id='$idpais'",$db_conexion);	
                                  $registro=mysql_fetch_array($consulta);
								  $opcion=$registro['opcion'];
                                 }
								 ?>
								<input id="pais" name="pais" type="text" AUTOCOMPLETE=OFF onChange="javascript:this.value=this.value.toUpperCase();"  onFocus="foco(this);" onBlur="no_foco(this);" value="<?php echo $opcion; ?>" disabled="disabled"/>
							   </td>
							   <td>
								<label for="estado"><font color="#F30">*</font>Estado:</label>
							   </td>
                               <td><input id="estados" name="estados" type="text" AUTOCOMPLETE=OFF onChange="javascript:this.value=this.value.toUpperCase();"  onFocus="foco(this);" onBlur="no_foco(this);" value="<?php if($suestado!=0) {echo $suedo; }?>" disabled="disabled"/>                                 
							   </td>
							   <td><label for="sexo">Sexo:</label></td>
							   <td><input id="sexo" name="sexo" type="text" AUTOCOMPLETE=OFF onChange="javascript:this.value=this.value.toUpperCase();"  onFocus="foco(this);" onBlur="no_foco(this);" value="<?php echo $sexo; ?>" disabled="disabled"/></td>
							  </tr>
							  <tr>
							   <!--<td><label for="edocivil">Edo. Civil:</label></td>
							   <td><select name="edocivil" style=" width:129px;visibility:hidden">
										<option value="">Selecciona opci&oacute;n...</option>
										<option value="SOLTERO">Soltero</option>
										<option value="CASADO">Casado</option>
									</select></td>-->
							   <td><label for="mail"><font color="#F30">*</font>Mail:</label></td>	
                               <td>
							   <?php
							   if($email!='')
							   {
							   ?>
							   <input id="mail" name="mail" type="text" value="<?php echo $email ?>" onChange="validamail(this.value);" onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled">
							   <?php
							   }
							   else
							   {
							   ?>
							   <input id="mail" name="mail" type="text" placeholder="eje:mexico@hotmail.com" onChange="validamail(this.value);" onFocus="foco(this);" onBlur="no_foco(this);">
							   <div id="msgmail" style="position:absolute;display:none;width:15px;height:15px;margin-top:-20px;margin-left:140px"></div></td>							   								<?php
							   }							   
							   ?>
							   
							   	<td><label for="edad">Edad:</label></td>	
                               <td><input id="edad" name="edad" type="text" AUTOCOMPLETE=OFF onChange="javascript:this.value=this.value.toUpperCase();"  onFocus="foco(this);" onBlur="no_foco(this);" value="<?php echo $edad; ?>" disabled="disabled"/></td>
							   <td><label for="motviaje"><font color="#F30">*</font>Motivo de Viaje:</label></td>
								 <td><input id="motivo" name="motivo" type="text" AUTOCOMPLETE=OFF onChange="javascript:this.value=this.value.toUpperCase();"  onFocus="foco(this);" onBlur="no_foco(this);" value="<?php echo $motivo_viaje; ?>" disabled="disabled"/></td>
							  </tr>
							  <tr>
							     <td colspan="2">
                                     <table border="0" align="center">
                                         <tr>
                                             <td colspan="4" style="font-size:11px;"><center>Tel&eacute;fono Op1:</center></td>
                                         </tr>
                                         <tr style="text-align: left; font-size:9px;">
                                             <td><label for="internacional_access1">Acceso Int.</label></td>
                                             <td><label for="country_code1">Cód. Pa&iacute;s</label></td>
                                             <td><label for="area_code1">Cód. &Aacute;rea</label></td>
                                             <td><label for="numero1">N&uacute;mero</label></td>
                                         </tr>
                                         <tr style="text-align: left">
                                             <td><input id="intacc1" name="intacc1" type="text" size="1" onfocus="foco(this);" onblur="no_foco(this);" value="<?echo $intacc1;?>" title="Acceso Internacional" disabled="disabled"/></td>
                                             <td><input id="coco1" name="coco1" type="text" size="1" onfocus="foco(this);" onblur="no_foco(this);" value="<?echo $coco1;?>" title="Código del Pa&iacute;s" disabled="disabled"/></td>
                                             <td><input id="aco1" name="aco1" type="text" size="1" onfocus="foco(this);" onblur="no_foco(this);" value="<?echo $aco1;?>" title="Código de &Aacute;rea" disabled="disabled"/></td>
                                             <td><input id="num1" name="num1" type="text" size="5" onfocus="foco(this);" onblur="no_foco(this);" value="<?echo $num1;?>" title="N&uacute;mero" disabled="disabled"/></td>
                                         </tr>
                                     </table>  
                                 </td>
								 <td colspan="2">
                                     <table border="0" align="center">
                                         <tr style="text-align: left">
                                             <td colspan="4" style="font-size:11px;"><center>Tel&eacute;fono Op2:</center></td>
                                         </tr>                                
                                         <tr style="text-align: left; font-size:9px;">
                                             <td><label for="internacional_access2">Acceso Int.</label></td>
                                             <td><label for="country_code2">Cód. Pa&iacute;s</label></td>
                                             <td><label for="area_code2">Cód. &Aacute;rea</label></td>
                                             <td><label for="numero2">N&uacute;mero</label></td>
                                         </tr>
                                         <tr style="text-align: left">
                                             <td><input id="intacc2" name="intacc2" type="text" size="1" onfocus="foco(this);" onblur="no_foco(this);" value="<?echo $intacc2;?>" title="Acceso Internacional" disabled="disabled"/></td>
                                             <td><input id="coco2" name="coco2" type="text" size="1" onfocus="foco(this);" onblur="no_foco(this);" value="<?echo $coco2;?>" title="Código del Pa&iacute;s" disabled="disabled"/></td>
                                             <td><input id="aco2" name="aco2" type="text" size="1" onfocus="foco(this);" onblur="no_foco(this);" value="<?echo $aco2;?>" title="Código de &Aacute;rea" disabled="disabled"/></td>
                                             <td><input id="num2" name="num2" type="text" size="5" onfocus="foco(this);" onblur="no_foco(this);" value="<?echo $num2;?>" title="N&uacute;mero" disabled="disabled"/></td>
                                         </tr>
                                     </table>      
                                 </td>
								 <td><!--<input type="button" value="Agregar(+)" onclick="anadir(this.form)" />--></td>
								 <td align="left"><!--<input type="text" name="agregar" style="background-color:#E0E8F3;" onFocus="foco(this);" onBlur="no_foco(this);" onChange="javascript:this.value=this.value.toUpperCase();" size="10"/>--></td>
							  </tr>
							 </table>
							</p>	
							
							<!--<p>
                                <label for="fing">Fecha Ingreso</label>
								<input type="text" id="datepicker" name="fing" AUTOCOMPLETE=ON>
                            </p>-->
                        </fieldset>
                        <fieldset class="step">
                            <legend><strong>DATOS DE RENTA</strong></legend>
                            <p>
							<table border="0" width="800" style="font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em;text-align:right">
							   <tr>
								 <td><label for="fecha">Fecha:</label></td>
								 <td align="left"><input name="fecha" readonly="readonly" type="text" value="<? echo $fecha; ?>" onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled" size="10"></td>
								</tr>
							   <tr>
							        <?
								      require('../conectar.php');
									  $empleado=mysql_query("select * from empleados where id_empleado='$_SESSION[usuario_id]'",$db_conexion);
										if($re=mysql_fetch_array($empleado))
										{
										 $id_empleado=$re['id_empleado'];
										 $nom=$re['nombre'];
										 $a_pat=$re['a_pat'];
										 $a_mat=$re['a_mat'];
										 $su_puesto=$re['puesto'];
										 $su_gerente=$re['gerente'];
										 $su_coordinador=$re['coordinador'];
										}
										// GERENTE ES 3
										// COORDINADOR ES 4
										// EJECUTIVO ES 5
									?>
							    <td><label for="gerente">Gerente:</label></td>
								<td align="left">		
                                <?php
								 $gr=mysql_query("select * from empleados where id_empleado='$id_gerente'",$db_conexion);
								 $rgr=mysql_fetch_array($gr);								 
								?>		
                                <input name="ger" readonly="readonly" type="text" value="<? echo $rgr['nombre']." ".$rgr['a_pat']." ".$rgr['a_mat']; ?>" onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled" size="30">
								</td>
								<td><label for="coordinador">Coordinador:</label></td>
								<td align="left">		
                                <?php
								 $crr=mysql_query("select * from empleados where id_empleado='$id_coordinador'",$db_conexion);
								 $rcrr=mysql_fetch_array($crr);								 
								?>		
                                <input name="ger" readonly="readonly" type="text" value="<? echo $rcrr['nombre']." ".$rcrr['a_pat']." ".$rcrr['a_mat']; ?>" onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled" size="30">
								</td>
								<td><label for="ejecutivo">Ejecutivo:</label></td>
						        <td align="left">		
                                <?php
								 $ej=mysql_query("select * from empleados where id_empleado='$id_ejecutivo'",$db_conexion);
								 $rej=mysql_fetch_array($ej);								 
								?>		
                                <input name="ger" readonly="readonly" type="text" value="<? echo $rej['nombre']." ".$rej['a_pat']." ".$rej['a_mat']; ?>" onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled" size="30">
								</td>	
								</tr>
							  <tr>
								 <td><label for="tipopros">T. Prospección:</label></td>
								 <td><SELECT name="tipoprospeccion" class="sel" disabled="disabled">
										<option value="<? echo $tipoprospeccion ?>"><? echo $tipoprospeccion ?></option>
										<? $campo="TIPO_PROSPECCION";
										   $valor=$prospeccion;
											require("llena2.php");
										?>
										</select>
								 </td>
								 <td><label for="medio">Medio:</label></td>
								 <td>
								  <select name="medio" onChange="validarmedio(this.value)" disabled="disabled"> 
									 <option value="">--SELECCIONE--</option> 
									   <? 
									   $sql="SELECT distinct id,canal from medio";
										$rs=mysql_query($sql);
									   if(mysql_num_rows($rs)>0) 
											{ 
											 while($row = mysql_fetch_assoc($rs)) 
												 { 
									   ?> 
								  <option value="<?=$row["id"]?>"<?if($medio==$row["id"]){?>selected="selected"<?}?>><?=$row["canal"]?></option> 
									   <? 
												 }												 
											} 
									   ?> 
								  </select>
								</td>
								 <td><label for="submedio">Submedio:</label></td>
								 <td align="left">
								  <select name="submedio"  id="submedio" style="width:145px;" disabled="disabled"> 
									 <option>--SUBMEDIO--</option>
                                      <? 
									   $sql="SELECT distinct idsubmedio,subcanal FROM submedio WHERE idcanal=$medio";
										$rs=mysql_query($sql);
									   if(mysql_num_rows($rs)>0) 
											{ 
											 while($row = mysql_fetch_assoc($rs)) 
												 { 
									              ?> 
								                  <option value="<?=$row["idsubmedio"]?>"<?if($submedio==$row["idsubmedio"]){?>selected="selected"<?}?>><?=$row["subcanal"]?></option> 
									              <? 
												 } 
											} 
									   ?> 									 
								  </select>
								</td>
							   </tr>
                               <tr>
								 <td>
								   <!-- <input type="button" value="Agregar(+)" onclick="anadirtipopros(this.form)" /> -->
								 </td>
								 <td align="left">
								    <!--<input type="text" name="agregartpros" style="background-color:#E0E8F3;" onFocus="foco(this);" onBlur="no_foco(this);" onChange="javascript:this.value=this.value.toUpperCase();" size="10"/>-->
							     </td>
								 <td>
								    <!--<input type="button" value="Agregar(+)" onclick="anadirmedio(this.form)" /> -->
								 </td>
								 <td align="left">
								   <!-- <input type="text" name="agregarmedio" style="background-color:#E0E8F3;" onFocus="foco(this);" onBlur="no_foco(this);" onChange="javascript:this.value=this.value.toUpperCase();" size="10"/>-->
							     </td>
								 <td>
								   <!-- <input type="button" value="Agregar(+)" onclick="anadirsubmedio(this.form)" /> -->
								 </td>
								 <td align="left">
								    <!--<input type="text" name="agregarsubmedio" style="background-color:#E0E8F3;" onFocus="foco(this);" onBlur="no_foco(this);" onChange="javascript:this.value=this.value.toUpperCase();" size="10"/>-->
							     </td>
							   </tr>							   
							</table>
                            </p>							
                        </fieldset>
						 <fieldset class="step">
                            <legend><strong>EVALUACIÓN DEL PROSPECTO</strong></legend>														
                            <p>
							  <table border="0" width="800" style="font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em;text-align:right">
							  <tr>
							    <td><label for="califica"><font color="#F30">*</font>Califica?</label></td>
								<td> 
									 <select name="combo" onchange="hide()" style="width:129px" disabled="disabled">	
                                     <option value="" selected="selected">Escoge opcion</option>										 
									 <option value="Q" <?if($califica=='Q'){?>selected="selected"<?}?>>Q</option>
									 <option value="NQ"<?if($califica=='NQ'){?>selected="selected"<?}?>>NQ</option>
									 </select>
								</td>
								<td>
									<input type="text" name="label" value="* Plazo de Renta" id="label" size="12" style="<?if($califica=='NQ'){?>visibility:hidden;<?}if($califica=='Q'){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none" readonly>
								</td>
								<td align="left">
									<select name="comfr" id="comfr" style="<?if($califica=='NQ'){?>visibility:hidden;<?}if($califica=='Q'){?>visibility:visible;<?}?>width:100px" onchange="califica()" disabled="disabled">
									    <option selected>Escoge opcion</option>
									    <option value="CP" <?if($formarenta=='CP'){?>selected="selected"<?}?>>CP</option>
									    <option value="LP" <?if($formarenta=='LP'){?>selected="selected"<?}?>>LP</option>
									    <option value="NI" <?if($formarenta=='NI'){?>selected="selected"<?}?>>NI</option>
									</select>
								</td>
								<td align="left"> 
								    &nbsp;<input type="text" name="frequerido" value="* Fecha Estancia" id="frequerido" size="12" style="<?if($califica=='NQ' ||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none" readonly>
								    <input id="aDate" class="input-text required" name="fr" type="text" size="15" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" onblur="javascript: ndias();" value="<?php echo $dia_inicio; ?>" disabled="disabled">
									<input id="dDate" class="input-text required" name="fr2" type="text" size="15" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" onblur="javascript:ndias();mostrar();" value="<?php echo $dia_salida; ?>" disabled="disabled">
								</td>
							   </tr>
							   <tr>
							    <td><input type="text" name="ncal" value="Motivo NQ" id="ncal" size="6" style="<?if($califica=="Q"){?>visibility:hidden;<?}if($califica=='NQ'){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none" readonly></td>
								<td align="left">
								    <select name="mncal" style="<?if($califica=="Q"){?>visibility:hidden;<?}if($califica=='NQ'){?>visibility:visible;<?}?>width:128px" disabled="disabled">		
									<? 
									$campo="MOTIVO_NO_CALIFICA";
									$valor=$motivo_nocal;
									require("llena2.php");									
									?>
									</select>
								</td>
								<td align="left">
									<input type="text" name="nit" value="Motivo NI" id="nit" size="10" style="<?if($califica=="NQ" || ($califica=="Q" && ($formarenta=="CP"||$formarenta=="LP"))){?>visibility:hidden;<?}if($califica=='Q' && $formarenta=="NI"){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none" readonly>
								</td>
                                <td>								
									<select name="nic" style="<?if($califica=="NQ" || ($califica=="Q" && ($formarenta=="CP"||$formarenta=="LP"))){?>visibility:hidden;<?}if($califica=='Q' && $formarenta=="NI"){?>visibility:visible;<?}?>width:100px" disabled="disabled">
									    <option value="<? $nic ?>"><? echo $nic ?></option>
										<? $campo="CALIFICA_NO_INTERESA";
										   $valor=$razon_ni;
											require("llena2.php");
										?>
									</select>
								</td>
								<td align="left">
								    <div id="totdias" style="font-size: 11px;padding-left:15px;"></div>
								</td>
								</tr>
								<tr>
								    <td><!--<input type="button" name="anadirmnq" style="<?if($califica=="Q"){?>visibility:hidden;<?}if($califica=='NQ'){?>visibility:visible;<?}?>" value="Agregar(+)" onclick="anadirmotnq(this.form)" />--></td>
								    <td align="left"><!--<input type="text" name="causa" style="background-color:#E0E8F3;<?if($califica=="Q"){?>visibility:hidden;<?}if($califica=='NQ'){?>visibility:visible;<?}?>" onFocus="foco(this);" onBlur="no_foco(this);" onChange="javascript:this.value=this.value.toUpperCase();" size="10"/>--></td>
								    <td><!--<input type="button" name="anadirni" style="<?if($califica=="NQ" || ($califica=="Q" && ($formarenta=="CP"||$formarenta=="LP"))){?>visibility:hidden;<?}if($califica=='Q' && $formarenta=="NI"){?>visibility:visible;<?}?>" value="Agregar(+)" onclick="anadircni(this.form)" />--></td>
								    <td align="left"><!--<input type="text" name="causani" style="background-color:#E0E8F3;<?if($califica=="NQ" || ($califica=="Q" && ($formarenta=="CP"||$formarenta=="LP"))){?>visibility:hidden;<?}if($califica=='Q' && $formarenta=="NI"){?>visibility:visible;<?}?>" onFocus="foco(this);" onBlur="no_foco(this);" onChange="javascript:this.value=this.value.toUpperCase();" size="10"/>--></td>
								<?
								////consulta que cuenta el numero de departamentos de cada propiedad o complejo que estan libres
								        for($i=1;$i<=5;$i++)
									    	{
											 //consulta que cuenta el numero de departamentos de cada propiedad o complejo
											 $sql="select count(id_complejo) from departamentos where id_complejo = '$i' group by id_complejo";
											 $ejesql=mysql_query($sql);
											 $totdepas=mysql_fetch_array($ejesql);
											 mysql_free_result($ejesql);
											 $totaldepas=$totdepas[0];
											 $sqldeplibres="select count(id_complejo) from departamentos where id_complejo = '$i' AND status='libre' group by id_complejo";
											 $ejesqldeplibres=mysql_query($sqldeplibres);
											 $totdepasdeplibres=mysql_fetch_array($ejesqldeplibres);
											 mysql_free_result($ejesqldeplibres);
											 $totaldepasdeplibres=$totdepasdeplibres[0];
											 $diflibredesocupado=$totaldepas-$totaldepasdeplibres;
											 
											 //tarifa alta,media,baja,muy baja
											 $tarifa=round((($diflibredesocupado*100)/$totaldepas));
											 if($tarifa>=0 && $tarifa<=35){
											  $tablatar="tarifa baja";
											  // echo "muy baja";
											 }
											 if($tarifa>=36 && $tarifa<=60){
											  $tablatar="tarifa media";
											 //  echo "baja";
											 }
											 if($tarifa>=61 && $tarifa<=85){
											  $tablatar="tarifa alta";
											  // echo "media";
											 }
											 if($tarifa>=86 && $tarifa<=100){
											  $tablatar="tarifa alta";
											  // echo "alta";
											 }
											 $array[$i]=$tablatar;
											 $array2[$i]=$tarifa;
										    }
								?>
								<td align="left">
								   <table border="0" width="300">
								    <tr>
									  <td width="75">
									  <input type="text" name="tst" value="Torre Sagredo" id="tst" size="12" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;" readonly>
									  </td>
									  <td width="75" align="center"><input type="text" name="mst" value="Moras Suites" id="mst" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;" readonly></td>
									  <td width="75" align="center"><input type="text" name="ctt" value="Casa Tiztik" id="ctt" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;" readonly></td>
									  <td width="75" align="center"><input type="text" name="cct" value="Casa Caracol" id="cct" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;" readonly></td>
									  <td width="75" align="center"><input type="text" name="tpt" value="Torre Periferico" id="tpt" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;" readonly></td>
									</tr>
									<tr>
									  <td width="75" align="center"><input type="text" name="tst2" value="<?echo $array[1];?>" id="tst2" size="12" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;color:#8A0808;font-size:10px;" readonly></td>
									  <td width="75" align="center"><input type="text" name="mst2" value="<?echo $array[2];?>" id="mst2" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;color:#8A0808;font-size:10px;" readonly></td>
									  <td width="75" align="center"><input type="text" name="ctt2" value="<?echo $array[3];?>" id="ctt2" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;color:#8A0808;font-size:10px;" readonly></td>
									  <td width="75" align="center"><input type="text" name="cct2" value="<?echo $array[4];?>" id="cct2" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;color:#8A0808;font-size:10px;" readonly></td>
									  <td width="75" align="center"><input type="text" name="tpt2" value="<?echo $array[5];?>" id="tpt2" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;color:#8A0808;font-size:10px;" readonly></td>
									</tr>
									<tr>
									  <td width="75" align="center"><input type="text" name="tst3" value="<?echo $array2[1]."%";?>" id="tst3" size="12" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;color:#8A0808;font-size:10px;" readonly></td>
									  <td width="75" align="center"><input type="text" name="mst3" value="<?echo $array2[2]."%";?>" id="mst3" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;color:#8A0808;font-size:10px;" readonly></td>
									  <td width="75" align="center"><input type="text" name="ctt3" value="<?echo $array2[3]."%";?>" id="ctt3" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;color:#8A0808;font-size:10px;" readonly></td>
									  <td width="75" align="center"><input type="text" name="cct3" value="<?echo $array2[4]."%";?>" id="cct3" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;color:#8A0808;font-size:10px;" readonly></td>
									  <td width="75" align="center"><input type="text" name="tpt3" value="<?echo $array2[5]."%";?>" id="tpt3" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none;text-align:center;color:#8A0808;font-size:10px;" readonly></td>
									</tr>
									<tr>
								        <td width="75" align="center"><input type="checkbox" name="ts" id="ts" onclick="javascript:if(this.value=='on'||this.value==''){this.value='ts'}else{this.value=''};" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" <?if($nombre_complejo=="TORRE SAGREDO"){?>checked="checked" value="ts"<?}?>></td>
									    <td width="75" align="center"><input type="checkbox" name="ms" id="ms" onclick="javascript:if(this.value=='on'||this.value==''){this.value='ms'}else{this.value=''};" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" <?if($nombre_complejo=="MORAS SUITES"){?>checked="checked" value="ms"<?}?>></td>
									    <td width="75" align="center"><input type="checkbox" name="ct" id="ct" onclick="javascript:if(this.value=='on'||this.value==''){this.value='ct'}else{this.value=''};" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" <?if($nombre_complejo=="CASA TIZTIK"){?>checked="checked" value="ct"<?}?>></td>
									    <td width="75" align="center"><input type="checkbox" name="cc" id="cc" onclick="javascript:if(this.value=='on'||this.value==''){this.value='cc'}else{this.value=''};" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" <?if($nombre_complejo=="CASA CARACOL"){?>checked="checked" value="cc"<?}?>></td>
									    <td width="75" align="center"><input type="checkbox" name="tp" id="tp" onclick="javascript:if(this.value=='on'||this.value==''){this.value='tp'}else{this.value=''};" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" <?if($nombre_complejo=="TORRE PERIFERICO"){?>checked="checked" value="tp"<?}?>></td>
								   </tr>
								   </table>
								</td>
							 </tr>	 
							 <tr>
							    <td></td>
								<td></td>
								<td></td>
								<td></td>
								<td>
								 <table align="center"border="0"> 
								 </table>	
								</td>
							 </tr>
							 <tr>
							    <td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td align="left"><!--<input type="text" name="presupuestot" value="* Presupuesto USD" id="presupuestot" size="14" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none" readonly>&nbsp;<input type="text" name="presupuesto" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" onFocus="foco(this);" onBlur="no_foco(this);">--></td>
							 </tr>
							 <tr> 
							    <td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td align="center"><!--<a href="javascript:mostrar();" id="disponibles" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>"><img src="images/disponibles.png" style="border:0;"></a>-->
								</td>
							 </tr>
							 </table>
                            </p>
                        </fieldset>
						<div id="flotante" style="display:none;">
						</div>
						<div id="cargando" style="position:fixed;left:50%;top:50%;width:250px;height:70px;margin-left:-125px;margin-top:-35px;display:none;background:url(images/bkloading.png);background-repeat:no-repeat;color:#ffffff;padding-top:5px;align:center;">
						    <br><p align="center"><img src="images/loading.gif"></center>Cargando
						</div>
						<fieldset class="step"> 
                            <legend><strong>ASIGNAR DEPARTAMENTO</strong></legend>
                            <div id="mensaje"></div>
							<table align="center" width="90%" style="font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em;text-align:right">
							<tr>
							    <td colspan="6" align="center">
								    <table>
							            <tr>
								            <td align="center"><input type="text" name="estmtotx" value="Estacionamiento" id="estmtotx" size="12" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none" readonly></td>
									        <td align="center"><input type="text" name="camaextx" value="Cama extra" id="camaextx" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none" readonly></td>
									        <td align="center"><input type="text" name="cunatx" value="   Cuna" id="cunatx" size="10" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none" readonly></td>
									        <td align="center"><input type="text" name="mascotatx" value="Mascota" id="mascotatx" size="11" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none" readonly></td>
									        <td align="center"><input type="text" name="nper" value="Nº Personas" id="nper" size="8" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none" readonly></td>
											<td align="center"><input type="text" name="descto" value="Descuento" id="descto" size="8"  style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>background-color:#f1f1f1;border:none" readonly></td>
											<td align="center"><input type="text" name="dolartx" value="Precio dolar $" id="dolartx" size="11" style="background-color:#f1f1f1;border:none;text-align:center;" readonly></td>
								        </tr>
									    <tr>
									        <td align="center"><input type="checkbox" name="estmnto" id="estmnto" <? if($estmtostatus=="s"){ echo "value='s'"; } else { echo "value='n'"; } ?> onclick="javascript:if(this.checked==0){limpiasub(),this.value='n'}else{calculatotal(),this.value='s'};" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" <?if($estmtostatus=="s"){?>checked<?}?>/></td>
									        <td align="center"><input type="checkbox" name="camaex" id="camaex" <? if($estmtostatus=="s"){ echo "value='s'"; } else { echo "value='n'"; } ?> onclick="javascript:if(this.checked==0){limpiasub(),calculatotal(),this.value='n'}else{calculatotal(),this.value='s'};" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" <?if($camaexstatus=="s"){?>checked<?}?>/></td>
									        <td align="center"><input type="checkbox" name="cuna" id="cuna" <? if($estmtostatus=="s"){ echo "value='s'"; } else { echo "value='n'"; } ?> onclick="javascript:if(this.checked==0){limpiasub(),this.value='n'}else{calculatotal(),this.value='s'};" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" <?if($cunastatus=="s"){?>checked<?}?>/></td>
									        <td align="center"><input type="checkbox" name="mascota" id="mascota" <? if($estmtostatus=="s"){ echo "value='s'"; } else { echo "value='n'"; } ?> onclick="javascript:if(this.checked==0){limpiasub(),this.value='n'}else{calculatotal(),this.value='s'};" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" <?if($mascotastatus=="s"){?>checked<?}?>/></td>
									        <td align="center">
									        <input id="npers" name="npers" type="text" size="2" value="<?echo $noPersonas?>" onKeypress="javascript:if (event.keyCode < 45 || event.keyCode > 57) event.returnValue=false;" onkeyup="javascript:if(this.value==''){limpiasub(),calculatotal()}else{capacidad(),setTimeout('calculatotal()',1000)};" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" disabled="disabled">
											</td>
											<td align="center">
									        <input id="descuento" name="descuento" type="text" size="2" value="<?echo $descuento;?>" onKeypress="javascript:if (event.keyCode < 45 || event.keyCode > 57) event.returnValue=false;"  onkeyup="javascript:if(this.value>100){this.value=100};if(this.value<0){this.value=0};if(this.value>0 && this.value<100 ){calculatotal()}else{calculatotal()};comdesc();" style="<?if($califica=='NQ'||($califica=='Q' &&$formarenta=="NI")){?>visibility:hidden;<?}if($califica=='Q' && ($formarenta=="CP" || $formarenta=="LP")){?>visibility:visible;<?}?>" <?if($su_puesto==5){?> readonly<?}?> disabled="disabled">
											<input type="hidden" name="descant" id="descant" size="5" value="<?echo $descuento?>">
									        <input type="hidden" name="iddep" id="iddep" size="5" value="<?echo $id_departamento;?>"><input type="hidden" name="compl" id="compl" size="5" onFocus="foco(this);" onBlur="no_foco(this);" value="<?echo $id_complejo;?>">
											</td>
											<td align="center">
									        <input id="dolar" name="dolar" type="text" size="2" value="<?echo $convmxn?>" readonly disabled="disabled">
											</td>
									    </tr>
										
										<input type="text" name="invitadotx" value="Cuota invitado" id="invitadotx" size="11" style="visibility:hidden;background-color:#f1f1f1;border:none;text-align:center;" readonly>
                                        <input type="checkbox" name="invitado" id="invitado" value="n" onclick="javascript:if(this.checked==0){limpiasub(),this.value='n'}else{calculatotal(),this.value='s'};" style="visibility:hidden;" />
									   
									    <tr>
									        <td colspan="6" align="center">											
										        <div id="huespedes" style="display:none;font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 10px;">  
								                    <table border="0" style="font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 10px;text-align:left;display: block">
								                        <tr>
								                            <td colspan="3">Agregar Huesped:<input type="button" name="agregar" id="agregar" value="Agregar(+)"  onclick="javascript:crear(),tabla();"/></td>
								                        </tr>
								                        <tr id="f1"></tr>
								                            <tr>
													            <td>
														            <table id="tab" border="0" style="font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em;text-align:left;display: block">
															        </table>
															    </td>
													        </tr>
								                            <tr>
														        <td id="fiel" colspan="3">
														        </td>
														    </tr>
								                    </table>
                                                <div>	
									        </td>
									    </tr>
									</table>
								</td>
                            </tr>								
							<tr>
							    <td colspan="6" align="center">
								 <div id="tabladatos1">
								    <table width="100%" style="font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em;text-align:right">
								        <tr>
										    <td align="center" colspan="2">Fecha:</td>
							                <td align="center">Propiedad:</td>
								            <td align="center">Clave:</td>
								            <td align="center">Monto <?if($factura=="CON FACTURA"){?>MXN<?}else{?>USD<?}?>:</td>
								            <td align="right">Deposito <?if($factura=="CON FACTURA"){?>MXN<?}else{?>USD<?}?>:</td>
										</tr>
										<tr>
										    <td colspan="2"><input id="fin" class="input-text required" name="fini" type="text" readonly onFocus="foco(this);" onBlur="no_foco(this);" value="<?php echo $dia_inicio; ?>" disabled="disabled"> - <input id="ffi" class="input-text required" name="ffin" type="text" onFocus="foco(this);" onBlur="no_foco(this);" readonly value="<?php echo $dia_salida; ?>" disabled="disabled"></td>
										    <td><input type="text" name="deparprop" id="deparprop" size="20" onFocus="foco(this);" onBlur="no_foco(this);" readonly value="<?php echo $nombre_complejo; ?>" disabled="disabled"></td>
										    <td><input type="text" name="clavedep" id="clavedep" size="5" onFocus="foco(this);" onBlur="no_foco(this);" readonly value="<?php echo $clave_depto; ?>" disabled="disabled"></td>
										    <td><input type="text" name="monto" id="monto" size="5" onFocus="foco(this);" onBlur="no_foco(this);" value="<?php echo $hospedaje; ?>" readonly disabled="disabled"></td>
										    <td><input type="text" name="deposito" id="deposito" style="text-align:right" size="5" onFocus="foco(this);" value="<?php echo $deposito; ?>" onBlur="no_foco(this);" readonly disabled="disabled"></td>
										</tr>
									</table>
                                 </div>									
							    </td> 
							</tr>
							<tr>
							    <td colspan="6">
								 <div id="tabladatos2">
								 <table width="100%" style="font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em;text-align:right">
								    <tr>
									    <td>Persona extra con cama:</td>
									    <td>Persona extra:</td>
									    <td>Estacionamiento:</td>
									    <td>Cama extra:</td>
									    <td>Cuna:</td>
									    <td>Mascota:</td>
									    <td>Subtotal <?if($factura=="CON FACTURA"){?>MXN<?}else{?>USD<?}?>:</td>
									</tr>
									<tr>
									    <td><input type="text" name="perextcama" id="perextcama" size="3" value="<?echo $perextcama;?>" readonly onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled" /></td>
									    <td><input type="text" name="persext" id="persext" size="3" value="<?echo $per_extra;?>" readonly onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled"/></td>
									    <td><input type="text" name="estmnto2" id="estmnto2" size="3" value="<?echo $garage;?>" readonly onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled"/></td>
									    <td><input type="text" name="camaex2" id="camaex2" size="3" value="<?echo $camaextra;?>" readonly onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled"/></td>
									    <td><input type="text" name="cuna2" id="cuna2" size="3" value="<?echo $cuna;?>" readonly onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled"/></td>
									    <td><input type="text" name="mascota2" id="mascota2" size="3" value="<?echo $mascota;?>" readonly onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled"/></td>
									    <td><input type="text" name="subtotal2" id="subtotal2" style="text-align:right" size="5" value="<?echo $subtotal;?>" readonly onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled"/></td>
									</tr>
								 </table>
								 </div>
								</td> 
							</tr>
							<tr>
							    <td colspan="6">
								 <div id="tabladatos3">
								    <table width="100%" style="<?if($factura=="CON FACTURA"){?><?}else{?>display:none;<?}?>font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em;text-align:right">
								        <td>IVA MXN: <input type="text" name="iva2" id="iva2" size="5" value="<?echo $impuesto;?>" style="text-align:right" readonly onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled"/></td>
								    </table>
								 </div>
								</td> 
							</tr>
							<tr>
							    <td colspan="6">
								 <div id="tabladatos4">
								    <table width="100%" style="font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em;text-align:right">
								        <td>TOTAL <?if($factura=="CON FACTURA"){?>MXN<?}else{?>USD<?}?>: <input type="text" style="text-align:right" name="total2" id="total2" size="5" value="<?php echo $total; ?>" readonly onFocus="foco(this);" onBlur="no_foco(this);" disabled="disabled"/></td>
								    </table>
								 </div> 
								</td> 
							</tr>
							<tr>
							    <td colspan="6">
								    <input type="hidden" name="idmto" id="idmto" size="5" value="0" readonly />
								    <input type="hidden" name="tipomoneda" id="tipomoneda" size="5" value="<?if($factura=="CON FACTURA"){?>MXN<?}else{?>USD<?}?>" readonly />
								    <input type="hidden" name="noanos" id="noanios" size="5" value="<?echo $no_anios;?>" readonly />
                                    <input type="hidden" name="nomeses" id="nomeses" size="5" value="<?echo $no_meses;?>" readonly />	
									<input type="hidden" name="nosem" id="nosem" size="5" value="<?echo $no_sem;?>" readonly />
                                    <input type="hidden" name="nodias" id="nodias" size="5" value="<?echo $no_dias?>" readonly />	
                                    <?php
									if($noPersonas>0)
									{
										$caplim=mysql_query("select * from departamentos where id_departamento='$id_departamento'",$db_conexion);
										if($r=mysql_fetch_array($caplim))
										{
										 $kp=$r['capacidad'];	
										 $lmt=$r['limite'];
										}
									?>
                                    <input type="hidden" name="cap" id="cap" size="5" value="<?php echo $kp; ?>" readonly />	
                                    <input type="hidden" name="lim" id="lim" size="5" value="<?php echo $kp; ?>" readonly />										
                                    <?php
									} else {										
									?>
                                    <input type="hidden" name="cap" id="cap" size="5" value="0" readonly />	
                                    <input type="hidden" name="lim" id="lim" size="5" value="0" readonly />				                                    
                                    <?php
									} 
									?>
								</td>
							</tr>
							</table>
                        </fieldset>
						
						<fieldset class="step"> 
                            <legend><strong>PRE-APARTADO<strong></legend>
							<table align="left" border="0" style="font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em;text-align:right">
							  <tr>						     
								 <td></td>
							     <td></td>
								 <td align="center">
								      <div id="fact" style="<?if($ubicacionactual=="MEXICO" && $formapago=="BANCO"){?><?}else{?>display:none;<?}?>width:600px">
								      Con factura: <input align="center" id="factura" name="factura" type="radio" value="CON FACTURA" onclick="javascript:opbanco();" <?if($factura=="CON FACTURA"){?>checked<?}?>>
									  Sin Factura: <input align="center" id="factura" name="factura" type="radio" value="SIN FACTURA" onclick="javascript:opbanco();"  <?if($factura=="SIN FACTURA"){?>checked<?}?>>
                                      </div>								 
								 </td>
							  </tr>
							  <tr>
							     <td><label>Ubicación Actual:</label></td>
							     <td>
								    <select name="ubiact" onchange="javascript:ubicar();" disabled="disabled">
									  <option value="">--</option>
									  <option value="MEXICO" <?if($ubicacionactual=="MEXICO"){?>selected<?}?>>MEXICO</option>
									  <option value="AMERICA" <?if($ubicacionactual=="AMERICA"){?>selected<?}?>>USA Y CANADA/RESTO DE LATINOAMERICA </option>
									  <option value="EUROPARESTOMUNDO" <?if($ubicacionactual=="EUROPARESTOMUNDO"){?>selected<?}?>>EUROPA/RESTOMUNDO</option> 
									</select>
                                 </td>
								 <td align="center">
								      <div id="tdpag" style="<?if($ubicacionactual=="MEXICO" && $formapago=="BANCO"){?><?}else{?>display:none;<?}?>width:600px">
								      Deposito: <input align="center" id="depos" name="tipopago" type="radio" value="DEPOSITO" onclick="javascript:calculatotal();opbanco();" <?if($tipopago=="DEPOSITO"){?>checked<?}?>>
									  Transferencia: <input align="center" id="trasf" name="tipopago" type="radio" value="TRANSFERENCIA" onclick="javascript:calculatotal();opbanco();" <?if($tipopago=="TRANSFERENCIA"){?>checked<?}?>>
									  Cheque: <input align="center" id="chequ" name="tipopago" type="radio" value="CHEQUE" onclick="javascript:calculatotal();opbanco();" <?if($tipopago=="CHEQUE"){?>checked<?}?>>
                                      </div>						  
								 </td>
							  </tr>
							  <tr>
							     <td><label>Forma de pago:</label></td>
							     <td>
								    <select name="formapago" onchange="javascript:opciones();" disabled="disabled">
									  <option value="">--</option>
									  <option value="BANCO" <?if($formapago=="BANCO"){?>selected<?}?>>BANCO</option>
									  <option value="PAYPAL" <?if($formapago=="PAYPAL"){?>selected<?}?>>PAYPAL</option>
									  <option value="EFECTIVO" <?if($formapago=="EFECTIVO"){?>selected<?}?>>EFECTIVO</option>									  
									</select>
                                 </td>
							  </tr>
							  <tr>
							      <td colspan="3">
								  <div id="info">
							      </div>	
							      </td>
							  </tr>
							</table>
                        </fieldset>
						<?
						if($su_puesto==1 || $su_puesto==2)
						{
						?>
                        <fieldset>
						    <legend><strong>VALIDACIÓN</strong></legend>
							
                        </fieldset>
						<?
						}
						?>
                        <fieldset class="step">                                                 
                      <legend><strong>ESTADO DE LA RENTA<strong></legend>
                            <p class="submit" align="center">
                            <table align="left" border="0" style="font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em;text-align:left">
                            <input type="hidden" name="fecha_cierre_anterior" value="<?php echo $fecha_cierre; ?>"/>
                            <tr>
                              <td>Fecha Cierre</td>
                              <td>
                              <input type="text" name="testinput" style="text-align:left;" value="<?php if($fecha_cierre=='0000-00-00') { } else { echo $fecha_cierre; } ?>" size="10" disabled="disabled"/>
								<script language="JavaScript">
                                var o_cal = new tcal ({
                                    // form name
                                    'formname': 'forma',
                                    // input name
                                    'controlname': 'testinput'
                                });
                                
                                // individual template parameters can be modified via the calendar variable
                                o_cal.a_tpl.yearscroll = false;
                                o_cal.a_tpl.weekstart = 1;
                                
                                </script>
                              </td>
                             </tr>
                            
                             <tr>
                               <td>Especifique Tarea</td>
                              <td>
                              <select name="tipo_renta" style="width:130px;" onchange="verifica();" disabled="disabled">
                                <?php
							   if($tipo_renta=='')
							    {
							  ?>
                               <option value="" selected="selected">--</option>                              
                               <option value="RENTA NUEVA">RENTA NUEVA</option>
                               <option value="SEGUIMIENTO">SEGUIMIENTO</option>
                              <?php
								}
								else if($tipo_renta=='RENTA NUEVA')
							    {
							  ?>                                                            
                               <option value="RENTA NUEVA" selected="selected">RENTA NUEVA</option>
                               <option value="SEGUIMIENTO">SEGUIMIENTO</option>
							   <option value="">--</option> 
                              <?php
								}
							     else if($tipo_renta=='SEGUIMIENTO')
							    {
							  ?>                                                                                           
                               <option value="SEGUIMIENTO">SEGUIMIENTO</option>
							   <option value="">--</option> 
                              <?php
								}
							  ?>                       
                              </select>
                              </td>
                             </tr>     
                             
                             <tr>
                               <td>Estatus Renta</td>
                              <td>
                              <select name="status_renta" style="width:130px;" disabled="disabled">
                              <?php
							   if($status_renta=='')
							    {
							  ?>
                               <option value="" selected="selected">--</option>                              
                               <option value="LIBRE">LIBRE</option>
                               <option value="OCUPADO">OCUPADO</option>
                               <option value="RENTADO">RENTADO</option>
                              <?php
								}
								else if($status_renta=='LIBRE')
							    {
							  ?>
                               <option value="LIBRE" selected="selected">LIBRE</option>
                               <option value="OCUPADO">OCUPADO</option>
                               <option value="RENTADO">RENTADO</option>
                               <option value="">--</option>
                               <?php
								}
							     else if($status_renta=='OCUPADO')
							    {
							  ?>
                               <option value="LIBRE">LIBRE</option>
                               <option value="OCUPADO" selected="selected">OCUPADO</option>
                               <option value="RENTADO">RENTADO</option>
                               <option value="">--</option>
                              <?php
								}
								else if($status_renta=='RENTADO')
							    {
							  ?>
                               <option value="LIBRE">LIBRE</option>
                               <option value="OCUPADO">OCUPADO</option>
                               <option value="RENTADO" selected="selected">RENTADO</option>
                               <option value="">--</option>
                              <?php
								}
							  ?>
                              </select>
                              </td>
                             </tr>
                            </table>                            
                            </p>
                        </fieldset>  
                        <div id="alerta_fecha"></div>
						
                    </form>				
					<SCRIPT type="text/javascript" src="calendario/calendar-start.js"></SCRIPT>
                </div>
            </div>
        </div>
	</div>	
	<div id="paypal" style="position:absolute;display:none;width:400px;margin-top:-150px;margin-left:380px;">
										    <form name="paypal" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">
                                             <input type="hidden" name="cmd" value="_xclick">
                                             <input type="hidden" name="hosted_button_id" value="5ESXKWWUMHW9J">
                                             <input type="hidden" name="business" value="mexicoenrenta@hotmail.com">
                                             <input type="hidden" name="currency_code" value="USD">
                                             <input type="hidden" name="item_name" value="">
                                             <input type="hidden" name="amount" value="">
                                             <input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110429-1/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
                                             <img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110429-1/es_XC/i/scr/pixel.gif" width="1" height="1">
                                        </form> 
    <div>
<script>
 domReady(capacidad(),opbanco2(),chuesp(<?echo $id_renta;?>,<?echo $id_cliente;?>));
</script>					 