﻿//---------------圖片等比例縮放--strat-----------------//
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;
			}
		}
	}
}
//---------------圖片等比例縮放--end-----------------//
//算輸入文字長度(欄位名稱,最大限制,span名稱)
function textCounterTwo(field, maxlimit,spanName)
{
	var count = 0;
	hasCh = false;
	if (field.value == null)
	{
		field.value.length =0;
	}
	else
	{
		count = field.value.length;
	}
	spanName.innerHTML = "一共輸入了 " + count + " 個字，最多" + maxlimit + "字";


	
}
//-----------------------------------------