<%@ 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 = "propertylistings" table_name = "properties" item_type = "property" dim propertyID 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 searchShowCity THEN %> <% END IF %> <% IF searchShowProvince THEN %> <% END IF %> <% IF searchShowCounty THEN %> <% END IF %> <% IF searchShowBedrooms THEN %> <% END IF %> <% IF searchShowBathrooms 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 searchShowMLSNumber THEN %> <% END IF %> <% IF searchShowPropertyID THEN %> <% END IF %>
Show Items:
<%=MainCategory%>:
<%=SubCategory%>:
<%=fieldPropertiesCity%>:
<%=fieldPropertiesProvince%>:
<%=fieldPropertiesCounty%>:
<%=fieldBedrooms%>:
<%=fieldBathrooms%>:
<%=fieldListingPrice%>:
<%=fieldListingPrice%> Range: to
<%=fieldDateEntered%>:
Results / Page:
Order:
Keywords:
Match: ALL words
ANY words

Or you can enter the <%=fieldMLSNumber%> of the property you wish to see.


Or you can enter the <%=fieldPropertyID%> of the property you wish to see.

<% END SUB %> <% SUB WritePropertiesList(page_size,current_page,records_displayed,ID,listing_price,listing_price_terms,city,province,display_options,status) %> "><%=city%>, <%=province%> <% 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,9,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 WritePropertySummaries(page_size,current_page,records_displayed,ID,display_title,general_description,listing_price,listing_price_terms,lot_area,finished_area,bathrooms,bedrooms,city,province,county,display_options,furnished,garage,status,mls_number) 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(4) <> 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 %>
<%=city%>, <%=province%> <% IF county <> "" AND display_options_array(23) <> 0 THEN response.write("("& county &")") %>
<% IF lot_area <> "" AND display_options_array(8) <> 0 THEN response.write(fieldLotArea &": "& lot_area &"
") END IF IF finished_area <> "" AND display_options_array(21) <> 0 THEN response.write(fieldFinishedArea &": "& finished_area &"
") END IF IF bedrooms <> "" AND bedrooms > 0 AND display_options_array(11) <> 0 THEN response.write(fieldBedrooms &": "& bedrooms &"
") END IF IF bathrooms <> "" AND bathrooms > 0 AND display_options_array(10) <> 0 THEN response.write(fieldBathrooms &": "& bathrooms &"
") END IF IF mls_number <> "" AND display_options_array(7) <> 0 THEN response.write(fieldMLSNumber &": "& mls_number &"
") END IF IF general_description <> "" AND display_options_array(0) <> 0 THEN response.write("
"& general_description) 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,lot_area,finished_area,bathrooms,bedrooms,city,province,county,display_options,furnished,garage,status,mls_number) 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 %> <%=city%>, <%=province%>
<% IF county <> "" AND display_options_array(23) <> 0 THEN response.write("("& county &")") %>

<% IF display_options_array(4) <> 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 lot_area <> "" AND display_options_array(8) <> 0 THEN response.write(fieldLotArea &": "& lot_area &"
") END IF IF finished_area <> "" AND display_options_array(21) <> 0 THEN response.write(fieldFinishedArea &": "& finished_area &"
") END IF IF bedrooms <> "" AND bedrooms > 0 AND display_options_array(11) <> 0 THEN response.write(fieldBedrooms &": "& bedrooms &"
") END IF IF bathrooms <> "" AND bathrooms > 0 AND display_options_array(10) <> 0 THEN response.write(fieldBathrooms &": "& bathrooms &"
") END IF IF mls_number <> "" AND display_options_array(7) <> 0 THEN response.write(fieldMLSNumber &": "& mls_number &"
") 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 'city 'province 'county 'listing_price (range) 'strKeywords 'categoryID_list 'propertyID 'agentID 'boolean 'mlsnumber 'bedrooms 'bathrooms 'furnished 'garage '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") &") " 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 & " ((properties.display_title LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (properties.general_description LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (properties.basement LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (properties.space_details LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (properties.construction_details LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (properties.features LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (properties.sales_notes LIKE '%"& Replace(search_terms(j),"'","''") &"%'))) " ELSE SQL = SQL & " ((properties.display_title LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (properties.general_description LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (properties.basement LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (properties.space_details LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (properties.construction_details LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (properties.features LIKE '%"& Replace(search_terms(j),"'","''") &"%') OR (properties.sales_notes 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("city") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & " properties.city = '"& request.querystring("city") &"' " END IF IF request.querystring("province") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & " properties.province = '"& request.querystring("province") &"' " END IF IF request.querystring("county") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & " properties.county = '"& request.querystring("county") &"' " END IF IF request.querystring("mlsnumber") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & "((properties.mls_number LIKE '%"& request.querystring("mlsnumber") &"%')) " END IF IF request.querystring("bedrooms") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & "((properties.bedrooms = "& request.querystring("bedrooms") &")) " END IF IF request.querystring("bathrooms") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & "((properties.bathrooms = "& request.querystring("bathrooms") &")) " END IF IF request.querystring("furnished") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & "((properties.furnished = "& request.querystring("furnished") &")) " END IF IF request.querystring("garage") <> "" THEN IF i = 0 THEN SQL = SQL & " WHERE " i = 1 ELSE SQL = SQL & " AND " END IF SQL = SQL & "((properties.garage = "& request.querystring("garage") &")) " 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 & "properties.province,properties.city;" 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 WritePropertyDisplay(top_rs("propertyID"),top_rs("display_title"),top_rs("general_description"),top_rs("status"),top_rs("opening_date"),top_rs("closing_date"),top_rs("listing_price"),top_rs("listing_price_terms"),top_rs("sale_price"),top_rs("property_taxes"),top_rs("property_taxes_terms"),top_rs("mls_number"),top_rs("lot_area"),top_rs("frontage"),top_rs("depth"),top_rs("finished_area"),top_rs("bathrooms"),top_rs("bedrooms"),top_rs("year"),top_rs("show_on_website"),top_rs("basement"),top_rs("space_details"),top_rs("construction_details"),top_rs("features"),top_rs("sales_notes"),top_rs("address"),top_rs("city"),top_rs("province"),top_rs("county"),top_rs("postal_code"),top_rs("country"),top_rs("display_options"),top_rs("virtualtour_URL"),top_rs("virtualtour_width"),top_rs("virtualtour_height"),top_rs("furnished"),top_rs("garage")) %>
<% 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 WritePropertySummaries(page_size,current_page,records_displayed,top_rs("propertyID"),top_rs("display_title"),top_rs("general_description"),top_rs("listing_price"),top_rs("listing_price_terms"),top_rs("lot_area"),top_rs("finished_area"),top_rs("bathrooms"),top_rs("bedrooms"),top_rs("city"),top_rs("province"),top_rs("county"),top_rs("display_options"),top_rs("furnished"),top_rs("garage"),top_rs("status"),top_rs("mls_number")) 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("propertyID"),top_rs("display_title"),top_rs("listing_price"),top_rs("listing_price_terms"),top_rs("lot_area"),top_rs("finished_area"),top_rs("bathrooms"),top_rs("bedrooms"),top_rs("city"),top_rs("province"),top_rs("county"),top_rs("display_options"),top_rs("furnished"),top_rs("garage"),top_rs("status"),top_rs("mls_number")) 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 WritePropertiesList(page_size,current_page,records_displayed,top_rs("propertyID"),top_rs("listing_price"),top_rs("listing_price_terms"),top_rs("city"),top_rs("province"),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 %>
"><%=fieldPropertiesCity%>, <%=fieldPropertiesProvince%>     "><%=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 WritePropertyDisplay(ID,display_title,general_description,status,opening_date,closing_date,listing_price,listing_price_terms,sale_price,property_taxes,property_taxes_terms,mls_number,lot_area,frontage,depth,finished_area,bathrooms,bedrooms,year,show_on_website,basement,space_details,construction_details,features,sales_notes,address,city,province,county,postalcode,country,display_options,virtualtour_URL,virtualtour_width,virtualtour_height,furnished,garage) 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(4) <> 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(1) <> 0 THEN %> <%=status%>
<% ELSE %>
<% END IF CASE "Closed" IF display_options_array(4) <> 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(1) <> 0 THEN %> <%=status%> <% IF display_options_array(3) <> 0 AND DisplayDate(closing_date,2) <> "" THEN response.write(" "& DisplayDate(closing_date,2)) %> <% IF sale_price > 0 AND display_options_array(5) <> 0 THEN response.write(DisplayCurrency(sale_price)) %>
<% ELSE %>
<% END IF CASE "Contract Pending" IF display_options_array(4) <> 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(1) <> 0 THEN %> <%=status%> <% END IF IF display_options_array(5) <> 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(4) <> 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(1) <> 0 THEN %> <%=status%> <% END IF IF display_options_array(5) <> 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 (city <> "" AND province <> "") AND display_options_array(22) <> 0 THEN %> Map it at MapQuest! <% END IF IF len(virtualtour_URL) > 7 THEN %> Click here to open a virtual tour of this property! <% END IF %> Click here to open a printable version of this page! <% IF status <> "Display Only" THEN %> Click here to open our mortgage calculator - find out if you can afford this property! <% END IF %> Click here to contact our agent directly with questions about this property! 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(24) <> 0 THEN response.write("") IF address <> "" AND display_options_array(18) <> 0 THEN response.write("") END IF response.write("") IF county <> "" AND display_options_array(23) <> 0 THEN response.write("") END IF response.write("") IF postalcode <> "" AND display_options_array(19) <> 0 THEN response.write("") END IF IF country <> "" AND display_options_array(20) <> 0 THEN response.write("") END IF IF lot_area <> "" AND IsNumeric(Left(lot_area,1)) AND display_options_array(8) <> 0 THEN response.write("") END IF IF frontage <> "" AND IsNumeric(Left(frontage,1)) AND display_options_array(9) <> 0 THEN response.write("") END IF IF depth <> "" AND IsNumeric(Left(depth,1)) AND display_options_array(9) <> 0 THEN response.write("") END IF IF finished_area <> "" AND IsNumeric(Left(finished_area,1)) AND display_options_array(21) <> 0 THEN response.write("") END IF IF year <> "" AND year > 0 AND display_options_array(12) <> 0 THEN response.write("") END IF IF bedrooms <> "" AND bedrooms > 0 AND display_options_array(11) <> 0 THEN response.write("") END IF IF bathrooms <> "" AND bedrooms > 0 AND display_options_array(10) <> 0 THEN response.write("") END IF IF property_taxes <> "" AND property_taxes <> 0 AND display_options_array(6) <> 0 THEN response.write("") END IF IF mls_number <> "" AND display_options_array(7) <> 0 THEN response.write("") END IF IF DisplayDate(opening_date,2) <> "" AND display_options_array(2) <> 0 THEN response.write("") END IF IF DisplayDate(closing_date,2) <> "" AND itemsExpire THEN IF display_options_array(3) <> 0 THEN response.write("") END IF END IF IF display_options_array(26) <> 0 AND furnished THEN response.write("") END IF IF display_options_array(25) <> 0 AND garage THEN response.write("") END IF %>

<%=Agent%>: <%=sub_rs("title")%> <%=sub_rs("firstname")%> <%=sub_rs("lastname")%>
"& fieldPropertyID &": "& ID &"
"& fieldPropertiesAddress &": "& address &"
"& fieldPropertiesCity &": "& city &"
"& fieldPropertiesCounty &": "& county &"
"& fieldPropertiesProvince &": "& province &"
"& fieldPropertiesPostalCode &": "& postalcode &"
"& fieldPropertiesCountry &": "& country &"
"& fieldLotArea &": "& lot_area &"
"& fieldFrontage &": "& frontage &"
"& fieldDepth &": "& depth &"
"& fieldFinishedArea &": "& finished_area &"
"& fieldYear &": "& year &"
"& fieldBedrooms &": "& bedrooms &"
"& fieldBathrooms &": "& bathrooms &"
"& fieldPropertyTaxes &": "& DisplayCurrency(property_taxes)) IF len(listing_price_terms) > 0 THEN response.write(" "& Replace(listing_price_terms,"Per"," /")) END IF response.write("
"& fieldMLSNumber &": "& mls_number &"
"& fieldOpeningDate &": "& DisplayDate(opening_date,2) &"
"& fieldClosingDate &": "& DisplayDate(closing_date,2) &"
"& fieldFurnished &": ") IF furnished THEN response.write("Yes") ELSE response.write("No") response.write("
"& fieldGarage &": ") IF garage THEN response.write("Yes") ELSE response.write("No") response.write("
<% CALL WritePhotos(ID,status) %>

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

"& fieldGeneralDescription &":
"& general_description &"

") %> <% IF space_details <> "" AND display_options_array(14) <> 0 THEN response.write("

"& fieldSpaceDetails &":
"& space_details &"

") %> <% IF basement <> "" AND display_options_array(13) <> 0 THEN response.write("

"& fieldBasement &":
"& basement &"

") %> <% IF construction_details <> "" AND display_options_array(15) <> 0 THEN response.write("

"& fieldConstructionDetails &":
"& construction_details &"

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

"& fieldFeatures &":
"& features &"

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

"& fieldSalesNotes &":
"& sales_notes &"

") %> <% 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("sale_type") <> "" THEN IF i > 0 THEN str = str & "Listings " i = 0 END IF str = str & request.querystring("sale_type") END IF IF request.querystring("city") <> "" OR request.querystring("province") <> "" THEN IF i > 0 THEN str = str & "In " i = 0 ELSE str = str & " in " END IF IF request.querystring("city") <> "" AND request.querystring("province") <> "" THEN str = str & request.querystring("city") &", "& request.querystring("province") ELSEIF request.querystring("city") = "" AND request.querystring("province") <> "" THEN str = str & request.querystring("province") ELSEIF request.querystring("city") <> "" AND request.querystring("province") = "" THEN str = str & request.querystring("city") END IF END IF IF request.querystring("listing_price") <> "" AND request.querystring("listing_price") <> "((properties.listing_price > 0) ) " THEN IF i > 0 THEN str = str & "" i = 0 END IF str = str & Replace(Replace(Replace(Replace(Replace(request.querystring("listing_price"),"properties.listing_price",""),"> ","More Than "),"< ","Less Than "),")",""),"(","") END IF IF request.querystring("bathrooms") <> "" OR request.querystring("bedrooms") <> "" THEN IF i > 0 THEN str = str & "With " i = 0 ELSE str = str & " with " END IF IF request.querystring("bedrooms") <> "" THEN str = str & request.querystring("bedrooms") &" "& LCase(fieldBedrooms) &" " IF request.querystring("bathrooms") <> "" THEN str = str & request.querystring("bathrooms") &" "& LCase(fieldBathrooms) &" " 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 %>