function setApplets()
{
   setSobrepostos();
   setDatas();
//   setValorInicial();
}


function setSobrepostos()
{
   ehPrincipal = 1;
   for(i = 0;i < 3;i++)
   {
      check = eval('document.form1.ativo' + i);// + '.checked');
      if(check.value != 'nenhum')
//      if(check.checked)
      {
//	 cod = eval('document.form1.ativo' + i + '.checked');
//	 alert(check.value);
	 document.graf.setAtivo(check.value, ehPrincipal);
//	 document.tabela.setAtivo(check.value);
	 document.barras.setAtivo(check.value);
	 ehPrincipal = 0;
      }
   }
//   document.graf.setAtivo('atualiza');
//	 alert(document.form1.ativo[i].value);
}

function setDatas()
{
   data = document.form1.dataInicial.selectedIndex;
   dtInicial = document.form1.dataInicial.value;
   dtInicial = StrReplace(dtInicial, "/", "");
   data = document.form1.dataFinal.selectedIndex;
   dtFinal = document.form1.dataFinal.value;
   dtFinal = StrReplace(dtFinal, "/", "");
   document.graf.setDatas(dtInicial,dtFinal);
//   document.tabela.setDatas(dtInicial, dtFinal);
   document.barras.setDatas(dtInicial, dtFinal);
}


function StrReplace(str1, str2, str3)
{
  str1 = str1.split(str2).join(str3);
  return str1;
}

function setValorInicial()
{
   ehPrincipal = 1;
   for(i = 0;i < 3;i++)
   {
      text = eval('document.form1.inv' + i);
      check = eval('document.form1.ativo' + i);
//      if(check.checked)
      {
//	 cod = eval('document.form1.ativo' + i + '.checked');
//	 alert(check.value);
//	 document.graf.setAtivo(check.value, ehPrincipal);
	 document.tabela.setAtivo(check.value);
         document.tabela.setValorInicial(check.value, text.value);
      }
   }
}
