MJL.event.add(window, "load", function(event) {
    // MJL に関係するコードはこの中に記述
    MJL.enable.flash("flash");
    MJL.enable.window("external");
    MJL.enable.tab("tabs");
    // MJL.enable.styleSwitcher("styleSwitcher");
    // MJL.enable.heightEqualizer("equalize");
    MJL.enable.rollover("roll");
}, false);

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

$(function() {
    // ------------------------------------------------------------------------
    // スムーススクロール
    // ------------------------------------------------------------------------
    // BUG jQuery 1.3.2: WebKit で .css() による scrollTop/scrollLeft が無反応
    !$.browser.safari && (function() {
        // --------------------------------------------------------------------
        // ユーザ設定
        // --------------------------------------------------------------------
        // スクロール処理完了までの時間 (単位 ms)
        // アンカーから対象要素までの距離によりスクロール速度が変化
        //   長い：高速
        //   短い：低速
        var dulation = 500;
        // easing エフェクト種類
        var easing   = 'easeOutExpo';
        // 対象要素 CSS セレクタ
        var selector = 'a.scroll[href*="#"], :not(a).scroll a[href*="#"]';

        // --------------------------------------------------------------------
        // 処理
        // --------------------------------------------------------------------
        var win = $(window);
        var doc = $(document);
        // スクロール対象要素
        // レンダリングモードにより対象が変化
        //   Standard: document.documentElment
        //   Quirks:   document.body
        var de = $(
            'BackCompat' === document.compatMode ? document.body
                                                 : document.documentElement
        );
        // "#" 除去＆有効ハッシュ判定
        var cond = /#([^#]+)$/;
        // 現在 a 要素のみサポート
        $(selector).each(function() {
            var from = $(this), // a 要素
                hash = (        // ハッシュ文字列
                    // 文字列がエンコードされている場合に備える
                    cond.exec(decodeURIComponent(from.attr('href'))) || []
                )[1];
            hash && $('#'+hash).each(function() {
                var target = $(this); // ジャンプ対象要素
                from.click(function(event) {
                    event.preventDefault();
                    // 対象要素 絶対座標
                    var offset = target.offset(),
                    // 小数点以下を四捨五入した対象要素 絶対座標
                        top    = parseInt(offset.top.toFixed(), 10),
                        left   = parseInt(offset.left.toFixed(), 10);
                    // スクロールできる余地がある場合のみ実行
                    //   ビューポートとコンテンツが同サイズなら無視
                    //   スクロール前後の状態が同一になったら無視
                    if ((
                        win.height()    !== doc.height() &&
                        doc.scrollTop() !== top
                    ) || (
                        win.width()      !== doc.width() &&
                        doc.scrollLeft() !== left
                    )) {
                        // アニメーションは非同期なので
                        // 開始前に同期が必須な処理は済ませる
                        de.animate({
                            scrollTop  : top,
                            scrollLeft : left
                        }, dulation, easing, function() {
                            from.trigger('blur');
                            target.trigger('focus');
                            // ハッシュ設定は必ずスクロール終了後に実行
                            // UA によってはスクロール中に設定すると既定の
                            // スクロールが行われてしまう問題を防止
                            location.hash = encodeURIComponent(hash);
                        });
                    } // スクロール不要なら何もしない
                });
            });
        });
    })();
});


/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/
jQuery.extend(jQuery.easing, {
    easeOutExpo: function (x, t, b, c, d) {
        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
    }
});

