
var polls = {
    
    init: function()
    {
        $$('form[name^=polls]').each(function(elem)
        {    
            elem.addEvent('submit', polls.vote);
        });
    },
    
    
    vote: function(e)
    {
        e.stop();
        if (this.getElement('input:checked'))
        {               
            new Request.HTML({
                url: '/ajax.php?do=votePolls',          
                update: this
            }).post(this);
        }
    },
    
    
    del: function(id, this_)
    {
        if (confirm('Точно удалить?'))
        new Request.JSON({
            url: '/ajax.php?do=deletePolls',
            onComplete: function(response)
            {
                if (response) this_.getParent().getParent().set('style','text-decoration:line-through;');
            }
        }).post({'id': id});
    }
    
}
