<%
'+------------------
'| Amazon Light - Search/Browse Results page
'+------------------

'+------------------
'| On Error Resume Next is here to accomodate occasional weirdness from results.
'| Amazon occasionally returns odd errors and this handles the display well
'+------------------

On Error Resume Next

'+------------------
'| Grab variables from querystring if they exist
'|  - szSchType = Type of main category -
'|		(books,elec,game,home)
'|  - szSchMode = Type of sub category (none = books) -
'|		(music,dvd,pc-hardware,software,toys,videogames,kitchen,universal,
'| 		garden,magazines,vhs,electronics,baby,photo)
'| 	- Request("term") and Request("field-keywords") are equivalent - just
'|		supporting old code by including "term"
'+------------------

If (Request("schMod") <> "") Then
	szSchMode = Request("schMod")
Else
	szSchMode = "books"
End if

'+------------------
'| szSB = "Search" (s) or "Browse" (o) mode
'+------------------

If (Request("sb") = "o") Then
	szSB = "o"
Else
	szSB = "s"
End if

If ((Request("term") <> "") OR (Request("field-keywords") <> "")) Then
	szTerm = Replace(Request("term")," ","+")
	If szTerm = "" Then
		szTerm = Replace(Request("field-keywords")," ","+")
	End if
Else
	If szSB = "s" Then
		szTerm = "Whittier Alaska"
	Else
		szTerm = ""
	End if
End if

szSchType = Request("typ")

If (Request("advSearch") <> "") Then
	szAdvSearch = Request("advSearch")
	rgSp = Split(szSchMode,"|")
	szSchMode = rgSp(0)
	szSchType = rgSp(1)
End if

If (Request("page") <> "") Then
	szPage = Request("page")
Else
	szPage = 1
End if

If (Request("scNode") <> "") Then
	szNode = Request("scNode")
Else
	szNode = "1000"
End if

'+------------------
'| Set up Top Node String for later use in "Browse" Display across top
'+------------------

Select Case szSchMode
	Case "music"
		sztNode = "1"
	Case "dvd"
		sztNode = "2"
	Case "pc-hardware"
		sztNode = "3"
	Case "software"
		sztNode = "4"
	Case "toys"
		sztNode = "5"
	Case "videogames"
		sztNode = "6"
	Case "kitchen"
		sztNode = "7"
	Case "universal"
		sztNode = "8"
	Case "garden"
		sztNode = "9"
	Case "magazines"
		sztNode = "10"
	Case "vhs"
		sztNode = "11"
	Case "electronics"
		sztNode = "12"
	Case "baby"
		sztNode = "13"
	Case "photo"
		sztNode = "14"
	Case Else
		sztNode = "0"
End Select

'+------------------
'| subCatTot = Counts of subcategories in each category
'| subCatTot2 = Starting Index within subCatNodes of subcategories for a particular cat
'| subCatNodes = Node names | Node IDs
'+------------------

