function thisResizeWidth(myImage, desiredWidth, maxHeight){
    if (myImage != null){
        var imgWidth = myImage.offsetWidth;
        var imgHeight = myImage.offsetHeight;
        var calcWidth = 0;
        var calcHeight = 0;

        if (imgWidth != 0 && imgHeight != 0){
            calcWidth = desiredWidth;
            calcHeight = Math.round((desiredWidth/imgWidth) * imgHeight);

            if (maxHeight > 0 && calcHeight > maxHeight){
                calcWidth = Math.round((maxHeight/imgHeight) * imgWidth);
                calcHeight = maxHeight;
            }

	        myImage.style.width = calcWidth;
	        myImage.style.height = calcHeight;
	    }
    }
}

function thisResizeHeight(myImage, desiredHeight, maxWidth){
    if (myImage != null){
        var imgWidth = myImage.offsetWidth;
        var imgHeight = myImage.offsetHeight;
        var calcWidth = 0;
        var calcHeight = 0;

        if (imgWidth != 0 && imgHeight != 0){
            calcWidth = Math.round((desiredHeight/imgHeight) * imgWidth);
            calcHeight = desiredHeight;

            if (maxWidth > 0 && calcWidth > maxWidth){
                calcWidth = maxWidth;
                calcHeight = Math.round((maxWidth/imgWidth) * imgHeight);
            }
            
	        myImage.style.width = calcWidth;
	        myImage.style.height = calcHeight;
	   }
    }
}
