//<!--
//=============================================================================================
//  Image Control
//---------------------------------------------------------------------------------------------
function ImageControl(obj, fixHeight, fixWidth) {
    var width = 0;
    var height = 0;

    // For FireFox, Safari, Chrome
    if (typeof obj.naturalWidth !== 'undefined') {
        width = obj.naturalWidth;
        height = obj.naturalHeight;
    // For IE
    } else if (typeof obj.runtimeStyle !== 'undefined') {
        var run = obj.runtimeStyle;
        var mem = { w: run.width, h: run.height };
        run.width  = "auto";
        run.height = "auto";

        width = obj.width;
        height = obj.height;

        run.width  = mem.w;
        run.height = mem.h;
    // For Opera
    } else {
        var mem = {w: obj.width, h: obj.height};
        obj.removeAttribute("width");
        obj.removeAttribute("height");

        width = obj.width;
        height = obj.height;

        obj.width = mem.w;
        obj.height = mem.h;
    }

    // 比率計算
    var widthDiff = (width - fixWidth) / fixWidth;
    var heightDiff = (height - fixHeight) / fixHeight;

    // 画像が横長の場合
    if (widthDiff >= heightDiff && widthDiff !== 0) {

        // shortans
        height = (height * fixWidth) / width;
        width = fixWidth;
    }

    // 画像が縦長の場合
    if (widthDiff < heightDiff && heightDiff !== 0) {

        // shortans
        width = (width * fixHeight) / height;
        height = fixHeight;
    }
    obj.width = width;
    obj.height = height;
}
//-->

