function GaleriaFotos(GaleriaFotos){
window.open(GaleriaFotos,"JanelaFotos","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,ontop=on,width=660,height=650")
}



function JanelaInformacoes(JanelaInformacoes){
window.open(JanelaInformacoes,"JanelaInformacoes","top=" + parseInt((screen.availHeight/2) - (563/2))+ " , left=" + parseInt((screen.availWidth/2) - (750/2)) + " directories=no, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=yes, toolbar=no, width=595, height=400");
}
function JanelaImprimir(JanelaImprimir){
window.open(JanelaImprimir,"JanelaImprimir","top=" + parseInt((screen.availHeight/2) - (563/2))+ " , left=" + parseInt((screen.availWidth/2) - (750/2)) + " directories=no, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=yes, toolbar=no, width=730, height=400");
}
function JanelaGrande(JanelaGrande){
window.open(JanelaGrande,"JanelaGrande","top=" + parseInt((screen.availHeight/2) - (563/2))+ " , left=" + parseInt((screen.availWidth/2) - (750/2)) + " directories=no, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=yes, toolbar=no, width=730, height=400");
}
function JanelaPantanal(JanelaPantanal){
window.open(JanelaPantanal,"JanelaPantanal","top=" + parseInt((screen.availHeight/2) - (563/2))+ " , left=" + parseInt((screen.availWidth/2) - (750/2)) + " directories=no, location=no, menubar=no, resizable=no, scrollbars=no, status=no, titlebar=yes, toolbar=no, width=600, height=450");
}
function AmpliaImagem(AmpliaImagem){
window.open(AmpliaImagem,"AmpliaImagem","toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,ontop=on,width=680,height=530,")
}

function JanelaDenuncia(JanelaDenuncia){
window.open(JanelaDenuncia,"JanelaDenuncia","top=" + parseInt((screen.availHeight/2) - (563/2))+ " , left=" + parseInt((screen.availWidth/2) - (750/2)) + " directories=no, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=yes, toolbar=no, width=595, height=400");
}
function JanelaMapa(JanelaMapa){
window.open(JanelaMapa,"JanelaMapa","top=" + parseInt((screen.availHeight/2) - (563/2))+ " , left=" + parseInt((screen.availWidth/2) - (750/2)) + " directories=no, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=yes, toolbar=no, width=670, height=600");
}
function AudioVideoVer(AudioVideoVer){
window.open("audiovideo-ver.php?video="+AudioVideoVer,"AudioVideoVer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,ontop=on,width=600,height=500,")
}
function AudioVideoOuvir(AudioVideoOuvir){
window.open("audiovideo-ouvir.php?faixa="+AudioVideoOuvir,"AudioVideoOuvir","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,ontop=on,width=600,height=500,")
}
function VerMapa(){
window.open("conheca-perfil-mapa-ver.php","VerMapa","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,ontop=on,width=700,height=500,")
}



// Conta caracteres
function ContaCaracteres(){
   intCaracteres = 500 - document.form.texto.value.length;
   if (intCaracteres > 0){
      document.form.qtde_caracteres.value = intCaracteres;
      return true;
   }
   else {
      document.form.qtde_caracteres.value = 0;
      document.form.texto.value = document.form.texto.value.substr(0,500)
      return false;
   }
}



// index.php
function IniciaBusca(){
var busca_texto = document.getElementById('busca_texto').value;
var busca_local = document.getElementById('busca_local').value;

if (busca_local == "noticias"){
document.location.href = "index.php?pagina=banco_noticias&busca_texto="+busca_texto;
} else if (busca_local == "site") {
window.open("http://www.google.com.br/custom?&domains=bandeirantes.ms.gov.br&btnG=Pesquisar&sitesearch=bandeirantes.ms.gov.br&q="+busca_texto);
} else {
window.open("http://www.google.com.br/custom?q="+busca_texto);
}

} // fim function



