﻿function ResizeImg(obj, theWidth, theHeight) {
    if (obj != null) {
        var imglist = obj.getElementsByTagName("img");
        if (imglist != null) {
            var a;
            for (a = 0; a < imglist.length; a++) {
               
                if (imglist[a].width > theWidth) {
                    imglist[a].height = Math.round(imglist[a].height * (theWidth / imglist[a].width))
                    imglist[a].width = theWidth;
                  
                }
                if (imglist[a].height > theHeight) {
                    imglist[a].width = Math.round(imglist[a].width * (theHeight / imglist[a].height))
                    imglist[a].height = theHeight
                   
                }
            }
        }
    }
}
function ResizeImg1(obj) {
    ResizeImg(obj, obj.style.width, obj.style.height);
}
function ResizeImg3(obj, theWidth, theHeight) {

    if (obj.width > theWidth) {
        obj.height = Math.round(obj.height * (theWidth / obj.width))
        obj.width = theWidth;
        
    }
    if (obj.height > theHeight) {
        obj.width = Math.round(obj.width * (theHeight / obj.height))
        obj.height = theHeight
       
    }
}

function ResizeImg4(obj, theWidth, theHeight) {

    if (obj.width > theWidth) {
   
        obj.height = Math.round(obj.height * (theWidth / obj.width))
        obj.width = theWidth;

    }
    if (obj.height > theHeight) {
    
        obj.width = Math.round(obj.width * (theHeight / obj.height))
        obj.height = theHeight

    }
}


