<!--#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/											*
	'*																					*
	'************************************************************************************
	
	sCountryCode  		= Trim(Request("sCountryCode"))
	bRefresh			= Trim(Request("bRefresh"))
	sSort				= Trim(Request("sSort"))
	sSearch				= Trim(Request("sSearch"))
	sSearchText			= Trim(Request("sSearchText"))
	set rsStoreData3	= CreateObject("ADODB.Recordset")
	
	'sSQLText = "SELECT CC.CountryName, CC.CountryCode, CC.Position, CC.Active, CT.ID, CT.TaxName, CT.Percentage FROM countryCodes CC LEFT OUTER JOIN CountryTax CT ON CC.CountryCode = CT.CountryCode WHERE CC.CountryCode = '" & sCountryCode & "' ORDER BY CT.TaxName"
	sSQLText = "SELECT * FROM countryCodes WHERE CountryCode = '" & sCountryCode & "'"
	Call DB_getFromDatabase(sSQLText, rsStoreData, "")
	If ( NOT rsStoreData.EOF ) Then
		If ( rsStoreData("TerritoryLabel") <> "" ) Then
			sLabelText = rsStoreData("TerritoryLabel")
		Else
			sLabelText = "Provence/State"
		End If
		%>
		<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?sCountryCode=<%=sCountryCode%>&sPage=ModifyCountries&sMessage=<%=Server.URLEncode(LANG_DT( "COUNTRY_SAVESCHANGED", "** Changes saved **" ))%>"
			<%Else%>
			parent.owBodyTopNav.location="owBodyTopNav.asp?sCountryCode=<%=sCountryCode%>&sPage=ModifyCountries&sMessage=<%=Trim(Request("sMessage"))%>"
			<%End If%>
			parent.owBodyFooter.location="owBodyFooter.asp?sAction=Null"
			
	
			function SubmitForm(sAction){
				document.ModifyCountries.sAction.value = sAction;
				document.ModifyCountries.submit();
			}
			
			function SubmitStateForm(sAction, sStateTaxCode)
			{
				document.ModifyCountries.sAction.value = sAction;
				document.ModifyCountries.sStateTaxCode.value = sStateTaxCode;
				document.ModifyCountries.submit();
			}
			
		</script>
		
		<body onLoad = 'toForm();' style="font-family: Arial; font-size: 11px;" topmargin="0" leftmargin="0" bgcolor=C3DAF9>
		<form method="post" name="ModifyCountries" action='owModifyCountriesExec.asp'>
			<input type='hidden' name='sAction' value='ModifyCountries'>
			<input type='hidden' name='sStateTaxCode' value=''>
			<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="sCountryCode" value="<%=sCountryCode%>">
			<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( "COUNTRY_CODE", "Country Code" )%>
					</td>
					<td>
						<%=LANG_DT( "COUNTRY_NAME", "Country Name" )%>
					</td>
					<td>
						<%=LANG_DT( "COUNTRY_LABEL", "Territory Descriptor" )%>
					</td>
					<td>
						<%=LANG_DT( "COUNTRY_POSTALCODE", "Postal Code Descriptor" )%>
					</td>
					<td align=center>
						<%=LANG_DT( "COUNTRY_POSITION", "Position" )%>
					</td>
					<td align=center>
						<%=LANG_DT( "COUNTRY_ACTIVE", "Active" )%>
					</td>
				</tr>
				<tr>
					<td>
						<%VALIDATE_textbox "sNewCountryCode", rsStoreData("CountryCode"), 3, "textbox", "blank"%>
					</td>
					<td>
						<%VALIDATE_textbox "sCountryName", rsStoreData("CountryName"), 30, "textbox", "blank"%>
					</td>
					<td>
						<%VALIDATE_textbox "sTerritoryLabel", rsStoreData("TerritoryLabel"), 20, "textbox", "blank"%>
					</td>
					<td>
						<%VALIDATE_textbox "sPostalCodeLabel", rsStoreData("PostalCodeLabel"), 20, "textbox", "blank"%>
					</td>
					<td align=center>
						<%VALIDATE_textbox "sPosition", rsStoreData("Position"), 3, "textbox", "blank"%>
					</td>
					<td align=center>
						<input type='checkbox' name="sActive" value="Y" <%If ( Trim(rsStoreData("Active")) = "Y" ) Then Response.Write "checked" End If%> alt="blank">
					</td>
				</tr>
			</table>
			
			<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 colspan=4 style='padding-bottom: 2px; padding-top: 6px;'>
						<table width=100% border="0" cellpadding="0" cellspacing="0" style="FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#FFFFFF">
							<tr>
								<td>
					            	<table border="0" cellpadding="5" cellspacing="0" style="border-left: 1px solid C3DAF9; FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#EAF1F9">
					            		<tr>
					            			<td align=right style='border-top: 1px solid C3DAF9; border-right: 1px solid C3DAF9;' nowrap><b><%=LANG_DT( "COUNTRY_TAXES", "Country Taxes" )%></b></td>
					            			<td width=100% bgcolor=FFFFFF style='border-bottom: 1px solid C3DAF9;'>&nbsp;</td>
					             		</tr>
					            	</table>
					            </td>
							</tr>
							<tr bgcolor="#EAF1F9">
								<td>
					            	<table width=100% border="0" cellpadding="5" cellspacing="0" style="border-left: 1px solid C3DAF9; border-right: 1px solid C3DAF9; border-bottom: 1px solid C3DAF9; FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#EAF1F9">
										<%
										sSQLText = "SELECT * FROM CountryTax WHERE CountryCode = '" & sCountryCode & "' ORDER BY TaxName"
										Call DB_getFromDatabase(sSQLText, rsStoreData2, "")
										If ( rsStoreData2.EOF ) Then
											%>
											<tr>
												<td>
													&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=LANG_DT( "COUNTRY_NONEWFORCOUNTRY", "No taxes have been created for " )%><%=rsStoreData("CountryName")%>.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
													<input type='button' name='' value='<%=LANG_DT( "COUNTRY_ADDNEWTAX", " Add New Tax " )%>' onClick='SubmitForm("NewTax");'>
												</td>
											</tr>
										<%Else
											%>
											<tr>
												<td>
													<table border="0" cellpadding="0" cellspacing="0" style="FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#EAF1F9">
														<tr>
															<td>
																<%=LANG_DT( "COUNTRY_TAX_NOTE", "Name of Tax<br>(required if you enter a tax percentage)" )%>
															</td>
															<td width=150 valign=bottom align=center>
																<%=LANG_DT( "COUNTRY_PERCENTAGE", "Percentage (eg. 7.25)" )%>
															</td>
															<td valign=bottom align=center>
																<%=LANG_DT( "COUNTRY_DELETE", "Delete?" )%>
															</td>
														</tr>
														<%
														iCount = 0
														While ( NOT rsStoreData2.EOF )
															%>
															<tr>
																<td>
																	<%VALIDATE_textbox "sTaxName" & rsStoreData2("ID"), rsStoreData2("TaxName"), 50, "textbox", ""%>
																</td>
																<td  width=150 valign=bottom align=center>
																	<%VALIDATE_textbox "sPercentage" & rsStoreData2("ID"), rsStoreData2("Percentage"), 5, "textbox", ""%>%
																</td>
																<td align=center>
																	<input type='checkbox' name='sDelete<%=rsStoreData2("ID")%>' value='Y'>
																</td>
																<%
																If ( iCount = 0 ) Then
																	iCount = 1
																	%>
																	<td width=150 align=center>
																		<input type='button' name='' value='<%=LANG_DT( "COUNTRY_ADDNEWTAX", " Add New Tax " )%>' onClick='SubmitForm("NewTax");'>
																	</td>
																	<%
																Else
																	%>
																	<td>&nbsp</td>
																	<%
																End If%>
															</tr>
															<%
															rsStoreData2.MoveNext
														Wend
														%>
													</table>
												</td>
											</tr>
											<%
						
										End If
										Call DB_closeRecordset(rsStoreData2)
										%>
					            	</table>
					            </td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			</td></tr></table>
			
			<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 colspan=4 style='padding-bottom: 2px; padding-top: 6px;'>
						<table width=100% border="0" cellpadding="0" cellspacing="0" style="FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#FFFFFF">
							<tr>
								<td>
					            	<table border="0" cellpadding="5" cellspacing="0" style="border-left: 1px solid C3DAF9; FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#EAF1F9">
					            		<tr>
					            			<td align=right style='border-top: 1px solid C3DAF9; border-right: 1px solid C3DAF9;' nowrap><b><%=sLabelText%><%=LANG_DT( "COUNTRY_TAXES2", " Taxes" )%></b></td>
					            			<td width=100% bgcolor=FFFFFF style='border-bottom: 1px solid C3DAF9;'>&nbsp;</td>
					             		</tr>
					            	</table>
					            </td>
							</tr>
							<tr bgcolor="#EAF1F9">
								<td>
					            	<table width=100% border="0" cellpadding="5" cellspacing="0" style="border-left: 1px solid C3DAF9; border-right: 1px solid C3DAF9; border-bottom: 1px solid C3DAF9; FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#EAF1F9">
										<%
										sSQLText = "SELECT * FROM stateCodes WHERE CountryCode = '" & sCountryCode & "' ORDER BY StateName"
										Call DB_getFromDatabase(sSQLText, rsStoreData2, "")
										If ( rsStoreData2.EOF ) Then
											%>
											<tr>
												<td colspan=3>
													&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=Replace(LANG_DT( "COUNTRIES_NOSTATES", "No 1: have been created for " ), "1:", STRUCTURE_TerritoryLabel(sCountryCode))%><%=rsStoreData("CountryName")%>.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
													<input type='button' name='' value=' <%=LANG_DT( "COUNTRY_ADDNEW", "Add New " )%><%=sLabelText%> ' onClick='SubmitForm("NewState");'>
												</td>
											</tr>
										<%Else
											%>
											<tr>
												<td colspan=3>
													<table border="0" cellpadding="0" cellspacing="0" style="FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#EAF1F9">
														<tr>
															<td valign=bottom align=center>
																<%=LANG_DT( "STATE_CODE", sLabelText & "Code" )%>
															</td>
															<td valign=bottom align=center>
																<%=LANG_DT( "STATE_NAME", sLabelText & "Name" )%>
															</td>
															<td valign=bottom align=center>
																<%=LANG_DT( "ACTIVEQUEST", "Active?" )%>
															</td>
															<td valign=bottom align=center>
																<%=LANG_DT( "DELETE", "Delete" )%>
															</td>
															<td align=center>
																<input type='button' name='' value=' <%=LANG_DT( "COUNTRY_ADDNEW", "Add New " )%><%=sLabelText%> ' onClick='SubmitForm("NewState");'>
																<br><br>
															</td>
														</tr>
														<%
														While ( NOT rsStoreData2.EOF )
															sSQLText = "SELECT * FROM StateTax WHERE StateCode = '" & rsStoreData2("StateCode") & "' ORDER BY TaxName"
															Call DB_getFromDatabase(sSQLText, rsStoreData3, "")
															%>
															<tr>
																<td align=center width=75>
																	<%VALIDATE_textbox "sStateCode" & rsStoreData2("StateID"), rsStoreData2("StateCode"), 3, "textbox", "blank"%>
																</td>
																<td width=100>
																	<%VALIDATE_textbox "sStateName" & rsStoreData2("StateID"), rsStoreData2("StateName"), 50, "textbox", "blank"%>
																</td>
																<td align=center width=50>
																	<input type='checkbox' name='sActiveState<%=rsStoreData2("StateID")%>' value='Y' <%If ( rsStoreData2("Active") = "Y" ) Then Response.Write "checked" End If%>>
																</td>
																<td align=center width=50>
																	<input type='checkbox' name='sStateDelete<%=rsStoreData2("StateID")%>' value='Y'>
																</td>
																<td>
																	<%If ( rsStoreData3.EOF ) AND ( Trim(rsStoreData2("StateName")) <> "" ) Then
																		%>
																		<input type='button' name='' value=' <%=LANG_DT( "COUNTRY_ADDNEW", "Add New " )%><%=rsStoreData2("StateName")%> <%=LANG_DT( "COUNTRY_TAX", "Tax" )%> ' style='width:220px' onClick='SubmitStateForm("NewStateTax", "<%=rsStoreData2("StateCode")%>");'>
																		<%
																	End If%>
																</td>
															</tr>
															<%If ( NOT rsStoreData3.EOF ) Then%>
																<tr>
																	<td colspan=5>
																		<table border="0" cellpadding="0" cellspacing="0" style="FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#EAF1F9">
																			<tr>
																				<td><img src='../images/blank.gif' width=75 height=1></td>
																				<td><%=rsStoreData2("StateName")%>&nbsp;<%=LANG_DT( "COUNTRY_TAXNAME", "Tax Name" )%></td>
																				<td align=center><%=LANG_DT( "PERCENTAGE", "Percentage (eg. 7.25)" )%></td>
																				<td align=center><%=LANG_DT( "DELETE", "Delete" )%></td>
																			</tr>
																			<%
																			While ( NOT rsStoreData3.EOF )
																				%>
																				<tr>	
																					<td>&nbsp;</td>
																					<td><%VALIDATE_textbox "sStateTaxName" & rsStoreData3("ID"), rsStoreData3("TaxName"), 40, "textbox", ""%></td>
																					<td width=150 align=center><%VALIDATE_textbox "sStatePercent" & rsStoreData3("ID"), rsStoreData3("Percentage"), 5, "textbox", ""%>%</td>
																					<td width=50 align=center><input type='checkbox' name='sDelStateTax<%=rsStoreData3("ID")%>' value='Y'></td>
																				</tr>
																				<%
																				rsStoreData3.MoveNext
																			Wend
																			%>
																			<tr>
																				<td><img src='../images/blank.gif' width=75 height=1></td>
																				<td colspan=3>
																					<%If ( Trim(rsStoreData2("StateName")) <> "" ) Then%>
																					<input type='button' name='' value=' <%=LANG_DT( "COUNTRY_ADDNEW", "Add New " )%><%=rsStoreData2("StateName")%><%=LANG_DT( "COUNTRYES_TAX", " Tax" )%> ' style='width:220px' onClick='SubmitStateForm("NewStateTax", "<%=rsStoreData2("StateCode")%>");'>
																					<%End If%>
																				</td>
																			</tr>
																		</table>
																		<br><br>
																	</td>
																</tr>
																<%
															End If
															Call DB_closeRecordset(rsStoreData3)
															rsStoreData2.MoveNext
														Wend
														%>
													</table>
												</td>
											</tr>
											<%
										End If
										Call DB_closeRecordset(rsStoreData2)
										%>
					            	</table>
					            </td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			</td></tr></table>
			</td></tr></table>
		</form>
		<form method='post' name='DelCountries' action='owListCountries.asp'>
			<input type='hidden' name='sDelete<%=sCountryCode%>' value=''>
			<input type='hidden' name='sAction' value='Delete'>
			<input type='hidden' name='sSort' value='<%=sSort%>'>
		</form>
	<%
	End If
	Call DB_closeRecordset(rsStoreData)
	Set rsStoreData3 = Nothing
	%>
	<!--#include file="../footer.asp"-->