﻿function closeJq(dialogID) {
    $('#' + dialogID).jqmHide();
}
function createJqDialog(dialogID) {
    $('#' + dialogID).jqm({
        //onShow: onPopupOpen,
        onHide: onPopupClose,
        overlay: 30
    })
}
var onPopupClose = function(hash) {
    $('#itest').attr('src', '');
    hash.w.fadeOut(100);
    hash.o.fadeOut(100, function() { hash.o.remove(); });
};
function openJq(dialogID) {
    $('#' + dialogID).jqmShow();
}

$().ready(function() {
    createJqDialog('dialog');
});

function showMovie(src, w, h) {
    var leftMargin = w / 2;

    document.getElementById('dialog').style.position = 'fixed';
    document.getElementById('dialog').style.top = '90px';
    document.getElementById('dialog').style.left = '50%';
    document.getElementById('dialog').style.marginLeft = -leftMargin + 'px';
    document.getElementById('dialog').style.width = (w + 20) + 'px';
    //document.getElementById('dialog').style.height = h;

    $('#itest').attr('src', src);
    $('#itest').attr('width', w);
    $('#itest').attr('height', h);

    openJq('dialog');
}