$(function()
{
	$('#cidade1').chainSelect('#bairro1','listaBairros.php',
	{ 
		before:function (target) //before request hide the target combobox and display the loading message
		{ 
			//$("#loading").css("display","block");
			//$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{ 
			//$("#loading").css("display","none");
			//$(target).css("display","inline");
		}
	});
	$('#cidade2_1').chainSelect('#bairro2_1','listaBairros.php',
	{ 
		before:function (target) //before request hide the target combobox and display the loading message
		{ 
			//$("#loading").css("display","block");
			//$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{ 
			//$("#loading").css("display","none");
			//$(target).css("display","inline");
		}
	});
	
	$('#cidade3_1').chainSelect('#bairro3_1','listaBairros.php',
	{ 
		before:function (target) //before request hide the target combobox and display the loading message
		{ 
			//$("#loading").css("display","block");
			//$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{ 
			//$("#loading").css("display","none");
			//$(target).css("display","inline");
		}
	});

	$('#cidade4_1').chainSelect('#bairro4_1','listaBairros.php',
	{ 
		before:function (target) //before request hide the target combobox and display the loading message
		{ 
			//$("#loading").css("display","block");
			//$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{ 
			//$("#loading").css("display","none");
			//$(target).css("display","inline");
		}
	});
	
	$('#cidade5_1').chainSelect('#bairro5_1','listaBairros.php',
	{ 
		before:function (target) //before request hide the target combobox and display the loading message
		{ 
			//$("#loading").css("display","block");
			//$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{ 
			//$("#loading").css("display","none");
			//$(target).css("display","inline");
		}
	});
	$('#cidade6_1').chainSelect('#bairro6_1','listaBairros.php',
	{ 
		before:function (target) //before request hide the target combobox and display the loading message
		{ 
			//$("#loading").css("display","block");
			//$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{ 
			//$("#loading").css("display","none");
			//$(target).css("display","inline");
		}
	});	

	$('#cidade7_1').chainSelect('#bairro7_1','listaBairros.php',
	{ 
		before:function (target) //before request hide the target combobox and display the loading message
		{ 
			//$("#loading").css("display","block");
			//$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{ 
			//$("#loading").css("display","none");
			//$(target).css("display","inline");
		}
	});	

});



function pesquisaImovelCasa(){
	$('#btnPesquisaCasa').hide();
	$('#loadingPesquisaCasa').show();
	xajax_buscaImoveis(1,xajax.getFormValues('frmImovel1'));
}
function pesquisaImovelApto(){
	$('#btnPesquisaCasa').hide();
	$('#loadingPesquisaCasa').show();
	xajax_buscaImoveis(2,xajax.getFormValues('frmImovel2'));
}
function pesquisaImovelSobrado(){
	$('#btnPesquisaCasa').hide();
	$('#loadingPesquisaCasa').show();
	xajax_buscaImoveis(3,xajax.getFormValues('frmImovel3'));
}
function pesquisaImovelTerreno(){
	$('#btnPesquisaCasa').hide();
	$('#loadingPesquisaCasa').show();
	xajax_buscaImoveis(4,xajax.getFormValues('frmImovel4'));
}
function pesquisaImovelComercial(){
	$('#btnPesquisaCasa').hide();
	$('#loadingPesquisaCasa').show();
	xajax_buscaImoveis(5,xajax.getFormValues('frmImovel5'));
}
function pesquisaImovelRural(){
	$('#btnPesquisaCasa').hide();
	$('#loadingPesquisaCasa').show();
	xajax_buscaImoveis(6,xajax.getFormValues('frmImovel6'));
}
function pesquisaImovelLitoral(){
	$('#btnPesquisaLitoral').hide();
	$('#loadingPesquisaLitoral').show();
	xajax_buscaImoveis(13,xajax.getFormValues('frmImovel7'));
}

function limpaPesquisa(){	
	$('#loadingPesquisaCasa').hide();
	$('#btnPesquisaCasa').show();
}
function escondeMenu(tipoImovel){
	$('#dMenu'+tipoImovel).slideUp(300);
	atual = -1;
}
function exibeResultados(){
	$('#resultadoBuscaContainer').show();	
	var destination = $('#resultadoBuscaContainer').offset().top;
	$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-50}, 1000 )	
}

