$(document).ready(function(){				   
	//Fix PNG images on Ie6
	$(document).pngFix();
	
	//Adaptar divs
	$(function(){ adaptar(); });
		
	// Initialize history plugin
		$.historyInit(pageload);
		// set onlick event for buttons		
		$("a[@rel='history']").livequery('click',function(){		
			var hash = this.href;
			hash = hash.replace(/^.*#/, '');
			$("#divConteudo").html('<div class="tarjaTit">Carregando...</div>');		
			$.historyLoad(hash);
			return false;
		});		
});

//função Show Hide Layers
function mostraDivs(div){
	$(div).css({visibility:"visible"});
}

// HISTORICO
function pageload(hash) {		
	// hash doesn't contain the first # character.
	if(hash) {
		// restore ajax loaded state
		$("#divConteudo").load(hash.replace('!','?'));
	}
	
	else if (paginaInicial) {
		// start page
		$("#divConteudo").load(paginaInicial);
	} 
};
//Flash Content
function flash(file, width, height, wmode){
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9' width='" + width + "' height='" + height + "'>");
    document.write("<param name='movie' value='" + file + "'>");
    document.write("<param name='quality' value='high'>");
	document.write("<param name='wmode' value='" + wmode + "'>");	
    document.write("<embed src='" + file + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "' wmode='" + wmode + "'></embed>");
    document.write("</object>");
};

//carregar o flash do fundo
function loadFlash(){
	$('#divFlash').css(
	{visibility:"visible"}
	);
}

//função adaptar div fundo verde
function adaptar(){
	var alturaConteudo = $("#divConteudo").innerHeight();
	$('#divFundoConteudo').height(alturaConteudo);
	
	var marginTopRodape = alturaConteudo + 473;
	$('#divRodape').css({ marginTop:marginTopRodape });
	
	setTimeout("adaptar()", 100);
};
