// JavaScript Document
function jsClickDisponibilidad()
{
	if(document.getElementById("divContenerDate").style.display=="none")
	{
		$("#divContenerDate").show();
		document.getElementById("tdMuestraDisponibilidad").innerHTML="Ocultar Disponibilidad"
	}
	else
	{
		$("#divContenerDate").hide();
		document.getElementById("tdMuestraDisponibilidad").innerHTML="Ver Disponibilidad"
	}
	
}

function jsOpenCalendario(IdInmueble)
{
	url="Calendario/calendario.php?IdInmueble="+IdInmueble;
	jsDialogIt(url,"dlgCalendario","Calendario",620,210,'','','','')
}
//informacion inmueble en venta
function jsSendInfo(IdInmueble)
{
	Nombre=trim($("#nombre").attr("value"));

	Direccion=trim($("#direccion").attr("value"));
	CP=$("#cp").attr("value");
	Telefono=$("#telefono").attr("value");
	Mobil=$("#mobil").attr("value");
	Email=$("#email").attr("value");
	Pais=$("#pais").attr("value");
	Estado=$("#estado").attr("value");
	if(Nombre!=""&&Telefono!=""&&Email!="")
	{
		url="info/enviainfo.php?Nombre="+Nombre+"&Direccion="+Direccion+"&Telefono="+Telefono+"&Mobil="+Mobil
		url+="&Email="+Email+"&Pais="+Pais+"&Estado="+Estado+"&CP="+CP+"&IdInmueble="+IdInmueble;

		res=jsJQueryIt(url);
		if(res==1)
		{
			$("#Venta").dialog("close");
			alert("Formulario enviado, pronto reciviras nuestra respuesta");	
		}
		else
		{
			alert("Ocurrio un error "+res);	
		}
		
	}
	else
	{
		alert("Nombre, Telefono y Email son obligatorios");	
	}
}
//reservaciones-----------------------------------------

function jsReservar(IdInmueble)
{
	Nombre=$("#nombre").attr("value");
	Direccion=$("#direccion").attr("value");
	CP=$("#cp").attr("value");
	Telefono=$("#telefono").attr("value");
	Mobil=$("#mobil").attr("value");
	Mail=$("#email").attr("value");
	Pais=$("#pais").attr("value");
	Estado=$("#estado").attr("value");
	Fecha1=$("#inicio").attr("value");
	Fecha2=$("#fin").attr("value");
	if(Nombre!=""&&Direccion!=""&&Telefono!=""&&Fecha1!=""&&Fecha2)
	{
		url="php/X.php?Op=AddReservaciones&Nombre="+Nombre+"&Direccion="+Direccion+"&CP="+CP+"&Telefono="+Telefono+"&Mobil="+Mobil+"&Mail="+Mail
		url+="&Pais="+Pais+"&Estado="+Estado+"&Fecha1="+Fecha1+"&Fecha2="+Fecha2+"&IdInmueble="+IdInmueble;
		res=jsJQueryIt(url);
		
		if(res==1)
		{
			alert("Se realizo la reservacion con exito, nos pondremos en contacto inmediatamente")
			$("#Renta").dialog("close");
		}
		else
		{
			alert("Ocurrio un error "+res)	
		}
	}
	else
	{
		alert("debes llenar los datos obligatorios (Nombre,Direccion,Telefono,Fecha de llegada y Fecha de salida)")	
	}
}

//renta
function jsOpenRenta()
{
	var fechainicio=document.getElementById("fechainicio").value;
	var fechafin=document.getElementById("fechafin").value;
	var personas=document.getElementById("personas").value;
	var destinos=document.getElementById("destinos").value;
	var recamaras=document.getElementById("recamaras").value;
	
	var Estado=document.getElementById("cboRentaEstado").value;
	var TipoSitio=document.getElementById("cboRentaTipo").value
	var TipoRenta=document.getElementById("cboRentaTipoRenta").value
	var Precio1=document.getElementById("cboRentaPrecio1").value
	var Precio2=document.getElementById("cboRentaPrecio2").value
//jsDialogIt('buscaRenta.php?fechafin='+fechafin.value+'&fechainicio='+fechainicio.value+'&personas='+personas.value+'&destinos='+destinos.value+'&recamaras='+recamaras.value+'&tipo=renta','Renta','Renta',700,650);	
	
	url="PaginaDestinos.php?pagina=buscaRenta"
	url+="&fechafin="+fechafin+"&fechainicio="+fechainicio+"&personas="+personas+"&destinos="+destinos+"&recamaras="+recamaras
	url+="&estado="+Estado+"&tipositio="+TipoSitio+"&tiporenta="+TipoRenta+"&precio1="+Precio1+"&precio2="+Precio2
	
	document.location.href=url;
}



//abre disponibilidad
function jsOpenDisponibilidad(IdInmueble)
{
	url="disponibilidad.php?IdInmueble="+IdInmueble
	jsDialogIt(url,'dlgDisponibilidad','Disponibilidad',600,210);
	
}

function jsOpenVenta()
{
	var personas=document.getElementById("personav").value;
	var destinos=document.getElementById("destinosv").value;
	var recamaras=document.getElementById("recamarasv").value;
	
	var Estado=document.getElementById("cboRentaEstadov").value;
	var TipoSitio=document.getElementById("cboVentaTipo").value
	
	var Precio1=document.getElementById("cboVentaPrecio1").value
	var Precio2=document.getElementById("cboVentaPrecio2").value
	var medidas=document.getElementById("medidas").value
//jsDialogIt('buscar.php?recamaras='+recamaras.value+'&personas='+personas.value+'&destinos='+destinos.value+'&tipo=venta','Ventas','Ventas',700,650)
	url="PaginaDestinos.php?pagina=buscaVenta"
	url+="&medidas="+medidas+"&personas="+personas+"&destinos="+destinos+"&recamaras="+recamaras
	url+="&estado="+Estado+"&tipositio="+TipoSitio+"&precio1="+Precio1+"&precio2="+Precio2
	
	document.location.href=url;
}

//DESTINOS----------------------------------------------------
function jsOpenDestinos()
{
	url="PaginaDestinos.php?pagina=destinos";
	document.location.href=url
}
