var modalWindow = {
    parent: "body",
    windowId: null,
    spacing: null,
    content: null,
    percentage: null,
    height: null,
    width: null,
    close: function () {
        $(".modal-window").remove();
        $(".modal-overlay").remove();

    },
    open: function () {
        $("div.flashobject").css("visibility", "hidden");

        var modal = "";
        modal += "<div class=\"modal-overlay\"></div>";

        if (this.percentage != null) {
            modal += "<div id=\"" + this.windowId + "\" class=\"modal-window\" style=\"width:900px; height: " + this.percentage + "%; left: 50%; margin-left:-450px; top: " + this.spacing + "%; \">";
        }
        else
        { modal += "<div id=\"" + this.windowId + "\" class=\"modal-window\" style=\"width:" + this.width + "px; height: " + this.height + "px; left: 50%; margin-left:-" + this.width / 2 + "px; top: " + this.height + "px; \">"; }
        modal += this.content;
        modal += "</div>";

        $(this.parent).append(modal);

        // $(".modal-overlay").click(function() { modalWindow.close(); });
    }
};

var openMyModal = function(source, percentage) {

    var lnPercentage = 90;

    if (percentage != null) {
        lnPercentage = percentage;
    }

    modalWindow.windowId = "myModal";
    modalWindow.percentage = lnPercentage;
    modalWindow.spacing = (100 - lnPercentage) / 2;
    modalWindow.content = "<iframe width='900px' height='100%' scrolling='auto' allowtransparency='false' style='border: 1px solid #000000;' src='" + source + "' frameborder=0>&lt/iframe>";
    modalWindow.open();
};


var openMyModalCustom = function (source, width, height) {

    modalWindow.windowId = "myModal";
    modalWindow.width = width
    modalWindow.height = height
    modalWindow.content = "<iframe width='" + width + "px' height='100%' scrolling='auto' allowtransparency='false' style='border: 1px solid #000000;' src='" + source + "' frameborder=0>&lt/iframe>";
    modalWindow.open();
};	

