function regula_div(div_id)
{
	// Pegando a DIV
	var div_total = document.getElementById(div_id);
	var div_total_fundo = document.getElementById(div_id + "_fundo");
	
	// Calculando tamanho e posição
	total = screen.availWidth;
	avail = total - 100;
	
	// Setando propriedades
	div_total.style.width = avail;
	div_total.style.left = '50px';
//	div_total.style.top = '100px';
	
	div_total_fundo.style.width = avail;
	div_total_fundo.style.left = '50px';
//	div_total_fundo.style.top = '100px';
}

function abre_janela(div_id)
{
	// Arrumar posição
	regula_div(div_id);
	
	// Pegando a DIV
	var div_total = document.getElementById(div_id);
	var div_total_fundo = document.getElementById(div_id + "_fundo");
		
	// Tornar visível
	div_total.style.visibility = 'visible';
	div_total_fundo.style.visibility = 'visible';
}

function fecha_janela(div_id)
{
	// Pegando a DIV
	var div_total = document.getElementById(div_id);
	var div_total_fundo = document.getElementById(div_id + "_fundo");

	// Tornar visível
	div_total.style.visibility = 'hidden';
	div_total_fundo.style.visibility = 'hidden';
}

function arredonda(numero, numero_casas_decimais)
{
	var temp_numero = numero.toString();
	var temp = temp_numero.split('.');
	casas_decimais = temp[1];
	
	// Se não tem casas decimais, criar
	if(casas_decimais == null)
	{
		casas_decimais = "0";
	}
	
	// Colocando no formato
	while(casas_decimais.length < numero_casas_decimais)
	{
		casas_decimais = casas_decimais + "0";
	}
	
	// Pegando casas úteis
	casas_uteis = casas_decimais.substr(0, numero_casas_decimais);

	// Pegando o resto
	resto = casas_decimais.substr(numero_casas_decimais, 1);
	
	// Arredondando caso necessário
	if(resto >= 5)
	{
		casas_uteis = parseInt(casas_uteis)+1;
	}
	
	// Montando numero
	temp[1] = casas_uteis;
	numero = temp.join(".");
	
	return(numero);
}