subCatTot = Array(22,14,15,7,19,13,7,9,10,9,29,22,17,7,10)
subCatTot2 = Array(0,23,38,54,62,82,96,104,114,125,135,165,188,206,214)
subCatNodes = Array("Top Selling|1000","Business|3","Cooking|6","Home/Garden|48","Literature/Fiction|17","Nonfiction|53","Technical|173507","Romance|23","Sports|26","Childrens|4","Engineering|13643","Health|10","Reference|21","Science|75","Biographies|2","Computers/Internet|5","Entertainment|86","History|9","Law|10777","Mystery|18","Religion|22","SciFi/Fantasy|25","Travel|27","Top Selling|301668","Classical|85","Dance/DJ|7","Pop|37","Rock|40","Alternative|30","Classic Rock|67204","Jazz|34","Rap|38","Soundtracks|42","Blues|31","Christian|173429","Country|16","Latin|289122","R/B|39","Animation|712256","Classic|163345","Documentary|508532","Horror|163396","SciFi/Fantasy|163431","Television|163450","Action/Adventure|163296","Anime/Manga|517956","Comedy|163357","Drama|163379","Kids/Family|163414","Music Video|163420","Special Interest|163448","Military/War|586156","Suspense|512030","Sports|467970","Top Selling|565118","AMD|602286","Apple|565124","HP|565120","IBM|603128","Intel|565122","Sony|565126","Toshiba|598398","Top Selling|491286","Communication|229636","Graphics|229614","Linux|290562","Operating Sys|229653","Downloadable|531448","Utilities|229672","Business|229535","Education|229563","Home/Hobby|229624","Macintosh|229643","Finance|229540","Handhelds|229663","Video|497022","Childrens|229548","Games|229575","Language/Travel|497026","Networking|229637","Programming|229667","Web Dev|497024","Top Selling|491290","Crafts|171859","Dolls|171569","Games|171689","Outdoor|171960","Action Figures|171662","Bikes|569472","Electronics|720366","Stuffed Animals|171992","Learning|171911","Building|171814","Furniture|172790","Puzzles|171744","Vehicles|171600","Top Selling|471280","Game Cube|541022","Play Station 2|301712","Game Boy|229783","Mac|229647","PC|229575","Game Boy Advance|541020","XBox|537504","Top Selling|491864","Coffee/Tea|289742","Cookware|289814","Appliances|289913","Baking|289668","Housewares|510080","Tableware|289891","Bar|289728","Gadgets|289754","Knives|289851","Top Selling|468240","Electrical|495266","H/C|495346","Lighting|495224","Automotive|553294","Hand Tools|551238","Equipment|551240","Power Tools|551236","Models|923468","Hardware|511228","Lawn/Garden|551242","Top Selling|468250","Gifts|553648","L/G Tools|915484","Pest Control|553844","Birding|553632","Grills|553760","Camping|892986","Decor|553788","Heat/Light|553778","Furniture|553824","Top Selling|599872","Computer/Internet|602324","Family|602330","Games|602336","History|602342","Lifestyle|602348","Music|602354","Pets|602360","Espanol|1040158","Travel|602370","Arts|602314","Business|602320","Electronics|602326","Fashion|602332","Home/Garden|602344","Literary|602350","Newspapers|1040160","Religion|602362","Sport|602366","Womens|602372","Automotive|602316","Childrens|602322","Entertain|602328","Food|602334","Health|602340","International|602346","Mens|602352","News/Politics|602358","Science/Nature|602364","Teen|602368","Top Selling|404274","Action/Adventure|141","African American|301597","Animation|712260","Anime/Manga|281300","International|126","Classics|127","Comedy|128","Cult|162482","Documentary|508530","Drama|129","Gay/Lesbian|301665","Horror|131","Kids/Family|132","Military/War|586154","Musicals/Arts|508526","Music Video|133","Suspense|512026","Science Fiction|144","Special Interest|135","Sports|169798","Television|136","Westerns|139725","Top Selling|493964","Accessories/Supplies|281407","Car Accessories|226184","Clocks & Clock Radios|509280","Computer Add-Ons|172455","DVD Players|172514","Gadgets|172517","GPS & Navigation|172526","Handhelds & PDAs|172594","Home Theater|172593","Home Office|172574","Receivers|281053","Digital Audio|172630","Phones|172606","Portable Audio/Video|172623","Printers|172635","TVs|172659","VCRs & DVRs|172669","Top Selling|540988","Activity|542460","Bath & Potty|541586","Feeding|541564","Gear|541558","Health & Safety|541580","Layette|738468","Nursery|541572","Top Selling|502394","Digital Cameras|281052","Camcorders|172421","Film Cameras|499106","Binoculars|499320","Telescopes|281063","Microscopes|499170","Batteries & Chargers|173563","Memory Cards|697752","All Accessories|172435","Printers|499328")

