/* 
	JS Mixtura

*/

try{
	var xmlhttp = new XMLHttpRequest();
}catch(ee){
	try{
		var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try{
			var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(E){
			var xmlhttp = false;
		}
	}
}

function troca_menu( ref ){
	$( ref ).morph('height:375px;');
	//new Effect.Morph(ref, {style: 'height:100%;'});	

	document.getElementById('dvMenu').style.display = 'none';
	
	//mostra_conteudo
	$( 'dvQuadro' ).appear({ from: 0, to: 1 });
	
	//carrega menus
	$( 'dvMenuItems' ).appear({ from: 0, to: 1, queue: 'end' });	
	
	return false;	
}

function troca_fundo( cor ){
	$('dvFundo').morph('background:#' + cor +';');
	
	return false;
}

function load( what, color, params ){
	//Exibe o texto carregando no div conteúdo
	conteudo = document.getElementById( 'dvConteudo' );
	conteudo.innerHTML = "<br><br><br><br><br><br><br><br><img src='sys.images/loader.gif'/>carregando...";

	troca_fundo( color );

	//Abre a url
	if( params == ""){
		xmlhttp.open("GET", "action.php?act=" + what, true);
	}else{
		xmlhttp.open("GET", "action.php?act=" + what + "&" + params, true);
	}

	//Executada quando o navegador obtiver o código
	xmlhttp.onreadystatechange = function() {

		if (xmlhttp.readyState == 4){
			//Lê o texto
			texto = xmlhttp.responseText;
			//Desfaz o urlencode
			texto = texto.replace(/\+/g, " ");
			texto = unescape( texto );
			//Exibe o texto no div conteúdo
			conteudo.innerHTML = texto;
		}
	}

	xmlhttp.send(null);
}
