// -------------------------------------------
//  Metodos JavaScript
//  SERENA
//  Febrero 2011
// -------------------------------------------
//  Dialogo alerta
//--------------------------------------------

	$(function(){					     
		$("#mensaje").dialog
		({
				resizable: false,
				bgiframe: false,
				autoOpen: false,
				minHeight: 100,
				height: 200,
				width: 400,
				modal: true,
				buttons:{ "Aceptar" : function(){$(this).dialog("close");}}
		});
	});

	//--------------------------------------------
	//  Dialogo busqueda
	//--------------------------------------------
	$(function(){					     
		$("#dialogo-resultado-busqueda").dialog
		({
				resizable: false,
				bgiframe: false,
				autoOpen: false,
				minHeight: 100,
				height: 650,
				width: 650,
				modal: true,
				buttons:{ "Cerrar" : function(){document.location.reload();$(this).dialog("close");}}
		});
	});
// -------------------------------------------
//  Dialogo de carga
//--------------------------------------------
	$(function(){					     
		$("#dialogo-loader").dialog
		({
				resizable: false,
				bgiframe: false,
				autoOpen: false,
				minHeight: 100,
				height: 120,
				width: 340,
				modal: false
		});
	});	
	//--------------------------------------------
	//  Metodos
	//--------------------------------------------	
	procesarBusqueda = function(){
    	//Preparar
		$.ajaxSetup ({cache: false });
		$('#dialogo-loader').dialog('open');
		tipo 		 = $('#combobox-tipo-arriendo').val();
		valor		 = $('#combobox-valor-arriendo').val();
		hubicacion	 = $('#combobox-hub-arriendo').val();
		num_hab		 = $('#combobox-num-habitacion').val();
		num_per		 = $('#combobox-num-personas').val();
		

		if(tipo=='0' && valor=='0' && hubicacion=='0' && num_hab=='0' && num_per=='0'){
			$('#dialogo-loader').dialog('close');
			$('#mensaje-texto').html('Debe seleccionar una opcion de busqueda.');
			$('#mensaje').dialog('open');
			return true;
		}
		else
		{
			$.get("Vistas/vista_resultado_busqueda.php", 
			{
				_tipo		: tipo,
				_valor		: valor,
				_hubicacion	: hubicacion,
				_num_hab	: num_hab,
				_num_per	: num_per,
				_modulo		:1
			},
			function(data)
			{
				$("#contenido-catalogo").html(data);
				$('#dialogo-loader').dialog('close');
			});
		}
	}
	procesarBusquedaPagina = function(pagina){
    	//Preparar
		$.ajaxSetup ({cache: false });	
		$('#dialogo-loader').dialog('open');	
			switch(pagina)
			{
				case "1": 
						tipo=1;
						modulo=2; 
						break;
				case "2":
						tipo=2;
						modulo=3; 
						break;
				case "3":
						tipo=3;
						modulo=4; 
						break;

			}
		$.get("Vistas/vista_resultado_busqueda.php", 
		{
			_tipo		: tipo,
			_valor		: 0,
			_hubicacion	: 0,
			_num_hab	: 0,
			_num_per	: 0,
			_modulo		: modulo
		},
		function(data)
		{
			$("#contenido-catalogo").html(data);
			$('#dialogo-loader').dialog('close');
		});
	}

