//window.onload = resizeImgs(135,100, 'thumb');

function resizeImgs(size_w,size_h,classId)
{
    var elms = document.getElementsByTagName("img");
    for (i = 0; i < elms.length; i++) {
//alert("width :" + elms[i].width + ", className: " + elms[i].className);
        if (elms[i].width > size_w && elms[i].className == classId) {
            wp = size_w / elms[i].width;
            //hp = size_h / elms[i].height;
            w = elms[i].width * wp;
            h = elms[i].height * wp;
            elms[i].width = Math.floor(w);
            elms[i].height = Math.floor(h);
        }
        else if (elms[i].height > size_h && elms[i].className == classId) {
            hp = size_h / elms[i].height;
            w = elms[i].width *hp;
            h = elms[i].height *hp;
            elms[i].width = Math.floor(w);
            elms[i].height = Math.floor(h);
        }
    }
}
