//Menu do Administrador
var time = 3000;
var numofitems = 6;

//constructor
function menu(allitems,thisitem,startstate){ 
  callname= "g"+thisitem;
  divname="subglobal"+thisitem;  
  this.numberofmenuitems = allitems;
  this.caller = document.getElementById(callname);
  this.thediv = document.getElementById(divname);
  this.thediv.style.visibility = startstate;
}

//methods
function ehandler(event,theobj){
  for (var i=1; i<= theobj.numberofmenuitems; i++){
    var shutdiv =eval( "menuitem"+i+".thediv");
    shutdiv.style.visibility="hidden";
  }
  theobj.thediv.style.visibility="visible";
}

//subnav				
function closesubnav(event){
  if ((event.clientY <48)||(event.clientY > 105)){
    for (var i=1; i<= numofitems; i++){
      var shutdiv =eval('menuitem'+i+'.thediv');
      shutdiv.style.visibility='hidden';
    }
  }
}



function pop_servico(url){
	janela = window.open(url,'Posto','width=50,height=50,top=50,left=50,toolbar=no, scrollbars=yes, resizable=yes, menubar=no, status=no, directories=no, location=no');
	janela.focus();
}



// Ir para url
function goUrl(url) {
	parent.location = url;
}



// Confirmar a exclusão
function Excluir(link) {
	if(confirm('Deseja apagar?')) {
		window.location=link;
	} else {
		;
	}
	}
	
	
	
// Valida formulário contato
function validaContato(){
	//validar nome
	d = document.formContato;
	//validar nome
	if (d.nome.value == ""){
		alert("O campo Nome deve ser preenchido!");
		d.nome.focus();
		return false;
	}
	//validar email
	if (d.email.value == ""){
		alert("O campo E-mail deve ser preenchido!");
		d.email.focus();
		return false;
	}
	//validar email(verificao de endereco eletronico)
	parte1 = d.email.value.indexOf("@");
	parte2 = d.email.value.indexOf(".");
	parte3 = d.email.value.length;
	if (!(parte1 >= 3 && parte2 >= 6 && parte3 >= 9)) {
		alert("O campo E-mail está incorreto!");
		d.email.focus();
		return false;
	}
	if (d.assunto.value == ""){
		alert("O campo Assunto deve ser preenchido!");
		d.assunto.focus();
		return false;
	}
	if (d.mensagem.value == ""){
		alert("O campo Mensagem deve ser preenchido!");
		d.mensagem.focus();
		return false;
	}
	return true;
}