$(document).ready(function(){
		
	$('div.box.retratil').each(function(){
		$('h2',this).prepend('<span class="retratil-botao retratil-expanded"></span>');
		$('span.retratil-botao',this).fadeTo(10,.25).toggle(function(){
			var content = $('div.box-conteudo',$(this).parent().parent());
			content.height(content.height());
			$('div.box-conteudo>*',$(this).parent().parent()).fadeOut(100, function(){
				content.slideUp(content.height());														
			});
			$(this).removeClass('retratil-expanded');
		},function(){
			var content = $('div.box-conteudo',$(this).parent().parent());
			content.slideDown(content.height(),function() {
				$('div.box-conteudo>*',$(this).parent().parent()).fadeIn(100);
				$('p.botoes',content).show();
			});
			$(this).addClass('retratil-expanded');
		}).hover(function(){$(this).fadeTo(200,.5);},function(){$(this).fadeTo(200,.25);});
	});

	var browser_name = navigator.appName;
	var browser_version = parseFloat(navigator.appVersion);
	
	if (navigator.appName != "Microsoft Internet Explorer") {
		$('a.botao, a.botao-gray').hover(function(){
		//old $('a.botao').hover(function(){
			$(this).fadeTo(200,0.65)
		},function(){
			$(this).fadeTo(200,1.0)
		});
	} 
	else {}

	// Move o rodape para fora do container, liberando a largura
	if ( $('div#footer').length > 0) { 
		var footer = $('div#footer').css('z-index',1000).clone();
		$('div#footer').remove();
		$('body').append(footer);
		if ($.browser.msie == true && $.browser.version.substr(0,1) == 6) {
			$('div#footer').css('behavior','url(/media//iepngfix.htc)');	
		}
	}
	
	$('body').append('<div id="white-footer"></div>');
	function jeitin(){
		/*************
			LEMBRETE: O -3 E O +3 SÃO PRA COMPENSAR UM BUG DE VISUALIZAÇÃO NO IE6
		*************/		
		$('div#white-footer').css('top', $('div#footer')[0].offsetTop + $('div#footer').height() -3);							  
		var top = $('div#white-footer').css('top').toString();
		var borderTopWidth = parseInt($('body').css('borderTopWidth').substr(0,$('body').css('borderTopWidth').length-2));
		var whiteFooterHeight = ($(window).height() > $('body').height()) ? $(window).height() : $('body').height() + borderTopWidth +3;
			
		$('div#white-footer').height(whiteFooterHeight - top.substr(0, top.length - 2) + 0);
		//$('div#white-footer').width($(window).width());
		$('div#white-footer,body').width(Math.max($('div.cLumPage').width(), $(window).width()));
		smallBody();

	}
	
	var footerInt = setInterval(jeitin, 100);
	
	$('img[@src$=.png],div#footer div.footer-text').ifixpng(); 
		
	function smallBody() {
		if ($('div.cLumPage').width() > $('body').width()) {
			$('body').width($('div.cLumPage').width());
			//$('div#white-footer').width($('div.cLumPage').width());
		}
	}
	
});