var ImgResize = {
	Sections: ['imageSection1', 'imageSection2', 'imageSection3'],
	getStyle: function(Element, Property) {
		if (!document.getElementById(Element)) return;
		return document.getElementById(Element).style[Property.toLowerCase()];
	},
	//method
	ResizeAction: function() {
		for (var i=0; i<this.Sections.length; i++) {
			var SectionObj = this.Sections[i];
			if (!document.getElementById(this.Sections[i])) continue;			
			var WidthLimit = (SectionObj.WidthLimit) ? SectionObj.WidthLimit : (this.getStyle(SectionObj.Section, 'width')) ? parseInt(this.getStyle(SectionObj.Section, 'width'), 10) : document.getElementById(this.Sections[i]).offsetWidth;
			if (document.getElementById("content")!=null ){WidthLimit=document.getElementById("content").offsetWidth;} 
			this.WidthSet = WidthLimit*0.9; //抓出寬度後，顯示90%的圖片大小
			//alert(WidthLimit);
			var GetSection = document.getElementById(this.Sections[i]);			
			var GetOImg = GetSection.getElementsByTagName('img');
			for (var j=0; j<GetOImg.length; j++) {
				var SizeArray = [GetOImg[j].width, GetOImg[j].height];
				//alert(SizeArray);
				if (SizeArray[0] > this.WidthSet) {
					GetOImg[j].style.width = this.WidthSet + 'px';
					GetOImg[j].style.height = Math.floor((this.WidthSet*SizeArray[1])/SizeArray[0]) + 'px';
				}//end if
			}//end for
		}//end for
	}
};

