function janela(item)
{
	document.getElementById('transparencia').style.display = "inline";
	document.getElementById(item).style.display = "inline";
}

function janela_cancela(item)
{
	document.getElementById('transparencia').style.display = "none";
	document.getElementById(item).style.display = "none";
}

function desce_mensagem(item,margem)
{
	if (margem <= 0)
	{
		document.getElementById(item).style.top = margem+'px';
		margem = margem+5;
		setTimeout("desce_mensagem('"+item+"',"+margem+")",30);
	}
}

function sobe_mensagem(item,margem)
{
	if (margem >= -40)
	{
		document.getElementById(item).style.top = margem+'px';
		margem = margem-5;
		setTimeout("sobe_mensagem('"+item+"',"+margem+")",30);
	}
	else
	{
		document.getElementById(item).style.display = 'none';
	}
}

function mostra_mensagem(item,texto,tipo)
{
	document.write('<div class="'+tipo+'" id="'+item+'" style="display:none;"');
	document.write('<p class="p_mensagens"><img src="imagens/mensagem/'+tipo+'.gif" align="middle">&nbsp;'+texto+'</p>');
	document.write('</div>');
	document.getElementById(item).style.display = "inline";
	desce_mensagem(item,-40);
	setTimeout("sobe_mensagem('"+item+"',0)",4000);
}
/** Senha **/
function verCaracterDaSenha(valor)
{
	var erespeciais = /[@!#$%&*+=?|-]/;
	var ermaiuscula = /[A-Z]/;
	var erminuscula = /[a-z]/;
	var ernumeros = /[0-9]/;
	var cont = 0;
	if (erespeciais.test(valor)) cont++;
	if (ermaiuscula.test(valor)) cont++;
	if (erminuscula.test(valor)) cont++;
	if (ernumeros.test(valor)) cont++;
	return cont;
}

function segurancaBaixa(d)
{
	d.style.backgroundImage = "url('imagens/mensagem/baixa.png')";
	d.innerHTML = '<p>Seguranca da senha: <font color=\'red\'> <b>BAIXA</b></font></p>';
}

function segurancaMedia(d)
{
	d.style.backgroundImage = "url('imagens/mensagem/media.png')";
	d.innerHTML = '<p>Seguranca da senha: <font color=\'orange\'> <b>MEDIA</b></font></p>';
}

function segurancaAlta(d)
{
	d.style.backgroundImage = "url('imagens/mensagem/alta.png')";
	d.innerHTML = '<p>Seguranca da senha: <font color=\'green\'> <b>ALTA</b></font></p>';
}

function testa_senha(valor)
{
	var d = document.getElementById('seguranca');
	var c = verCaracterDaSenha(valor);
	var t = valor.length;
	if(t == '')
	{
		d.style.backgroundImage = "url('imagens/mensagem/seguranca.png')";
		d.innerHTML = "<p>Seguranca da senha: <font color=\'orange\'>...</font></p>";
	}
	else
	{
		if(t > 6 && c >= 2)
		{
				segurancaAlta(d);
		}
		else
		{
			if(t > 6 && c >= 1 || t > 3 && c >= 2)
			{
				segurancaMedia(d);
			}
			else
			{
				segurancaBaixa(d);
			}
		}
	}
}
/** Confirma Exclusão **/
function confirma_exclusao(aURL,msg)
{
	if(confirm('Confirmar:\nVocê tem certeza que deseja excluir '+msg+'\n'))
	{
		location.href = aURL;
	}
}
/** formulario data **/
function diaini(valor)
{
	if (valor.length == 2)
	{
		document.rel_log.mes_ini.focus();
	}
}

function mesini(valor)
{
	if (valor.length == 2)
	{
		document.rel_log.ano_ini.focus();
	}
}

function anoini(valor)
{
	if (valor.length == 4)
	{
		document.rel_log.dia_fin.focus();
	}
}

function diafin(valor)
{
	if (valor.length == 2)
	{
		document.rel_log.mes_fin.focus();
	}
}

function mesfin(valor)
{
	if (valor.length == 2)
	{
		document.rel_log.ano_fin.focus();
	}
}

function anofin(valor)
{
	if (valor.length == 4)
	{
		document.rel_log.username.focus();
	}
}
