$(document).ready(function(){				   
	//LavaLamp Menu
	$("#lavaLamp").lavaLamp({
	fx: "easeOutSine",
	speed: 250,
	click: function() {return false;}
	});
	
	//SubMenu
	$('#divSubMenuProd').hide().slideUp(300);
	$('#divSubMenuEMS').hide().slideUp(300);
	
	//Fix PNG images on Ie6
	$(document).pngFix();
	
	// 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('<table width="100%" height="270" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle"><img src="images/load.gif" /><br />Carregando...</td></tr></table>');		
		$.historyLoad(hash);
		return false;
	});	
	
	//Text Resize
	// changer links when clicked
	$("a.changer").livequery ('click',(function(){
		//set the div with class mainText as a var called $mainText 
		var $mainText = $('div#divTextos');
		// set the current font size of .mainText as a var called currentSize
		var currentSize = $mainText.css('font-size');
		// parse the number value out of the font size value, set as a var called 'num'
		var num = parseFloat(currentSize, 12);
		// javascript lets us choose which link was clicked, by ID
		if (this.rel == 'linkLarge' && num < 14){
		num = num + 1;
		} else if (this.rel == 'linkSmall' && num > 10){
		num = num - 1;
		}
		// jQuery lets us set the font Size value of the mainText div
		$mainText.css('font-size', num);
		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);
		
	} else {
		// start page
		$("#divConteudo").load("home.php");
	}
}

//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>");
};

