Poll = {
    send : function() { 
        var value = this.getValue();
        
        if (value == null) { return; };
        
        var postData = "value=" + value;
        var callback = {
            success: function(o) {
                var html = o.responseText;
                var block = document.getElementById('encuestas');
                if (typeof block != 'undefined') {
                    block.innerHTML = html;
                }
            },
            failure: function (o) {}
        };

        YAHOO.util.Connect.asyncRequest(
            'POST',
            '/encuestas/vota',
            callback,
            postData);
    },
    
    getValue : function(){
        var opciones = document.getElementById('encuestas').getElementsByTagName('INPUT');
        for (var i=0; i < opciones.length; i++) {
            
            if (opciones[i].type == 'radio'
            && (opciones[i].checked))
            {
                return opciones[i].value;
            };
            
        };
        
        return null;
    }
}