<%response.Expires=1440%>

<% pageTitle = "Ridecamp Search" 
  secondaryBanner = "/images/ENbanner_sm_right_ridecamp.jpg"
'   sectionHead_Image = "/images/header_ridecamp.jpg"
   sectionHead_String = "<h1><font color='red'>Search</font> The Ridecamp Archives</h1>"
%>
<!--#include virtual="/include/siteHeader.html" -->
<center>
  <table cellspacing="3" cellpadding="3" border="1">
   <tr>
    <td bgcolor="#ffffff">

     <center>
     <p>
     <font face="verdana" size="3"><b>Search the Archives:</b>
</center>

     <font size="2" font face="verdana">

<!--#include virtual="/ridecamp/archives/lockdown.html" -->

<%
    DebugFlag = FALSE
    NewQuery = FALSE
    UseSavedQuery = FALSE
    SearchString = ""
    QueryForm = Request.ServerVariables("PATH_INFO")

    if Request.ServerVariables("REQUEST_METHOD") = "POST" then
        SearchString = Request.Form("SearchString")
        DocAuthorRestriction = Request.Form("DocAuthorRestriction")
        FSRest = Request.Form("FSRest")
        FSRestVal = Request.Form("FSRestVal")
        FSRestOther = Request.Form("FSRestOther")
        FMMod = Request.Form("FMMod")
        FMModDate = Request.Form("FMModDate")
        SortBy = Request.Form("SortBy")
        Colset = Request.Form("ColChoice")
        Scope = Request.Form("Scope")
		RankBase = Request.Form("RankBase")
        ' NOTE: this will be true only if the button is actually pushed.
        if Request.Form("Action") = "Find" then
            NewQuery = TRUE
        elseif Request.Form("pg") <> "" then
            UseSavedQuery=TRUE
            NextPageNumber = Request.Form("pg")
        end if
    end if
 %>

<SCRIPT LANGUAGE=JavaScript>
<!--

function SetAll()
{
    document.QForm.SearchString.value = "<%=SearchString%>";

    <%select case FSRest%>
    <%case " > "%>
        document.QForm.FSRest.selectedIndex = 1;
    <%case else%>
        document.QForm.FSRest.selectedIndex = 0;
    <%end select%>

    <%select case FSRestVal%>
    <%case "any"%>
        document.QForm.FSRestVal.selectedIndex = 0;
    <%case "100"%>
        document.QForm.FSRestVal.selectedIndex = 1;
    <%case "1024"%>
        document.QForm.FSRestVal.selectedIndex = 2;
    <%case "10240"%>
        document.QForm.FSRestVal.selectedIndex = 3;
    <%case "102400"%>
        document.QForm.FSRestVal.selectedIndex = 4;
    <%case "1048576"%>
        document.QForm.FSRestVal.selectedIndex = 5;
    <%case "10485760"%>
        document.QForm.FSRestVal.selectedIndex = 6;
    <%case "104857600"%>
        document.QForm.FSRestVal.selectedIndex = 7;
    <%case "other"%>
        document.QForm.FSRestVal.selectedIndex = 8;
    <%case else%>
        document.QForm.FSRestVal.selectedIndex = 0;
    <%end select%>

    document.QForm.FSRestOther.value = "<%=FSRestOther%>";

    <%select case FMMod%>
    <%case "any"%>
        document.QForm.FMMod.selectedIndex = 0;
    <%case "-10n"%>
        document.QForm.FMMod.selectedIndex = 1;
    <%case "-1h"%>
        document.QForm.FMMod.selectedIndex = 2;
    <%case "-1d"%>
        document.QForm.FMMod.selectedIndex = 3;
    <%case "-1w"%>
        document.QForm.FMMod.selectedIndex = 4;
    <%case "-1m"%>
        document.QForm.FMMod.selectedIndex = 5;
    <%case "-1y"%>
        document.QForm.FMMod.selectedIndex = 6;
    <%case "since"%>
        document.QForm.FMMod.selectedIndex = 7;
    <%case else%>
        document.QForm.FMMod.selectedIndex = 0;
    <%end select%>

    document.QForm.FMModDate.value = "<%=FMModDate%>";

    document.QForm.DocAuthorRestriction.value = "<%=DocAuthorRestriction%>";
}
//-->
</SCRIPT>



