//以下两个函数是图片加载自动控制缩放的，在每个要控制的图像中使用DrawImage(this,FitWidth,FitHeight)
//如果要弹出缩放后的图片，请使用后面的VIEW_IMG(THIS,adjSize),通常情况下FitWidth=FitHeight=adjSize
function adjpic(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;
			//ImgD.alt='Click to View Large Pic';
			ImgD.alt='点击浏览大图片';
			ImgD.style.cursor='hand';
			}
			else{
			ImgD.width=image.width;
			ImgD.height=image.height;
			}
		}
		else{
			if(image.height>FitHeight){
			ImgD.height=FitHeight;
			ImgD.width=(image.width*FitHeight)/image.height;
			//ImgD.alt='Click to View Large Pic';
			ImgD.alt='点击浏览大图片';
			ImgD.style.cursor='hand';
			}
			else
				{
				ImgD.width=image.width;
				ImgD.height=image.height;
				}
		}
	}
}
function picview(ImgD,adjSize){
	var image=new Image();
	image.src=ImgD.src
//	var image=new Image();
//	image.src=ImgD.src;
	//alert('width:'+image.width+' height:'+image.height)
	if(image.width>adjSize || image.height>adjSize){
	window.open('pic.asp?img='+image.src.replace('.jpg','.jpic').replace('.gif','.gpic'),'view_pic','toolbar=no,scrollbars=yes,resizable=yes')
	}
}

// hot product lists function
function productPan(id){
	this.object = document.getElementById(id);
	this.prolist = this.object.getElementsByTagName("LI");
	
	this.play = function()
	{
		var objh5= document.getElementById(id).getElementsByTagName("H5")
		
		var objp= document.getElementById(id).getElementsByTagName("p")
		for(var j=0;j<objh5.length;j++)
		{			
			objh5[j].className="";
			objp[j].style.display="none";
		}
		this.getElementsByTagName("H5")[0].className="choosen";
		this.getElementsByTagName("p")[0].style.display="block";
		this.style.backgroundColor="#faf6ee";
	}
	this.noplay=function()
	{
		this.style.backgroundColor="#fff";
	}
}

/*下面的函数功能是选取所有的复选框*/
function CheckAll(form){
  for (var i=0;i<form.elements.length;i++){
    var e = form.elements[i];
    if (e.name != 'chkall' && e.name!='moveaction' && e.name!='chkflag')e.checked = form.chkall.checked;
  }
}
/*下面函数是将商品放入购物车后进行提示的*/
function clickHref(target,url,pname){ 
  var opener
  opener=window.open(url,target);
  //opener.alert('成功将商品'+pname+'』放入了您的购物车。');
  opener.focus();
}
/*下列函数让ID是blinkMe的元素，出现闪烁效果*/
function letMeBlink() {
	var obj = document.getElementById('blinkMe');
	if(!obj) return;
	obj.style.visibility = obj.style.visibility == '' ? 'hidden' : '';
	setTimeout(letMeBlink, 500);
}

