// JavaScript Document
$(document).ready(function(){

	function redimImg(img){
		var limite = {
			hMax: 100,
			wMax: 140
		}
		if(img.height() > img.width()){
			img.height(limite.hMax);
			img.removeAttr("width");
		}else{
			img.width(limite.wMax);
			img.removeAttr("height");		
		}
		return(true);
	}
	$("#fichaLancamento #fotos img").each(function(){
		redimImg($(this));
	});


	$('.bannerroda').before('<div id="nav">').cycle({ 
		fx:     'fade', 
		speed:  'fast', 
		timeout: 15000, 
		pager:  '#nav' 
	});
	//CYCLE LANCAMENTOS
    $('#futuroslanc .cycleLanc').jCarouselLite({
        btnNext: '#futuroslanc .cycleNext',
        btnPrev: '#futuroslanc .cyclePrev',
		auto: 10000,
		speed: 500,
		visible: 2
    });
	
	//CYCLE Imóveis
    $('.destaquesBox .cycleLanc2').jCarouselLite({
        btnNext: '.destaquesBox .cycleNext',
        btnPrev: '.destaquesBox .cyclePrev',
		auto: 10000,
		speed: 500,
		visible: 3
    });
	
	//CYCLE Imóveis Locação
    $('.destaquesBoxloc .cycleLanc2').jCarouselLite({
        btnNext: '.destaquesBoxloc .cycleNext',
        btnPrev: '.destaquesBoxloc .cyclePrev',
		auto: 10000,
		speed: 500,
		visible: 1
    });
	
	//CYCLE FUTUROS
    $('#futuros .cycleMiddle').jCarouselLite({
        btnNext: '#futuros .cycleNext',
        btnPrev: '#futuros .cyclePrev',
		auto: 10000,
		speed: 500,
		visible: 1
    });

	//CYCLE Ja Vendidos
    $('#javendidos .cycleLanc').jCarouselLite({
        btnNext: '#javendidos .cycleNext',
        btnPrev: '#javendidos .cyclePrev',
		auto: 10000,
		speed: 500,
		visible: 3
    });

	//TABS
	$('#fichaLancamento').tabs({
		fxSlide:	true,
		fxFade:		true,
		fxSpeed:	'fast'
	});

});


// Rich Media

var intervaloRich;
$(document).ready(function() {
	$("#rich_media").show();						   

})

function fechaRich(){
	$("#rich_media").hide("slow");
}
/*
function mostraRich(){
	var rich_media = document.getElementById("rich_media");
	if(rich_media){
		rich_media.style.display = "block";
		setTimeout("fechaRich()",15000)
	}
}*/