<FORM NAME="QForm" ACTION="<%=QueryForm%>" METHOD=POST>

<!--     -->

<table width=500 border=0 bgcolor="#xaa99cc">
 <tr>
  <td align="right"><font face="comic sans ms">Search string:</font></td>
  <td><INPUT TYPE="TEXT" NAME="SearchString" SIZE="46" MAXLENGTH="100" VALUE=""></td>
 </tr><tr>
  <td align="right"><font face="comic sans ms">Where File Size is:</font></td>
  <td><SELECT NAME="FSRest">
        <!--
          <OPTION VALUE=" &lt; " <%if FSRest = " < " then%>SELECTED <%end if%>>Less Than
          <OPTION VALUE=" &gt; " <%if FSRest = " > " then%>SELECTED <%end if%>>Greater Than
        -->
        <OPTION VALUE=" &lt; " SELECTED>Less Than
        <OPTION VALUE=" &gt; " >Greater Than
      </SELECT>
      <SELECT NAME="FSRestVal">
        <OPTION VALUE="any" SELECTED>any size
        <OPTION VALUE="100" >100 bytes
        <OPTION VALUE="1024" >1K bytes
        <OPTION VALUE="10240" >10K bytes
        <OPTION VALUE="102400" >100K bytes
        <OPTION VALUE="1048576" >1M byte
        <OPTION VALUE="10485760" >10M bytes
        <OPTION VALUE="104857600" >100M bytes
        <OPTION VALUE="other" >Other
      </SELECT>
      <INPUT TYPE="TEXT" NAME="FSRestOther" SIZE="12" MAXLENGTH="9" VALUE="">
  </td>
 </tr><tr>
  <td align="right"><font face="comic sans ms">Date Posted:</font></td>
  <td><SELECT NAME="FMMod">
        <OPTION VALUE="any" SELECTED >at any time.
        <OPTION VALUE="-10n">in the last 10 minutes.
        <OPTION VALUE="-1h">in the last hour.
        <OPTION VALUE="-1d">in the last day.
        <OPTION VALUE="-1w">in the last week.
        <OPTION VALUE="-1m">in the last month.
        <OPTION VALUE="-1y">in the last year.
        <OPTION VALUE="since">since GMT (yy/mm/dd)       .
     </SELECT>
     <INPUT TYPE="TEXT" NAME="FMModDate" SIZE="12" MAXLENGTH="9" VALUE="">
  </td>
 </tr><tr>
  <td align="right"><A HREF="ixtiphlp.htm">
		      <font face="comic sans ms">Tips for searching</font>
      </A></td>
   <td align="center">
     <INPUT TYPE="SUBMIT" NAME="Action" VALUE="Find">
     <INPUT TYPE="RESET"  NAME="Clear" VALUE="Clear">
   </td>
 </tr>
</table>
        <INPUT TYPE="HIDDEN" NAME="SortBy" VALUE="rank[d]">
        <INPUT TYPE="HIDDEN" NAME="ColChoice" VALUE="1">
        <INPUT TYPE="HIDDEN" NAME="Scope" VALUE="/">

</FORM>

<BR>

<%if DebugFlag then%>
    <PRE>
    SearchString         = <%=SearchString%>
    DocAuthorRestriction = <%=DocAuthorRestriction%>
    FSRest               = <%=FSRest%>
    FSRestVal            = <%=FSRestVal%>
    FSRestOther          = <%=FSRestOther%>
    FMMod                = <%=FMMod%>
    FMModDate            = <%=FMModDate%>
    SortBy               = <%=SortBy%>
    Colset               = <%=Colset%>
    Scope                = <%=Scope%>
    NewQuery             = <%=CStr(NewQuery)%>
    UseSavedQuery        = <%=CStr(UseSavedQuery)%>
    </PRE>
<%end if%>

