// JavaScript Document


//没有问题
var flag=false;
function ZoomImg(ImgD,zoom_type){
	var iwidth = 500; //定义允许图片宽度
	var iheight = 80; //定义允许图片高度
	switch(zoom_type){
		case "proimg":
			iwidth=screen.availWidth/4; 
			iheight=screen.availHeight; 
			break;
		case "techimg":
			iwidth=screen.availWidth-260; 
			iheight=screen.availHeight*2; 
			break;
		case "otherimg":
			iwidth=screen.availWidth-260; 
			iheight=screen.availHeight*2; 
			break;
		default : 
			iwidth=screen.availWidth-260; 
			iheight=screen.availHeight*2; 
			break;
	}


var image=new Image();

image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= iwidth/iheight){
if(image.width>iwidth){
ImgD.width=iwidth;
ImgD.height=(image.height*iwidth)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>iheight){
ImgD.height=iheight;
ImgD.width=(image.width*iheight)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
}
	
	
}



/*使用方法
<img src="sh180.jpg" onload="ZoomImg(this,缩放类型)"> 
ZoomImg(图片对象,缩放类型)
缩放类型: proimg techimg otherimg 

*/

function GlZoomImg(o){
	 var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
	 return false;
}


/*使用方法
 <img onmousewheel="return GlZoomImg(this)" src="images/userface/image5.gif" width="72" height="122">
 '在IMG中添加onmousewheel＝"return GlZoomImg(this)"属性

onload="ZoomImg(this,缩放类型)" onmousewheel="return GlZoomImg(this)"

*/




