﻿// JScript 文件
function ImageResize(imgObj,w,h)
{
   
    if(imgObj.width > 0 && imgObj.height > 0)
    {
        var newWidth;
        var newHeight;
        newWidth = (w > imgObj.width) ? imgObj.width : w;
        newHeight = newWidth * imgObj.height / imgObj.width;

        if (newHeight > h)
        {
            newHeight = h;
            newWidth = newHeight * imgObj.width / imgObj.height;
        }    
        
        imgObj.style.width = newWidth + "px";
        imgObj.style.height = newHeight + "px";
    }
}


function reloadVildCode(imgObj,imgUrl)
{	
	var r = Math.floor(Math.random() * (999 + 1));
	imgObj.src = imgUrl+'?r='+r;
}