$(function() {
    $("a.fbox").fancybox({

        'speedIn'    :    600,
        'speedOut'    :    300,
        'overlayShow'    :    false,
        'hideOnContentClick'   :   true,
        'showCloseButton'   :   false,
        'enableEscapeButton'   :   true,
        'opacity'   :   true,
        'centerOnScroll'   :   true
    });

    $('select.fancycal').chosen(
        { disable_search_threshold: false }
    );

    $('a.fbox_video').fancybox({
        //type: 'inline',
        content: '<div id="video_container" style="width: 480px; height: 270px; overflow: hidden;"></div>',
        autoDimensions: false,
        width: "480px",
        height: "270px",
        onComplete: function() {
            //if ($.browser)
            jwplayer("video_container").setup({
                flashplayer: "/web/mediaplayer/player.swf",
                skin: '/web/mediaplayer/skins/glow/glow.xml',
                //image: this.orig[0].src.substr(this.orig[0].src.indexOf('=') + 1, (this.orig[0].src.indexOf("w=") - 1) - (this.orig[0].src.indexOf('=') + 1)),
                file: this.href,
                height: 270,
                width: 480,
                //autostart: true, // iOS5 bug with this
                plugins: ''
            });
        }
    })

});

function goTo(url) {
    document.location = url;
}

function email_this() {
    mail_str = "mailto:?subject=" + document.title;
    mail_str += "&body=" + location.href;
    location.href = mail_str;
}
