if (window.addEventListener)
{
         window.addEventListener('DOMMouseScroll', bbimg, false);
 }
function initimg(parpic,maxWidth,maxHeight)
{
	var scale=1;
	if(parpic.height>0)
	{
		scale=parpic.width/parpic.height;
	}
	if(maxWidth==0&&maxHeight==0)
	{
		return;
	}
	if(maxWidth==0)
	{
		parpic.height=parpic.height>maxHeight?maxHeight:parpic.height;
		parpic.width=parpic.height*scale;
		return;
	}
	if(maxHeight==0)
	{
		parpic.width=parpic.width>maxWidth?maxWidth:parpic.width;
		parpic.height=parpic.width/scale;
		return;
	}
	var tempWidth=0;
	if(parpic.height>maxHeight)
	{
		tempWidth=maxHeight*scale;
		if(tempWidth>maxWidth)
		{
			parpic.width=maxWidth;
			parpic.height=parpic.width/scale;
		}
		else
		{
			parpic.width=tempWidth;
			parpic.height=maxHeight;
		}
	}
	else
	{
		if(parpic.width>maxWidth)
		{
			parpic.width=maxWidth;
			parpic.height=parpic.width/scale;
		}
		else
		{
			return;
		}
	}
}
function bbimg(obj){
	if(document.all){
		var zoom=parseInt(obj.style.zoom, 10)||100;
    	zoom+=event.wheelDelta/12;
    	if (zoom>10) obj.style.zoom=zoom+"%";
    	return false;
	}
	else{
		var e=obj.target
		if(e.tagName.toLowerCase()=='img'){
			var scale=obj.detail/50;
			if(obj.detail>0||e.width>50){
				e.width=e.width*(1+scale);
				e.height=e.height*(1+scale);
			}
			obj.preventDefault();
		}
		return false;
	}
}

