//图片自动缩放
//参数(img：图片对象，w：缩放后的宽，h：缩放后的高)
function autoImg(img,w,h)
{
	if(w<=0 || h<=0) return;
	var image=new Image();
	image.src=img.src;
	if(image.width>w)
	{
		newHeight=image.height/image.width*w;
		img.width=w;
		img.height=newHeight;
	}
	if(img.height>h)
	{
		newWidth=image.width/image.height*h;
		img.height=h;
		img.width=newWidth;
	}      
}

//通过对象ID获得对象引用
//参数(e：对象ID值)
function $(e) {return document.getElementById(e);}