
/*
function carregaBairros() {
	var cidade = $('#busca_cidade').val();

	$("#listabairros").html('<div id="listabairros">Carregando...</div>');

	if(cidade!=''){
		 $.get("inc/lib/fnc_load-busca.php?act=bairros", {cidade: cidade},
			function(data){
				$("#listabairros").html(data);
			})			
	}
}	

*/

$(document).ready(function() {
	
	$("body").bind("contextmenu", function() { return false; });

	//bairros busca
	//carregaBairros();
	//$("#busca_cidade").change(function(){ carregaBairros(); });		

	//submit busca
	$("#fbusca").submit(function(){
		var livre = $.trim($("#codigo").val());
		if(livre!='') {
			if (isNaN(livre)) { $("#fbusca").attr('action','imoveis.php'); }
			else 			  { $("#fbusca").attr('action','detalhes.php'); }	 
		}
	});

	
	//efeitos newsletter
	$("#footer .box3 .nwnome").focus(function(){
		v = $(this).val();
		if (v=='Nome') $(this).val("");
	});
	$("#footer .box3 .nwnome").blur(function(){
		v = $(this).val();
		if (v=='') $(this).val("Nome");
	});
	$("#footer .box3 .nwemail").focus(function(){
		v = $(this).val();
		if (v=='E-mail') $(this).val("");
	});
	$("#footer .box3 .nwemail").blur(function(){
		v = $(this).val();
		if (v=='') $(this).val("E-mail");
	});

	/*animação home
	if ($('#animacao').length>0) {
		$('#anibase').Horinaja({
			capture: 'anibase',
			delai: 0.7,
			duree: 6,
			pagination: true,
			nCell: 100
		});
	}*/
	
	//faz a animação quando tiver #animacao .slides.cycle
	if ($("#animacao .slides.cycle").length>0) {
		$("#animacao .slides .slide").css("height",$("#animacao .slides.cycle").css("height")).css("width",$("#animacao .slides.cycle").css("width"));
		$("#animacao .slides.cycle")
			.after('<div id="anav"></div>')
			.cycle({
				fx:		'scrollHorz',
				pager:	'#anav',
				timeout:10000,
				pause:	true,
				pauseOnPagerHover: true
			});
		$("#animacao .slides.cycle .slide").each(function(){
			if ($(this).find("a.link").length>0) {
				$(this).css("cursor","pointer");
				$(this).click(function(){ window.location = $(this).find("a.link").attr("href"); });
			}
		});
	}	

	//icones do imovel
	$("#detalhes .icones li a").hover(function(){
		alt = $(this).find("img").attr("alt");
		$("#detalhes .icones li.legenda").html(alt);
	},function(){
		$("#detalhes .icones li.legenda").html("");
	});
	
	//fotos do imovel
	if ($("#imovel-fotos").length>0) {
		$('#imovel-fotos ul li a').lightBox();
	}

	
});

