//自動縮放顯示圖片
function DrawImage(ImgD,FitWidth,FitHeight){
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		if(image.width/image.height>= FitWidth/FitHeight){
			if(image.width>FitWidth){
				ImgD.width=FitWidth;
				ImgD.height=(image.height*FitWidth)/image.width;
			}else{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		} else{
			if(image.height>FitHeight){
				ImgD.height=FitHeight;
				ImgD.width=(image.width*FitHeight)/image.height;
			}else{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		}
	}
}

//驗證日期欄位內容的正確性 
function CHECK_SEL_DATE(nYear ,nMonth ,nDate) 
	{ 
	    var date01 = new Array(31,28,31,30,31,30,31,31,30,31,30,31); 
	    var nYear, nMonth, nDate; 
	     
	    if ( (nYear % 4) == 0 ) //表示為閏年 
	    { 
	        if ( nMonth == 2 ) 
			{ 
	            if ( nDate > 29 ) 
	            { 
					return false; //二月份不能超過29天 
	            } 
	        } 
	        else if ( nDate > date01[nMonth - 1] ) 
			{
				return false; //月份日數超過 
	        } 
	    } 
		else 
	    { 
	        if ( nDate > date01[nMonth - 1] ) 
			{ 
				return false; //月份日數超過 
			} 
	    } 
	     
	    return true; 
	} 
