<%e_pages = ActionController::Pagination::Paginator.new(
		self, (@elt.rgt-@elt.lft-1)/2, LIST_LENGTH, params['page'])
	elts = Elt.find :all,
		:select => 'SUM(value) AS resultLocal, elts.id, parent_id, elts.created_on, parent_id,' \
			+'elts_count, position, elts.person_id, subject, body, lft, rgt',
		:conditions => "lft > #{@elt.lft} AND rgt < #{@elt.rgt}",
		:order => 'SUM(value) IS NULL, SUM(value) DESC, created_on DESC',
		:group => 'elts.id, parent_id, elts.created_on, parent_id, elts_count,' \
			+'position, elts.person_id, subject, body, lft, rgt',
		:limit  => e_pages.items_per_page,
		:offset => e_pages.current.offset,
		:joins => "LEFT JOIN choices ON choices.elt_id = elts.id" %>

<div id="listByVote">
	<% if e_pages.length > 1 %>
		<%= link_to_remote('|&lt;',
			{ :update => 'listByVote',
				:url => { :action => 'listByVote', :id => @elt, :page => e_pages.last },
				:before => visual_effect(:BlindUp, 'listByVote', { :queue => 'end' }),
				:loaded => visual_effect(:BlindDown, 'listByVote', { :queue => 'end' }) }) \
				if e_pages.last != e_pages.current %>
		<%= link_to_remote('&lt;',
			{ :update => 'listByVote',
				:url => { :action => 'listByVote', :id => @elt, :page => e_pages.current.next },
				:before => visual_effect(:BlindUp, 'listByVote', { :queue => 'end' }),
				:loaded => visual_effect(:BlindDown, 'listByVote', { :queue => 'end' }) }) \
				if e_pages.current.next and e_pages.current.next != e_pages.last %>

		<span class="pageCount"><%= e_pages.length-e_pages.current.to_i+1 %></span>

		<%= link_to_remote('&gt;',
			{ :update => 'listByVote',
				:url => { :action => 'listByVote', :id => @elt, :page => e_pages.current.previous },
				:before => visual_effect(:BlindUp, 'listByVote', { :queue => 'end' }),
				:loaded => visual_effect(:BlindDown, 'listByVote', { :queue => 'end' }) }) \
				if e_pages.current.previous and e_pages.current.previous != e_pages.first %>
		<%= link_to_remote('&gt;|',
			{ :update => 'listByVote',
				:url => { :action => 'listByVote', :id => @elt, :page => e_pages.first },
				:before => visual_effect(:BlindUp, 'listByVote', { :queue => 'end' }),
				:loaded => visual_effect(:BlindDown, 'listByVote', { :queue => 'end' }) }) \
				if e_pages.first != e_pages.current %>
	<% end %>

	<ul>
		<% elts.each do |elt| %>
			<li class="boxLine elt" title="<%= elt.created_on.strftime('%d/%m %H:%M') %>">
				<span>
					<%= link_to_remote("%+d" % elt.resultlocal,
						{ :update => 'resultList_'+elt.id,
							:position => :top,
							:url => { :action => 'choices', :id => elt } },
						{ :class => 'result', :id => "resultList_#{ elt.id}",
							:href => url_for(:controller => 'elt', :action => 'choices', :id => elt) }
							) if elt.resultlocal %>
				</span>

				<% if elt.person %>
					<span class="author">
						&lt;<%= link_to(elt.person.name, :controller => 'person', :action => 'show', :id => elt.person) %>&gt;
					</span>
				<% elsif not displayTitle? elt %>
					<span class="author">&lt;<%= ANONYMOUS_POSTER %>&gt;</span>
				<% end %>

				<%= link_to elt.subject.gsub(/\[.*\]/, ''), :action => 'show', :id => elt %>
			</li>
		<% end %>
	</ul>

	<%= link_to image_tag("/images/webfeed.gif"), :action => 'vote_rss', :id => @elt %>
</div>