$(document).ready(function() {
    $('a[rel=external],a[href$=pdf]').live('click', function(e) {
        window.open($(this).attr('href'));
        e.preventDefault();
    });

    $('a[href$=pdf]').attr('title', 'PDFファイルを開きます').after(' <img src="/wp-content/themes/srkumamoto/img/icon_pdf.png" alt="PDF" class="icon-pdf" />');

    $('a[href$=doc]').attr('title', 'Wordファイルを開きます').after(' <img src="/wp-content/themes/srkumamoto/img/icon_word.png" alt="Word" class="icon-word" />');

    var pagetop = $('#pagetop');
    pagetop.hide();
    $(function() {
        if (navigator.platform.indexOf('iPad') != -1 || navigator.platform.indexOf('MSIE 6') != -1) {
            // ipad
        } else {

            $(window).scroll(function() {
                if ($(this).scrollTop() > 100) {
                    pagetop.fadeIn();
                } else {
                    pagetop.fadeOut();
                }
            });

            $('#pagetop a').click(function() {
                $('body,html').animate({
                    scrollTop: 0
                }, 800);
                return false;
            });
        }
    });
});


