function enviaComment() {    
    if(document.getElementById('nome').value!="" && document.getElementById('email').value!="" && document.getElementById('comentario').value!="") {
        if (!parseEmail(document.getElementById('email').value)) {
            alert('Por favor insira um e-mail válido!');
            return;
        } else {                        
            vars = 'modo=comentario&IDIdioma=1&StatusComentario=I&NMNomeComentador=' + document.getElementById('nome').value + '&NMEmailComentador=' + document.getElementById('email').value + '&TXComentario=' + document.getElementById('comentario').value + '&NMCidadeComentador=' + document.getElementById('cidade').value;

            Ajax.requestGetBy("../php/ajax.php?"+vars, "aposSalvar");
        }
    } else {
        alert('Por favor preencha todos os campos para enviar seu comentário!');
    }
    
}

function efetuaVoto() {

    resu = '';
    vot = document.getElementsByName('voto');

    for (i=0;i<vot.length;i++) {
        if (vot[i].checked) {
            resu = vot[i].value;
            break;
        }
    }

    if (resu!='') {

        vars = 'modo=enquete&IDEnquete=1&IDRespostaEnquete='+resu;

        Ajax.requestGetBy("../php/ajax.php?"+vars, "aposSalvar");

        
    }

}

function aposSalvar(ret)
{
    alert(ret);
    fechaComent();
}

$(document).ready(function() {
    $.fn.hoverscroll.params = $.extend($.fn.hoverscroll.params, {
        vertical : true,
        //width: 67,
        height: 300,
        arrowsOpacity: 0.7,
        arrows: true,
        debug: false
    });
    $('#my-list').hoverscroll();

    $(document).buildContextualMenu(
    {
        template:"menuVoices.html",
        menuWidth:230,
        overflow:2,
        menuSelector: ".menuContainer",
        iconPath:"../images/",
        hasImages:false,
        fadeInTime:100,
        fadeOutTime:100,
        adjustLeft:0,
        adjustTop:0,
        opacity:.99,
        closeOnMouseOut:false,
        onContextualMenu:function(){}, //params: o,e
        shadow:true
    });

    $("#myScroll").mbScrollable({
        width:400,
        elementsInPage:1,
        elementMargin:2,
        shadow:"#999 2px 2px 2px",
        height:300,
        controls:"#controls",
        slideTimer:600,
        autoscroll:true,
        scrollTimer:4000
    });


    Ajax = new Ajax();

});