<!--
function MM_showHideLayers() { //v2.0
  var i, visStr, args, theObj;
  args = MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) { //with arg triples (objNS,objIE,visStr)
    visStr   = args[i+2];
    if (navigator.appName == 'Netscape' && document.layers != null) {
      theObj = eval(args[i]);
      if (theObj) theObj.visibility = visStr;
    } else if (document.all != null) { //IE
      if (visStr == 'show') visStr = 'visible'; //convert vals
      if (visStr == 'hide') visStr = 'hidden';
      theObj = eval(args[i+1]);
      if (theObj) theObj.style.visibility = visStr;
  } }
}
//-->


function ExibirMenus(alvo,item,item2,item3,item4,item5)

{
	if(alvo.style.display == 'none' || alvo.style.display == '')
      
        {
	    alvo.style.display='block';
	    item.style.display='none';
	    }
	    else
        {
	    alvo.style.display='none';
	    }
}
// função que mostra ou esconde um elemento 
// quando definimos "display : none" no estilo e não da forma inline,
// o valor de style.display é vazio, e não none (tentativa e erro)

function ExibirMenu(alvo,item,item2,item3,item4,item5)

{
	if(alvo.style.display == 'none' || alvo.style.display == '')
      
        {
	    alvo.style.display='block';
	   
	    
	    if("undefined" != "" + item + "")
	    {
	    item.style.backgroundColor='#008040';
	    }
	    
	    if("undefined" != "" + item2 + "")
	    {
	    item2.style.backgroundColor='#008040';
	    }
	    
	    if("undefined" != "" + item3 + "")
	    {
	    item3.style.backgroundColor='#008040';
	    }
	    
	    if("undefined" != "" + item4 + "")
	    {
	    item4.style.backgroundColor='#008040';
	    }
	     if("undefined" != "" + item5 + "")
	    {
	    item5.style.backgroundColor='#008040';
	    }
	    
        }
    else
        {
	    alvo.style.display='none';
	    
	    if("undefined" != "" + item + "")
	    {
	    item.style.backgroundColor='Darkseagreen';
	    }
	    
        }
}

// função que altera cor de elemento no evento onMouseOver

function changeOver()
{
  var e;
  e = window.event.srcElement;
  if (e.trocar == null) 
     return;   
  e.style.color = 'silver';
  e.style.cursor='hand';
}
document.onmouseover = changeOver;


// função que altera cor de elemento no evento onMouseOut

function changeOut()
{
  var e;
  e = window.event.srcElement;
  if (e.trocar == null) 
     return;
  e.style.color = 'white';
}
document.onmouseout = changeOut;

// função Trocar: recebe como argumento a imagem a ser trocada

function TrocarImg(Imagem)
{
if (Imagem.src.match('seta1'))
	Imagem.src = '../images/ofolder.gif';
else
	Imagem.src = '../images/seta1.gif';
}



//função para confirmar se usuário deseja realmente alterar ou excluir algo
function ConfirmarAltExc()
{
	return(confirm('Confirma a operação?'));
}



//função para mostrar a área de dados
function Pesquisa(theForm)
{
lista_acion.style.display = 'block';
}

//função para esconder a área de dados
function Pesquisa2(theForm)
{
lista_acion.style.display = 'none';
}

//função para enviar a seleção da área para o input
function Envia(texto)
{
var num;

num=texto.search(":");
form1.acionista.value=texto.substr(num+1);
form1.cod_acionista.value=texto.substr(0,num);
//form1.listas.selectedIndex=form1.lista.selectedIndex;

}


//função para procurar dados pelas letras digitadas em um caixa de texto
function Procura(teclapres)
 {
	var i;
	var letras;
	var num;
	var tipo;
	var tecla;
	var inicio;
	//form1.lista.visible=false;	
	tecla =(String.fromCharCode(teclapres.keyCode).toUpperCase());
	tipo=form1.acionista.value.toUpperCase()+tecla; 
	vr = tipo.length;
	var key = (window.event.keyCode)
	if (vr != 0)
	{
		inicio = form1.lista.selectedIndex;
		for (i = 0; i < form1.lista.length; i++)
		{
			form1.lista.selectedIndex = i;
			num=form1.lista.value.search(":");
			letras=form1.lista.value.substr(num+1).toUpperCase();
		 	if (tipo == letras.substr(0,vr))
		   	{
		   		form1.lista.selectedIndex;
		   		numkey=form1.lista.selectedIndex;
				break;  
			}
			//tecla Tab
			if (key == 9)
			{												
				form1.lista.selectedIndex=numkey;
				Envia(form1.lista.value);
				break;
			}
			//if (key == 9 && form1.cod_acionista.value == " " && form1.acionista.value != "")
			//{
			//alert(form1.cod_acionista.value);
			//lista_acion.style.display = 'none';
			//form1.valorperc.focus();
			//break;
			//}					
			//tecla esc
			if (key == 27) 	
			{
				form1.acionista.value="";
				form1.cod_acionista.value="";
				form1.lista.selectedIndex=0;
				break;
			}
		}
		//alert(inicio);
		if (i == form1.lista.length)
		{
		form1.lista.selectedIndex=inicio;
	//	form1.lista.visible=true;
		}
	}
}

function Limpar(teclapres)
 {
 var key = (window.event.keyCode)

			if (key == 27) 	
			{
				form1.acionista.value="";
				form1.cod_acionista.value="";
				form1.lista.selectedIndex=0;
				form1.acionista.focus();
			}
 
 }
 

//Função para validar datas
<!-- Begin
function checkdate(objName) {
var datefield = objName;
if (chkdate(objName) == false) {
datefield.select();
alert("A data é inválida.  Por favor, tente novamente.");
datefield.focus();
return false;
}
else {
return true;
   }
}
function chkdate(objName) {
var strDatestyle = "BR"; 
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;

strDate = datefield.value;
if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
   }
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
   }
}
if (strYear.length == 2) {
strYear = '20' + strYear;
}
// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) 
{

if (isNaN(intMonth)) {
err = 3;
return false;
   }
}
intYear = parseInt(strYear, 10);
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}
}
return true;
}


function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}


function doDateCheck(from, to) 
{
if (Date.parse(from.value) <= Date.parse(to.value)) {
return true;
}
else {
if (from.value == "" || to.value == "") 
{
alert("As duas datas devem ser digitadas.");
return false;

}
else 
{
alert("A data final deve ser maior que a data de início.");
return false;

}
}
}
//  End -->
 
 