// caixa eventos

function mostraGeral() {
		
	var eventosEnspDiv = document.getElementById('Eventos-Ensp');
	var eventosGeraisDiv = document.getElementById('Eventos-Gerais');	
	var eventosEnspAba = document.getElementById('aba-ensp');
	var eventosGeraisAba = document.getElementById('aba-geral');
	var eventosEnspH3 = document.getElementById('aba-h3-ensp');
	var eventosGeraisH3 = document.getElementById('aba-h3-geral');
	
	// link
	eventosEnspAba.style.fontWeight = "normal";
	eventosGeraisAba.style.fontWeight = "bold";
	eventosEnspAba.style.color = "green";
	eventosGeraisAba.style.color = "red";
	
	// div
	eventosEnspDiv.style.display = "none";
	eventosGeraisDiv.style.display = "block";			
	
	// h3
	eventosEnspH3.style.backgroundPosition = "left bottom";
	eventosGeraisH3.style.backgroundPosition = "left top";	
}

function mostraEnsp() {	

	var eventosEnspDiv = document.getElementById('Eventos-Ensp');
	var eventosGeraisDiv = document.getElementById('Eventos-Gerais');	
	var eventosEnspAba = document.getElementById('aba-ensp');
	var eventosGeraisAba = document.getElementById('aba-geral');
	var eventosEnspH3 = document.getElementById('aba-h3-ensp');
	var eventosGeraisH3 = document.getElementById('aba-h3-geral');
	
	// link
	eventosEnspAba.style.fontWeight = "bold";
	eventosGeraisAba.style.fontWeight = "normal";
	eventosEnspAba.style.color = "red";
	eventosGeraisAba.style.color = "green";
	
	// div
	eventosEnspDiv.style.display = "block";
	eventosGeraisDiv.style.display = "none";			
	
	// h3
	eventosEnspH3.style.backgroundPosition = "left top";
	eventosGeraisH3.style.backgroundPosition = "left bottom";	
}


// caixa Consulta publica e eventos

function mostraEditais() {
		
	var caixaConsultaDiv = document.getElementById('consulta-publica');
	var caixaEditaisDiv = document.getElementById('editais');	
	var caixaConsultaAba = document.getElementById('aba-consulta');
	var caixaEditaisAba = document.getElementById('aba-editais');
	var caixaConsultaH3 = document.getElementById('aba-h3-consulta');
	var caixaEditaisH3 = document.getElementById('aba-h3-editais');
	
	// link
	caixaConsultaAba.style.fontWeight = "normal";
	caixaEditaisAba.style.fontWeight = "bold";
	caixaConsultaAba.style.color = "#9A9A9A";
	caixaEditaisAba.style.color = "#666";
	
	// div
	caixaConsultaDiv.style.display = "none";
	caixaEditaisDiv.style.display = "block";			
	
	// h3
	caixaConsultaH3.style.backgroundPosition = "left bottom";
	caixaEditaisH3.style.backgroundPosition = "left top";	
}

function mostraConsulta() {	

	var caixaConsultaDiv = document.getElementById('consulta-publica');
	var caixaEditaisDiv = document.getElementById('editais');	
	var caixaConsultaAba = document.getElementById('aba-consulta');
	var caixaEditaisAba = document.getElementById('aba-editais');
	var caixaConsultaH3 = document.getElementById('aba-h3-consulta');
	var caixaEditaisH3 = document.getElementById('aba-h3-editais');
	
	// link
	caixaConsultaAba.style.fontWeight = "bold";
	caixaEditaisAba.style.fontWeight = "normal";
	caixaConsultaAba.style.color = "#666";
	caixaEditaisAba.style.color = "#9A9A9A";
	
	// div
	caixaConsultaDiv.style.display = "block";
	caixaEditaisDiv.style.display = "none";			
	
	// h3
	caixaConsultaH3.style.backgroundPosition = "left top";
	caixaEditaisH3.style.backgroundPosition = "left bottom";	
}

