/*************************************
	Programador: Wanderson Alberto Silveira Andrade Santos
	Email: wanderson@wanderson.eti.br
	Email1: wanderson@dpc.mar.mil.br
	Email2: wsantos.rj@gmail.com
	Criado em : 10/10/2010
	Modificado em: 10/10/2010
*************************************/
/* -- Funções javascript para o ideal funcionamento da página -- */
/* PADRÃO DOM */

function escreveDia()
{
			var dx,dia,mes,ano,txtsaudacao,hora;
			dh = new Date()
			hx = dh.getHours();
			mx = dh.getMinutes();
			sx = dh.getSeconds();
			hx = ((hx < 10) ? "0" + hx : hx);
			mx = ((mx < 10) ? "0" + mx : mx);
			sx = ((sx < 10) ? "0" + sx : sx);
   //exibe a saudação dependendo do horário 
   if (hx >= 00 && hx < 12) {txtsaudacao = "Bom Dia! "}
   if (hx >= 12 && hx < 18) {txtsaudacao = "Boa Tarde! "}
   if (hx >= 18 && hx <= 23) {txtsaudacao = "Boa Noite! "}
   //cria uma array contendo os sete dias da semana   
   sem = new Array(7);
   sem[0] = "Domingo";
   sem[1] = "Segunda-feira";
   sem[2] = "Terça-feira";
   sem[3] = "Quarta-feira";
   sem[4] = "Quinta-feira";
   sem[5] = "Sexta-feira";
   sem[6] = "Sábado";
   
   dx = dh.getDay();
   
   dia = dh.getDate();
   mes = dh.getMonth();
   ma = new Array(12);
   ma[0] = "janeiro";
   ma[1] = "fevereiro";
   ma[2] = "março";
   ma[3] = "abril";
   ma[4] = "maio";
   ma[5] = "junho";
   ma[6] = "julho";
   ma[7] = "agosto";
   ma[8] = "setembro";
   ma[9] = "outubro";
   ma[10] = "novembro";
   ma[11] = "dezembro";
   ano = dh.getFullYear();
   frase = txtsaudacao + " " + sem[dx] + ", " + dia + " de " + ma[mes] + " de " + ano + " - " + hx +":"+mx+":"+sx+"&nbsp;";
			divDia = document.getElementById('welcome');
			divDia.innerHTML = frase;
}

function constroiMenu() {
		if (document.all&&document.getElementById) {
				navRoot = document.getElementById("navigation");
				for (i=0; i<navRoot.childNodes.length; i++) {
						node = navRoot.childNodes[i];
						if (node.nodeName=="LI") {
								node.onmouseover=function() {
								this.className+=" hover";
								}
								node.onmouseout=function() {
										this.className=this.className.replace
										(" hover", "");
								}
						}
				}
		}
}

/* function apareceBusca(idLnk, idObj)
{
	 lnkObj = document.getElementById(idLnk);
	 obj = document.getElementById(idObj);
		
	 obj.style.visibility = 'visible';
		obj.style.left = (lnkObj.offsetLeft-99)+'px';
		obj.style.top = (lnkObj.offsetTop+20)+'px';
		
		document.getElementById('input_busca').select();
		
//  alert(document.getElementById('busca').offsetTop);
}

function fecharHB(idObj)
{
	  obj = document.getElementById(idObj);
			
	  obj.style.visibility = 'hidden';
			obj.style.left = '0px';
			obj.style.top = '0px';
}

function buscar(e)
{
	 if(e.keyCode == 13 || e == 'click')
		{
			 window.open('http://www.google.com.br/search?hl=pt-BR&q='+document.getElementById("input_busca").value+'+site:http://www.cpes.mar.mil.br/&btnG=Pesquisa+Google&meta=');
		}
	 
}
*/
function openConsultaProtocolo()
{
	
  window.open('consulta_protocolo.asp','','dialog=1, modal=yes, dependent=yes, status=yes, width=300, height=400, left=' + (screen.width-300)/2 + ', top=' + (screen.height-400)/2);
}
