var flag=false;
function DrawImage(ImgD,w,h)
{
	var image=new Image();
	image.src=ImgD.src;
	if((image.width>0)&&(image.height>0))
	{
		flag=true;
		if(image.width/image.height>= w/h)
		{
			if(image.width>w)
			{
				ImgD.width=w;
				ImgD.height=(image.height*w)/image.width;
			}
			else
			{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		}
		else
		{
			if(image.height>h)
			{
				ImgD.height=h;
				ImgD.width=(image.width*h)/image.height;
			}
			else
			{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		}
	}
}

//改变图片大小
function resizepic(o)
{ 
var maxwidth=550;   //定义最大宽度
var maxheight=800;  //定义最大高度
var a=new Image();
a.src=o.src
if(a.width > maxwidth)
{
  o.style.width=maxwidth;
}
if (a.height> maxheight)
{
  o.style.height=maxheight;
 }
}
//无级缩放图片大小
function bbimg(o)
{
  var zoom=parseInt(o.style.zoom, 10)||100;
  zoom+=event.wheelDelta/12;
  if (zoom>0) o.style.zoom=zoom+'%';
  return false;
}

//调用方式style="cursor: pointer" alt="点此在新窗口浏览图片" onclick="javascript:window.open(this.src);" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)"