<%
--[[ Define some variables to make locating other resources easier
     firstPage was defined in our manifest.]]

    local others = "content"
    local theRoot = "."
    local mySize = "thumb"
%>

<% --[[ Include the page header]] %>
<%@ include file="head.html" %>

  <% --[[ Main grid area ]] %>

  <div id="stage">
    <div id="index">
      <lr:ThumbnailGrid>
        <%
			--[[ Logic for putting borders around all the grid cells ]]

			local borderFunc = function( row, column )
				local result = ''
				if column == columns then result = ' borderRight' end
				if row == rows then result = result .. ' borderBottom' end
				return result
			end
		%>

		<% --[[ The grid ]] %>

        <lr:GridPhotoCell>
          <div class="thumbnail borderTopLeft<%= borderFunc( row, column ) %>" onmouseover="window.gridOn( this.parentNode, 'ID<%= image.imageID %>_thumb' );" onmouseout="window.gridOff( this.parentNode );" onclick="window.location.href='$others/<%= image.exportFilename %>_large.html'">
            <div class="itemNumber">$cellIndex</div>
            <a href="$others/<%= image.exportFilename %>_large.html" onclick="return needThumbImgLink;">
            <div style="margin-left:<%= 80 - math.floor( image.renditions.thumb.width / 2 ) %>px; margin-top:<%= 80 - math.floor( image.renditions.thumb.height / 2 ) %>px;">
              <% if model.nonCSS.dropShadows then %>
              <div class="dropShadow">
                <div class="inner">
                  <% end %>
                  <img src="$others/images/thumb/<%= image.exportFilename %>.jpg" id="ID<%= image.imageID %>_thumb" alt="" class="thumb" />
                  <% if model.nonCSS.dropShadows then %>
                </div>
              </div>
              <% end %>
            </div>
            </a> </div>
        </lr:GridPhotoCell>
        <lr:GridEmptyCell>
          <div class="emptyThumbnail borderTopLeft <%= borderFunc( row, column ) %>"></div>
        </lr:GridEmptyCell>
        <lr:GridRowEnd>
          <div class="clear">
          </div>
        </lr:GridRowEnd>
      </lr:ThumbnailGrid>
    </div>
  </div>
  <div class="clear">
  </div>

  <% --[[ Pagination section ]] %>

<% if numGridPages > 1 then %>
  <div class="pagination">
    <ul>
      <lr:Pagination>
        <lr:CurrentPage>
          <li class="current textColor">$page</li>
        </lr:CurrentPage>
        <lr:OtherPages>
          <li class="textColor"> <a href="$link">$page</a> </li>
        </lr:OtherPages>
		<lr:PreviousEnabled>
	      <li class="previous textColor"> <a class="paginationLinks" href="$link"><%= LOC "$$$/AgWPG/Templates/HTML/output/Previous=Previous" %></a> </li>
		</lr:PreviousEnabled>
		<lr:PreviousDisabled>
	      <li class="previous textColor"> <%= LOC "$$$/AgWPG/Templates/HTML/output/Previous=Previous" %> </li>
		</lr:PreviousDisabled>
		<lr:NextEnabled>
	      <li class="next textColor"> <a class="paginationLinks" href="$link"><%= LOC "$$$/AgWPG/Templates/HTML/output/Next=Next" %></a> </li>
		</lr:NextEnabled>
		<lr:NextDisabled>
	      <li class="next textColor"> <%= LOC "$$$/AgWPG/Templates/HTML/output/Next=Next" %> </li>
		</lr:NextDisabled>
      </lr:Pagination>
    </ul>
  </div>
<% end %>

<% --[[ Include the page footer]] %>
<%@ include file="foot.html" %>
