﻿function setSmallImg(str,width,height){
	var obj=document.getElementById(str);
	var objs=obj.getElementsByTagName('img');
	var width_img,width_re,height_img,height_re,bl,bl_re
	
	for(i=0;i<objs.length;i++){
		width_img=objs[i].width;//原始宽度
		height_img=objs[i].height;//原始高度
		bl=width/width_img;
		width_re=width_img>width ? width : width_img;
		height_re=width_img>width ? (bl*height_img) : height_img;
		
		if (height){
			bl_re=height/height_re;
			width_re= height_re>height ? (bl_re*width_re) : width_re;
			height_re= height_re>height ? height : height_re;
		}
		
		objs[i].width=width_re;
		objs[i].height=height_re;
	}
}