function wumiiImageResize (image) {
    var IMAGE_SCALE_SIZE = 114;
    
    // Constrain the min(image.width, image.height) to IMAGE_SCALE_SIZE, and equal scale the image.
    if (image.width < image.height) {
        image.height = IMAGE_SCALE_SIZE * image.height / image.width;
        image.width = IMAGE_SCALE_SIZE;
    } else {
        image.width = IMAGE_SCALE_SIZE * image.width / image.height;
        image.height = IMAGE_SCALE_SIZE;
    }
    var imageStyle = image.style;
    
    // top = originalImage.topLine.Y-axis - scaledImage.topLine.Y-axis
    // right = scaledImage.rightLine.X-axis
    // bottom = originalImage.topLine.Y - scaledImage.bottomLine.Y
    // left = scaledImage.leftLine.X-axis
    // See http://www.seifi.org/css/creating-thumbnails-using-the-css-clip-property.html for more
    var top = (image.height - IMAGE_SCALE_SIZE) / 2;
    var bottom = top + IMAGE_SCALE_SIZE;
    var left = (image.width - IMAGE_SCALE_SIZE) / 2;
    var right = left + IMAGE_SCALE_SIZE;
    
    imageStyle.clip = "rect(" + top + "px " + right + "px " + bottom + "px " + left + "px)";
    imageStyle.left = -left + 3 + "px";
    imageStyle.top = -top + 3 + "px";
    
    imageStyle.visibility = "visible";
}


function wumiiLinkReplace(object, link) {
    object.href = link;
}