<participant>
     <quickSearch><![CDATA[_total]]></quickSearch>
     <insertText location="aboveHTML+75">
<![CDATA[
<%
// *** Recordset Stats: if we don't know the record count, manually count them

if (@@rsName@@_total == -1) {

  // count the total records by iterating through the recordset
  for (@@rsName@@_total=0; !@@rsName@@.EOF; @@rsName@@.MoveNext()) {
    @@rsName@@_total++;
  }

  // reset the cursor to the beginning
  if (@@rsName@@.CursorType > 0) {
    if (!@@rsName@@.BOF) @@rsName@@.MoveFirst();
  } else {
    @@rsName@@.Requery();
  }

  // set the number of rows displayed on this page
  if (@@rsName@@_numRows < 0 || @@rsName@@_numRows > @@rsName@@_total) {
    @@rsName@@_numRows = @@rsName@@_total;
  }

  // set the first and last displayed record
  @@rsName@@_last  = Math.min(@@rsName@@_first + @@rsName@@_numRows - 1, @@rsName@@_total);
  @@rsName@@_first = Math.min(@@rsName@@_first, @@rsName@@_total);
}
%>
]]>
     </insertText>
     <searchPatterns whereToSearch="directive">
       <searchPattern paramNames="rsName"><![CDATA[/\b(\w+)_total\+\+;/]]></searchPattern>
     </searchPatterns>
     <updatePatterns>
       <updatePattern paramName="rsName"><![CDATA[/(\W)\w+(_total|_numRows|_first|_last|\.EOF|\.MoveNext|\.MoveFirst|\.CursorType|\.Requery)/g]]></updatePattern>
     </updatePatterns>
</participant>
