<%@ Control Language="c#" AutoEventWireup="false"%>
<%@ OutputCache Duration="100" VaryByParam="none" %>
<%@ Import namespace="System.Data" %>
<%
	Response.Write("<script language=javascript>");
	
		
		DataBase db = new DataBase();
		
		Response.Write("var aryCity = new Array(");
		string strSql = "select pId,cyId,(cyCNName + '(' + cyENName + ')') as cyName from tbDictCity where cyState = 1  order by cyOrder";
		DataSet ds = new DataSet();
		ds = db.GetDataSet(strSql,ds);
		int itbRowCount = ds.Tables[0].Rows.Count;
		int i = 0;
		foreach(DataRow row in ds.Tables[0].Rows)
		{
			Response.Write("new Array('" + row[0].ToString() + "','" + row[1].ToString() + "','" + row[2].ToString() + "'),");
		}
		Response.Write("new Array('x','x','x')");
		Response.Write(");");
		Response.Write("var aryPopedom = new Array(");
		strSql = "select cyId,pdId,(pdCNName + '(' + pdENName + ')') as pdName from tbDictPopedom where pdState = 1  order by pdOrder";
		ds = new DataSet();
		ds = db.GetDataSet(strSql,ds);
		itbRowCount = ds.Tables[0].Rows.Count;
		i = 0;
		foreach(DataRow row in ds.Tables[0].Rows)
		{
			Response.Write("new Array('" + row[0].ToString() + "','" + row[1].ToString() + "','" + row[2].ToString() + "'),");
		}
		Response.Write("new Array('x','x','x')");
		
		ds.Dispose();
		ds = null;
		db = null;
		Response.Write(");");
	Response.Write("</script>");
%>
<script language="javascript">
	function Provinceonchange(pId,objCity,objPopedom)
	{
		if (pId!="")
		{
			var strCity = "";j = 0,p = 0;
			for (i=0;i<aryCity.length;i++)
			{
				if (aryCity[i][0] == pId)
				{
					j=j+1;
					strCity = strCity + aryCity[i][1] +"," +aryCity[i][2]+",";
				}
			}
			objCity.length=j;
			aryCity1 = strCity.split(",");
			for (i=0;i<j;i++)
			{
				if(aryCity1[p] != null && aryCity1[p] != "")
				{
					objCity.options[i].value = aryCity1[p];
					objCity.options[i].text = aryCity1[p+1];
				}
				p=p+2;
			}
			Cityonchange(objCity.options[objCity.options.selectedIndex].value,objPopedom);
		}
	}
	
	function Cityonchange(cyId,objPopedom)
	{
		if (cyId!="")
		{
			var strPopedom="";j=0,p=0;
			for (i=0;i<aryPopedom.length;i++)
			{
				if (aryPopedom[i][0] == cyId)
				{
					j=j+1;
					strPopedom = strPopedom + aryPopedom[i][1] +"," +aryPopedom[i][2]+",";
				}
			}
			objPopedom.length=j;
			aryPopedom1 = strPopedom.split(",");
			for (i=0;i<j;i++)
			{
				if(aryPopedom1[p] != null && aryPopedom1[p] != "")
				{
					objPopedom.options[i].value = aryPopedom1[p];
					objPopedom.options[i].text = aryPopedom1[p+1];
				}
				p=p+2;
			}
		}
	}
</script>



