<!--#include file="../../owFunctions/I_GeneralFunctions.asp"-->
<!--#include file="../header.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/											*
	'*																					*
	'************************************************************************************

	
	pIdCategory			= CONVERSION_SQLEncode2(Request("idCategory"),10)
	bRefresh			= Trim(Request("bRefresh"))
	sSort				= Trim(Request("sSort"))
	sSearch				= Trim(Request("sSearch"))
	sSearchText			= Trim(Request("sSearchText"))
	
	if trim(pIdCategory)="" then
		%>
		<script language = "javascript">
			parent.owBodyTopNav.location = "owBodyTopNav.asp?sPage=ModifyCategories&sMessage=<%=Server.URLEncode(LANG_DT( "CATEGORIES_MISSINGID", "** Missing Category ID **" ))%>"
			location = "owListCategories.asp?sSort=<%=sSort%>&sSearch=<%=sSearch%>&sSearchText=<%=sSearchText%>";
		</script>
		<%
	Else
		sSQLText = "SELECT * FROM categories WHERE idCategory=" & pIdCategory
		Call DB_getFromDatabase(sSQLText, rsStoreData, "") 
		If ( NOT rsStoreData.EOF ) Then
			sCategoryDesc		= rsStoreData("categoryDesc")
			sIDParentCategory	= rsStoreData("idParentCategory")
			sImageCategory		= rsStoreData("imageCategory")
			sActive				= rsStoreData("active")
			sLongHTML			= rsStoreData("longHTML")
			sShortHTML			= rsStoreData("shortHTML")
			sFeatured			= rsStoreData("Featured")
			sDisplayOrder		= rsStoreData("displayOrder")
		End If
		Call DB_closeRecordset(rsStoreData)
	
		Call WriteForm()
	End If

	'************************************************************************************
	'*																					*
	'*																					*
	'*																					*
	'************************************************************************************
	Sub WriteForm()
		%>
		<script type="text/javascript" src="../Script/fValConfig.js"></script>
		<script type="text/javascript" src="../Script/fValidate.js"></script>

		<script language = "javascript">
	
			<%If ( bRefresh = "TRUE" ) Then%>
			parent.owBodyTopNav.location="owBodyTopNav.asp?sPage=ModifyCategories&sMessage=<%=Server.URLEncode(LANG_DT( "CATEGORY_SAVED", "** Changes saved **" ))%>"
			<%Else%>
			parent.owBodyTopNav.location="owBodyTopNav.asp?sPage=ModifyCategories"
			<%End If%>
			parent.owBodyFooter.location="owBodyFooter.asp?sAction=Null"
			
		</script>
		
		<body onLoad = 'toForm()' style="font-family: Arial; font-size: 11px;" topmargin="0" leftmargin="0" bgcolor=C3DAF9>
		<form ENCTYPE="multipart/form-data" method="post" name="ModifyCategories" action='owModifyCategoriesExec.asp'>
			<input type='hidden' name='sAction' value='ModifyCategories'>
			<input type='hidden' name='sSort' value='<%=sSort%>'>
			<input type='hidden' name='sSearchText' value='<%=sSearchText%>'>
			<input type='hidden' name='sSearch' value='<%=sSearch%>'>
			<input type="hidden" name="sIDCategory" value="<%=pIdCategory%>">
			<table border="0" cellpadding="0" cellspacing="0" width="100%" style="padding:5px; FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#ffffff"><tr><td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" style="FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#ffffff">
				<tr>
					<td style='padding-top: 5px;'>
						<%=LANG_DT( "CATEGORIES_DESC", "Description" )%>
					</td>
					<td align=center>
						<%=LANG_DT( "CATEGORIES_DISPORDER", "Display Order" )%>
					</td>
					<td align=center>
						<%=LANG_DT( "CATEGORIES_ACTIVE", "Active?" )%>
					</td>
					<td align=center>
						<%=LANG_DT( "CATEGORIES_FEATURED", "Featured?" )%>
					</td>
				</tr>
				<tr>
					<td>
						<%VALIDATE_textbox "sCategoryDesc", sCategoryDesc, 75, "textbox", "blank"%>
					</td>
					<td align=center>
						<%VALIDATE_textbox "sDisplayOrder", sDisplayOrder, 3, "textbox", "blank"%>
					</td>
					<td align=center>
						<input type="checkbox" name="sActive" value=-1 <%if sActive=-1 then response.write "checked" end if%>>
					</td>
					<td align=center>
						<input type="checkbox" name="sFeatured" value=-1 <%if sFeatured=-1 then response.write "checked" end if%>>
					</td>
				</tr>
				<tr>
					<td colspan=4 style='padding-bottom: 2px; padding-top: 6px;'>
						<%=LANG_DT( "CATEGORIES_PARENT", "Parent Category" )%>
					</td>
				</tr>
				<tr>
					<td colspan=4>
						<select name="sIDParentCategory">  
							<%Call STRUCTURE_RecurseCategories(0, 0, "SELECT", sIDParentCategory)%>
						</select>
					</td>
				</tr>
				<tr>
					<td colspan=4 style='padding-bottom: 2px; padding-top: 6px;'>
						<%=LANG_DT( "CATEGORIES_SHORTHTML", "Short HTML <font size=-1>(255 chars or less)</font>" )%>
					</td>
				</tr>
				<tr>
					<td colspan=4>
						<%VALIDATE_textbox "sShortHTML", sShortHTML, 75, "textbox", ""%>
					</td>
				</tr>
				<tr>
					<td colspan=4 style='padding-bottom: 2px; padding-top: 6px;'>
						<%=LANG_DT( "CATEGORIES_LONGHTML", "Long HTML" )%>
					</td>
				</tr>
				<tr>
					<td colspan=4>
						<%VALIDATE_textbox "sLongHTML", sLongHTML, 75, "textarea", ""%>
					</td>
				</tr>
				<tr>
					<td colspan=4 style='padding-bottom: 2px; padding-top: 6px;'>
						<%=LANG_DT( "CATEGORIES_CATIMAGEPATH", "Category Image Path" )%>
					</td>
				</tr>
				<tr>
					<td colspan=4>
						<input TYPE='FILE' NAME='sImageCategory' SIZE=30 alt='file|jpg,gif,png|0|bok'>
						<%If ( Trim(sImageCategory) <> "" ) Then%>
						<table border="0" cellpadding="0" cellspacing="0" width="100%" style="FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#ffffff">
							<tr>
								<td>
									<b><%=LANG_DT( "CATEGORIES_CURRENTIMAGE", "Current Image:" )%></b>
								</td>
								<td>
									<%=LANG_DT( "CATEGORIES_DEL_CUR_IMAGE", "Delete Current Image?" )%>
									<input type='checkbox' name='sDelCurImage' value='Y'>
									<input type='hidden' name='sOriginalImageName' value='<%=Server.HTMLEncode(sImageCategory)%>'>
								</td>
							</tr>
							<tr>
								<td colspan=2 align=center>
									<img src="../../<%=Server.HTMLEncode(sOWCategoryImage & "/" & sImageCategory)%>">
								</td>
							</tr>
						</table>
						<%End If%>
					</td>
				</tr>
			</table>
			</td></tr></table>
		</form>
		<form method='post' name='CategoryList' action='owListCategories.asp'>
			<input type='hidden' name='sDelete<%=pIdCategory%>' value=''>
			<input type='hidden' name='sAction' value='Delete'>
			<input type='hidden' name='sSort' value='<%=sSort%>'>
		</form>
	<%
	End Sub
	'************************************************************************************
%>