(function ($) {
	/**
	 * Replaces text contained in element by colourful text created by separate
	 * spans.
	 */
	$.fn.poll = function () {
		var CLASSES = Array('green', 'yellow', 'red');
		
		this.each(function () {
            var $poll = $(this);
            
            $(this).find('a.vote').click(function () {
                $.get($(this).attr('href'), function (data) {
                    $poll.parents('.poll-wrapper:first').html(data);
                }, 'html');
                return false;
            });
		});
	};
})(jQuery);
