<%
	import org.exoplatform.faq.webui.UIAnswersPageIterator ;
	import org.exoplatform.faq.service.JCRPageList ;
	 
	List totals = uicomponent.getInfoPage() ; 
	if(totals != null){
		long max_page = totals.get(3) ;
		if(max_page > 1){
			long pageSelected = uicomponent.getPageSelected() ;
			String selected = "" + pageSelected ;
	%>
			<div class="UIAnswersPageIterator" id="$uicomponent.id">
				<div class="PageIteratorContainer">
				  <div class="RightPageIteratorBlock">
				  <% if(pageSelected == 1) {%>
				    <div class="Icon DisableLastTopPageIcon"></div>        
				    <div class="Icon DisableLastPageIcon"><span></span></div>
				  <% } else { 
				  		String firstPage = _ctx.appRes("UIAnswersPageIterator.label.BackFirstPage") ;
				  		String priviousPage = _ctx.appRes("UIAnswersPageIterator.label.PreviousPage") ;
				  %>
				    <a title="$firstPage" class="Icon LastTopPageIcon" href="<%=uicomponent.event("GoPage","first")%>"></a>        
				    <a title="$priviousPage" class="Icon LastPageIcon" href="<%=uicomponent.event("GoPage","previous")%>"></a>
				  <% } %>
				  <% 
				  	for(number in uicomponent.getTotalpage()) {
				  		if(number.equals(selected)) {
				  %>
						  <div class="Number">
						    <a class="PageSelected" style="color:#0183f1; font-weight:bold;">$number</a>
						  </div>
				  	<%} else {%>
						  <div class="Number">
						    <a class="PageNormal" href="<%=uicomponent.event("GoPage",number)%>">$number</a>
						  </div>
				  	<% } %>
				  <%} %>
				  <% if(pageSelected != max_page) {
				  		String nextPage = _ctx.appRes("UIAnswersPageIterator.label.NextPage") ;
				  		String lastPage = _ctx.appRes("UIAnswersPageIterator.label.LastPage");
				  %>  
				    <a title="$nextPage" class="Icon NextPageIcon" href="<%=uicomponent.event("GoPage","next")%>"></a>
				    <a title="$lastPage" class="Icon NextTopPageIcon" href="<%=uicomponent.event("GoPage","last")%>"></a>
				  <% } else { %>  
				    <div class="Icon DisableNextPageIcon"><span></span></div>
				    <div class="Icon DisableNextTopPageIcon"><span></span></div>
				  <% } %>
				    <div style="clear:left;"><span></span></div>
				  </div>
				  <div class="LeftPageIteratorBlock">
				  	<div class="TotalPages"><%=_ctx.appRes("UIAnswersPageIterator.label.TotalPages")%>:</div>
				  	<div class="PagesTotalNumber"><%=max_page%></div>
				  	<div style="clear:left;"><span></span></div>
				  </div>
			  </div>
			  <div style="clear:right;"><span></span></div>
			</div>
	<%
		}
	}
%>