%><html>
<head>
<title>Amazon Light - Search Results</title>
<meta name="keywords" content="Amazon.com, Amazon webservices, amazon web services, amazon light, amazon lite, amazonlight, amazagoogle, googlezon, amagoogle, amazon.com light, amazon associates, easy search, kokogiak amazon">
<meta name="description" content="Amazon Light - a fast and easy way to search and browse Amazon.com, Amazon Light, an Amazon.com Web Service, Amazon Light by Kokogiak Media">
<link rel="stylesheet" type="text/css" href="ph.css">
</head>
<body bgcolor="#ffffff" link="#222222" alink="#000066" vlink="#666666" text="#000000" marginheight=0 marginwidth=0 topmargin=0 leftmargin=0>
<center><table border=0 cellspacing=0 cellpadding=0 width=100% ><tr bgcolor="#efeecf"><td><img border=0 height=15 width=290 src="nv.gif" align="absmiddle" usemap="#nv"> </td></table></center>
<map name="nv"><area shape='rect' href='default.asp?field-keywords=<% =szTerm %>&sb=<% =szSB %>&typ=<% =szSchType %>&mod=<% =szSchMode %><% If szSB = "o" Then Response.write("&scNode=" & szNode) %>' coords='0,0,52,15'><%
Response.write("<area shape='rect' href='results.asp?sb=" & szSB & "&schMod=books&field-keywords=" & szTerm & "&scNode=000' coords='52,0,96,15'>")
Response.write("<area shape='rect' href='results.asp?sb=" & szSB & "&schMod=electronics&typ=elec&field-keywords=" & szTerm & "&scNode=000' coords='96,0,169,15'>")
Response.write("<area shape='rect' href='results.asp?sb=" & szSB & "&schMod=toys&typ=game&field-keywords=" & szTerm & "&scNode=000' coords='169,0,205,15'>")
Response.write("<area shape='rect' href='results.asp?sb=" & szSB & "&schMod=kitchen&typ=home&field-keywords=" & szTerm & "&scNode=000' coords='205,0,289,15'>")
%></map>
<table cellspacing=5 cellpadding=0 width=100% border=0><tr valign=top><td>
<font face="arial,helvetica" size=2>
<form action="results.asp">
<table cellspacing=0 cellpadding=0 border=0>
<tr valign=top><td rowspan=2>  </td>
<td width=148 rowspan=2>
<font face="arial,helvetica" size=1>
<a href="default.asp?field-keywords=<% =szTerm %>&sb=<% =szSB %>&typ=<% =szSchType %>&mod=<% =szSchMode %><% If szSB = "o" Then Response.write("&scNode=" & szNode) %>"><img src="amzn-logo-sm.gif" alt="Amazon" width="148" height="43" border=0 hspace="0" vspace="0" align=left></a>  </td>
<td align=left><font face="arial,helvetica" size=1><nobr><a href="advsearch.asp">Advanced Search</a> - <a href="http://www.amazon.com" target="_new">Amazon.com Proper</a></nobr><br></font>
</td>
</tr>
<tr valign=bottom>
<td align=center>
	<input maxLength=256 size=30 name="field-keywords" value="<% =Replace(szTerm,"+"," ") %>"><br><input type=image src="azs.gif" alt="Search for Amazon.com Products" height="20" width="150" border="0" value="Amazon Search" name=AZSch>
	<input type=hidden value="<% =szSchMode %>" name=schMod><input type=hidden value="<% =szSchType %>" name=typ></form>
</td>
</tr>
</table>
</td>
<%
'+------------------
'| Include the mini-shopping-cart (ylist.inc)
'+------------------
%>
<td align=right><!-- #INCLUDE FILE="ylist.inc" --></td>
</tr></table>

<center>
<table cellspacing=0 cellpadding=0 border=0>
	<tr><td><img src="rl.gif" border=0 height=20 width=24></td>

<%

szTerm = Replace(szTerm,"'","%27")

'+------------------
'| Determine how to display top categories button bar
'+------------------

