MJL.event.add(window, "load", function() {
    // MJL に関係するコードはこの中に記述
    MJL.enable.flash("flash");
	MJL.enable.window("popup", {width: 800, height: 600});
	MJL.enable.tab("tabs");
    MJL.enable.heightEqualizer("equalize");
	MJL.enable.rollover("roll", { active : "active" });
	MJL.enable.rollover("roll-disable", { disable : "unroll" });
});

// MJL と無関係なコードはこの先に記述

/**
 * jQuery setImgParallelStyler plugin
 * 画像とキャプションの幅を揃える
 * 
 */
 $(document).ready(function(){
    $('p.image').setImgAndCaptionStyler();
    $('p.lyt_image').setImgAndCaptionStyler();
	$('ul.image li').setImgAndCaptionStyler();
});

(function($){
    var name_space = 'setImgAndCaptionStyler';
    $.fn[name_space] = function(options){
        var elements = $(this);
        function getImgAndCaptionStyler(){
            return function(){
                var elm = $(this);
                var img = $("img", elm);
                function resize(){
                    var imgWidth = img.width();
                    var caption = $(">span", elm)
                    if(imgWidth){
                        caption.css("width", imgWidth);
                    }
                }
                resize();
                img.load(function(){resize()});
            }
        }
        elements.each(getImgAndCaptionStyler());
        return this;
    };
})(jQuery);

/**
 * jQuery pagePrint plugin
 *  印刷ボタン
 * 
 */
 (function($){
    var name_space = 'pagePrint';
    $.fn[name_space] = function(){
        var elements = $(this);
        function get(){
            return function(){
				$(this).click(function(){
					window.print();
					return false;
				});
            }
        }
        elements.each(get());
        return this;
    };
    $(function(){
        $('p.printButton_02 a').pagePrint();
    });
})(jQuery);

/**
 * jQuery windowClose plugin
 * ウィンドウを閉じるボタン
 * 
 */
 (function($){
    var name_space = 'windowClose';
    $.fn[name_space] = function(){
        var elements = $(this);
        function get(){
            return function(){
				$(this).click(function(){
					(window.open('', '_self').opener = window).close();
					return false;
				});
            }
        }
        elements.each(get());
        return this;
    };
    $(function(){
        $('p#closeButton a').windowClose();
    });
})(jQuery);

