function resize(which, maxW, maxH, id) {
    var elem = which;
    
    if (elem == undefined)
        return false;
        
    if (id != "null")
        document.getElementById("image" + id).style.display = "block";
    
    if (maxW == undefined)
        maxW = 75;


    if (elem.width > elem.height) {

        if (elem.width > maxW)
            elem.width = maxW;
    } else {
        if (elem.height > maxH)
            elem.height = maxH;
    }

    if (elem.height > maxH) {
        elem.height = maxH;
    }
    
    
}