//平衡图片宽高
function scaleImage(img,width,height) {
	if (img.width>width) {
		var p = width/img.width;
		w = width;
		h = img.height*p;
		img.width = w;
		img.height = h;
	}
	if (img.height>height) {
		var p = height/img.height;
		w=img.width*p;
		h=height;
		img.width = w;
		img.height = h;
	}
	$(img).css("margin-top",($(img).parent().height()-$(img).height())/2);//上下居中
}
