function fAjaxPoll() {
	polls = $$('.pollform');

	for (i=0;i<polls.length;i++) {
		polls[i].addEvent('submit', function(e) {
			e.stop();			
			pollId = $(this.pollId).get('value');	
			this.set('send', {
				onComplete: function(response) {
					new Request.HTML({update: 'pollcontainer' + pollId, 
						onComplete: function(response) {
							fAjaxPoll();
						}
					}).get('poll/details/' + pollId);
				}
			});
			
			var ok = false;
			if (this.vote.length!=null) {
				for (j=0;j<this.vote.length;j++) {
					if (this.vote[j].checked) {					
						ok = true;
						break;
					}
				}
			} else {
				if (this.vote.checked) {					
					ok = true;
					this.send();
				}
			}
			
			if (ok) {
				$('poll-save-' + pollId).setStyle('display', 'none');
				$('poll-ajax-' + pollId).setStyle('display', 'inline');
				this.send();
			}
		});		
	}	
}

window.addEvent('domready', function() {
	fAjaxPoll();
});
