<%@ Language = VBScript %> <% Option Explicit %> <% response.buffer = true response.expiresAbsolute = #1/1/2000# response.CacheControl = "Private" dim relative_path_to_database dim this_page dim table_name dim item_type relative_path_to_database = "2020applications.mdb" %> <% this_page = "vehiclelistings" table_name = "vehicles" item_type = "vehicle" dim vehicleID CALL GetTemplate_Styles_Header(this_page) cn.close set cn=nothing dim SQL dim sub_rs dim i dim company_rs dim display_options_array dim ID_array dim j %> <% SUB WriteDocuments(ID) SQL = "SELECT * FROM "& item_type &"_images WHERE "& item_type &"ID = "& ID &" AND NOT isPhoto;" set sub_rs = Server.CreateObject("ADODB.RecordSet") sub_rs.Open SQL,cn,3,1,-1 IF sub_rs.RecordCount = 0 THEN ' ELSE response.write("

Documents:
") sub_rs.MoveFirst DO UNTIL sub_rs.EOF %> " target=_blank>" border=0 width=16 height=16> " target=_blank> <% IF sub_rs("notes") <> "" THEN %> <%=sub_rs("notes")%> <% ELSE %> <%=Replace(sub_rs("imageURL"),"uploads/","")%> <% END IF %>
<% sub_rs.MoveNext LOOP response.write("

") END IF sub_rs.close set sub_rs = nothing %> <% END SUB SUB WritePhotos(ID,status) SQL = "SELECT order_number,* FROM "& item_type &"_images WHERE "& item_type &"ID = "& ID &" AND isPhoto ORDER BY order_number;" set sub_rs = Server.CreateObject("ADODB.RecordSet") sub_rs.Open SQL,cn,3,1,-1 IF sub_rs.RecordCount = 0 THEN ' ELSE dim array_size,images_array array_size = sub_rs.RecordCount ReDim images_array(3,array_size) i = 0 sub_rs.MoveFirst DO UNTIL sub_rs.EOF images_array(0,i) = sub_rs("imageID") images_array(1,i) = sub_rs("imageURL") images_array(2,i) = sub_rs("notes") i = i + 1 sub_rs.MoveNext LOOP END IF sub_rs.close set sub_rs = nothing IF array_size > 0 THEN i = 0 %> <% IF array_size > 1 THEN FOR i = 1 TO array_size -1 IF i MOD 5 = 1 THEN response.write("") %> <% IF i MOD 5 = 0 THEN response.write("") NEXT i = i - 1 IF i MOD 5 <> 0 THEN DO UNTIL i MOD 5 = 0 response.write("") i = i + 1 LOOP response.write("") END IF END IF %>
1 THEN response.write("colspan=5") %> align=center>
1 THEN response.write("colspan=5") %>> ¬es=<%=ReplaceQuotes(images_array(2,i))%>','400','300','0','0','no','no','yes','no','no','yes');return false;" width=300 height=225 border=1 style=border-style:solid;border-width:1px;border-color:#000000; alt="Click on Photos to Enlarge.">
¬es=<%=ReplaceQuotes(images_array(2,i))%>','400','300','0','0','no','no','yes','no','no','yes');return false;" onMouseOver="changeImageInfo('<%=images_array(1,i)%>','<%=images_array(2,i)%>');return false;" onMouseOut="changeImageInfo('<%=images_array(1,0)%>','<%=images_array(2,0)%>');return false;"><%=images_array(2,i)%>
<% END IF END SUB %> <% SUB WriteSearch(submit_page) %>
onSubmit="checkValues(this);return true;">

Search... Tell us what you're looking for, and we'll help you find it on our web site.

<% IF searchShowSaleType THEN SQL = "SELECT DISTINCTROW categories.categoryname FROM categories WHERE (categories.categoryname = 'For Sale' OR categories.categoryname = 'For Lease' OR categories.categoryname = 'For Rent' OR categories.categoryname = 'For Sale or Lease' OR categories.categoryname = 'Display Only' OR categories.categoryname = 'For Sale by Auction') AND categories.categoryID IN (SELECT category_"& item_type &"_link.categoryID as [temp] FROM category_"& item_type &"_link INNER JOIN "& table_name &" ON "& table_name &"."& item_type &"ID = category_"& item_type &"_link."& item_type &"ID WHERE "& table_name &".show_on_website " IF itemsExpire AND hideExpiredFromPublic THEN SQL = SQL &" AND (NOT isDate("& table_name &".closing_date) OR DateDiff('D',"& table_name &".closing_date,Date()) < 0) " END IF SQL = SQL &") ORDER BY categories.categoryname;" set rs = cn.Execute(SQL) IF rs.bof AND rs.eof THEN ' ELSE %> <% END IF rs.close set rs = nothing END IF %> <% IF searchShowMainCategory THEN %> <% END IF %> <% IF searchShowSubCategory THEN %> <% END IF %> <% IF searchShowManufacturer THEN %> <% END IF %> <% IF searchShowModel THEN %> <% END IF %> <% IF searchShowYear THEN %> <% END IF %> <% IF searchShowListingPrice THEN IF searchListingPriceType THEN %> <% ELSE %> <% END IF END IF %> <% IF searchShowDateEntered THEN %> <% END IF %> <% IF searchShowPageSize THEN %> <% END IF %> <% IF searchShowSortOrder THEN %> <% END IF %> <% IF searchShowKeyWords THEN %> <% END IF %> <% IF searchShowStockNumber THEN %> <% END IF %> <% IF searchShowVehicleID THEN %> <% END IF %> <% IF searchShowVIN THEN %> <% END IF %>
Show Items:
<%=MainCategory%>:
<%=SubCategory%>:
<%=fieldManufacturer%>:
<%=fieldModel%>:
<%=fieldYear%>: (yyyy)
<%=fieldListingPrice%>:
<%=fieldListingPrice%> Range: to
<%=fieldDateEntered%>:
Results / Page:
Order:
Keywords:
Match: ALL words
ANY words

Or you can enter the <%=fieldStockNumber%> of the vehicle you wish to see.


Or you can enter the <%=fieldVehicleID%> of the vehicle you wish to see.


Or you can enter the <%=fieldVIN%> of the vehicle you wish to see.

<% END SUB %> <% SUB WriteVehiclesList(page_size,current_page,records_displayed,ID,display_title,listing_price,listing_price_terms,manufacturer,model,year,display_options,status) %> "><%=manufacturer%>, <%=model%> <%=year%> <% set sub_rs = cn.Execute("SELECT categories.supercategory, categories.categoryname FROM categories INNER JOIN category_"& item_type &"_link ON categories.categoryID = category_"& item_type &"_link.categoryID WHERE category_"& item_type &"_link."& item_type &"ID = "& ID &" AND categories.supercategory ORDER BY categories.supercategory,categories.categoryname;") response.write("") IF sub_rs.bof AND sub_rs.eof THEN response.write("") ELSE sub_rs.movefirst response.write(sub_rs("categoryname")) END IF response.write(" <% set sub_rs = cn.Execute("SELECT categories.categoryname FROM categories INNER JOIN category_"& item_type &"_link ON categories.categoryID = category_"& item_type &"_link.categoryID WHERE category_"& item_type &"_link."& item_type &"ID = "& ID &" AND categories.supercategory = 0 AND NOT (categories.categoryname = 'For Sale' OR categories.categoryname = 'For Rent' OR categories.categoryname = 'For Lease' OR categories.categoryname = 'For Sale or Lease' OR categories.categoryname = 'For Sale by Auction' OR categories.categoryname = 'Display Only');") IF sub_rs.bof AND sub_rs.eof THEN response.write("") ELSE sub_rs.movefirst i = 0 response.write("") DO UNTIL sub_rs.eof IF i > 0 THEN response.write(", ") response.write(sub_rs("categoryname")) i = i + 1 sub_rs.movenext LOOP response.write("") END IF sub_rs.close set sub_rs=nothing %>
<% IF Mid(display_options,7,1) = "1" AND status <> "Display Only" THEN IF status = "Reduced" THEN response.write(""& DisplayCurrency(listing_price) &"") ELSEIF status = "Sold" THEN response.write(""& DisplayCurrency(listing_price) &"") ELSEIF status = "Contract Pending" THEN response.write(""& DisplayCurrency(listing_price) &"") ELSE response.write(""& DisplayCurrency(listing_price) &"") END IF IF len(listing_price_terms) > 0 THEN response.write(" "& Replace(listing_price_terms,"Per"," /") &"") END IF ELSE response.write("
-
") END IF %>
<% END SUB %> <% SUB WriteVehicleSummaries(page_size,current_page,records_displayed,ID,display_title,manufacturer,model,year,listing_price,listing_price_terms,exterior_colour,interior_colour,body_style,doors,comments,display_options,status) display_options_array = Split(display_options,",") %>
<%=display_title%> <% IF status = "Reduced" OR status = "Sold" OR status = "Contract Pending" THEN response.write(""& status &" ") ELSE set sub_rs = cn.Execute("SELECT categories.categoryname FROM categories INNER JOIN category_"& item_type &"_link ON categories.categoryID = category_"& item_type &"_link.categoryID WHERE category_"& item_type &"_link."& item_type &"ID = "& ID &" AND (categories.categoryname = 'For Sale' OR categories.categoryname = 'For Rent' OR categories.categoryname = 'For Lease' OR categories.categoryname = 'For Sale by Auction' OR categories.categoryname = 'For Sale or Lease' OR categories.categoryname = 'Display Only');") IF sub_rs.bof AND sub_rs.eof THEN ' ELSE sub_rs.movefirst %> <%=sub_rs("categoryname")%>  <% END IF sub_rs.close set sub_rs=nothing END IF IF display_options_array(3) <> 0 AND status <> "Display Only" THEN IF status = "Reduced" THEN response.write(""& DisplayCurrency(listing_price) &"") ELSE response.write(DisplayCurrency(listing_price)) END IF IF len(listing_price_terms) > 0 THEN response.write(" "& Replace(listing_price_terms,"Per"," /")) END IF END IF %>
<% set sub_rs = cn.Execute("SELECT "& item_type &"_images.imageURL FROM "& item_type &"_images WHERE "& item_type &"ID = "& ID &" AND isPhoto ORDER BY order_number;") IF sub_rs.bof AND sub_rs.eof THEN ' ELSE sub_rs.movefirst %> <% END IF sub_rs.close set sub_rs=nothing %>
<%=year%> <% IF manufacturer <> "" AND display_options_array(1) <> 0 THEN response.write(" "& manufacturer &" ") END IF %> <%=model%>

<% IF exterior_colour <> "" OR interior_colour <> "" THEN IF exterior_colour <> "" AND display_options_array(6) <> 0 THEN response.write(exterior_colour) IF interior_colour <> "" AND display_options_array(7) <> 0 THEN response.write("/") ELSE response.write("
") END IF END IF IF interior_colour <> "" AND display_options_array(7) <> 0 THEN response.write(interior_colour &"
") END IF END IF IF (doors <> "" AND doors <> "0") AND display_options_array(10) <> 0 THEN response.write(fieldDoors &": "& doors &"
") END IF IF body_style <> "" AND display_options_array(8) <> 0 THEN response.write(fieldBodyStyle &": "& body_style &"
") END IF IF comments <> "" AND display_options_array(16) <> 0 THEN response.write("
"& comments &"
") END IF %>
">" width=140 height=105 border=0 alt="Click here for more information about this <%=item_type%>.">
<% set sub_rs = cn.Execute("SELECT people.peopleID,people.title,people.firstname,people.lastname FROM people INNER JOIN people_"& item_type &"_link ON people.peopleID = people_"& item_type &"_link.peopleID WHERE people_"& item_type &"_link."& item_type &"ID = "& ID &";") IF sub_rs.bof AND sub_rs.eof THEN ' ELSE sub_rs.movefirst %> <%=Agent%>: " class=incolouredtablecell><%=sub_rs("title")%> <%=sub_rs("firstname")%> <%=sub_rs("lastname")%> <% END IF sub_rs.close set sub_rs = nothing %> " class=incolouredtablecell>More Info >

<% END SUB %> <% SUB RecordsNav(page_location,total_records,total_page_count,current_page) i = 0 %> <% IF page_location = "top" THEN i = 0 IF request.querystring("categoryID_list") <> "" THEN %> <% END IF response.write("") END IF %> <% IF page_location = "top" AND (total_records > 1 OR total_page_count > 1 OR request.querystring("agentID") <> "") THEN %> <% END IF %> <% IF total_page_count > 1 THEN %> <% ELSE %> <% END IF %>
<% j = Replace(Replace(request.querystring("categoryID_list"),", ","_"),"__","_") IF Left(j,1) = "_" THEN j = Mid(j,2) END IF IF Right(j,1) = "_" THEN j = Left(j,len(j)-1) END IF IF Instr(j,"_") <> 0 THEN ID_array = Split(j,"_") FOR i = 0 TO UBound(ID_array) set rs=cn.Execute("SELECT categoryname FROM categories WHERE categoryID = "& ID_array(i) &";") IF rs.bof AND rs.eof THEN ' ELSE IF i <> UBound(ID_array) THEN IF i = 0 THEN %> "><%=rs("categoryname")%> > <% ELSE %> "><%=rs("categoryname")%> or <% END IF ELSE %> "><%=rs("categoryname")%> <% END IF END IF rs.close set rs = nothing NEXT ELSE i = 1 set rs=cn.Execute("SELECT categoryname FROM categories WHERE categoryID = "& j &";") IF rs.bof AND rs.eof THEN ' ELSE response.write(""& rs("categoryname") &"") END IF rs.close set rs = nothing END IF %>
"& WritePageTitle &"

<% IF total_records > 1 THEN %> Total Records Found : <%=total_records%> <% END IF %> <% IF total_page_count > 1 THEN %> | Displaying page <%=current_page%> of <%=total_page_count%> <% END IF %> <% IF request.querystring("agentID") <> "" THEN set sub_rs = cn.Execute("SELECT * FROM people WHERE peopleID = "& request.querystring("agentID") &";") IF sub_rs.bof AND sub_rs.eof THEN ' ELSE sub_rs.movefirst %> | All Listings of : <%=sub_rs("title")%> <%=sub_rs("firstname")%> <%=sub_rs("lastname")%> <% END IF sub_rs.close set sub_rs = nothing END IF %>

<% IF CInt(current_page) > 2 THEN %> « ">First <% ELSE %> « First <% END IF %> <% IF CInt(current_page) > 1 THEN %> < ">Previous <% ELSE %> < Previous <% END IF %> | ">All Results | <% IF CInt(current_page) < CInt(total_page_count) THEN %> ">Next > <% ELSE %> Next > <% END IF %> <% IF CInt(current_page) < CInt(total_page_count-1) THEN %> ">Last » <% ELSE %> Last » <% END IF %>
<% IF page_location="top" THEN response.write("
") %>

<% END SUB %> <% SUB WriteBriefDisplay(page_size,current_page,records_displayed,ID,display_title,listing_price,listing_price_terms,manufacturer,model,year,display_options,status) display_options_array = Split(display_options,",") IF records_displayed MOD 2 = 0 THEN %> <% END IF %>
<%=display_title%>
<% set sub_rs = cn.Execute("SELECT "& item_type &"_images.imageURL FROM "& item_type &"_images WHERE "& item_type &"ID = "& ID &" AND isPhoto ORDER BY order_number;") IF sub_rs.bof AND sub_rs.eof THEN response.write("") ELSE sub_rs.movefirst %> ">" width=112 height=84 border=0 alt="Click to View Details of this <%=item_type%>"> <% END IF sub_rs.close set sub_rs=nothing %> <% IF display_options_array(3) <> 0 AND status <> "Display Only" THEN IF status = "Reduced" THEN response.write(""& status &": "& DisplayCurrency(listing_price) &"") ELSEIF status = "Sold" OR status = "Contract Pending" THEN response.write(""& status &": "& DisplayCurrency(listing_price)) ELSE response.write("Price: "& DisplayCurrency(listing_price)) END IF IF len(listing_price_terms) > 0 THEN response.write(" "& Replace(listing_price_terms,"Per"," /")) END IF response.write("
") END IF IF request.querystring("sale_type") <> "" THEN set sub_rs = cn.Execute("SELECT categories.categoryname FROM categories INNER JOIN category_"& item_type &"_link ON categories.categoryID = category_"& item_type &"_link.categoryID WHERE category_"& item_type &"_link."& item_type &"ID = "& ID &" AND (categories.categoryname = 'For Sale' OR categories.categoryname = 'For Rent' OR categories.categoryname = 'For Lease' OR categories.categoryname = 'For Sale by Auction' OR categories.categoryname = 'For Sale or Lease' OR categories.categoryname = 'Display Only');") IF sub_rs.bof AND sub_rs.eof THEN ' ELSE sub_rs.movefirst %> <%=sub_rs("categoryname")%>
<% END IF sub_rs.close set sub_rs=nothing END IF IF year <> "" AND display_options_array(2) <> 0 THEN response.write(year &" ") END IF IF manufacturer <> "" AND display_options_array(0) <> 0 THEN response.write(manufacturer &"
") END IF IF model <> "" AND display_options_array(1) <> 0 THEN response.write(model &"
") END IF %>
">View Details >
<% IF records_displayed MOD 2 = 0 THEN %>   <% ELSE %>   <% END IF END SUB %> <% SUB WriteBrowseOptions dim fs IF request.querystring = "" THEN %>
Browse... You can browse through our listings, or use the search below to find exactly what you're looking for. Please select one of our <%=LCase(MainCategory_plural)%>:

<% SQL = "SELECT DISTINCTROW categories.categoryID, categories.categoryname FROM categories WHERE categories.supercategory = 1 AND categories.categoryID IN (SELECT category_"& item_type &"_link.categoryID as [temp] FROM category_"& item_type &"_link INNER JOIN "& table_name &" ON "& table_name &"."& item_type &"ID = category_"& item_type &"_link."& item_type &"ID WHERE "& table_name &".show_on_website " IF itemsExpire AND hideExpiredFromPublic THEN SQL = SQL &" AND (NOT isDate("& table_name &".closing_date) OR DateDiff('D',"& table_name &".closing_date,Date()) < 0) " END IF SQL = SQL &") ORDER BY categories.categoryname;" set sub_rs = cn.Execute(SQL) IF sub_rs.bof AND sub_rs.eof THEN ' ELSE sub_rs.movefirst DO UNTIL sub_rs.eof %> " title="<%=sub_rs("categoryname")%>"><%=sub_rs("categoryname")%>
<% SQL = "SELECT DISTINCT category_"& item_type &"_link.categoryID, categories.categoryname FROM category_"& item_type &"_link INNER JOIN categories ON category_"& item_type &"_link.categoryID = categories.categoryID WHERE categories.supercategory = 0 AND NOT (categories.categoryname = 'For Sale' OR categories.categoryname = 'For Lease' OR categories.categoryname = 'For Rent' OR categories.categoryname = 'For Sale or Lease' OR categories.categoryname = 'Display Only' OR categories.categoryname = 'For Sale by Auction') AND category_"& item_type &"_link."& item_type &"ID IN (SELECT category_"& item_type &"_link."& item_type &"ID as [temp] FROM category_"& item_type &"_link INNER JOIN "& table_name &" ON "& table_name &"."& item_type &"ID = category_"& item_type &"_link."& item_type &"ID WHERE category_"& item_type &"_link.categoryID = "& sub_rs("categoryID") &" AND "& table_name &".show_on_website " IF itemsExpire AND hideExpiredFromPublic THEN SQL = SQL &" AND (NOT isDate("& table_name &".closing_date) OR DateDiff('D',"& table_name &".closing_date,Date()) < 0) " END IF SQL = SQL &") ORDER BY categories.categoryname;" set rs = cn.Execute(SQL) %>
<% IF rs.bof AND rs.eof THEN ELSE i=0 rs.movefirst DO UNTIL rs.eof %> <% IF i>0 THEN response.write(", ") %>" title="<%=sub_rs("categoryname")%>, <%=rs("categoryname")%>"><%=Left(rs("categoryname"),17)%><% IF len(rs("categoryname")) > 17 THEN response.write("...")%><% i=i+1 rs.movenext LOOP END IF %>
<% rs.close set rs = nothing sub_rs.movenext LOOP END IF sub_rs.close set sub_rs = nothing set fs = Server.CreateObject("Scripting.FileSystemObject") If fs.FileExists(Server.MapPath("geosearch.asp")) THEN %>

Or you can browse by Geographic Location.

<% END IF set fs = nothing set fs = Server.CreateObject("Scripting.FileSystemObject") If fs.FileExists(Server.MapPath("people.asp")) THEN %>

Perhaps you would like to Find an <%=Agent%>!

<% END IF set fs = nothing ELSE dim s_list s_list = "" SQL = "SELECT DISTINCTROW categories.categoryID, categories.categoryname FROM categories WHERE categories.supercategory = 1 AND categories.categoryID IN (SELECT category_"& item_type &"_link.categoryID as [temp] FROM category_"& item_type &"_link INNER JOIN "& table_name &" ON "& table_name &"."& item_type &"ID = category_"& item_type &"_link."& item_type &"ID WHERE "& table_name &".show_on_website " IF itemsExpire AND hideExpiredFromPublic THEN SQL = SQL &" AND (NOT isDate("& table_name &".closing_date) OR DateDiff('D',"& table_name &".closing_date,Date()) < 0) " END IF SQL = SQL &") ORDER BY categories.categoryname;" set sub_rs = cn.Execute(SQL) IF sub_rs.bof AND sub_rs.eof THEN ' ELSE sub_rs.movefirst %>
.asp>New Search

<% END IF IF s_list <> "" THEN ID_array = Split(s_list,",") %> <% ELSE %> <% END IF sub_rs.close set sub_rs = nothing END IF END SUB %> <% SUB DisplayPublic2020 IF request.querystring = "" THEN CALL WriteBrowseOptions CALL WriteSearch(this_page &".asp") ELSE dim current_page, top_rs, page_size, total_page_count, total_records, records_displayed, agentID IF request.querystring("page_size") <> "" THEN page_size = request.querystring("page_size") ELSE page_size = 10 END IF IF request.querystring("current_page") <> "" THEN current_page = request.querystring("current_page") ELSE current_page = 1 END IF 'POSSIBLE QUERY VALUES 'sale_type 'manufacturer 'model 'year 'listing_price (range) 'strKeywords 'categoryID_list 'vehicleID 'agentID 'boolean 'stock_number 'vin 'date_entered SQL = "SELECT "& table_name &".* FROM "& table_name &" " i = 0 IF request.querystring("agentID") <> "" THEN SQL = SQL & "INNER JOIN people_"& item_type &"_link ON "& table_name &"."& item_type &"ID = people_"& item_type &"_link."& item_type &"ID WHERE people_"& item_type &"_link.peopleID = "& request.querystring("agentID") i = 1 END IF IF request.querystring("sale_type") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & table_name &"."& item_type &"ID IN (SELECT category_"& item_type &"_link."& item_type &"ID AS [temp_ID] FROM category_"& item_type &"_link INNER JOIN categories ON category_"& item_type &"_link.categoryID = categories.categoryID WHERE categories.categoryname = '"& request.querystring("sale_type") &"') " END IF IF request.querystring("listing_price") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF 'SQL = SQL &" ("& request.querystring("listing_price") &" OR "& Replace(request.querystring("listing_price"),"listing_price","sale_price") &") " SQL = SQL & " (iif("& table_name &".sale_price > 0,"& Replace(request.querystring("listing_price"),"listing_price","sale_price") &","& request.querystring("listing_price") &")) " END IF IF request.querystring("strKeywords") <> "" THEN dim search_terms search_terms = Split(request.querystring("strKeywords")," ") IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & "(" FOR j = 0 TO UBound(search_terms) IF j = UBound(search_terms) THEN SQL = SQL & " ((vehicles.display_title LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.comments LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.features LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.drive_train LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.engine LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.engine LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.transmission LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.body_style LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.interior_colour LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.model LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.manufacturer LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.exterior_colour LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.transmission LIKE '%"& Replace(search_terms(j),"'","''") &"%'))) " ELSE SQL = SQL & " ((vehicles.display_title LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.comments LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.features LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.drive_train LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.engine LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.engine LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.transmission LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.body_style LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.interior_colour LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.model LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.manufacturer LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.exterior_colour LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (vehicles.transmission LIKE '%"& Replace(search_terms(j),"'","''") &"%')) "& request.querystring("boolean") END IF NEXT END IF IF request.querystring(item_type &"ID") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & table_name &"."& item_type &"ID = "& request.querystring(item_type &"ID") END IF IF request.querystring("categoryID_list") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF j = Replace(Replace(request.querystring("categoryID_list"),", ","_"),"__","_") IF Left(j,1) = "_" THEN j = Mid(j,2) END IF IF Right(j,1) = "_" THEN j = Left(j,len(j)-1) END IF IF Instr(j,"_") <> 0 THEN dim category_array, tempSQL category_array = Split(j,"_") FOR j = 0 TO UBound(category_array) IF j = 1 THEN SQL = SQL & " ( " END IF IF j = UBound(category_array) THEN SQL = SQL & table_name &"."& item_type &"ID IN (SELECT category_"& item_type &"_link."& item_type &"ID AS ["& j &"] FROM category_"& item_type &"_link INNER JOIN categories ON category_"& item_type &"_link.categoryID = categories.categoryID WHERE category_"& item_type &"_link.categoryID = "& category_array(j) &")) " ELSEIF j = 0 THEN SQL = SQL & table_name &"."& item_type &"ID IN (SELECT category_"& item_type &"_link."& item_type &"ID AS ["& j &"] FROM category_"& item_type &"_link INNER JOIN categories ON category_"& item_type &"_link.categoryID = categories.categoryID WHERE category_"& item_type &"_link.categoryID = "& category_array(j) &") AND " ELSE SQL = SQL & table_name &"."& item_type &"ID IN (SELECT category_"& item_type &"_link."& item_type &"ID AS ["& j &"] FROM category_"& item_type &"_link INNER JOIN categories ON category_"& item_type &"_link.categoryID = categories.categoryID WHERE category_"& item_type &"_link.categoryID = "& category_array(j) &") OR " END IF NEXT ELSE SQL = SQL & table_name &"."& item_type &"ID IN (SELECT category_"& item_type &"_link."& item_type &"ID AS [temp_cat] FROM category_"& item_type &"_link INNER JOIN categories ON category_"& item_type &"_link.categoryID = categories.categoryID WHERE category_"& item_type &"_link.categoryID = "& j &") " END IF END IF IF request.querystring("manufacturer") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & " vehicles.manufacturer = '"& request.querystring("manufacturer") &"' " END IF IF request.querystring("model") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & " vehicles.model = '"& request.querystring("model") &"' " END IF IF request.querystring("year") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & " vehicles.year = "& request.querystring("year") &" " END IF IF request.querystring("body_style") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & " vehicles.body_style = '"& request.querystring("body_style") &"' " END IF IF request.querystring("stock_number") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & "(vehicles.stock_number LIKE '%"& request.querystring("stock_number") &"%') " END IF IF request.querystring("vin") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & "(vehicles.vin LIKE '%"& request.querystring("vin") &"%') " END IF IF request.querystring("date_entered") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & "((DateDiff('D',"& table_name &".date_entered,#"& request.querystring("date_entered") &"#) < 0 )) " END IF IF itemsExpire AND hideExpiredFromPublic THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & " (NOT isDate("& table_name &".closing_date) OR DateDiff('D',"& table_name &".closing_date,Date()) < 0) " END IF IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & table_name &".show_on_website " IF request.querystring("o") <> "" THEN SQL = SQL & " ORDER BY "& request.querystring("o") ELSE SQL = SQL & " ORDER BY "& table_name &".listing_price DESC," SQL = SQL & "vehicles.manufacturer,vehicles.model;" END IF set top_rs = Server.CreateObject("ADODB.Recordset") top_rs.PageSize = page_size top_rs.CacheSize = page_size top_rs.Open SQL,cn,3,1,1 total_page_count = top_rs.PageCount total_records = top_rs.RecordCount IF total_page_count = 0 THEN %>

Sorry, there are no records to display.

You should either  <% IF request.servervariables("HTTP_REFERER") <> "" THEN %> ">go back to the previous page <% ELSE %> go back to the previous page <% END IF %> , or try a new search:

<% CALL WriteBrowseOptions CALL WriteSearch(this_page &".asp") ELSE top_rs.AbsolutePage = current_page records_displayed = 0 CALL WriteBrowseOptions DO UNTIL records_displayed = CInt(page_size) OR top_rs.eof IF total_records = 1 OR page_size = 1 THEN IF request.querystring("agentID") <> "" AND records_displayed = 0 THEN CALL WriteAgentInfo("peopleID",request.querystring("agentID")) %>
<% END IF IF records_displayed = 0 THEN CALL RecordsNav("top",total_records,total_page_count,current_page) %>
<% END IF CALL WriteVehicleDisplay(top_rs("vehicleID"),top_rs("display_title"),top_rs("manufacturer"),top_rs("model"),top_rs("year"),top_rs("listing_price"),top_rs("listing_price_terms"),top_rs("sale_price"),top_rs("status"),top_rs("exterior_colour"),top_rs("interior_colour"),top_rs("body_style"),top_rs("transmission"),top_rs("doors"),top_rs("engine"),top_rs("fuel_type"),top_rs("drive_train"),top_rs("mileage") &" "& top_rs("mileage_unit"),top_rs("stock_number"),top_rs("vin"),top_rs("comments"),top_rs("features"),top_rs("display_options"),top_rs("info_URL"),top_rs("info_URL_width"),top_rs("info_URL_height"),top_rs("closing_date")) %>
<% IF request.querystring("agentID") = "" AND records_displayed = 0 THEN CALL WriteAgentInfo(item_type &"ID",top_rs(item_type &"ID")) END IF ELSEIF total_records < 6 OR (page_size >1 AND page_size < 6) THEN IF request.querystring("agentID") <> "" AND records_displayed = 0 THEN CALL WriteAgentInfo("peopleID",request.querystring("agentID")) %>
<% END IF IF records_displayed = 0 THEN CALL RecordsNav("top",total_records,total_page_count,current_page) END IF CALL WriteVehicleSummaries(page_size,current_page,records_displayed,top_rs("vehicleID"),top_rs("display_title"),top_rs("manufacturer"),top_rs("model"),top_rs("year"),top_rs("listing_price"),top_rs("listing_price_terms"),top_rs("exterior_colour"),top_rs("interior_colour"),top_rs("body_style"),top_rs("doors"),top_rs("comments"),top_rs("display_options"),top_rs("status")) ELSEIF total_records < 11 OR (page_size < 11 AND page_size > 5) THEN IF request.querystring("agentID") <> "" AND records_displayed = 0 THEN CALL WriteAgentInfo("peopleID",request.querystring("agentID")) %>
<% END IF IF records_displayed = 0 THEN CALL RecordsNav("top",total_records,total_page_count,current_page) END IF IF records_displayed = 0 THEN %> <% END IF CALL WriteBriefDisplay(page_size,current_page,records_displayed,top_rs("vehicleID"),top_rs("display_title"),top_rs("listing_price"),top_rs("listing_price_terms"),top_rs("manufacturer"),top_rs("model"),top_rs("year"),top_rs("display_options"),top_rs("status")) IF ((records_displayed + 1) = CInt(page_size)) OR (CInt(total_records) = (((CInt(current_page) -1) * CInt(page_size)) + (records_displayed + 1))) THEN IF (records_displayed + 1) MOD 2 = 0 THEN %>
<% ELSE %>    <% END IF END IF ELSEIF total_records > 10 OR page_size > 10 THEN IF request.querystring("agentID") <> "" AND records_displayed = 0 THEN CALL WriteAgentInfo("peopleID",request.querystring("agentID")) END IF IF records_displayed = 0 THEN CALL RecordsNav("top",total_records,total_page_count,current_page) %> <% END IF CALL WriteVehiclesList(page_size,current_page,records_displayed,top_rs("vehicleID"),top_rs("display_title"),top_rs("listing_price"),top_rs("listing_price_terms"),top_rs("manufacturer"),top_rs("model"),top_rs("year"),top_rs("display_options"),top_rs("status")) IF ((records_displayed + 1) = CInt(page_size)) OR (CInt(total_records) = (((CInt(current_page) -1) * CInt(page_size)) + (records_displayed + 1))) THEN %>
"><%=fieldManufacturer%>, <%=fieldModel%> "><%=fieldYear%>     "><%=fieldListingPrice%>
 
<% END IF END IF records_displayed = records_displayed + 1 top_rs.movenext LOOP CALL RecordsNav("bottom",total_records,total_page_count,current_page) END IF top_rs.close set top_rs=nothing END IF END SUB %> <% SUB WriteVehicleDisplay(ID,display_title,manufacturer,model,year,listing_price,listing_price_terms,sale_price,status,exterior_colour,interior_colour,body_style,transmission,doors,engine,fuel_type,drive_train,mileage,stock_number,vin,comments,features,display_options,info_URL,info_URL_width,info_URL_height,closing_date) display_options_array = Split(display_options,",") %>
<%=display_title%> <% set sub_rs = cn.Execute("SELECT categories.categoryname FROM categories INNER JOIN category_"& item_type &"_link ON categories.categoryID = category_"& item_type &"_link.categoryID WHERE category_"& item_type &"_link."& item_type &"ID = "& ID &" AND (categories.categoryname = 'For Sale' OR categories.categoryname = 'For Lease' OR categories.categoryname = 'For Rent' OR categories.categoryname = 'For Sale by Auction' OR categories.categoryname = 'For Sale or Lease' OR categories.categoryname = 'Display Only');") IF sub_rs.bof AND sub_rs.eof THEN ' ELSE response.write(sub_rs("categoryname") &" ") END IF sub_rs.close set sub_rs = nothing IF sale_price > 0 AND sale_price < listing_price AND status <> "Sold" AND status <> "Contract Pending" THEN status = "Reduced" END IF IF DisplayDate(closing_date,2) <> "" AND itemsExpire THEN IF status <> "Sold" THEN IF DateDiff("d",Now(),FixDate(closing_date)) < 0 THEN status = "Closed" END IF END IF SELECT CASE status CASE "Active", "Accepting Bids" IF display_options_array(3) <> 0 THEN %> <%=DisplayCurrency(listing_price)%><% IF len(listing_price_terms) > 0 THEN response.write(" "& Replace(listing_price_terms,"Per"," /"))%>
<% ELSE %>
<% END IF IF display_options_array(5) <> 0 THEN %> <%=status%>
<% ELSE %>
<% END IF CASE "Closed" IF display_options_array(3) <> 0 THEN %> <%=DisplayCurrency(listing_price)%><% IF len(listing_price_terms) > 0 THEN response.write(" "& Replace(listing_price_terms,"Per"," /"))%>
<% END IF IF display_options_array(5) <> 0 THEN %> <%=status%> <% IF display_options_array(20) <> 0 AND DisplayDate(closing_date,2) <> "" THEN response.write(" "& DisplayDate(closing_date,2)) %> <% IF sale_price > 0 AND display_options_array(4) <> 0 THEN response.write(DisplayCurrency(sale_price)) %>
<% ELSE %>
<% END IF CASE "Contract Pending" IF display_options_array(3) <> 0 THEN %> <%=DisplayCurrency(listing_price)%><% IF len(listing_price_terms) > 0 THEN response.write(" "& Replace(listing_price_terms,"Per"," /"))%>
<% ELSE %>
<% END IF IF display_options_array(5) <> 0 THEN %> <%=status%> <% END IF IF display_options_array(4) <> 0 AND IsNumeric(sale_price) THEN IF sale_price > 0 THEN %> <%=DisplayCurrency(sale_price)%> <% END IF END IF %>
<% CASE "Sold", "Reduced" IF display_options_array(3) <> 0 THEN %> <%=DisplayCurrency(listing_price)%><% IF len(listing_price_terms) > 0 THEN response.write(" "& Replace(listing_price_terms,"Per"," /"))%>
<% ELSE %>
<% END IF IF display_options_array(5) <> 0 THEN %> <%=status%> <% END IF IF display_options_array(4) <> 0 AND IsNumeric(sale_price) THEN IF sale_price > 0 THEN %> <%=DisplayCurrency(sale_price)%> <% END IF END IF %>
<% CASE "Display Only" %>
<% CASE ELSE END SELECT %>  
<% IF len(info_URL) > 7 THEN %> Click here for more information about this vehicle! <% END IF %> Click here to open a printable version of this page! <% IF status <> "Display Only" THEN %> Click here to open our loan calculator - find out if you can afford this vehicle! <% END IF %> Click here to contact our <%=LCase(Agent)%> directly with questions about this vehicle! Click here to send this page to a friend! Click here to access your QuickList.
<% set sub_rs = cn.Execute("SELECT people.title,people.firstname,people.lastname FROM people INNER JOIN people_"& item_type &"_link ON people.peopleID = people_"& item_type &"_link.peopleID WHERE people_"& item_type &"_link."& item_type &"ID = "& ID &";") IF sub_rs.bof AND sub_rs.eof THEN ' ELSE sub_rs.movefirst %> <% END IF sub_rs.close set sub_rs=nothing %> <% IF display_options_array(19) <> 0 THEN response.write("") IF display_options_array(2) <> 0 THEN response.write("") i = 1 END IF IF display_options_array(0) <> 0 THEN response.write("") END IF IF model <> "" AND display_options_array(1) <> 0 THEN response.write("") END IF IF exterior_colour <> "" AND display_options_array(6) <> 0 THEN response.write("") END IF IF interior_colour <> "" AND display_options_array(7) <> 0 THEN response.write("") END IF IF (doors <> "" AND doors <> "0") AND display_options_array(10) <> 0 THEN response.write("") END IF IF body_style <> "" AND display_options_array(8) <> 0 THEN response.write("") END IF IF transmission <> "" AND display_options_array(9) <> 0 THEN response.write("") END IF IF drive_train <> "" AND display_options_array(13) <> 0 THEN response.write("") END IF IF engine <> "" AND display_options_array(11) <> 0 THEN response.write("") END IF IF fuel_type <> "" AND display_options_array(12) <> 0 THEN response.write("") END IF IF len(mileage) > 2 AND display_options_array(14) <> 0 THEN response.write("") END IF IF stock_number <> "" AND display_options_array(15) <> 0 THEN response.write("") END IF IF DisplayDate(closing_date,2) <> "" AND itemsExpire THEN IF display_options_array(20) <> 0 THEN response.write("") END IF END IF %>

<%=Agent%>: <%=sub_rs("title")%> <%=sub_rs("firstname")%> <%=sub_rs("lastname")%>
"& fieldVehicleID &": "& ID &"
"& fieldYear &": "& year &"
"& fieldManufacturer &": "& manufacturer &"
"& fieldModel &": "& model &"
"& fieldExteriorColour &": "& exterior_colour &"
"& fieldInteriorColour &": "& interior_colour &"
"& fieldDoors &": "& doors &"
"& fieldBodyStyle &": "& body_style &"
"& fieldTransmission &": "& transmission &"
"& fieldDriveTrain &": "& drive_train &"
"& fieldEngine &": "& engine &"
"& fieldFuelType &": "& fuel_type &"
") IF Instr(mileage,"feet") <> 0 THEN response.write("Length") ELSEIF Instr(mileage,"hours") <> 0 THEN response.write("Hours") ELSE response.write(fieldMileage) END IF response.write(": "& mileage &"
"& fieldStockNumber &": "& stock_number &"
"& fieldClosingDate &": "& DisplayDate(closing_date,2) &"
<% CALL WritePhotos(ID,status) %> <% IF vin <> "" AND display_options_array(18) <> 0 THEN response.write(""& fieldVIN &": "& vin) END IF %>

<% IF features <> "" AND display_options_array(17) <> 0 THEN response.write("

"& fieldFeatures &":
"& features &"

") %> <% IF comments <> "" AND display_options_array(16) <> 0 THEN response.write("

"& fieldComments &":
"& comments &"

") %> <% CALL WriteDocuments(ID) %>  
<% set sub_rs = cn.Execute("SELECT hits FROM "& table_name &" WHERE "& item_type &"ID = "& ID &";") sub_rs.movefirst cn.Execute("UPDATE "& table_name &" SET hits = "& (sub_rs("hits") + 1) &" WHERE "& item_type &"ID = "& ID &";") sub_rs.close set sub_rs = nothing END SUB %> <% FUNCTION WritePageTitle dim str str = " " i = 1 IF request.querystring("year") <> "" THEN IF i > 0 THEN str = str & " " i = 0 ELSE str = str & " " END IF str = str & request.querystring("year") END IF IF request.querystring("manufacturer") <> "" OR request.querystring("model") <> "" THEN IF i > 0 THEN str = str & " " i = 0 ELSE str = str & " " END IF IF request.querystring("manufacturer") <> "" AND request.querystring("model") <> "" THEN str = str & request.querystring("manufacturer") &", "& request.querystring("model") ELSEIF request.querystring("manufacturer") = "" AND request.querystring("model") <> "" THEN str = str & request.querystring("model") ELSEIF request.querystring("manufacturer") <> "" AND request.querystring("model") = "" THEN str = str & request.querystring("manufacturer") END IF END IF IF request.querystring("sale_type") <> "" THEN IF i > 0 THEN str = str & "Listings " i = 0 ELSE str = str & " " END IF str = str & request.querystring("sale_type") END IF IF request.querystring("listing_price") <> "" AND request.querystring("listing_price") <> "((vehicles.listing_price > 0) ) " THEN IF i > 0 THEN str = str & "" i = 0 ELSE str = str & " " END IF str = str & Replace(Replace(Replace(Replace(Replace(request.querystring("listing_price"),"vehicles.listing_price",""),"> ","More Than "),"< ","Less Than "),")",""),"(","") END IF IF request.querystring("strKeywords") <> "" THEN IF i > 0 THEN str = str & "With " i = 0 ELSE str = str & " with " END IF str = str & "keywords: "& request.querystring("strKeywords") END IF WritePageTitle = str END FUNCTION %>