//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';
    }
  }
}



// Abrir uma nova janela conforme o tamanho da imagem
function openWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function openWindow2(url, propriedades) {
	window.open(url,'_blank',"toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=no, left=200, top=200, width=418, height=320," + propriedades);
}



// Busca por Linha - Link na combo
function Menu(url) {
	parent.location = url;
}



// 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;
}