﻿function resize(which, max) {
    var elem = document.getElementById(which);

    var orig_width = elem.width;
    var orig_height = elem.height;

    if (max == undefined) max = 150;
    if (elem.width > elem.height) {
        if (elem.width > max) { elem.width = max; elem.height = orig_height * (max / orig_width); }
    } else {
        if (elem.height > max) { elem.height = max; elem.width = orig_width * (max / orig_height); };
    }
} 

