<!--#include file="../owFunctions/I_StoreFront.asp"-->
<!--#include file="../owFunctions/I_Cart.asp"-->
<%
	'************************************************************************************
	'*																					*
	'*	MODIFICATION TO THIS SCRIPT OR ANY FILES INCLUDED WITH 							*
	'*		ONEWORLDSTORE IS DONE AT YOUR OWN RISK!										*
	'*	Product  : OneWorldStore														*
	'*	Version  : 9.0000																*
	'*	Modified : June 2004															*
	'*	Copyright:	Copyright (C) 2004 OneWorldStore.Com								*
	'*				Registration Number: 1024507										*
	'*				http://strategis.ic.gc.ca/											*
	'*																					*
	'************************************************************************************
	
	iNumColums = 2
	

	Dim sCategoryID		' must dim this because we can't use idCategory as it's already dimm'ed in other files, BUT not dimm'ed in yet others
	Dim iLevel, iY
	Dim aCategoryDropDowns(100)	' this is set for 100 levels of recursion...never going to happen so we are safe
	Dim owTemplateTitle
	Dim iNumColums
	
	Call SF_OpenPage()
	
	'************************************************************************************
	'*																					*
	'*																					*
	'*																					*
	'************************************************************************************
	Sub DisplayCategoriesStandard()

		Dim rsStoreData, rsStoreData2
		
		set rsStoreData		= CreateObject("ADODB.Recordset")
		set rsStoreData2	= CreateObject("ADODB.Recordset")
		
		sSQLText = "SELECT idCategory, categoryDesc, idParentCategory FROM categories WHERE idParentCategory=1 AND idCategory<>1 AND active=-1 ORDER BY categoryDesc"
		Call DB_getFromDatabase (sSQLText, rsStoreData, "listCategoriesTree")
		If ( NOT rsStoreData.EOF ) Then
			%>
			<table border="0" cellspacing="0" cellpadding="0" width="170">
				<tr>
					<td width=1><img src='<%=sPath%>../owTemplates/images/LeftNavTopLeft.gif'></td>
					<td width=168 background='<%=sPath%>../owTemplates/images/LeftNavTopBG.gif'><span class='LeftNavHead'><%=LANG_DT( "TEMPLATE_CATEGORIES", "CATEGORIES" )%></SPAN></td>
					<td width=1><img src='<%=sPath%>../owTemplates/images/LeftNavTopRight.gif'></td>
				</tr>
				<tr>
					<td background='<%=sPath%>../owTemplates/images/LeftNavMiddleLeft.gif'><img src='<%=sPath%>../owTemplates/images/ClearDot.gif' width=5></td>
					<td background='<%=sPath%>../owTemplates/images/F7F7F0.gif' width=170>
						<table border="0" cellspacing="0" cellpadding="0" width="100%">
						<%
						While ( NOT rsStoreData.EOF )
							pIdCategory			= rsStoreData("idCategory")
							pCategoryDesc		= rsStoreData("categoryDesc")   
							pIdParentCategory	= rsStoreData("idParentCategory")
							%>
							<tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td background='<%=sPath%>../owTemplates/images/LeftNavLine.gif'><img src="images/ClearDot.gif" width="1" height="11"></td></tr></table></td></tr>
							<tr> 
								<td class="owInfoBoxWithHeadings">&nbsp;
									<a href="<%=sOWStoreUrlNonSSL%>owListProduct.asp?idCategory=<%=(rsStoreData("idCategory"))%>" class='LeftNavLinks'><%=(rsStoreData("categoryDesc"))%></a>
								</td>
							</tr>
							<tr> 
								<td class="owInfoBoxWithHeadings"> 
									<%
									'sSQLText = "SELECT * FROM Categories WHERE idParentCategory > 1 And idParentCategory = " & rsStoreData("idCategory") & " ORDER BY ISNULL(sortOrder,99999999),categoryDesc"
									sSQLText = "SELECT * FROM Categories WHERE idParentCategory = " & rsStoreData("idCategory") & " ORDER BY displayOrder,categoryDesc"
									Call DB_getFromDatabase (sSQLText, rsStoreData2, "listCategoriesTree")
									While ( NOT rsStoreData2.EOF )
										%>
										<table cellpadding=0 cellspacing=0 border=0>
											<tr>
												<td><img src='<%=sPath%>../owTemplates/images/ClearDot.gif' width=15></td>
												<td><a href="<%=sOWStoreUrlNonSSL%>owListProduct.asp?bSub=T&idCategory=<%=(rsStoreData2.Fields.Item("idCategory").Value)%>" class='LeftNavLinks'><img src='<%=sPath%>../owTemplates/images/LeftNavArrow.gif' border=0 align=middle></a></td>
												<td><a href="<%=sOWStoreUrlNonSSL%>owListProduct.asp?bSub=T&idCategory=<%=(rsStoreData2.Fields.Item("idCategory").Value)%>" class='LeftNavLinks'><%=(rsStoreData2.Fields.Item("categoryDesc").Value)%></a></td>
											</tr>
										</table>
										<%
										rsStoreData2.MoveNext()
									Wend
									Call DB_closeRecordset(rsStoreData2)
									%>
								</td>
							</tr>
							<%
							rsStoreData.MoveNext
						Wend 
						%>
						</table>
					</td>
					<td background='<%=sPath%>../owTemplates/images/LeftNavMiddleRight.gif'><img src='<%=sPath%>../owTemplates/images/ClearDot.gif' width=5></td>
				</tr>
				<tr>
					<td><img src='<%=sPath%>../owTemplates/images/LeftNavBottomLeft.gif'></td>
					<td background='<%=sPath%>../owTemplates/images/LeftNavBottomBG.gif'><img src='<%=sPath%>../owTemplates/images/ClearDot.gif' width=5></td>
					<td><img src='<%=sPath%>../owTemplates/images/LeftNavBottomRight.gif'></td>
				</tr>
				<tr><td colspan=3><img src='<%=sPath%>../owTemplates/images/ClearDot.gif' width=5></td></tr>
			</table>
			<%
		End If
		Call DB_closeRecordset(rsStoreData)
		set rsStoreData		= Nothing
		set rsStoreData2	= Nothing
		
	End Sub
	'************************************************************************************


	'************************************************************************************
	'*																					*
	'*																					*
	'*																					*
	'************************************************************************************
	Function ShowNewProd(iDispNum)
	
		Dim rsStoreData, sSQLText, iCount
		
		set rsStoreData = CreateObject("ADODB.Recordset")
		
		sSQLText = "SELECT TOP " & iDispNum & " idProduct, description FROM products WHERE active = -1 ORDER BY dateAdded DESC"
		Call DB_getFromDatabase(sSQLText, rsStoreData, "") 
		if ( not rsStoreData.EOF ) Then
			%>
			<table border="0" cellspacing="0" cellpadding="0" width="170">
				<tr>
					<td width=1><img src='<%=sPath%>../owTemplates/images/LeftNavTopLeft.gif'></td>
					<td width=168 background='<%=sPath%>../owTemplates/images/LeftNavTopBG.gif'><span class='LeftNavHead'><%=LANG_DT( "TEMPLATE_NEWPROD", "NEW PRODUCTS" )%></SPAN></td>
					<td width=1><img src='<%=sPath%>../owTemplates/images/LeftNavTopRight.gif'></td>
				</tr>
				<tr>
					<td background='<%=sPath%>../owTemplates/images/LeftNavMiddleLeft.gif'><img src='<%=sPath%>../owTemplates/images/ClearDot.gif' width=5></td>
					<td background='<%=sPath%>../owTemplates/images/F7F7F0.gif' width=100%>
						<%
						While ( ( NOT rsStoreData.EOF ) And ( iCount < iDispNum ) )
							'Increment counter
							iCount = iCount + 1
							' must put in a table because sometimes the product desc wraps and looks crazy
							%>
							<table cellpadding=0 cellspacing=0 border=0>
								<tr>
									<td><a href="<%=sOWStoreUrlNonSSL%>owProductDetail.asp?idProduct=<%=rsStoreData("idProduct")%>" class='LeftNavLinks'><img src='<%=sPath%>../owTemplates/images/LeftNavArrow.gif' border=0 align=middle></a></td>
									<td><a href="<%=sOWStoreUrlNonSSL%>owProductDetail.asp?idProduct=<%=rsStoreData("idProduct")%>" class='LeftNavLinks'><%=iCount%>. <%=rsStoreData("description")%></a></td>
								</tr>
							</table>
							<%
							rsStoreData.MoveNext
						Wend
						%>
					</td>
					<td background='<%=sPath%>../owTemplates/images/LeftNavMiddleRight.gif'><img src='<%=sPath%>../owTemplates/images/ClearDot.gif' width=5></td>
				</tr>
				<tr>
					<td><img src='<%=sPath%>../owTemplates/images/LeftNavBottomLeft.gif'></td>
					<td background='<%=sPath%>../owTemplates/images/LeftNavBottomBG.gif'><img src='<%=sPath%>../owTemplates/images/ClearDot.gif' width=5></td>
					<td><img src='<%=sPath%>../owTemplates/images/LeftNavBottomRight.gif'></td>
				</tr>
				<tr><td colspan=3><img src='<%=sPath%>../owTemplates/images/ClearDot.gif' width=5></td></tr>
			</table>
		<%
		End If
	
		Call DB_closeRecordset(rsStoreData)
		set rsStoreData = Nothing
	
	End Function
	'************************************************************************************
	
	
	
	'************************************************************************************
	'*																					*
	'*																					*
	'*																					*
	'************************************************************************************
	Sub TEMPLATE_ProductListingDisplay( pSmallImageUrl, pDescription, pListPrice, sPrice, sBToBPrice, pStock, pVisits, sIDProduct, idCategory )
	
		Dim rsStoreData
	
		If ( sOWCurrencyCode <> "" ) Then
			sTempCurrencyCode = "(" & sOWCurrencyCode & ")"
		End If
	
		%>
		<table cellpadding=0 cellspacing=0 border=0 width=100%>
			<tr>
				<td valign=top width=200>
					<%If ( Trim(pSmallImageUrl) <> "" ) Then%>
					<a href="<%=sPath%>owProductDetail.asp?idproduct=<%=sIDProduct%>&idCategory=<%=idCategory%>"><img src='<%=sOWImagesDir%>/small/<%=pSmallImageUrl%>' alt="<%=server.HTMLEncode(pDescription)%>" border=0 width=150></a><br>
					<%Else%>
					<a href="<%=sPath%>owProductDetail.asp?idproduct=<%=sIDProduct%>&idCategory=<%=idCategory%>"><img src='<%=sPath%>owTemplates/images/imageNA.gif' alt="<%=LANG_DT( "TEMPLATE_IMAGEMISSING", "Image not available" )%>" border=0></a><br>
					<%End If%>
				</td>
				<td valign=top>
					<font size=+1 color=660000>
					<%
					if sBtoBPrice>0 and (bOWShowBtoBPrice or ACCNT_InGroup(iLoginAccountUnq, C_GROUP_WHOLESALE)) then
						%><%=CONVERSION_Currency(sBToBPrice)%>&nbsp;<font size=-1><%=sTempCurrencyCode%></font><%
					Else
						%><%=CONVERSION_Currency(sPrice)%>&nbsp;<font size=-1><%=sTempCurrencyCode%></font><%
					End If
					%>
					</font>
					<%if (pListPrice-sPrice)>0 and ACCNT_InGroup(iLoginAccountUnq, C_GROUP_RETAIL) then%>
						<br> ~ <%=LANG_DT( "TEMPLATE_YOUSAVE", "You save" )%> <%=CONVERSION_Currency(pListPrice-sPrice)%>
					<%End If%>

					<table cellpadding=0 cellspacing=0 border=0 height=40><tr><td valign=top><a href="<%=sPath%>owProductDetail.asp?idproduct=<%=sIDProduct%>"><%=pDescription%></a></b></td></tr></table>
					<table cellpadding=0 cellspacing=0 border=0 width=100%>
						<tr>
							<td>
								<br><%=LANG_DT( "TEMPLATE_POP", "Popularity" )%>:  <%=pVisits%> 
							</td>
							<td align=right>
								<a href="<%=sPath%>owBasket/owAddItem.asp?idProduct=<%=sIDProduct%>"><img src="<%=sPath%>owTemplates/images/English/small_addCart.gif" border="0"></a>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<br><hr size=1 color=DDDDDD><br>
		<%
		
	End Sub
	'************************************************************************************
	
	
	'************************************************************************************
	'*																					*
	'*																					*
	'*																					*
	'************************************************************************************
	Sub ItemDetailSmall( pSmallImageUrl, pDescription, pListPrice, sPrice, sBToBPrice, pStock, pVisits )
	
		pListPrice		= Cdbl(pListPrice)
		sPrice			= Cdbl(sPrice)
		sBToBPrice		= Cdbl(sBToBPrice)
		
		If ( sOWCurrencyCode <> "" ) Then
			sTempCurrencyCode = "(" & sOWCurrencyCode & ")"
		End If

		%>
		<table height=110 cellspacing=0 border=0 width="100%" cellpadding="0">
			<tr> 
				<td width=5 valign="top"><img src="<%=sPath%>../owTemplates/ClearDot.gif" width="5" height="1"></td>
				<td valign="top"> 
					<table border="0" cellspacing="0" cellpadding="5" align="left">
						<tr> 
							<td> 
								<center>
								<table width=100% height=200 cellpadding=0 cellspacing=0 border=0>
									<tr>
										<td align=center valign=top>
											<%If ( Trim(pSmallImageUrl) <> "" ) Then%>
											<a href="<%=sPath%>owProductDetail.asp?idproduct=<%=sIDProduct%>&idCategory=<%=idCategory%>"><img src='<%=sOWImagesDir%>/Thumbs/<%=pSmallImageUrl%>' alt="<%=server.HTMLEncode(pDescription)%>" border=0 width=150></a><br>
											<%Else%>
											<a href="<%=sPath%>owProductDetail.asp?idproduct=<%=sIDProduct%>&idCategory=<%=idCategory%>"><img src='<%=sPath%>../owTemplates/images/imageNA.gif' alt="<%=LANG_DT( "TEMPLATE_IMAGEMISSING", "Image not available" )%>" border=0></a><br>
											<%End If%>
										</td>
									</tr>
								</table>
								</center>
								<font size=+1 color=660000>
								<%
								if sBtoBPrice>0 and (bOWShowBtoBPrice or ACCNT_InGroup(iLoginAccountUnq, C_GROUP_WHOLESALE)) then
									%><%=CONVERSION_Currency(sBToBPrice)%>&nbsp;<font size=-1><%=sTempCurrencyCode%></font><%
								Else
									%><%=CONVERSION_Currency(sPrice)%>&nbsp;<font size=-1><%=sTempCurrencyCode%></font><%
								End If
								%>
								</font>

								<%if (pListPrice-sPrice)>0 and ACCNT_InGroup(iLoginAccountUnq, C_GROUP_RETAIL) then%>
									<br> ~ <%=LANG_DT( "TEMPLATE_YOUSAVE", "You save" )%> <%=CONVERSION_Currency(pListPrice-sPrice)%>
								<%End If%>

								<table cellpadding=0 cellspacing=0 border=0 height=40><tr><td valign=top><a href="<%=sPath%>owProductDetail.asp?idproduct=<%=sIDProduct%>"><%=pDescription%></a></b></td></tr></table>
								<table cellpadding=0 cellspacing=0 border=0 width=100%>
									<tr>
										<td>
											<br><%=LANG_DT( "TEMPLATE_POP", "Popularity" )%>:  <%=pVisits%> 
										</td>
										<td align=right>
											<a href="<%=sPath%>owBasket/owAddItem.asp?idProduct=<%=sIDProduct%>"><img src="<%=sPath%>../owTemplates/images/English/small_addCart.gif" border="0"></a>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<%

	End Sub
	'************************************************************************************
	
	
	'********************************************************************************
	'*																				*
	'*																				*
	'********************************************************************************
	Sub TEMPLATE_PrintRecordsetNav( sURL, iOWNumPerPage, iTtlNumItems, iDBLoc, sQuerystring )

		Dim sSqlTemp, iTtlTemp, iNumLinksPerPage
		Dim iDBLocTemp, sURLBeg, iA, iB, x, iTemp, rsObj

		iTtlNumItems	= CDbl(iTtlNumItems)
		iDBLoc			= CDbl(iDBLoc)
		iOWNumPerPage		= CDbl(iOWNumPerPage)
		iTtlTemp		= iTtlNumItems \ iOWNumPerPage	' this is the number of numbers overall (use the "\" to return int)
		iDBLocTemp		= iDBLoc \ iOWNumPerPage		' this is which number we are currently on (use the "\" to return int)
		iNumLinksPerPage= 10	' this is the number of links to display

		If (sQuerystring <> "") Then
			sURLBeg = "<a href = ""JavaScript:PaginationLink('" & sQuerystring & "&iTtlNumItems=" & iTtlNumItems & "&iDBLoc="
		Else
			sURLBeg = "<a href = ""JavaScript:PaginationLink('&iTtlNumItems=" & iTtlNumItems & "&iDBLoc="
		End If

		'***** BEGIN DISPLAY *****
		Response.Write "<table cellpadding=0 cellspacing=5 border=0><tr>"
		%>
		<table border="0" cellpadding="0" cellspacing="0" style="font-size: 11px">
			<tr>
				<td height="25">
					<%
					' Print the <<
					if (iDBLocTemp >= iOWNumPerPage) then
						iTemp = ( iDBLocTemp * iOWNumPerPage ) - ( iOWNumPerPage * iNumLinksPerPage)
						Response.Write "&nbsp;" & sURLBeg & iTemp & "')"">&lt;&lt;</a>&nbsp;"
					end if
					' Print the "Previous"
					if (iDBLoc <> 0) then
						iTemp = iDBLoc - iOWNumPerPage
						Response.Write "&nbsp;" & sURLBeg & iTemp & "')""> &#8592; </a>&nbsp;"
					end if
			
					' Print the numbers in between. Print them out in sets of 10.
					iA = iDBLocTemp-5
					If ( iA < 0 ) Then
						iA = 0
					End If
					iB = iA + iNumLinksPerPage
					for x = iA to iB
						iTemp = (x * iOWNumPerPage)
						if (iTemp < iTtlNumItems) then	' takes care of extra numbers after the overall final number
							If ( iDBLoc >= iTemp ) And ( iDBLoc < (iTemp + iOWNumPerPage) ) Then
								Response.Write "&nbsp;" & x+1 & "&nbsp;"
							else
								Response.Write "&nbsp;" & sURLBeg & (x * iOWNumPerPage) & "')"">" & x+1 & "</a>&nbsp;"
							end if
						else
							exit for
						end if
					next
					' Print the "Next"
					if ((iDBLoc + iOWNumPerPage) < iTtlNumItems) then
						iTemp = (iDBLoc + iOWNumPerPage)
						Response.Write "&nbsp;" & sURLBeg & iTemp & "')""> &#8594; </a>&nbsp;"
					end if
					' Print the >>
					if ((iDBLocTemp + iNumLinksPerPage) <= iTtlTemp) then
						iTemp = ( iDBLocTemp * iOWNumPerPage ) + ( iOWNumPerPage * iNumLinksPerPage)
						Response.Write "&nbsp;" & sURLBeg & iTemp & "')"">&gt;&gt;</a>&nbsp;"
					end if
					%>
				</td>
			</tr>
		</table>
		<%

	End Sub
	'********************************************************************************
%>