//pop-up
function MM_openBrWindow(theURL,winName,features) { //v2.0
 window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function caixaComentar(){
	
	if(document.getElementById('caixa-escondida').style.display == 'none'){
		document.getElementById('caixa-escondida').style.display = 'block';
	}else{
		document.getElementById('caixa-escondida').style.display = 'none';
	}
}

function mostraTermoComentario(){
	if(document.getElementById('exibeTermoComentario').style.display == 'none'){
		document.getElementById('exibeTermoComentario').style.display = 'block';
	}else{
		document.getElementById('exibeTermoComentario').style.display = 'none';
	}
	
}

function trocaFoto (imagem) {
	document.images['foto'].src=imagem;
}
function trocaLegenda (legenda) {
	document.getElementById('legenda').innerHTML=legenda;
}

// String.isEmpty ()
String.prototype.isEmpty = function(){
	return this.split(" ").join("").length == 0;}

function criteriosComentar(target){

	var form = target;
	var frm = document.getElementById(form.id);
	
	if(frm.txaMensagem.value.isEmpty()){
		alert('O campo de comentário está vazio.');
		frm.txaMensagem.focus();
		return false;
	}
	
	if(!frm.termos.checked){
		alert('É necessário aceitar os termos para enviar um comentário.');
		frm.termos.focus();
		return false;
	}

	return true;	
}

function checa() {
				with(document.frmBusca) {
					var pegatexto_noticia ;
					
					if (fNome.value == "") {
						alert("É necessário que seja informado o nome completo.");
						fNome.focus();
						return false;
					}
					
					if (fEmail.value == "") {
						alert("Informe o email.");
						fEmail.focus();
						return false;
					}	
					
					if (fEmail.value != "") {
						prim = fEmail.value.indexOf("@")
						if(prim < 2) {
							alert("O e-mail informado parece não estar correto.");
							fEmail.focus();
							fEmail.select();
							return false;
						}
						if(fEmail.value.indexOf("@",prim + 1) != -1) {
							alert("O e-mail informado parece não estar correto.");
							fEmail.focus();
							fEmail.select();
							return false;
						}
						if(fEmail.value.indexOf(".") < 1) {
							alert("O e-mail informado parece não estar correto.");
							fEmail.focus();
							fEmail.select();
							return false;
						}
						if(fEmail.value.indexOf(" ") != -1) {
							alert("O e-mail informado parece não estar correto.");
							fEmail.focus();
							fEmail.select();
							return false;
						}
						if(fEmail.value.indexOf(".@") > 0) {
							alert("O e-mail informado parece não estar correto.");
							fEmail.focus();
							fEmail.select();
							return false;
						}
						if(fEmail.value.indexOf("@.") > 0) {
							alert("O e-mail informado parece não estar correto.");
							fEmail.focus();
							fEmail.select();
							return false;
						}
						if(fEmail.value.indexOf("..") > 0) {
							alert("O e-mail informado parece não estar correto.");
							fEmail.focus();
							fEmail.select();
							return false;
						}
					}
					
					if (ftitulo.value == "") {
						alert("Digite o titulo.");
						ftitulo.focus();
						return false;
					}
					
					if (fsecao.value == "") {
						alert("Selecione uma seção.");
						fsecao.focus();
						return false;
					}
					
					if (fMateria.value == "") {
						alert("Digite o texto.");
						fMateria.focus();
						return false;
					}
					
					if (fDia1.value == "") {
						alert("Por favor, informe a data incial corretamente!");
						fDia1.focus();
						return false;
					}
					
					if (fMes1.value == "") {
						alert("Por favor, informe a data incial corretamente!");
						fMes1.focus();
						return false;
					}
					
					if (fAno1.value == "") {
						alert("Por favor, informe a data incial corretamente!");
						fAno1.focus();
						return false;
					}
					
					if ((document.frmBusca.fDia1.value!="")&&(document.frmBusca.fMes1.value=="")&&(document.frmBusca.fAno1.value=="")){
						alert("Por favor, informe a data incial corretamente!");
						document.frmBusca.fMes1.focus();
						return false;		
					}
					if ((document.frmBusca.fDia1.value=="")&&(document.frmBusca.fMes1.value!="")&&(document.frmBusca.fAno1.value=="")){
						alert("Por favor, informe a data incial corretamente!");
						document.frmBusca.fDia1.focus();
						return false;		
					}
					if ((document.frmBusca.fDia1.value=="")&&(document.frmBusca.fMes1.value=="")&&(document.frmBusca.fAno1.value!="")){
						alert("Por favor, informe a data incial corretamente!");
						document.frmBusca.fDia1.focus();
						return false;		
					}
					if ((document.frmBusca.fDia1.value!="")&&(document.frmBusca.fMes1.value!="")&&(document.frmBusca.fAno1.value=="")){
						alert("Por favor, informe a data incial corretamente!");
						document.frmBusca.fAno1.focus();
						return false;		
					}
					if ((document.frmBusca.fDia1.value=="")&&(document.frmBusca.fMes1.value!="")&&(document.frmBusca.fAno1.value!="")){
						alert("Por favor, informe a data incial corretamente!");
						document.frmBusca.fDia1.focus();
						return false;		
					}
					if ((document.frmBusca.fDia1.value!="")&&(document.frmBusca.fMes1.value=="")&&(document.frmBusca.fAno1.value!="")){
						alert("Por favor, informe a data incial corretamente!");
						document.frmBusca.fMes1.focus();
						return false;		
					}
					
				return true;
				}
			}
