MJL.event.add(window, "load", function(event) {
    // MJL に関係するコードはこの中に記述
    MJL.enable.rollover("roll", {disable:"unroll"});
    MJL.enable.heightEqualizer("equalize");
    MJL.enable.heightEqualizer("column-col2", {groupBy : 2});
    MJL.enable.heightEqualizer("list-index-01", {groupBy : 2});
    MJL.enable.heightEqualizer("list-home-scene", {
        groupBy : 2,
        collect : function(parent) {
            return MJL.getElementsByClassName(parent, "content");
        }
    });
    MJL.enable.heightEqualizer("list-home-introduction", {
        collect : function(parent) {
            return MJL.getElementsByClassName(parent, "content");
        }
    });
    //
    // 画像とテキスト (based on jQuery)
    //
    // 画像とテキストの並列処理を行う関数を返す高階関数
    function getImgParallelStyler(side) {
        // side は既定値しか認めない
        if ("left" != side && "right" != side) {
            throw Error("invalid side type: '"+side+"'");
        }
        // 実行関数
        return function() {
            var obj = $(this);
            var imgBlock = $("div.image:first-child", obj);
            var imgWidth = $("p.image img", imgBlock).width(); // 画像幅
            imgBlock.css("width", imgWidth+"px"); // 画像幅を強制
            // 別カラムの margin を調整
            $("div.column", obj).css("margin-"+side,
                                     imgBlock[0].offsetWidth+"px");
        };
    }
    // 実行
    $(".image-parallel.image-L").each(getImgParallelStyler("left"));
    $(".image-parallel.image-R").each(getImgParallelStyler("right"));
}, false);
