$(document).ready(function(){if($.browser.msie&&$.browser.version=="6.0"){$.getScript("inc/js/jquery.bgiframe.js")
$.getScript("inc/js/jquery.pngfix.js",function(xhr){var aplicar_pngfix=".imoveis .faixa img";try{$(aplicar_pngfix).pngfix();}catch(err){eval(xhr);$(aplicar_pngfix).pngfix();}});}
$("#menu2 a").hover(function(){$(this).parents("li").addClass("ovr");},function(){$(this).parents("li").removeClass("ovr");});$('#animacao').nivoSlider({pauseTime:5000,pauseOnHover:false,controlNavTitles:true,directionNav:false,effect:'sliceDown'});$.getScript("inc/js/jquery.labelify.js",function(xhr){var aplicar_labelify="#busca .campo";try{$(aplicar_labelify).labelify();}catch(err){eval(xhr);$(aplicar_labelify).labelify();}});if($('#busca').length>0){if($.browser.msie&&$.browser.version=="6.0"){}else{$("#busca select").selectbox();}
$('#busca .bairros').jScrollPane({scrollbarWidth:19,dragMinHeight:17,dragMaxHeight:17});reinitialiseScrollPane=function(){$('#busca .bairros').jScrollPane({scrollbarWidth:19,dragMinHeight:17,dragMaxHeight:17});}
letras_bairros();}
var i=0;$(".home-slider .slider").each(function(){i=i+1;$(this).before('<div class="slider-nav"><a href="#" class="seta prev" id="prev'+i+'">p</a><div class="dots" id="nav'+i+'"></div><a href="#" class="seta next" id="next'+i+'">n</a></div>');$(this).cycle({fx:'scrollHorz',pager:'#nav'+i,next:'#next'+i,prev:'#prev'+i,timeout:0});});if($(".tooltip").length>0){$(".tooltip").tooltip({track:true,delay:0,showURL:false,showBody:" - ",fade:250});}
if($("#fotos").length>0){$("#fotos a").lightBox({fixedNavigation:true});}
if($("#rightContent .imovel").length>0){$("#rightContent .imovel").mouseover(function(){$(this).css("cursor","pointer");$(this).addClass("ovr");});$("#rightContent .imovel").mouseout(function(){$(this).removeClass("ovr");});$("#rightContent .imovel p, #rightContent .imovel .foto .label span").click(function(){lnk=$(this).parents(".imovel").find(".foto .base a").attr("href");window.location=lnk;});}
$("#constru-slides a img").each(function(){h=$(this).height();dif=70-h;mar=Math.round(dif/2);$(this).css("margin-top","10px");});$("#constru-slides").cycle({fx:'scrollHorz',next:'#constru-next',prev:'#constru-prev',timeout:0});if($(".imoveis .imovel").length>0){if($.browser.msie&&$.browser.version=="6.0"){$(".imoveis .imovel").mouseover(function(){$(this).addClass("ovr");});$(".imoveis .imovel").mouseout(function(){$(this).removeClass("ovr");});}
$(".imoveis .imovel .label, .imoveis .imovel .c1, .imoveis .imovel .c2, .imoveis .imovel .c3, .imoveis .imovel .c4, .imoveis .imovel .c5, .imoveis .imovel .c6, .imoveis .imovel .c8, .imoveis .imovel .faixa").click(function(){lnk=$(this).parents(".imovel").find(".foto .base a").attr("href");window.location=lnk;});}
if($("#enviar-por-email").length>0){$("#enviar-por-email").dialog({autoOpen:false,bgiframe:true,minHeight:140,modal:true,width:330,resizable:false});$(".label .email").click(function(){$("#enviar-por-email").dialog('open');return false;});}
$('.subir').click(function(){$('html, body').animate({scrollTop:0},1000);});$('.voltar').click(function(){history.go(-1);});$.getScript("inc/js/fav.js");carregaBairros();$("#busca_cidade").change(function(){carregaBairros();});});function mapa_imovel(l1,l2,tipo,controles,mapid){if(tipo===undefined)tipo='ponto';if(controles===undefined)controles=true;if(mapid===undefined)mapid="map";if($("#"+mapid).length>0){if(GBrowserIsCompatible()){var map=new GMap2(document.getElementById(mapid));map.setCenter(new GLatLng(l1,l2),15);var latlng=new GLatLng(l1,l2);if(controles){map.addControl(new GSmallMapControl());map.addControl(new GMapTypeControl());}
if(tipo=='circulo'){var marcador=GPolygon.Circle(latlng,500,"#0071BC",2,1,"#000",0.2)
map.addOverlay(marcador);}else{var icone=new GIcon(G_DEFAULT_ICON);icone.image="img/design/gmaps_icon.png";icone.iconSize=new GSize(26,30);markerOptions={icon:icone};map.addOverlay(new GMarker(latlng,markerOptions));}}}}
function letras_bairros(){if($("#busca .divbairros p").length==0)$("#busca .divbairros").prepend("<p></p>");letras="ABCDEFGHIJKLMNOPQRSTUVWXYZ";letras_usadas="";$("#busca .divbairros .bairros label").each(function(){str=$(this).html();v=str.split("> ");nome_bairro=v[1];letras_usadas+=nome_bairro.substr(0,1);});letras_links='<a href="javascript:;" onclick="mostraBairros()" class="todos" title="Mostrar todos bairros">Clique aqui e escolha os Bairros</a> ';for(i=0;i<=letras.length-1;i++){tem=letras_usadas.indexOf(letras.substr(i,1));if(tem>=0){letras_links+='<a href="#" class="letra" title="Bairros que começam com '+letras.substr(i,1)+'">'+letras.substr(i,1)+'</a>';}else{}}
$("#busca .divbairros p").html(letras_links);$("#busca .divbairros p a.letra").click(function(){letra=$(this).html();$("#busca .divbairros label").each(function(){str=$(this).html();v=str.split("> ");nome_bairro=v[1];bletra=nome_bairro.substr(0,1);if(bletra==letra)$(this).show();else $(this).hide();});reinitialiseScrollPane();return false;});$("#busca .divbairros p a.todos").click(function(){$("#busca .divbairros label").show();reinitialiseScrollPane();return false;});}



function mostraBairros(){
	jQuery.facebox({ ajax: 'inc/layout/modalBairros.php' });
}

