// ----------------------------------------------------------------------------
// MJL
// ----------------------------------------------------------------------------
MJL.event.add(window, "load", function() {
    MJL.enable.heightEqualizer("list-products-01", {
        groupBy: 3,
        collect: function(parent) {
            return MJL.getElementsByClassName(parent, "inner");
        }
    });
    MJL.enable.heightEqualizer("list-custompaint", {
        groupBy: 5,
        collect: function(parent) {
            return MJL.getElementsByClassName(parent, "data");
        }
    });
    MJL.enable.rollover("roll");
    MJL.enable.window("rail-detail-02", {
        width: 700,
        menubar: "no",
        toolbar: "no"
    });
    MJL.enable.window("map", {
        width: 620,
        height: 700,
        menubar: "no",
        toolbar: "no"
    });
});


// ----------------------------------------------------------------------------
// Extend Scripts with jQuery
// ----------------------------------------------------------------------------
"jQuery" in window && (function($) {
    $(function() {
        // -----------------------
        // 外部リンクの別窓表示
        // -----------------------
        (function() {
            var pattern = "(http://(?!" + location.hostname + ")|\.pdf$)";
            var regexObj = new RegExp(pattern);
            $("a").each(function() {
                var target = $(this);
                try {
                    if(target.attr("href").match(regexObj)) {
                        target.attr("target", "_blank");
                    }
                } catch(e) {
                }
            });
        }());
        
        // -----------------------
        // シートレールサンプル
        // -----------------------
        $.fn.fancybox && (function() {
            $("a.rail-detail").fancybox({
                width: 660,
                height: '75%',
                autoScale: false,
                transitionIn: 'none',
                transitionOut: 'none',
                type: 'iframe'
            });
        }());
    });
}(jQuery));