<%
    if NewQuery then
        set Session("Query") = nothing
        set Session("Recordset") = nothing
        NextRecordNumber = 1
        set Q = Server.CreateObject("ixsso.Query")
        Q.Catalog = "RideCampArchives"
        Composer = ""
        TheQuery = ""

        if SearchString <> "" then
            if Left( SearchSting, 1 ) <> "@" AND Left( SearchString, 1 ) <> "#" AND Left( SearchString, 1 ) <> "$" then
                TheQuery = "@Contents " + SearchString
            else
                TheQuery = SearchString
            end if

            Composer = " & "
        end if

        if FSRestVal <> "any" then
            if FSRestVal <> "other" then
                TheQuery = "(@Size " + FSRest + FSRestVal + ") " + Composer + TheQuery
            else
                TheQuery = "(@Size " + FSRest + FSRestOther + ") " + Composer + TheQuery
            end if

            Composer = " & "
        end if

        if DocAuthorRestriction <> "" then
            TheQuery = "(@DocAuthor " + DocAuthorRestriction + ") " + Composer + TheQuery

            Composer = " & "
        end if

        if FMMod <> "" AND FMMod <> "any" then
            if FMMod <> "since" then
                TheQuery = "(@Write > " + FMMod + ") " + Composer + TheQuery
            else
                TheQuery = "(@Write > " + FMModDate + ") " + Composer + TheQuery
            end if
        end if

%> <%if DebugFlag then%> TheQuery = <%=TheQuery%> <%end if%> <%

        Q.Query = TheQuery

        Q.SortBy = SortBy
        if Scope <> "/" then
            set Util = Server.CreateObject("ixsso.Util")
            Util.AddScopeToQuery Q, Scope, "DEEP"
            set Util = nothing
        end if
        if ColSet = 1 then
            Q.Columns = "DocTitle, vpath, path, filename, size, write, characterization, rank"
            RecordsPerPage = 10
        elseif ColSet = 2 then
            Q.Columns = "vpath, path"
            RecordsPerPage = 200
        elseif ColSet = 3 then
            Q.Columns = "filename, vpath, size, write"
            RecordsPerPage = 25
        end if

        set RS = Q.CreateRecordSet("nonsequential")
        RS.PageSize = RecordsPerPage
        ActiveQuery = TRUE
    elseif UseSavedQuery then
        if IsObject( Session("Query") ) And IsObject( Session("RecordSet") ) then
            set Q = Session("Query")
            set RS = Session("RecordSet")
            if RS.RecordCount <> -1 and NextPageNumber <> -1 then
                RS.AbsolutePage = NextPageNumber
                NextRecordNumber = RS.AbsolutePosition
            end if
            ActiveQuery = TRUE
        else
            Response.Write "ERROR - No saved query"
        end if
    end if

    if ActiveQuery then
        if not RS.EOF then
 %>

<p>
<HR WIDTH=80% ALIGN=center SIZE=3>
<p>

<%
        LastRecordOnPage = NextRecordNumber + RS.PageSize - 1
        CurrentPage = RS.AbsolutePage
        if RS.RecordCount <> -1 AND RS.RecordCount < LastRecordOnPage then
            LastRecordOnPage = RS.RecordCount
        end if

        Response.Write "<font face='comic sans ms'>Documents " & NextRecordNumber & " to " & LastRecordOnPage
        if RS.RecordCount <> -1 then
            Response.Write " of " & RS.RecordCount
        end if

        if SearchString <> "" then
            Response.Write " matching the query " & chr(34) & "<I>"
            Response.Write SearchString & "</I>" & chr(34) & ".<P></font>"
        end if
 %>
