function showCompare(id)
{
   m=document.getElementById("ck_"+id);
   var result=ChkValue("newproductlist")
   if(m.checked==true)
   {
        if(result.split(",").length==6)
		{
	       show_error("一次最多只能先择五条数据进行比较！");
	       return false;		
		}
        else if(result.split(",").length>1 && result.split(",").length<6)
	    {
	        var w=0,h=0;
	        while(m.offsetParent)
	        {
		        w+=m.offsetLeft;
		        h+=m.offsetTop;
		        m=m.offsetParent;
	        }
            document.getElementById("tishiDiv").style.visibility='visible';        
            document.getElementById("tishiDiv").style.left=w+'px';
            document.getElementById("tishiDiv").style.top=h-70+'px';
	    }
	    else
	    {
            document.getElementById("tishiDiv").style.visibility='hidden'; 	    
	    }
	}
	if(result.split(",").length<=1)
    {
       document.getElementById("tishiDiv").style.visibility='hidden'; 	
    }
	
}

function compare()
{
    var result=ChkValue("newproductlist")

	var list=result.split(",");
	if(list.length>5)
	{
	   show_error("一次最多只能先择五条数据进行比较！");
	   return false;
	}
	window.open("/product/ProductCompare.html?IDS="+result,"_blank")
}

function ResizeImages()
{
    var myimg,oldwidth,oldheight; 
    var maxwidth=264; //宽缩放系数 
    var maxheight=185; //高缩放系数 
    for(i=0;i <document.images.length;i++)
    {
        myimg = document.images[i];
        if(myimg.width > maxwidth||myimg.height>maxheight)
        { 
            oldwidth = myimg.width; 
            oldheight = myimg.height; 
            if(oldwidth/oldheight>=maxwidth/maxheight)//按宽度缩放
            {
                myimg.width = maxwidth; 
                myimg.height = maxwidth * (oldheight/oldwidth); 
            }
            else//按高度缩放
            {
                myimg.height = maxheight; 
                myimg.width = maxheight * (oldwidth/oldheight); 
            }
        } 
    } 
}


