// JavaScript Document

function AbreJanela(theURL,winName,features) {
	window.open(theURL,winName,features);
}

$(document).ready(function(){
	$(function(){
		//$.ga.load("UA-1963651-56");		     
		$("#ref").blur(function(){
			if (this.value=='') this.value='Código do imóvel';
		});     
		$("#ref").focus(function(){
			if (this.value=='Código do imóvel') this.value='';
		});     
		     
		$("#cycleVenda .jCarouselLite").jCarouselLite({
			btnNext: "#cycleVenda .next",
			btnPrev: "#cycleVenda .prev",
			speed: 800,
			visible: 2,
			cleartype: 1
		});
		$("#cycleLocacao .jCarouselLite2").jCarouselLite({
			btnNext: "#cycleLocacao .next2",
			btnPrev: "#cycleLocacao .prev2",
			speed: 800,
			visible: 3,
			cleartype: 1
		});

		$('.nossasunidades')
		.after('<div class="relative3"><div id="run3">')
		.cycle({
			fx:     'fade',
			speed:  'slow',
			timeout: 5000,
			pager:  '#run3',
			pagerAnchorBuilder: function(idx, slide){
				return '<li><a href="#">' + slide.title + '</a></li>'; 
			}
		});
		$(".rodalitoral").cycle({
			cleartype: 1,
			fx:     'fade',
			timeout: 20000,
			speed: 1000,  
			pager:  '#barraCycles',
			pagerAnchorBuilder: function(idx, slide) { 
			return '<li><a href="#">' + slide.title + '</a></li>'; 
			} 
		});
	});
});


function cartorios(id) { 
	esconder = (document.getElementById(id).style.display == 'block');	
	divs = document.getElementsByTagName('DIV');
	for(d=0; d<divs.length; d++){
		_div = divs[d];

		if (_div.className == 'cartorios'){
			id_link = 'cartorios_'+(_div.id);
			_link = document.getElementById(id_link);

			if (_div.id != id){
				_div.style.display = 'none';
				if (_link) _link.style.color = 'black';
			}
			else{
				_div.style.display = esconder ? 'none' : 'block';
				if (_link) _link.style.color = esconder ? 'black' : '#17945C';
			}
		}
	}
}

