function resizeImg(imgid,h,w) {

    var maxwidth = w;

    var maxheight = h;

    var imagen = document.getElementById(imgid);

    if (imagen.width>maxwidth || imagen.height>maxheight) {

        var scale = Math.min((maxwidth/imagen.width),(maxheight/imagen.height), 1 );

        var new_width = Math.floor(scale*imagen.width);

        var new_height = Math.floor(scale*imagen.height);

        imagen.width = new_width;

        imagen.height = new_height;        

    }

    imagen.style.visibility = "visible";

}



