<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../hl_Conn.asp"-->
<%
'Option Explicit
Response.Buffer=True

	dim Country,Province,City
	Dim ShowCountry,ShowProvince,ShowCity
	Dim TempRs

	Country=ReplaceBadChar(Trim(Request("Country")))
	Province = ReplaceBadChar(Trim(Request("Province")))
	City = ReplaceBadChar(Trim(Request("City")))
	If Country="" Then Country = "中国"
	If Province="" Then Province = "广东"
	If City="" Then City = "广州市"

	On Error Resume Next
	Set TempRs = Conn.Execute("SELECT Country FROM Country ORDER BY Country")
	If Err or TempRs.Eof Then
		FoundErr = True
	Else
		ShowCountry = TempRs.GetRows(-1)
	End If
	Set TempRs = Conn.Execute("SELECT Province FROM Province WHERE Country='" & Country & "' ORDER BY ProvinceID")
	If Err or TempRs.Eof Then
		redim ShowProvince(0,0)
		Province = Trim(Request.QueryString("Province"))
	Else
		ShowProvince = TempRs.GetRows(-1)
	End If
	Set TempRs = Conn.Execute("SELECT City FROM City WHERE Province='" & Province & "' ORDER BY CityID")
	If Err or TempRs.Eof Then
		redim ShowCity(0,0)
	Else
		ShowCity = TempRs.GetRows(-1)
	End If
	Set TempRs = Nothing
	Conn.Close
	Set Conn = Nothing
	If FoundErr = True Then
		response.write "您的<font color=""red"">数据库</font>文件不存在或已经损坏！" & vbCrLf
	End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Admin/Admin_Style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%"  border="0" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
	<form name="regionform" id="regionform" action="Region.asp" method="post">
	<tr class="tdbg">
		<td width="100" align="right">
			国家/地区：
		</td>
		<td colspan="2">
			<select name="Country" id="Country" onChange="document.regionform.submit();">
				<%
				Dim i
				i = 0
				For i = 0 to Ubound(ShowCountry,2)
					Response.Write "<option value='" & ShowCountry(0,i) & "'"
					If Country = ShowCountry(0,i) Then Response.Write " selected"
					Response.Write ">" & ShowCountry(0,i) & "</option>" &vbCrLf
				Next
				%>
			</select>
		</td>
	</tr>
	<tr class="tdbg">
		<td align="right">
			省市/州郡：
		</td>
		<td>
			<select name="Province" id="Province" onChange="document.regionform.submit();">
				<%
				If ShowProvince(0,0) = "" Then
					Response.Write "<option>请输入</option>" & vbCrLf
				Else
					i = 0
					For i = 0 to Ubound(ShowProvince,2)
						Response.Write "<option value='" & ShowProvince(0,i) & "'"
						If Province = ShowProvince(0,i) Then Response.Write " selected"
						Response.Write ">" & ShowProvince(0,i) & "</option>" & vbCrLf
					Next
				End If
				%>
			</select>
		</td>
	</tr>
	<tr class="tdbg">
		<td align="right">
			城市：
		</td>
		<td >
			<select name="City" id="City">
				<%
				If ShowCity(0,0) = "" Then
					Response.Write "<option>请输入</option>" & vbCrLf
				Else
					i = 0
					For i = 0 to Ubound(ShowCity,2)
						Response.Write "<option value='" & ShowCity(0,i) & "'"
						If City = ShowCity(0,i) Then Response.Write " selected"
						Response.Write ">" & ShowCity(0,i) & "</option>" &vbCrLf
					Next
				End If
				%>
			</select>
		</td>
	</tr>
	</form>
</table>
</body>
</html>
<%
Function ReplaceBadChar(strChar)
    If strChar = "" Then
        ReplaceBadChar = ""
    Else
        ReplaceBadChar = Replace(Replace(Replace(Replace(Replace(Replace(Replace(strChar, "'", ""), "*", ""), "?", ""), "(", ""), ")", ""), "<", ""), ".", "")
    End If
End Function

%>