<%
	'************************************************************************************
	'*																					*
	'*																					*
	'*																					*
	'************************************************************************************
	Function DisplayHeader(sIdSettingGroup)

		sSQLText = "SELECT GroupName FROM SettingsGroupNames WHERE idSettingGroup = " & sIdSettingGroup
		call DB_getFromDatabase(sSQLText, rsStoreData, "") 
		If ( NOT rsStoreData.EOF ) Then
			DisplayHeader = "<font size=+1 color=2A5CB2>" & rsStoreData("GroupName") & "</font>"
		End If
		Call DB_closeRecordset(rsStoreData)
		
	End Function
	'************************************************************************************


	'************************************************************************************
	'*																					*
	'*																					*
	'*																					*
	'************************************************************************************
	Sub DisplaySettings(sIdSettingGroup)
		sSQLText = "SELECT S.idSetting, S.settingKey, S.settingValue, S.comments, S.type, SO.settingoption, SO.optionvalue FROM Settings S LEFT OUTER JOIN SettingsOptions SO ON S.idSetting = SO.idSetting WHERE S.idSettingGroup = " & sIdSettingGroup & " ORDER BY S.idSetting"
		call DB_getFromDatabase(sSQLText, rsStoreData, "") 
		While ( NOT rsStoreData.EOF )
			sIdSetting		= Trim(rsStoreData("idSetting"))
			sSettingKey		= Trim(rsStoreData("settingKey"))
			sSettingValue	= Trim(rsStoreData("settingValue"))
			sComments		= Trim(rsStoreData("comments"))
			sType			= UCase(Trim(rsStoreData("type")))
			
			If ( sComments = "" ) Or ( IsNull(sComments) ) Then
				sComments = sSettingKey
			End If
			
			Select Case sType
				Case "MULTIPICK"
					%>
	        		<tr>
						<td width=50%><%=sComments%></td>
						<td width=50%>
							<select name='<%=sSettingKey%>' size=4 multiple>
								<%
								Do While ( NOT rsStoreData.EOF )
									If ( sIdSetting = Trim(rsStoreData("idSetting")) ) Then
										sSettingOption	= Trim(rsStoreData("settingoption"))
										sOptionValue	= Trim(rsStoreData("optionvalue"))
										If ( InStr(Trim(UCase(CStr(sSettingValue))), Trim(UCase(CStr(sOptionValue)))) > 0 ) Then
											Response.Write "<option value='" & sOptionValue & "' selected>" & sSettingOption & "</option>"
										Else
											Response.Write "<option value='" & sOptionValue & "'>" & sSettingOption & "</option>"
										End If
									Else
										Exit Do
									End If
									rsStoreData.MoveNext
								Loop
								%>
							</select>
						</td>
	         		</tr>
					<%
				Case "SELECT"
					%>
	        		<tr>
						<td width=50%><%=sComments%></td>
						<td width=50%>
							<select name='<%=sSettingKey%>'>
								<%
								Do While ( NOT rsStoreData.EOF )
									If ( sIdSetting = Trim(rsStoreData("idSetting")) ) Then
										sSettingOption	= Trim(rsStoreData("settingoption"))
										sOptionValue	= Trim(rsStoreData("optionvalue"))
										If ( Trim(UCase(CStr(sSettingValue))) = Trim(UCase(CStr(sOptionValue))) ) Then
											Response.Write "<option value='" & sOptionValue & "' selected>" & sSettingOption & "</option>"
										Else
											Response.Write "<option value='" & sOptionValue & "'>" & sSettingOption & "</option>"
										End If
									Else
										Exit Do
									End If
									rsStoreData.MoveNext
								Loop
								%>
							</select>
						</td>
	         		</tr>
					<%
				Case "TEXT"
					%>
	        		<tr>
	        			<td width=50%><%=sComments%></td>
						<td width=50%><%VALIDATE_textbox sSettingKey, sSettingValue, 50, "textbox", ""%></td>
	         		</tr>
					<%
					If ( NOT rsStoreData.EOF ) Then
						rsStoreData.MoveNext
					End If
				Case "BOOLEAN"
					%>
	        		<tr>
	        			<td width=50%><%=sComments%></td>
						<td width=50%>
							<select name='<%=sSettingKey%>'>
								<option value=0 <%If ( Trim(UCase(CStr(sSettingValue))) = "0" ) Then Response.Write "selected" End If%>>No</option>
								<option value=-1 <%If ( Trim(UCase(CStr(sSettingValue))) = "-1" ) Then Response.Write "selected" End If%>>Yes</option>
							</select>
						</td>
	         		</tr>
					<%
					If ( NOT rsStoreData.EOF ) Then
						rsStoreData.MoveNext
					End If
				Case Else
					If ( NOT rsStoreData.EOF ) Then
						rsStoreData.MoveNext
					End If
			End Select

		Wend
		Call DB_closeRecordset(rsStoreData)
	End Sub
	'************************************************************************************
%>