﻿$(function () {
    // video popups
    $("a[href$=.flv]").click(function (e) {
        e.preventDefault();
        var videoPath = $(this).attr("href");
        // get title
        var image = $("img", this);
        var title = image.attr("longdesc");
        if (title.length == 0)
            title = image.attr("alt");
        // show ui box
        var dlg = $(".jShowVideo").dialog({
            height: 'auto',
            width: 'auto',
            position: ['center', '100'],
            left: '350px',
            top: '100px',
            modal: true,
            title: title,
            open: function () {
                $("#VideoContainer").flashembed({
                    src: "Flash/VideoPlayer.swf",
                    expressInstall: "Flash/expressinstall.swf",
                    wmode: "opaque"
                },
                {
                    flvPath: videoPath,
                    skinPath: "Flash/VideoPlayerAssets.swf"
                });
            },
            beforeclose: function () {
                $("#VideoContainer").html("");
            }
        });
    });
});
