// JavaScript Document
function $(Id){
	return document.getElementById(Id);	
}
function Win_Open_Shop(Id){
	var ThisWin=window.open("Show_Cart.asp?Id="+Id,"_blank","fullscreen=no,channelmode=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=500,top=100,left=100");
}
function WinOpen(Url,Win_Width,Win_Height){
	var ThisWin=window.open(Url,"_blank","fullscreen=no,channelmode=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+Win_Width+",height="+Win_Height+",top=100,left=100");
}
//图片按比例缩放
function DrawImage(ImgD,Img_Width,Img_Height,AltStr){
	var flag=false;
	var image=new Image();
	var iwidth = Img_Width; //定义允许图片宽度，当宽度大于这个值时等比例缩小
	var iheight = Img_Height; //定义允许图片高度，当宽度大于这个值时等比例缩小
	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=AltStr;
		}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=AltStr;
		}
	}
} 
//调用：<img src="图片" onload="javascript:DrawImage(this)">
function getQuery(url,name){ 
　　var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); 
　　var r = url.substr(url.indexOf("\?")+1).match(reg); 
　　if (r!=null) return unescape(r[2]); return null; 
}