<participant>
     <quickSearch><![CDATA[(!MM_paramIsDefined]]></quickSearch>
     <insertText location="aboveHTML+82">
<![CDATA[
<%
// *** Move To Record: handle 'index' or 'offset' parameter

if (!MM_paramIsDefined && MM_rsCount != 0) {

  //use index parameter if defined, otherwise use offset parameter
  String r = request.getParameter("index");
  if (r==null) r = request.getParameter("offset");
  if (r!=null) MM_offset = Integer.parseInt(r);

  // if we have a record count, check if we are past the end of the recordset
  if (MM_rsCount != -1) {
    if (MM_offset >= MM_rsCount || MM_offset == -1) {  // past end or move last
      if (MM_rsCount % MM_size != 0)    // last page not a full repeat region
        MM_offset = MM_rsCount - MM_rsCount % MM_size;
      else
        MM_offset = MM_rsCount - MM_size;
    }
  }

  //move the cursor to the selected record
  int i;
  for (i=0; @@rsName@@_hasData && (i < MM_offset || MM_offset == -1); i++) {
    @@rsName@@_hasData = MM_rs.next();
  }
  if (!@@rsName@@_hasData) MM_offset = i;  // set MM_offset to the last possible record
}
%>
]]>
     </insertText>
     <searchPatterns whereToSearch="directive">
       <searchPattern><![CDATA[/r\s*=\s*request\.getParameter\("index"\);/]]></searchPattern>
       <searchPattern paramNames="rsName"><![CDATA[/\b(\w+)_hasData/]]></searchPattern>
     </searchPatterns>
     <updatePatterns>
       <updatePattern paramName="rsName"><![CDATA[/(\W)\w+(_hasData)/g]]></updatePattern>
     </updatePatterns>
</participant>
