var previewImg = false;

function ir_pagina(obj,n){
	obj.currentpage.value=n;
	obj.submit();
}

/*mais fotos*/
function paginar(url,QtdImagemExibic,pagina,criterioPesq,organizarPesq) {
    document.getElementById('ExibirPagina').value=pagina;
    document.getElementById('go').action = url;
    document.getElementById('go').submit();
}

function valida() {
    if (document.getElementById('txtBusca').value=="" || document.getElementById('txtBusca').value=="Localizar imagem") {
        alert('Preencha o campo de busca');
        document.getElementById('txtBusca').focus();
        return false;
    }
    
    document.getElementById('go').submit();
}

//Preview da imagem
function preview(imgName,imgDir) {

    //Verificando se o nome do arquivo de imagem foi preenchido
    if (document.getElementById(imgName).value!='' && !previewImg) {

        //Evitando o cache da imagem
        var mydate = new Date();
        var dateTime = mydate.getTime();

        srcImage = new Image();
        srcImage.src = imgDir+document.getElementById(imgName).value;

        document.getElementById('imgPreview').src = srcImage.src+'?rand='+dateTime;
        
        //Posicionando o box do Editor de Imagens
        fixPos = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
        var w = document.body.offsetWidth;

        document.getElementById('boxPreview').style.left=Math.round(((w-srcImage.width)/2),0)+'px';
        document.getElementById('boxPreview').style.top=(75+fixPos)+'px';

        show_so('boxPreview');
        
        previewImg = true; //Segurando a ajanela de preview
    
    }
}

function votar(id) {
    if (id!='') {
        
        if (confirm("Confirma seu voto nesse candidato?")) {
            document.getElementById('perg1').value = 'RAD!82!'+id;
            document.getElementById('go').action='prcVotacao.asp';
            document.getElementById('go').submit();
        }
        
    }
}

/*fim*/


