//根据地区ID,显示城市列表



//生成生日日期列表
function SetBirthday(desObj)
{
	var count=desObj.options.length;
	var i=0;
    for(i=count-1;i>=0;i--) desObj.remove(i); 
    
    var year=document.frmreg.birthyear.value;
	var month=document.frmreg.birthmonth.value;
	
	var str=getDays(month,year);
	for(var i=1;i<=str;i++)
	{
		desObj.options.add(new Option(i,i));
	}

	if(document.frmreg.bday.value!="")
	{
		document.frmreg.birthday.value=document.frmreg.bday.value;
	}
	
}

//获取年份是否是闰年
function getDays(month, year) 
{
	 var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31);
	 var tstr="";
	if(month=="0" || year=="0")
	{
		tstr="0";
	}
	else
	{
		 
		  if (month==2)
		  {
			  if ((year % 4)==0 && (year % 100)!=0 ||(year % 400)==0) 
			  {
				 tstr=29;
			  }
			  else
			  {
				 tstr=28;
			  }
		  }
		  else
		  {
			 tstr=daysInMonth[month-1];
		  }
	}
  return tstr;

}

//将年份转换成生肖
function SetBirthdayYear(year)
{
		var ShengXiao = new Array(0,1,2,3,4,5,6,7,8,9,10,11);
		document.frmreg.shengxiao.selectedIndex = ShengXiao[(year-4)%60%12];
		document.frmreg.bsx.value=document.frmreg.shengxiao.value;
}
//将月份与日期转换成星座
function SetConstellation(m_year,month,day)
{
	var tempDate=new Date(m_year,month-1,day);
	var GC;
	switch(tempDate.getMonth()+1)
	{
		case 1:
			if(tempDate.getDate()>=20)
			{
				GC=10;
			}
			else
			{
				GC=9;
			}
			break;
		case 2:
			if(tempDate.getDate()>=19)
			{
				GC=11;
			}
			else
			{
				GC=10;
			}
			break;
		case 3:
			if(tempDate.getDate()>=21)
			{
				GC=0;
			}
			else
			{
				GC=11;
			}
			break;
		case 4:
			if(tempDate.getDate()>=21)
			{
				GC=1;
			}
			else
			{
				GC=0;
			}
			break;
		case 5:
			if(tempDate.getDate()>=21)
			{
				GC=2;
			}
			else
			{
				GC=1;
			}
			break;
		case 6:
			if(tempDate.getDate()>=22)
			{
				GC=3;
			}
			else
			{
				GC=2;
			}
			break;
		case 7:
			if(tempDate.getDate()>=23)
			{
				GC=4;
			}
			else
			{
				GC=3;
			}
			break;
		case 8:
			if(tempDate.getDate()>=23)
			{
				GC=5;
			}
			else
			{
				GC=4;
			}
			break;
		case 9:
			if(tempDate.getDate()>=23)
			{
				GC=6;
			}
			else
			{
				GC=5;
			}
			break;
		case 10:
			if(tempDate.getDate()>=24)
			{
				GC=7;
			}
			else
			{
				GC=6;
			}
			break;
		case 11:
			if(tempDate.getDate()>=22)
			{
				GC=8;
			}
			else
			{
				GC=7;
			}
			break;
		case 12:
			if(tempDate.getDate()>=22)
			{
				GC=9;
			}
			else
			{
				GC=8;
			}
			break;
	}

			/* 
				牡羊座	03/21 - 04/20 ---0
				金牛座	04/21 - 05/20 ---1
				双子座	05/21 - 06/21 ---2
				巨蟹座	06/22 - 07/22 ---3
				狮子座	07/23 - 08/22 ---4
				处女座	08/23 - 09/22 ---5
				天秤座	09/23 - 10/23 ---6
				天蝎座	10/24 - 11/21 ---7
				射手座	11/22 - 12/21 ---8
				魔羯座	12/22 - 01/19 ---9
				水瓶座	01/20 - 02/18 ---10
				双鱼座  02/19 - 03/20 ---11
			*/

			document.Form1.UI_Constellation.selectedIndex=GC;
			document.Form1.s_Constellation.value=document.Form1.UI_Constellation.value;
			document.Form1.s_Birthday_Day.value=document.Form1.UI_Birthday_Day.value;
			document.Form1.s_Birthday_Year.value=document.Form1.UI_Birthday_Year.value;
			document.Form1.s_Birthday_Month.value=document.Form1.UI_Birthday_Month.value;
			document.Form1.s_Birthday_Day.value=document.Form1.UI_Birthday_Day.value;

}
function SetDay()
{
	//设置日期
	SetBirthday(document.frmreg.birthday);
	//获得生肖
	SetBirthdayYear(document.frmreg.birthyear.value);
	//获得星座
	//SetConstellation(document.Form1.UI_Birthday_Year.value,document.Form1.UI_Birthday_Month.value,document.Form1.UI_Birthday_Day.value);
	document.frmreg.byear.value=document.frmreg.birthyear.value;
	document.frmreg.bmonth.value=document.frmreg.birthmonth.value;
	document.frmreg.bday.value=document.frmreg.birthday.value;
	
}
function LoadAC()
{
	if(document.Form1.s_Inhabit_Area.value!="")
	{
		document.Form1.UI_Inhabit_Area.value=document.Form1.s_Inhabit_Area.value;
	}
	else
	{
		document.Form1.s_Inhabit_Area.value=document.Form1.UI_Inhabit_Area.value;
	}

	if(document.Form1.s_Hometown_Area.value!="")
	{
		document.Form1.UI_Hometown_Area.value=document.Form1.s_Hometown_Area.value;
	}
	else
	{
		document.Form1.s_Hometown_Area.value=document.Form1.UI_Hometown_Area.value;
	}
}
//Page_OnLoad()
function aconload()
{
	LoadAC();
	chooseac(document.Form1.UI_Inhabit_County,document.Form1.UI_Inhabit_Area.selectedIndex);
	chooseac(document.Form1.UI_Hometown_County,document.Form1.UI_Hometown_Area.selectedIndex);
	//document.Form1.s_Inhabit_County.value=document.Form1.UI_Inhabit_County.value;
	//document.Form1.s_Hometown_County.value=document.Form1.UI_Hometown_County.value;
	//alert(document.Form1.UI_Inhabit_County.value+" - "+document.Form1.UI_Hometown_County.value+"\n"+document.Form1.s_Inhabit_County.value+" - "+document.Form1.s_Hometown_County.value);

	SetDay();
}