function ticketOpen (arg) {
    var url = '';
    if ( arg == 'ticket' ) {
        url = '/ticket/';
    } else if ( arg == 'kijyun' ) {
        url = '/menu/kijyun/';
    }
    window.open(arg, 'ticket', 'width=470, height=520');
}
function RunWordpress () {
    document.write('<embed src="http://www.coeur-coeur.jp/wordpress/wp-content/themes/coeur/flash/movie.swf" width="800" height="250" background="#FFFFFF" type="application/x-shockwave-flash"/>');
}
$(function(){
    var godetail = $('p.go-detail a');
    if ( godetail ) {
    godetail.click(function () {
        var detail = $(this).parent().parent().parent().next();
        if ( detail.is(':hidden') ) {
        detail.slideDown('fast');
        }
        return false;
        });
    }
    var closedetail = $('p.close-detail a');
    if ( closedetail ) {
        closedetail.click(function () {
                $(this).parent().parent().parent().slideUp('fast');
                return false;
                });
    }
    // モーダルウィンドウ
    var hasModal = false;
    $('a.modal').click(function () {
        if ( $.browser.msie && $.browser.version < 7 ) { // for IE 6
            this.target = "_blank";
        } else {
            if ( !hasModal ) {
                $('body').append('<div id="modal-back"></div><div id="modal-front"></div>');
                $('#modal-back').click(function () {
                    $("#modal-back").hide();
                    $("#modal-front").hide();
                });
                hasModal = true;
            }
            $('#modal-back').show();
            var img = new Image();
            img.src = $(this).attr('href') + '?'+ new Date().getTime(); // (1) new Date().getTime()はIEのキャッシュ対策。必ずImage.onloadを発生させるために必要。
            img.onload = function () { // (2) 画像の幅width, 高さheightを必ず取得するためにImage.onloadの中で取得する。
                var template_dir;
                var scripts = document.getElementsByTagName('script');
                var i = scripts.length;
                while (i--) {
                    var match = scripts[i].src.match(/(.+)js\/basic.js/);
                    if (match) {
                        template_dir = match[1];
                        break;
                    }
                }
                $('#modal-front').html('<img src="' + template_dir + 'images/close.png" class="close" /><img src="' + this.src + '" />');
                var left = Math.floor(($(window).width() - this.width) / 2);
                var top  = Math.floor(($(window).height() - this.height) / 2);
                $('#modal-front').css({
                    "z-index" : 20,
                    "top": top,
                    "left": left
                });
                $('#modal-front').fadeIn('fast');
                $('#modal-front img.close').click(function(){
                    $("#modal-back").hide();
                    $("#modal-front").hide();
                });
            }
            return false;
        }
    });
});

