function sizeImg(obj, _width) {
    var tmpImg = new Image();
    tmpImg.src = obj.src;
    if (tmpImg.width > _width) { obj.width = _width; }
}
function sizeImgWHpropor(obj, _w, _h) {
    var tmpImg = new Image();
    tmpImg.src = obj.src;
	var differenceH = 0;
	var differenceW = 0;
    if (tmpImg.height > _h) { 
		differenceH = obj.height - _h;
	}
    if (tmpImg.width > _w) { 
		differenceW = tmpImg.width - _w;
	}
	if (differenceH >= differenceW && differenceH != 0){
		obj.width = Math.round(_h * obj.width / obj.height);
		obj.height = _h;
	} else if (differenceW != 0){
		obj.height = Math.round(_w * obj.height / obj.width);
		obj.width = _w;
	}
}