$(document).ready(function() {
	if($.browser.msie && ($.browser.version < 7)){ $("body").addClass("ie"); } //Adiciona uma classe para o IE6.
	$mostraIlustracao = function(){
		$(".ilustra").hide();
		$(this).parent().find(".ilustra").fadeIn();
	}
	$("ul#menuHome").superfish({pathClass: 'current', delay: 1000, animation: {opacity:'show', height:'show'}, speed: 'fast', autoArrows: false, dropShadows: false, onShow: $mostraIlustracao });
	$("ul#menuHome > li:eq(0)").append('<span class="ilustra ilustraCasa"></span>');
	$("ul#menuHome > li:eq(1)").append('<span class="ilustra ilustraRolo"></span>');
	$("ul#menuHome > li:eq(2)").append('<span class="ilustra ilustraCerca"></span>');
	$("ul#menuHome li.sfHover span.ilustra").show();
	$("ul#tabsDicas, ul.tabsCredito").idTabs();
	$("div.video a[href^='http://www.youtube.com']").each(function() {
		$w = $(this).parent().width();
		$h = $(this).parent().height();
		$(this).flash({ width: $w, height: $h, wmode: 'opaque' }, { version: 9 },
	        function(htmlOptions) {
	            htmlOptions.src = $(this).attr('href');
	            $(this).html($.fn.flash.transform(htmlOptions));						
	        }
	    ).removeAttr("href");
	});


	$("#carrosselFotos ul a").click(function(){
		$imgPreview = $(this).find("img").attr("src");
		$("img#preview").attr('src', $imgPreview);
		return false;
	});

	
	$("a.btnSimuleFinanciamento, a.btnFacaSimulacao").click(function() {
        window.open($(this).attr("href"), "Caixa", "width=500, height=550, scrollbars=yes");
		return false;
    });

	$("#carrosselFotos ul").jcarousel({ scroll: 2 });
	$(".fix, .ilustra, .ilustraCasa185x105, ul.dicas li span").ifixpng();
});