function keyup_yyyy(theform)
{ 
	var yyyy = theform.yyyy.value;
	if (yyyy.length == 4) {
		theform.mm.focus();
	}
	else {
		theform.yyyy.focus();
	}
}
function keyup_mm(theform)
{
	var mm = theform.mm.value;
	if (mm.length == 2) {
		if ((mm >=1 ) && (mm <=12 )){
			theform.dd.focus();
		}
		else {
			alert("月份超出範圍");
			theform.mm.value = "";
			return false;
		}
	}
}
function keyup_dd(theform)
{
	var yyyy = theform.yyyy.value;
	var mm = theform.mm.value;
	var dd = theform.dd.value;
	var dd1= 0;
	var li_mod;
	if (dd.length == 2) {
		li_mod = yyyy % 4;
		dd1 = dd * 1;
		if ((li_mod ==0) && (mm == 2 )) {
			if ((dd1 >= 1 ) && (dd1 <= 29 )){
					theform.City.focus();
			}
			else {
				alert("您輸入的日期不存在");
				theform.dd.value = "";
				theform.dd.focus();				
				return false;
			}
		}
		else
		{
			if ((mm ==2 )) {
				if ((dd1 >= 1 ) && (dd1 <= 28 )){
					theform.City.focus();
					return true;
				}
				else {
					alert("您輸入的日期不存在");
					theform.dd.value = "";
					theform.dd.focus();				
				}
			} //end if ((theform.mm.value ==2 ))非閏年二月
			if ((mm ==1 ) || (mm ==3 ) ||
				(mm ==5 ) || (mm ==7 ) ||
				(mm ==8 ) || (mm ==10 ) ||
				(mm ==12 )) {
				if ((dd1 >=1 ) && (dd1 <=31 )){
					theform.City.focus();
					return true;
				}
				else {
					alert("您輸入的日期不存在");
					theform.dd.value = "";
					theform.dd.focus();		
					return false;		
				}
			} //end if ((mm.value ==1 ) || (mm.value ==3 )大月
			if ((mm ==4 ) || (mm ==6 ) ||
				(mm ==9 ) || (mm ==11 )) {
				if ((dd1 >=1 ) && (dd1 <=30 )){
					theform.City.focus();
					return true;
				}
				else {
					theform.dd.value = "";
					alert("您輸入的日期不存在");			
					theform.dd.focus();	
					return false;	
				}
			} //end if ((mm.value ==4 ) || (mm.value ==6 ) 正常小月
		}// end if ((yyyy.value / 4) == 0) &&  (mm.value == 2 ))
	}// if dd.length == 2
}
function get_birthday(theform){ 
	var yyyy = theform.yyyy.value;
	var mm = theform.mm.value;
	var dd = theform.dd.value;
	theform.Birth_Date.value = yyyy + "-" + 
							 mm + "-" + 
							 dd ;
}
