﻿
jQuery().ready(function () {
    jQuery('#VideoPopup').dialog(
            { 
               autoOpen: false,
               close: unloadVideo 
            }
        );
});

function loadVideo(videoPath, width, height) {
    var padding = 20;
    var heightOffset = 18;
    var flashVars = { VideoPath: videoPath, AutoPlay: "true" };
    swfobject.embedSWF("/media/flash/DataEmbeddableVP.swf", "FlashVideo", width, height, "9.0.0", "/media/flash/expressInstall.swf", flashVars, { allowfullscreen: "true" });    
    width = parseInt(width) + padding;
    height = parseInt(height) + padding + heightOffset;
    jQuery('#VideoPopup').dialog({
        height: height,
        width: width
    });
    jQuery('#VideoPopup').dialog('open');
}

function unloadVideo(hash) {
    swfobject.removeSWF("FlashVideo");
    jQuery("#VideoPopup").html('<div id="FlashVideo"></div>');
}
