/* ÁREA DE LOGIN **************************************************/
function AB_BOTAO(){
  var el = document.forms[0];
  if ((el.login.value!="") && (el.senha.value!=""))
    el.botao.disabled = false;
  else
    el.botao.disabled = true;
}


/* trata o Link Ajuda! */
function sLinkAjuda(sLink){
  var el = document.getElementById("icoHELP").attributes.getNamedItem("href");
  el.value = '../help/index.asp?id='+sLink;  
}
function sHelp(URL) {

   var width = 780;
   var height = 540;

   var left = 0;
   var top = 0;

   window.open(URL,'HELP', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');

}

/* exibe o balão de informações - páginas Busca turismo e Busca atrativo */
function balao(n){
  if (n==0)
    document.getElementById("Balao").style.display = 'none'
  else
    document.getElementById("Balao").style.display = '';
}


/*  ABAS - INCLUIR, CONSULTAR E EDITAR */
function ABAS(n){
  var doc = document;
  doc.getElementById("aba_incluir").style.display = 'none';
  doc.getElementById("aba_consultar").style.display = 'none'; 
  doc.getElementById("aba_editar").style.display = 'none';  
  switch(n){
	case 0:	doc.getElementById("aba_incluir").style.display = ''; break;
	case 1:	doc.getElementById("aba_consultar").style.display = ''; break;
	case 2:	doc.getElementById("aba_editar").style.display = ''; break;			
  }
}



// EXIBE MENSAGENS - Exibe todas as mensagens
function MENSAGENS(msg){
  if (msg!=null) alert(msg)
}



/*********************************************************** TRATAMENTO DO MENU */
function MENU_EXPANDE(obj,set,menos,mais){
  var el = document.getElementById(obj);
  if (set==0){ 
     document.getElementById(menos).style.display = 'none';
     document.getElementById(mais).style.display = '';  
     el.style.display = 'none';
  }
  else{ 
     document.getElementById(menos).style.display = '';
     document.getElementById(mais).style.display = 'none';	 
     el.style.display = '';
  }
}
/*********************************************************** FIM TRATAMENTO MENU */



/*********************************************************** USUARIOS*/

// CADASTRAR USUÁRIOS - Tratamento complementar das abas
function ABAS_USER(n){
  var doc = document;
  if (n==0){	
	doc.getElementById("formincluir").style.display = '';
	doc.getElementById("formbusca").style.display = 'none';
	doc.fincluir.reset();
    doc.fincluir.incluir.style.display = '';
	doc.fincluir.alterar.style.display = 'none';
  }
  else{
	doc.getElementById("formincluir").style.display = 'none';
	doc.getElementById("formbusca").style.display = '';	
  } 
}


// MUDA O STATUS DO USUÁRIO
function MUDA_STATUS(n,id,nome){
  window.top.location.href='exec_usuarios.asp?onoff='+n+'&operacao=4&nrseq='+id+'&nome='+nome+'';
}
// EXLUIR USUARIO
function EXCLUIR_USUARIO(n,id,nome){
  if (confirm('Tem certeza que deseja apagar o usuário\n "'+nome+'" ?'))	
    window.top.location.href='exec_usuarios.asp?onoff='+n+'&operacao=3&nrseq='+id+'&nome='+nome+'';
}
// CARREGA REGISTROS PARA ATUALIZAÇÃO
function CARREGA_REG_USUARIO(id,nome,email,login,senha,status){
	var doc = window.top.document;
	doc.getElementById("aba_incluir").style.display = 'none';
	doc.getElementById("aba_consultar").style.display = 'none';
	doc.getElementById("aba_editar").style.display = '';
	doc.getElementById("formincluir").style.display = '';
	doc.getElementById("formbusca").style.display = 'none';
	doc.fincluir.nrseq.value = id;
	doc.fincluir.nome.value  = nome;
	doc.fincluir.email.value = email;
	doc.fincluir.login.value = login;
	doc.fincluir.senha.value = senha;
	doc.fincluir.operacao.value = 2;
    doc.fincluir.incluir.style.display = 'none';
	doc.fincluir.alterar.style.display = '';
	if (status==1)
	  doc.fincluir.status.checked = true
	else
	  doc.fincluir.status.checked = false;
    window.top.sLinkAjuda('1.1')
}
/*********************************************************** FIM USUÁRIOS*/






/***********************************************************  CADASTRADOS DO SITE - FABIANO*/

// CADASTRAR USUÁRIOS - Tratamento complementar das abas
function ABAS_USER_CAD(n){
  var doc = document;
  if (n==0){	
	doc.getElementById("formincluir").style.display = '';
	doc.getElementById("formbusca").style.display = 'none';
	doc.fincluir.reset();
    doc.fincluir.incluir.style.display = '';
	doc.fincluir.alterar.style.display = 'none';
  }
  else{
	doc.getElementById("formincluir").style.display = 'none';
	doc.getElementById("formbusca").style.display = '';	
  } 
}


// MUDA O STATUS DO CADASTRO
function MUDA_STATUS_CAD(n,id,nome){
  window.top.location.href='exec_cadastro.asp?onoff='+n+'&operacao=4&nrseq='+id+'&nome='+nome+'';
}
// EXLUIR CADASTRO
function EXCLUIR_CADASTRO(n,id,nome){
  if (confirm('Tem certeza que deseja apagar o cadastro de\n "'+nome+'" ?'))	
    window.top.location.href='exec_cadastro.asp?onoff='+n+'&operacao=3&nrseq='+id+'&nome='+nome+'';
}
// CARREGA REGISTROS PARA ATUALIZAÇÃO
function CARREGA_REG_CADASTRO(id,nome,email,endereco,bairro,cidade,estado,pais,cep,ddd,telefone,origem,nascimento,empresa,cargo,status){
	var doc = window.top.document;
	doc.getElementById("aba_incluir").style.display = 'none';
	doc.getElementById("aba_consultar").style.display = 'none';
	doc.getElementById("aba_editar").style.display = '';
	doc.getElementById("formincluir").style.display = '';
	doc.getElementById("formbusca").style.display = 'none';
	doc.fincluir.nrseq.value = id;
	doc.fincluir.nome.value  = nome;
	doc.fincluir.email.value = email;
	doc.fincluir.endereco.value = endereco;
	doc.fincluir.bairro.value = bairro;
	doc.fincluir.cidade.value = cidade;
	doc.fincluir.estado.value  = estado;
	doc.fincluir.pais.value = pais;
	doc.fincluir.cep.value = cep;
	doc.fincluir.ddd.value = ddd;
	doc.fincluir.telefone.value = telefone;
	doc.fincluir.origem.value  = origem;
	doc.fincluir.nascimento.value = nascimento;
	doc.fincluir.empresa.value = empresa;
	doc.fincluir.cargo.value = cargo;
	doc.fincluir.operacao.value = 2;
    doc.fincluir.incluir.style.display = 'none';
	doc.fincluir.alterar.style.display = '';
	if (status==1)
	  doc.fincluir.status.checked = true
	else
	  doc.fincluir.status.checked = false;
    window.top.sLinkAjuda('6.1')
}
/*********************************************************** FIM CADASTROS DO SITE - FABIANO*/




/*********************************************************** NOTÍCIAS*/
// CADASTRAR USUÁRIOS - Tratamento complementar das abas
function ABAS_NOTICIA(n){
  var doc = document;
  doc.getElementById("formincluir").style.display = 'none';
  doc.getElementById("formbusca").style.display = 'none';
  if (n==0)
    doc.getElementById("formincluir").style.display = '';
  else
	doc.getElementById("formbusca").style.display = '';	
}
function CARREGA_REG_NOTICIA(n){
	var doc = document;
    if (n!=0){
	    ABAS(2)
		doc.fincluir.incluir.style.display = 'none';
		doc.fincluir.alterar.style.display = '';
		doc.fincluir.operacao.value = 2;	
	}
	else 
	  ABAS(0);
	ABAS_NOTICIA(0);	  
}
// EXLUIR NOTÍCIA
function EXCLUIR_NOTICIA(n,id,nome){
  if (confirm('Tem certeza que deseja apagar a notícia\n "'+nome+'" ?'))	
    window.top.location.href='exec_noticias.asp?operacao=3&nrseq='+id+'&nome='+nome+'';
}
/********************************************************* FIM NOTÍCIAS*/

/*********************************************************** TURISMO*/

// MUDA O STATUS DO TURISMO
function MUDA_STATUS_T(n,id,nome){
  window.top.location.href='exec_turismo.asp?onoff='+n+'&operacao=4&nrseq='+id+'&nome='+nome+'';
}
// EXLUIR TURISMO
function EXCLUIR_TURISMO(n,id,nome,o){
  if (o>0) {alert("Procedimento não permitido!\nHá "+o+" dado(s) relacionado(s) a este registro.")}
  else{
	   if (confirm('Tem certeza que deseja apagar o turismo \n "'+nome+'" ?'))	
		 window.top.location.href='exec_turismo.asp?onoff='+n+'&operacao=3&nrseq='+id+'&nome='+nome+'';
  }
}


// ------------------------------------


// CARREGA REGISTROS DE TURISMO PARA ATUALIZAÇÃO
function CARREGA_REG_TURISMO(form,id,nome,status,fk_turismo,fk_atrativo){
   // alert( form +' - '+ id +' - '+ nome +' - '+ status +' - '+ fk_turismo +' - '+ fk_atrativo )
    var doc = window.top.document.forms;
	var el  = window.top.document;
	el.getElementById("modoInc1").style.display = '';
	el.getElementById("modoInc2").style.display = '';
	doc[form].nrseq.value = id;
	doc[form].nome.value  = nome;
	doc[form].operacao.value = 2;
    doc[form].incluir.style.display = 'none';
	doc[form].alterar.style.display = '';
	if (status==1)
	  doc[form].status.checked = true
	else
	  doc[form].status.checked = false;
    if (fk_turismo!=0) { doc[form].turismo.value = fk_turismo }
}


function ABAS_TURISMO(n){
	if (n==null) n = 0;
    var doc = document;
    doc.getElementById("aba_turismo").style.display = 'none';
	doc.getElementById("aba_atrativo").style.display = 'none';
	doc.getElementById("aba_localidade").style.display = 'none';
	doc.getElementById("pagina_turismo").style.display = 'none';
	doc.getElementById("pagina_atrativo").style.display = 'none';
	doc.getElementById("aguarde").style.display = 'none';
	doc.getElementById("pagina_localidade").style.display = 'none';
    switch(n){
	  case 0: doc.getElementById("aba_turismo").style.display = ''; 
	          doc.getElementById("pagina_turismo").style.display = '';
			  break;
	  case 1: doc.getElementById("aba_atrativo").style.display = ''; 
	  		  doc.getElementById("pagina_atrativo").style.display = '';
	  		  break;
	  case 2: doc.getElementById("aba_localidade").style.display = ''; 
	  		  doc.getElementById("pagina_localidade").style.display = '';
	  		  break;
	  case 3: doc.getElementById("aguarde").style.display = ''; break;
	}
}

/********************************************************* FIM TURISMO*/






/*********************************************************** ATRATIVO*/

// MUDA O STATUS DO ATRATIVO
function MUDA_STATUS_A(n,id,nome){
  window.top.location.href='exec_atrativo.asp?onoff='+n+'&operacao=4&nrseq='+id+'&nome='+nome+'';
}
// EXLUIR ATRATIVO
function EXCLUIR_ATRATIVO(n,id,nome,o){
  if (o>0) {alert("Procedimento não permitido!\nHá "+o+" dado(s) relacionado(s) a este registro.")}
  else{	
		  if (confirm('Tem certeza que deseja apagar o atrativo \n "'+nome+'" ?'))	
			window.top.location.href='exec_atrativo.asp?onoff='+n+'&operacao=3&nrseq='+id+'&nome='+nome+'';
  }
}


/********************************************************* FIM ATRATIVO*/






/*********************************************************** LOCALIDADES*/
function CARREGA_REG_LOCALIDADES(id,n){
	var doc = window.top.document;
	if (n==0)
      doc.location.href = "gerenciar_turismo.asp?div=2&find=1&localId="+id;
}


// MUDA O STATUS DAS LOCALIDADES
function MUDA_STATUS_L(n,id,titulo){
  window.top.location.href='exec_atrativo.asp?onoff='+n+'&operacao=4&nrseq='+id+'&titulo='+titulo+'';
}
// EXLUIR AS LOCALIDADES
function EXCLUIR_LOCALIDADES(n,id,titulo){
  if (confirm('Tem certeza que deseja apagar a localidade \n "'+titulo+'" ?'))	
    window.top.location.href='exec_localidades.asp?onoff='+n+'&operacao=3&nrseq='+id+'&titulo='+titulo+'';
}
// CARREGA REGISTROS DAS LOCALIDADES PARA ATUALIZAÇÃO




//
function mPag(url){
  if (url!=""){
	EXIBE_DIV(3)
    window.location = url;
  }
}


function sendFiltro(form,val){
	if (val!=""){
	  document.forms[form].chave.value = '';
  	  document.forms[form].submit();
	}
}

function MODO_INCLUIR(form){
    var doc = document.forms;
    doc[form].reset();
    doc[form].incluir.style.display = '';
	doc[form].alterar.style.display = 'none';
	document.getElementById("modoInc1").style.display = 'none';
	document.getElementById("modoInc2").style.display = 'none';

}



/********************************************************* FIM LOCALIDADES*/

/********************************************************* LICITAÇÕES COMEÇA AQUI*/
// EXCLUI A LICITAÇÃO
function EXCLUIR_LICITACAO(id){
  if (confirm('Tem certeza que deseja apagar esta licitação?'))	
	window.top.location.href='exec_licitacoes.asp?operacao=3&nrseq='+id;
}
function mudaPIncluir(){
  if (document.flicitacoes.operacao.value == 2)
    window.location = "gerenciar_licitacoes.asp?div=0"
}
function EDITAR_LICITACAO(n){
  var doc = document.flicitacoes;
  switch(n){
    case 0: ABAS(0);
			ABAS_LICITACAO(0);
	        break;
    case 2:
	  ABAS(2);
	  ABAS_LICITACAO(0);
	  doc.operacao.value = 2;
      doc.botao.value = 'Alterar Licitação';
	  break;
  }
}
function ABAS_LICITACAO(n){
  var doc = document;
  doc.getElementById("licitacao_buscar").style.display = 'none';
  doc.getElementById("licitacao_incluir").style.display = 'none';
  if (n==0)	
	doc.getElementById("licitacao_incluir").style.display = '';
  else
	doc.getElementById("licitacao_buscar").style.display = '';	
}
/********************************************************* FIM LICITAÇÕES*/


/*********************************************************** NEWSLETTER*/



/*  ABAS - INCLUIR, CONSULTAR, EDITAR, GERAR ARQUIVO*/
function ABAS_GERAR(n){
  var doc = document;
  doc.getElementById("aba_incluir").style.display = 'none';
  doc.getElementById("aba_consultar").style.display = 'none'; 
  doc.getElementById("aba_gerar").style.display = 'none';
  doc.getElementById("aba_editar").style.display = 'none';
  switch(n){
	case 0:	doc.getElementById("aba_incluir").style.display = ''; break;
    case 1:	doc.getElementById("aba_consultar").style.display = ''; break;
	case 2:	doc.getElementById("aba_editar").style.display = ''; break;		
	case 3:	doc.getElementById("aba_gerar").style.display = ''; break;
  }
}


// CADASTRAR NEWSLETTER - Tratamento complementar das abas
function ABAS_NEWSLETTER(n){
  var doc = document;
	doc.getElementById("formincluir").style.display = 'none';
    doc.getElementById("formbusca").style.display = 'none';
	doc.getElementById("formgerar").style.display = 'none';
	
  switch(n){
   case 0:doc.getElementById("formincluir").style.display = ''; break;
   case 1:doc.getElementById("formbusca").style.display = ''; break;
   case 2:doc.getElementById("formgerar").style.display = ''; break;
}
  
}

function CARREGA_REG_NEWSLETTER(n){
	var doc = document;
    if (n!=0){
	    ABAS_GERAR(2)
		doc.fincluir.incluir.style.display = 'none';
		doc.fincluir.alterar.style.display = '';
		doc.fincluir.operacao.value = 2;	
	}
	else 
	  ABAS_GERAR(0);
	ABAS_NEWSLETTER(0);	  
}
// EXLUIR NEWSLETTER
function EXCLUIR_NEWSLETTER(n,id,nome){
  if (confirm('Tem certeza que deseja apagar a newsletter\n "'+nome+'" ?'))	
    window.top.location.href='exec_newsletter.asp?operacao=3&nrseq='+id+'&nome='+nome+'';
}
/********************************************************* FIM NEWSLETTER*/



/************************************* DOWNLOADS ******/
function EXCLUIR_DOWN(id,nome){
  if (confirm('Tem certeza que deseja apagar o arquivo\n "'+nome+'" ?'))	
    window.top.location.href='exec_downloads.asp?operacao=3&nrseq='+id+'&nome='+nome+'';
}

function setPathImg(caminho){
  var img = document.formincluir;
  if (img.imagem.value=="")
    img.imgnull.value = caminho;
  else
    img.imgnull.value = "0";
}
function MODO_DOWNLOADS(n,id,tit,descr){
  var doc = document;
  switch(n){
	  case 0:
		doc.getElementById("modo_incluir").style.display = '';
		doc.getElementById("modo_consultar").style.display = 'none';
   		doc.formincluir.reset();
		doc.formincluir.botao.value = 'Incluir';
		doc.formincluir.limpar.style.display = ''; 
		setaImg(0); break; 
	  case 1:
		doc.getElementById("modo_incluir").style.display = 'none';
		doc.getElementById("modo_consultar").style.display = ''; break; 
	  default:	
		doc.getElementById("modo_incluir").style.display = '';
		doc.getElementById("modo_consultar").style.display = 'none';  	  
	    doc.formincluir.titulodown.value = tit;
		doc.formincluir.descricao.value	 = descr;
		doc.formincluir.nrseq.value 	 = id;
		doc.formincluir.operacao.value	 = 2;
		doc.formincluir.botao.value = 'Alterar';
		doc.formincluir.limpar.style.display = 'none';
		setaImg(id)
		ABAS(2);		
  }
}
/**************************/
