﻿function search_submit()
{
	if(document.search_hair.key.value=='')
	{
			alert("请您要查找的关键字");
			return false;
	}

	search_hair.submit();
}


//改变图片大小
function resizepic(thispic)
{ 
if(thispic.width>400) thispic.width=400; 
}
//无级缩放图片大小
function bbimg(o)
{
  var zoom=parseInt(o.style.zoom, 10)||100;
  zoom+=event.wheelDelta/12;
  if (zoom>0) o.style.zoom=zoom+'%';
  return false;
}


//图片按比例缩放
//调用：<img src="1148202890.jpg" alt="自动缩放后的效果" width="200" height="200" onload="javascript:DrawImage(this,200,200);" /> 
function DrawImage(ImgD,FitWidth,FitHeight) 
{ 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0) 
	{ 
		if(image.width/image.height>= FitWidth/FitHeight) 
		{ 
			if(image.width>FitWidth) 
			{ 
				ImgD.width=FitWidth; 
				ImgD.height=(image.height*FitWidth)/image.width; 
			} 
			else 
			{ 
				ImgD.width=image.width; 
				ImgD.height=image.height; 
			} 
			} 
		else 
		{ 
			if(image.height>FitHeight) 
			{ 
				ImgD.height=FitHeight; 
				ImgD.width=(image.width*FitHeight)/image.height; 
			} 
			else 
			{ 
				ImgD.width=image.width; 
				ImgD.height=image.height; 
			} 
		} 
	} 
} 