</PRE>
<table border=0>
<!--
<colgroup width=105>
-->
<% Do While Not RS.EOF and NextRecordNumber <= LastRecordOnPage 

    ' This is the detail portion for Title, Abstract, URL, Size, and
    ' Modification Date.
    ' If there is a title, display it, otherwise display the filename.
	' Graphically indicate rank of document with list of stars (*'s).

	if NextRecordNumber = 1 then
		RankBase=RS("rank")
	
		if RankBase>1000 then
			RankBase=1000
		elseif RankBase<1 then
			RankBase=1
		end if
	end if

	NormRank = RS("rank")/RankBase

	if NormRank > 0.80 then
		stars = "rankbtn5.gif"
	elseif NormRank > 0.60 then
		stars = "rankbtn4.gif"
	elseif NormRank > 0.40 then
		stars = "rankbtn3.gif"
	elseif NormRank >.20 then
		stars = "rankbtn2.gif"
	else stars = "rankbtn1.gif"

	end if

      mypath=replace(mid(RS("path"), 20, 100), "\", "/")

%>
  <tr class="RecordTitle">
   <td align="right" class="RecordTitle">
     <font size=-1 face="comic sans ms">
     <%= NextRecordNumber%>.
     </font>
   </td>	
   <td align="right"><IMG src="<%=stars%>"></td>
   <td>
     <font size=-1 face="comic sans ms">
     <%=RS("write")%> GMT
     </font>
   </td>
   <td>
    <b class="RecordTitle"> 
    <%if VarType(RS("DocTitle")) = 1 or RS("DocTitle") = "" then%>
       <a href="<%=mypath%>" class="RecordTitle">
          <font face="comic sans ms">
          <%= Server.HTMLEncode( RS("filename") )%>
          </font>
       </a>
       <%else%>
	<a href="<%=mypath%>" class="RecordTitle">
          <font face="comic sans ms">
          <%= Server.HTMLEncode(RS("DocTitle"))%>
          </font>
        </a>
    <%end if%>
    </b>
   </td>           
  <tr><tr>
<!--

		<td valign=top align=left>
			<IMG SRC="<%=stars%>">
			<br>
 
<%
    ' Construct the URL for hit highlighting
			WebHitsQuery = "CiWebHitsFile=" & Server.URLEncode(mypath)
			WebHitsQuery = WebHitsQuery & "&CiRestriction=" & Server.URLEncode( Q.Query )
			WebHitsQuery = WebHitsQuery & "&CiBeginHilite=" & Server.URLEncode( "<b class=Hit>" )
			WebHitsQuery = WebHitsQuery & "&CiEndHilite=" & Server.URLEncode( "</b>" )
			WebHitsQuery = WebHitsQuery & "&CiUserParam3=" & QueryForm
'	        WebHitsQuery = WebHitsQuery & "&CiLocale=" & Q.LocaleID
 %>
            <a href="oop/qsumrhit.htw?<%= WebHitsQuery %>"><IMG src="hilight.gif" align=left alt="Highlight matching terms in document using Summary mode."> Summary</a>
			<br>
			<a href="oop/qfullhit.htw?<%= WebHitsQuery %>&CiHiliteType=Full"><IMG src="hilight.gif" align=left alt="Highlight matching terms in document."> Full</a>

		</td>
-->

	<td valign=top>
			<%if VarType(RS("characterization")) = 8 and RS("characterization") <> "" then%>
				
<!--
<b><i>Abstract:  </I></b><%= Server.HTMLEncode(RS("characterization"))%>
-->
            <%end if%>
<!--
			<p>
			<i class="RecordStats"><a href="<%=RS("vpath")%>" class="RecordStats" style="color:blue;">http://<%=Request("server_name")%><%=RS("vpath")%></a>
            <br><%if RS("size") = "" then%>(size and time unknown)<%else%>size <%=RS("size")%> bytes - <%=RS("write")%> GMT<%end if%></i>
		</td>
	</tr>
	<tr>
-->
</tr>
<%
          RS.MoveNext
          NextRecordNumber = NextRecordNumber+1
      Loop
 %>

</table>

<P><BR>

<%
  else   ' NOT RS.EOF
      if NextRecordNumber = 1 then
          Response.Write "No documents matched the query<P>"
      else
          Response.Write "No more documents in the query<P>"
      end if

  end if ' NOT RS.EOF
 %>

<!-- If the index is out of date, display the fact -->

<%if NOT Q.OutOfDate then%>
    <P>
    <I>The index is up-to-date.</I><BR>
<%end if%>

<!--
    If the query was not executed because it needed to enumerate to
    resolve the query instead of using the index, but AllowEnumeration
    was FALSE, let the user know
-->

<%if Q.QueryIncomplete then%>
    <P>
    <I><B>The query is too expensive to complete.</B></I><BR>
<%end if%>

<!--
    If the query took too long to execute (for example, if too much work
    was required to resolve the query), let the user know
-->

<%if Q.QueryTimedOut then%>
    <P>
    <I><B>The query took too long to complete.</B></I><BR>
<%end if%>


<TABLE border=0>

<!--
    This is the "previous" button.
    This retrieves the previous page of documents for the query.
-->

<%SaveQuery = FALSE%>
<%if CurrentPage > 1 and RS.RecordCount <> -1 then ' BUGBUG - use RS.Supports(adMovePrevious)%>
    <td align=right colspan=2>
        <form action="<%=QueryForm%>" method="post">
           <INPUT TYPE="HIDDEN" NAME="SearchString" VALUE="<%=SearchString%>">
           <INPUT TYPE="HIDDEN" NAME="DocAuthorRestriction"  VALUE="<%=DocAuthorRestriction%>">
           <INPUT TYPE="HIDDEN" NAME="FSRest" VALUE="<%=FSRest%>">
           <INPUT TYPE="HIDDEN" NAME="FSRestVal" VALUE="<%=FSRestVal%>">
           <INPUT TYPE="HIDDEN" NAME="FSRestOther" VALUE="<%=FSRestOther%>">
           <INPUT TYPE="HIDDEN" NAME="FMMod" VALUE="<%=FMMod%>">
           <INPUT TYPE="HIDDEN" NAME="FMModDate" VALUE="<%=FMModDate%>">
           <INPUT TYPE="HIDDEN" NAME="SortBy" VALUE="<%=SortBy%>">
           <INPUT TYPE="HIDDEN" NAME="Colset" VALUE="<%=ColChoice%>">
           <INPUT TYPE="HIDDEN" NAME="Scope" VALUE="<%=Scope%>">
           <INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage-1%>" >
		   <INPUT TYPE="HIDDEN" NAME="RankBase" VALUE="<%=RankBase%>">

           <input type="submit" value="Previous <%=RS.PageSize%> documents">
        </form>
    </td>
    <%SaveQuery = TRUE%>
<%end if%>

<!--
    This is the "next" button.
    This button retrieves the next page of documents for the query.
-->

<%if Not RS.EOF then%>
    <td align=left colspan=2>
        <form action="<%=QueryForm%>" method="post">

           <INPUT TYPE="HIDDEN" NAME="SearchString" VALUE="<%=SearchString%>">
           <INPUT TYPE="HIDDEN" NAME="DocAuthorRestriction"  VALUE="<%=DocAuthorRestriction%>">
           <INPUT TYPE="HIDDEN" NAME="FSRest" VALUE="<%=FSRest%>">
           <INPUT TYPE="HIDDEN" NAME="FSRestVal" VALUE="<%=FSRestVal%>">
           <INPUT TYPE="HIDDEN" NAME="FSRestOther" VALUE="<%=FSRestOther%>">
           <INPUT TYPE="HIDDEN" NAME="FMMod" VALUE="<%=FMMod%>">
           <INPUT TYPE="HIDDEN" NAME="FMModDate" VALUE="<%=FMModDate%>">
           <INPUT TYPE="HIDDEN" NAME="SortBy" VALUE="<%=SortBy%>">
           <INPUT TYPE="HIDDEN" NAME="Colset" VALUE="<%=ColChoice%>">
           <INPUT TYPE="HIDDEN" NAME="Scope" VALUE="<%=Scope%>">
           <INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage+1%>" >
		   <INPUT TYPE="HIDDEN" NAME = "RankBase" VALUE="<%=RankBase%>">

            <% NextString = "Next "
               if RS.RecordCount <> -1 then
                   NextSet = (RS.RecordCount - NextRecordNumber) + 1
                   if NextSet > RS.PageSize then
                       NextSet = RS.PageSize
                   end if
                   NextString = NextString & NextSet & " documents"
               else
                   NextString = NextString & " page of documents"
               end if
             %>
            <input type="submit" value="<%=NextString%>">
        </form>
    </td>
    <%SaveQuery = TRUE%>
<%end if%>

</TABLE>


<!-- Display the page number -->

   <font face="comic sans ms">Page <%=CurrentPage%>
<%if RS.PageCount <> -1 then
     Response.Write " of " & RS.PageCount
  end if %>
   </font>
<%
    ' If either of the previous or back buttons were displayed, save the query
    ' and the recordset in session variables.
    if SaveQuery then
        set Session("Query") = Q
        set Session("RecordSet") = RS
    else
        RS.close
        Set RS = Nothing
        Set Q = Nothing
        set Session("Query") = Nothing
        set Session("RecordSet") = Nothing
    end if
 %>
<% end if %>

</ul>
</font>
</td>
</tr>
</table>

<!--#include virtual="/include/siteTrailer.html" -->
