﻿jQuery(document).ready(function ($) {
    $("#SubNav ul.level0 li:last-child")
        .css({ borderBottom: "0px" })
});

jQuery(document).ready(function ($) {
    $("#leftColumn #BreadCrumb ul li:first-child")
        .css({ paddingLeft: "0px", background: "none" })
});

jQuery(document).ready(function ($) {
    $("#content #BreadCrumb ul li:first-child")
        .css({ paddingLeft: "0px", background: "none" })
});

$(document).ready(function () {

    $(".popup-iframe").colorbox({ width: "650px", height: "500px", iframe: true });

    $(".popup-video").each(function () {

        var id = $(this).attr('id');

        if ((id == "") || (id == undefined)) {
            id = "popup-video-" + $(this).index();
            $(this).attr('id', id);
        }

        $(this).append('<div id="Holder" style="display:none;"><div id="PlayerWrapper"><div id="Player"></div></div></div>');

        var divId = '#' + id + ' #PlayerWrapper';
        var holder = '#' + id + ' #Holder';
        var player = jwplayer('Player');

        player.setup({
            flashplayer: BaseUrl + 'Scripts/mediaplayer/player.swf',
            file: $(this).attr("href"),
            image: $(this).attr("previewImageUrl"),
            autostart: $(this).attr('autoStart'),
            width: $(this).attr('videoWidth'),
            height: $(this).attr('videoHeight')
        });

        $(this).colorbox({ inline: true, href: divId,
            onOpen: function () {
                player.onReady(function () {
                    player.play();
                });
            },
            onCleanup: function () {
                player.onReady(function () {
                    player.stop();
                });
            }
        });

    });

});
