function menu(camada,acao){
  document.all[camada].style.visibility = acao;
}

function trocaCor(objeto,cor){
  objeto.style.background = cor;
}

function trocaCorMenu(objeto,cor){
  document.all[objeto].style.background = cor;
}

function trocaImagem(objeto,endereco){
  document.all[objeto].src = endereco;
}


function formata_numero(numero,decimais)
{ 
    if (isNaN(numero)) { return '0,00';}
    if (numero=='') { return '0,00';}
	    
    var IsNegative=(parseInt(numero)<0);
    if(IsNegative)numero=-numero;
	  
    var snum = new String(numero); 
    var sec = snum.split('.'); 
    var whole = parseInt(sec[0]); 
    var result = ''; 
    if(sec.length > 1){ 
  	var dec = new String(sec[1]); 
  	dec = parseInt(dec)/Math.pow(10,parseInt(dec.length-decimais-1));
  	Math.round(dec);
  	dec = parseInt(dec)/10;
  	
  	if(IsNegative)
  	{
	     var x = 0-dec;
	     x = Math.round(x);
	     dec = - x;
  	}
 	else
  	{
	     dec = Math.round(dec);
  	}
	  
/*
    * If the number was rounded up from 9 to 10, and it was for 1 'decimal'
    * then we need to add 1 to the 'whole' and set the dec to 0.
*/
  	if(decimais==1 && dec==10)
  	{
	     whole+=1;
	     dec="0";
  	}
	  
  	dec = String(whole) + "," + String(dec); 
  	var dot = dec.indexOf(','); 
  	if(dot == -1)
	{
	     dec += '.'; 
	     dot = dec.indexOf(','); 
  	}
  	var l=parseInt(dot)+parseInt(decimais);
  	while(dec.length <= l) { dec += '0'; } 
  	result = dec; 
	} else{ 
	  	var dot; 
	  	var dec = new String(whole); 
	  	dec += ','; 
	  	dot = dec.indexOf(','); 
	  	var l=parseInt(dot)+parseInt(decimais);
	  	while(dec.length <= l) { dec += '0'; } 
	  	result = dec; 
	    } 
	    if(IsNegative)result="-"+result;
	    return result; 
} 