szTopbar = ""
Select Case szSchType

	Case "elec"
		szBgCol="0000cc"
		If szSchMode="electronics" Then
			szTopbar = szTopbar & ("<td bgcolor=#0000cc align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1><b>Electronics</b></font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=electronics&typ=elec&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'><a href='results.asp?sb=" & szSB & "&schMod=electronics&typ=elec&field-keywords=" & szTerm & "&scNode=000' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=electronics&typ=elec&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Electronics</font></a></td>")
		End if
		If szSchMode="photo" Then
			szTopbar = szTopbar & ("<td bgcolor=#0000cc align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1> <b>Camera & Photo</b> </font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=photo&typ=elec&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'> <a href='results.asp?scNode=000&sb=" & szSB & "&schMod=photo&typ=elec' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=photo&typ=elec&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Camera & Photo</font></a> </td>")
		End if
		If szSchMode="software" Then
			szTopbar = szTopbar & ("<td bgcolor=#0000cc align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1><b>Software</b></font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=software&typ=elec&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'><a href='results.asp?scNode=000&sb=" & szSB & "&schMod=software&typ=elec' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=software&typ=elec&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Software</font></a></td>")
		End if
		If szSchMode="pc-hardware" Then
			szTopbar = szTopbar & ("<td bgcolor=#0000cc align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1><b>Computers</b></font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=pc-hardware&typ=elec&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'><a href='results.asp?scNode=000&sb=" & szSB & "&schMod=pc-hardware&typ=elec' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=pc-hardware&typ=elec&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Computers</font></a></td>")
		End if

	Case "game"
		szBgCol="990099"
		If szSchMode="toys" Then
			szTopbar = szTopbar & ("<td bgcolor=#990099 align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1><b>Toys</b></font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=toys&typ=game&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'><a href='results.asp?scNode=000&sb=" & szSB & "&schMod=toys&typ=game' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=toys&typ=game&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Toys</font></a></td>")
		End if
		If szSchMode="videogames" Then
			szTopbar = szTopbar & ("<td bgcolor=#990099 align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1><b>Videogames</b></font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=videogames&typ=game&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'><a href='results.asp?scNode=000&sb=" & szSB & "&schMod=videogames&typ=game' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=videogames&typ=game&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Videogames</font></a></td>")
		End if
		If szSchMode="baby" Then
			szTopbar = szTopbar & ("<td bgcolor=#990099 align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1><b>Baby</b></font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=baby&typ=game&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'><a href='results.asp?scNode=000&sb=" & szSB & "&schMod=baby&typ=game' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=baby&typ=game&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Baby</font></a></td>")
		End if

	Case "home"
		szBgCol="990000"
		If szSchMode="kitchen" Then
			szTopbar = szTopbar & ("<td bgcolor=#990000 align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1> <b>Kitchen & Housewares</b> </font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=kitchen&typ=home&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'> <a href='results.asp?scNode=000&sb=" & szSB & "&schMod=kitchen&typ=home' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=kitchen&typ=home&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Kitchen & Housewares</font></a> </td>")
		End if
		If szSchMode="garden" Then
			szTopbar = szTopbar & ("<td bgcolor=#990000 align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1><b>Outdoor Living</b></font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=garden&typ=home&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'><a href='results.asp?scNode=000&sb=" & szSB & "&schMod=garden&typ=home' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=garden&typ=home&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Outdoor Living</font></a></td>")
		End if
		If szSchMode="universal" Then
			szTopbar = szTopbar & ("<td bgcolor=#990000 align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1> <b>Tools & Hardware</b> </font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=universal&typ=home&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'> <a href='results.asp?scNode=000&sb=" & szSB & "&schMod=universal&typ=home' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=universal&typ=home&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Tools & Hardware</font></a> </td>")
		End if

	Case Else
		szBgCol="006699"
		If ((szSchMode="books") OR (szSchMode="")) Then
			szTopbar = szTopbar & ("<td bgcolor=#006699 align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1><b>Books</b></font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=books&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'><a href='results.asp?scNode=000&sb=" & szSB & "&schMod=books' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=books&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Books</font></a></td>")
		End if
		If szSchMode="music" Then
			szTopbar = szTopbar & ("<td bgcolor=#006699 align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1><b>Music</b></font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=music&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'><a href='results.asp?scNode=000&sb=" & szSB & "&schMod=music' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=music&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Music</font></a></td>")
		End if
		If szSchMode="dvd" Then
			szTopbar = szTopbar & ("<td bgcolor=#006699 align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1><b>DVD</b></font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=dvd&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'><a href='results.asp?scNode=000&sb=" & szSB & "&schMod=dvd' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=dvd&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>DVD</font></a></td>")
		End if
		If szSchMode="vhs" Then
			szTopbar = szTopbar & ("<td bgcolor=#006699 align=center width=100 style='font-family:arial;'><font face='arial,helvetica' color=#ffffff size=-1><b>Video</b></font></td>")
		Else
			szTopbar = szTopbar & ("<td bgcolor=#eeeecc align=center width=100 onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=vhs&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & " style='font-family:arial;cursor:hand;'><a href='results.asp?scNode=000&sb=" & szSB & "&schMod=vhs' onclick=" & Chr(34) & "document.location=('results.asp?sb=" & szSB & "&schMod=vhs&field-keywords=" & szTerm & "&scNode=000');return false;" & Chr(34) & "><font face='arial,helvetica' size=-1 color='#000000'>Video</font></a></td>")
		End if
	End Select

	Response.write(szTopbar) %>

<td><img src="rr.gif" border=0 height=20 width=24></td>
</tr></table>

<%

'+------------------
'| Build the XML URL, and fetch the XML doc from Amazon
'+------------------

dim objHTTP
dim objXML
dim szGetString

set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")

szSubcats = ""
szSubcatName = ""

For i=subCatTot2(sztNode) to (subCatTot(sztNode)+subCatTot2(sztNode))
	catCount = catCount + 1
	rgScNodes = Split(subCatNodes(i),"|")
	If ((catCount = 1) AND (szNode="000")) Then
		szNode = rgScNodes(1)
	End if
	If szNode <> rgScNodes(1) Then
		szSubcats = szSubCats & ("<nobr><a href='results.asp?sb=" & szSB & "&scNode=" & rgScNodes(1) & "&schMod=" & szSchMode & "&typ=" & szSchType & "&field-keywords=" & szTerm & "'>" & rgScNodes(0) & "</a>")
	Else
		szSubcats = szSubCats & ("<nobr><b>" & rgScNodes(0) & "</b>")
		If catCount=1 Then
			szSubcatName = UCase(szSchMode)
		Else
			szSubcatName = rgScNodes(0)
		End if
	End if
	If i < (subCatTot(szTnode)+subCatTot2(szTnode)) Then
		szSubcats = szSubCats & (" |</nobr> ")
	Else
		szSubcats = szSubCats & ("</font></td></tr></table>")
	End if
Next

'+------------------
'| XML Strings, Advanced Search, Normal Search, and Browse
'+------------------

Select Case szAdvSearch
	Case "1"
		szGetString = "http://xml.amazon.com/onca/xml?v=1.0&t=kokogiak-20&dev-t=[Insert Developer's Token Here]&AuthorSearch=" & Replace(szTerm,"+","%20") & "&mode=books&type=heavy&page=" & szPage & "&f=xml"
	Case "2"
		szGetString = "http://xml.amazon.com/onca/xml?v=1.0&t=kokogiak-20&dev-t=[Insert Developer's Token Here]&AuthorSearch=" & Replace(szTerm,"+","%20") & "&mode=" & szSchMode & "&type=heavy&page=" & szPage & "&f=xml"
	Case "3"
		szGetString = "http://xml.amazon.com/onca/xml?v=1.0&t=kokogiak-20&dev-t=[Insert Developer's Token Here]&ActorSearch=" & Replace(szTerm,"+","%20") & "&mode=" & szSchMode & "&type=heavy&page=" & szPage & "&f=xml"
	Case "4"
		szGetString = "http://xml.amazon.com/onca/xml?v=1.0&t=kokogiak-20&dev-t=[Insert Developer's Token Here]&DirectorSearch=" & Replace(szTerm,"+","%20") & "&mode=" & szSchMode & "&type=heavy&page=" & szPage & "&f=xml"
	Case "5"
		szGetString = "http://xml.amazon.com/onca/xml?v=1.0&t=kokogiak-20&dev-t=[Insert Developer's Token Here]&ManufacturerSearch=" & Replace(szTerm,"+","%20") & "&mode=" & szSchMode & "&type=heavy&page=" & szPage & "&f=xml"
	Case Else
		If szSB = "s" Then
			szGetString = "http://xml.amazon.com/onca/xml?v=1.0&t=kokogiak-20&dev-t=[Insert Developer's Token Here]&KeywordSearch=" & Replace(szTerm,"+","%20") & "&mode=" & szSchMode & "&type=heavy&page=" & szPage & "&f=xml"
		Else
			szGetString = "http://xml.amazon.com/onca/xml?v=1.0&t=kokogiak-20&dev-t=[Insert Developer's Token Here]&BrowseNodeSearch=" & szNode & "&mode=" & LCase(szSchMode) & "&type=heavy&page=" & szPage & "&f=xml"
		End if
End Select

objHTTP.open "GET", szGetString, false
objHTTP.Send
Set objXML = objHTTP.ResponseXML

If (objXML.getElementsByTagName("error").length=0) Then
	totProds = objXML.getElementsByTagName("Details").length

'+------------------
'| Debug code, uncomment the line below to display onscreen the XML string being built and requested.
'+------------------
	''Response.write("<a href='" & szGetString & "' target=_new>" & szGetString & "</a><br>")

	If szSB = "s" Then
		Response.write ("<table cellspacing=0 cellpadding=2 border=0 width=100%  bgcolor='#" & szBgCol & "'><tr><td align=center><font size=1 style='font-size:3px;'> <br></font></td></tr><tr><td align=center><font face='arial,helvetica' color=#ffffff size=2 style='font-size:12px'> Top bestsellers for <b>" & Replace(Replace(szTerm,"%27","'"),"+"," ") & "</b> in " & Replace(szSchMode,"universal","tools") & " - Page <b>" & szPage & "</b></font>")
	Else
		Response.write ("<table cellspacing=0 cellpadding=2 border=0 width=100%  bgcolor='#" & szBgCol & "'><tr><td align=center><font size=1 style='font-size:3px;'> <br></font></td></tr><tr><td align=center><font face='arial,helvetica' color=#ffffff size=2 style='font-size:12px'> Top sellers in <b>" & szSubcatName & "</b> - Page <b>" & szPage & "</b></font>")
	End if

	If totProds = 10 Then
		Response.write("<font face='arial,helvetica' color=#ffffff size=2 style='font-size:12px'> -- <a href='results.asp?sb=" & szSB & "&scNode=" & szNode & "&field-keywords=" & szTerm & "&schMod=" & szSchMode & "&typ=" & szSchType & "&page=" & (szPage+1) & "&advSearch=" & szAdvSearch & "'><font color='#ffffff'><b>More on Next Page ></b></font></a> <br></td></tr></table>")
	Else
		Response.write("</td></tr></table>")
	End if

	catCount = 0
	If (subCatTot(sztNode)<16) Then
		nMod = 4
	Else
		nMod = 6
	End if

	If szSB = "o" Then
		Response.write("<table border=0 width=670 cellpadding=4><tr valign=top><td align=center><font size='1' style='font-size:11px;' face='arial,helvetica'>")
		Response.write(szSubcats)
		Response.write("<hr size=1 width=640 noshade=true><font face='arial,helvetica' size=2><b>Top sellers in <font style='font-size:15px;' color=" & szBgcol & ">" & szSubcatName & "</font></b></font><hr size=1 width=640 noshade=true></td></tr></table>")
	End if


	For i = 0 to (totProds-1)

		set o15 = objXML.getElementsByTagName("Details").item(i)

		set o16 = o15.childNodes
		For j = 0 to o16.length-1
			On Error Resume Next
			Select Case o16.item(j).nodeName
				Case "Isbn" szIsbn = o16.item(j).text
				Case "Upc" szUpc = o16.item(j).text
				Case "ProductName"
					szProductName = o16.item(j).text
				Case "Asin"
					szAsin = o16.item(j).text
				Case "Authors"
					szAuthor = o16.item(j).text
				Case "Artists"
					set o17 = objXML.getElementsByTagName("Artists").item(i)
					set o20 = o17.childNodes
					For k = 0 to o20.length-1
						If (k<o20.length-1) Then szCom = ", " Else szCom = "" End if
						Select Case o20.item(k).nodeName
							Case "Artist"
								szArtists = szArtists & o20.item(k).text & szCom
						End Select
					Next
				Case "ImageUrlSmall"
					szImage = o16.item(j).text
				Case "OurPrice"
					szOurprice = o16.item(j).text
				Case "ListPrice"
					szListprice = o16.item(j).text
				Case "ReleaseDate"
					szReleasedate = o16.item(j).text
				Case "SalesRank"
					szSalesRank = o16.item(j).text
				Case "Reviews"
					set o17 = objXML.getElementsByTagName("Reviews").item(i)
					set o20 = o17.childNodes
					For k = 0 to o20.length-1
						Select Case o20.item(k).nodeName
							Case "AvgCustomerRating"
								szAvgCustomerRating = o20.item(k).text
						End Select
					Next
			End Select
		Next

		If (szAsin<>"") Then
			szTaggedurl="detpage.asp?sb=" & szSB & "&asin=" & szAsin & "&field-keywords=" & szTerm & "&schMod=" & szSchMode & "&type=" & szSchType
		End if

		If ((Request("AZLuck") = "Serendipity") AND (i=0)) Then
			Response.Redirect(szTaggedURL)
		End if

		Response.write ("<table border=0 width=640 ><tr valign=top><td align=left width=10% >")
		If (szImage<>"") Then
			If szSB = "o" Then
				Response.write("<nobr><font face='arial,helvetica' size=-1><b>" & i+((szPage*10)-10)+1 & ".</b> </font><a href='" & szTaggedurl & "'><img border=0 src='" & szImage & "' align='top'></a></nobr>")
			Else
				Response.write("<a href='" & szTaggedurl & "'><img border=0 src='" & szImage & "'></a>")
			End if
		Else
			Response.write(" ")
		End if

		Response.write ("</td><td width=90% ><font face='arial,helvetica' size=2 style='font-size:12px;'><b><a href='" & szTaggedurl & "'>" & szProductName & "</a></b><br>")
		If (szAuthor<>"") Then
			Response.write ("<font style='font-size:10px;'>by " & szAuthor & "</font><br>")
		End if

		If (szArtists<>"") Then
			Response.write ("<font style='font-size:10px;'>by " & szArtists & "</font><br>")
		End if

		If ((szListprice <> "") AND (szListprice <> szOurPrice)) Then
			Response.write ("List Price: <b><strike>" & szListprice & "</strike></b><br>")
		End if

		If (szOurprice <> "") Then
			Response.write ("Our Price: <b><font color='red'>" & szOurprice & "</font></b><br>")
		End if

		If (szSalesRank <> "") Then
			Response.write ("Sales Rank: <b><font color='darkred'>" & szSalesRank & "</font></b>")
			If (szAvgCustomerRating <> "") Then
				Response.write (" - ")
			Else
				Response.write ("<br>")
			End if
		End if

		If (szAvgCustomerRating <> "") Then
			Response.write ("Avg. Rating: <b><font color='darkred'>" & Round(szAvgCustomerRating,1) & "</font></b> (out of 5)<br>")
		End if

		If (szReleasedate <> "") Then
			Response.write ("Released: " & szReleasedate )
			If (szIsbn <> "") Then
				Response.write (" - <font size=1 style='font-size:10px;'>ISBN: " & szIsbn & "</font><br>")
			Elseif (szUpc <> "") Then
				Response.write (" - <font size=1 style='font-size:10px;'>UPC: " & szUpc & "</font><br>")
			Else
				Response.write ("<br>")
			End if
		Else
			If (szIsbn <> "") Then
				Response.write ("<font size=1 style='font-size:10px;'>ISBN: " & szIsbn & "</font><br>")
			Elseif (szUpc <> "") Then
				Response.write ("<font size=1 style='font-size:10px;'>UPC: " & szUpc & "</font><br>")
			End if
		End if

		Response.write ("</td><td align='right'>")

		Response.write ("<form method='GET' action='results.asp'><input type='image' src='add_s.gif' border=0 height=20 width=100 alt='Add this Item to Your List' name='add-to-cart' value='Add to Your List'><input type='hidden' name='page' value='" & szPage & "'><input type='hidden' name='addasin' value='1'><input type='hidden' name='typ' value='" & szSchType & "'><input type='hidden' name='schMod' value='" & szSchMode & "'><input type='hidden' name='scNode' value='" & Request("scNode") & "'><input type='hidden' name='sb' value='" & szSB & "'><input type='hidden' name='szProd' value='" & Replace(szProductName,"'","") & "'><input type='hidden' name='asin' value='" & szAsin & "'><input type='hidden' name='field-keywords' value='" & szTerm & "'></form>")

		Response.write ("</td></tr><tr><td colspan=3><hr size=1 color=#cccccc noshade=true width=100% ></td></tr></table>")

		szProductName = ""
		szAsin = ""
		szAuthor = ""
		szImage = ""
		szSmallimage = ""
		szOurprice = ""
		szListprice = ""
		szReleasedate = ""
		szBinding = ""
		szTaggedurl = ""
		szAvgCustomerRating = ""
		szSalesRank = ""
		szArtists = ""
		szIsbn = ""
		szUpc = ""
	Next

	If totProds = 10 Then
		Response.write(" <br></div><center><font face='arial,helvetica' size=2><a href='results.asp?sb=" & szSB & "&scNode=" & szNode & "&field-keywords=" & szTerm & "&schMod=" & szSchMode & "&typ=" & szSchType & "&page=" & (szPage+1) & "&advSearch=" & szAdvSearch & "'><b>More on Next Page ></b></a><p></center>")
	Else
		Response.write (" <br><p> </div>")
	End if

	Set objXML = Nothing
	Set objXSL = Nothing

if totProds > 0 Then %>
<center>
<form action="results.asp">
<table cellspacing=0 cellpadding=0 border=0>
<tr>
<td>
	<input maxLength=256 size=40 name="field-keywords" value="<% =Replace(Replace(szTerm,"%27","'"),"+"," ") %>"> <input type="image" height="20" width="150" src="azs.gif" value="Amazon Search" name=AZSch align="absmiddle">
	<input type=hidden value="<% =szSchMode %>" name=schMod><input type=hidden value="<% =szSchType %>" name=typ></form>
</td>
</tr>
</table>
</form>

<% Else %>

<center>
<p><font face='arial,helvetica' size=2>
We're sorry, no results found for <% =Replace(Replace(szTerm,"%27","'"),"+"," ") %> in <% =szSchMode %>. Please try another category.</font>
</center>


<% End if

Else

	Response.write ("<div id='bin'>No Results found for <b>" & Replace(Replace(szTerm,"%27","'"),"+"," ") & "</b> in " & szSchMode & ".</div>")

End if


%>

<p><br><br><font face='arial,helvetica' size=2>
<b>At Amazon.com Proper</b><br>
<table border=0 cellspacing=0 cellpadding=0 width=100% ><tr bgcolor="#efeecf"><td align="center"><font face="arial,helvetica" size=2>
<a href="http://www.amazon.com/exec/obidos/tg/stores/recs/instant-recs/-/recs">Recommendations</a> -
<a href="http://www.amazon.com/exec/obidos/tg/stores/static/-/gateway/international-gateway">International</a> -
<a href="http://www.amazon.com/exec/obidos/account-access-login">Your Account</a> -
<a href="http://www.amazon.com/exec/obidos/wishlist">Wish List</a> -
<a href="http://www.amazon.com/exec/obidos/tg/browse/-/909656">Today's Deals</a> -
<a href="http://www.amazon.com/exec/obidos/tg/browse/-/508510">Help</a><br> 
 </td></table></center></body></html>