// Conta caracteres Descricao
function ContaCaracteresDescricao(){
   intCaracteres = 200 - document.form.descricao.value.length;
   if (intCaracteres > 0){
      document.form.qtde_caracteres_descricao.value = intCaracteres;
      return true;
   }
   else {
      document.form.qtde_caracteres_descricao.value = 0;
      document.form.descricao.value = document.form.descricao.value.substr(0,200)
      return false;
   }
}

// Conta caracteres Descricao
function ContaCaracteresContato(){
   intCaracteres = 100 - document.form.contato.value.length;
   if (intCaracteres > 0){
      document.form.qtde_caracteres_contato.value = intCaracteres;
      return true;
   }
   else {
      document.form.qtde_caracteres_contato.value = 0;
      document.form.contato.value = document.form.contato.value.substr(0,100)
      return false;
   }
}





function EnviarFaleConosco(){

var consulta = "";
var valor1 = "0";
var destino = document.form.destino.value;
var nome = document.form.nome.value;
var assunto = document.form.assunto.value;
var mensagem = document.form.mensagem.value;

if (destino == "0"){
consulta = consulta + "Selecione o destino desejado \n\n";
valor1 = "1";
}

if (nome == ""){
consulta = consulta + "O preenchimento do NOME é obrigatório \n\n";
valor1 = "1";
}

if (assunto == ""){
consulta = consulta + "O preenchimento dO ASSUNTO é obrigatório \n\n";
valor1 = "1";
}

if (mensagem == ""){
consulta = consulta + "O preenchimento da MENSAGEM é obrigatório \n\n";
valor1 = "1";
}

if (valor1 != "0"){
alert(consulta);
} else {
document.form.submit();
}

}




function EnviaMateria(){

var erro = "0";
var nome = document.form.seu_nome.value;
var email = document.form.seu_email.value;
var msg_erro = "";

if (nome == ""){
erro = "1";
msg_erro = msg_erro + "O Preencha do SEU NOME é obrigatório \n\n";
}
if (email == ""){
erro = "1";
msg_erro = msg_erro + "O Preencha do SEU E-MAIL é obrigatório \n\n";
}

if (erro != 0){
alert(msg_erro);
} else {
document.form.submit();
}

}




function MM_swapImgRestore() //v3.0
{
  var i, x, a = document.MM_sr;
  for(i=0; a && i < a.length && (x = a[i]) && x.oSrc; i++)
    x.src = x.oSrc;
}

function MM_preloadImages() //v3.0
{
  var d = document;
  if(d.images)
  {
    if(!d.MM_p)
      d.MM_p = new Array();

    var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
    for(i = 0; i < a.length; i++)
      if (a[i].indexOf("#") != 0)
      {
        d.MM_p[j] = new Image;
        d.MM_p[j++].src = a[i];
      }
   }
}

function MM_findObj(n, d) //v4.0
{
  var p, i, x;
  if(!d)
    d = document;

  if((p = n.indexOf("?")) > 0 && parent.frames.length)
  {
    d = parent.frames[n.substring(p + 1)].document;
    n = n.substring(0, p);
  }
  if(!(x = d[n]) && d.all)
    x = d.all[n];

  for(i = 0; !x && i < d.forms.length; i++)
    x = d.forms[i][n];

  for(i = 0; !x && d.layers && i < d.layers.length; i++)
    x = MM_findObj(n, d.layers[i].document);

  if(!x && document.getElementById)
    x = document.getElementById(n);

  return x;
}

function MM_swapImage() //v3.0
{
  var i, j = 0, x, a = MM_swapImage.arguments;
  document.MM_sr = new Array;
  for(i = 0; i < (a.length - 2); i += 3)
    if((x = MM_findObj(a[i])) != null)
    {
      document.MM_sr[j++] = x;
      if(!x.oSrc)
        x.oSrc = x.src;
      x.src = a[i+2];
    }
}

