
// PopUps
function PopUpEnquete(theURL,winName) { //v2.0
  window.open(theURL,winName,'width=620,height=420,left=0,top=0,menubar=no,toolbar=no,locationbar=no,resizable=no,status=yes,dependent=no,scrollbars=yes');
}

function noticias(theURL,winName) { //v2.0
  window.open(theURL,winName,'width=400,height=400,left=0,top=0,menubar=no,toolbar=no,locationbar=no,resizable=no,status=yes,dependent=no,scrollbars=yes');
}

function PopUpGrafico(theURL,winName) { //v2.0
  window.open(theURL,winName,'width=620,height=420,left=0,top=0,menubar=no,toolbar=no,locationbar=no,resizable=no,status=yes,dependent=no,scrollbars=yes');
}

function PopUpNewsLetter(theURL,winName) { //v2.0
  window.open(theURL,winName,'width=420,height=320,left=0,top=0,menubar=no,toolbar=no,locationbar=no,resizable=no,status=yes,dependent=no,scrollbars=yes');
}

function PopUpConvenios(theURL,winName) { //v2.0
  window.open(theURL,winName,'width=420,height=320,left=0,top=0,menubar=no,toolbar=no,locationbar=no,resizable=no,status=yes,dependent=no,scrollbars=yes');
}

// Enquete
function validaVoto(formID) {
        num_respostas = document.enquete.opcao.length;
        resposta = num_respostas;
        respostas = "";
        for(i=0; i<num_respostas; i++) {
                if(document.enquete.opcao[i].checked) {
                        resposta = i;
                        if(respostas) {
                                respostas=respostas + "&";
                        } else {
                                respostas=respostas + "?";
                        }
                        respostas=respostas + "opcao=" + document.enquete.opcao[i].value;
                }
        }
        if(resposta==num_respostas) {
                alert("Uma opção deve ser escolhida!");
        } else {
                PopUpEnquete("pes_enquete_visualizacao.php" + respostas + "&subEnquete=1&enq_id=" + formID,'RespostaEnquete');
        }
}

function Abre(url, width, height) {
        window.open(url,"_blank","resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=yes,width=" + width + ",height=" + height);
}

// NewsLetter
function enviaNews() {
        if (document.newsletter.email.value=='') {
                alert('O Campo de email deve ser preenchido!');
        } else {
                PopUpNewsLetter('newsletter.php?email=' + document.newsletter.email.value + '&submeteu=1','NewsLetter');
                document.newsletter.email.value = '';

        }
}



function hotsite(theURL,winName) { //v2.0
  window.open(theURL,winName,"_blank",'width=550,height=550,left=0,top=0,menubar=no,toolbar=no,locationbar=no,resizable=no,status=no,dependent=no,scrollbars=no');
}


function PopUpNatal(theURL,winName) { //v2.0
  window.open(theURL,winName,'width=420,height=320,left=0,top=0,menubar=no,toolbar=no,locationbar=no,resizable=no,status=yes,dependent=no,scrollbars=no');
}

function PopUpEvento(theURL,winName) { //v2.0
  window.open(theURL,winName,'width=225,height=232,left=0,top=380,menubar=no,toolbar=no,locationbar=no,resizable=no,status=yes,dependent=no,scrollbars=no');
}

function PopUpConvite(theURL,winName) { //v2.0
  window.open(theURL,winName,'width=300,height=249,left=0,top=0,menubar=no,toolbar=no,locationbar=no,resizable=no,status=yes,dependent=no,scrollbars=no');
}

//Funcão para o HOT SITE comemorativo do DNPM 70 anos
// DATA: 11/03/2004
function openWindow() {
  var w = 600;
  var h = 420;
  var winleft = (screen.width  - w) / 2;
  var wintop  = (screen.height - h) / 2;
  winprop = 'width='+w+', height='+h+', top='+wintop+', left='+winleft+', menubar=0, resizeble=0, scrollbars=0, status=0'
  win = window.open('http://www.dnpm.gov.br/DNPM70anos/default2.htm', 'Comemora', winprop)
  if (parseInt(navigator.appVersion) >= 4) {
    win.window.focus();
  }
openWindow();
}