﻿// Opens the modal window and populates it with text from content
function ShowPopUpWindow(contentUrl) {
    try {
        // Set the large size
        var windowContainer = document.getElementById("modalpopup");
        if (windowContainer) {
            windowContainer.className = "modalpopupsmall";
        }

        var body = document.getElementById("main");
        if (body) {
            body.className = "nonScrollable";
        }

        var coverContainer = document.getElementById("coverall");
        var contentFrame = document.getElementById("modalpopupframe");

        if (coverContainer && contentFrame) {
            coverContainer.className = "coverall";

            contentFrame.src = contentUrl;
        }
    }
    catch (ex) { }
}

/*
 * Opens the modal window and populates it with text from content (iframe)
 * This method opens the large popup
 */ 
function ShowPopUpWindowLarge(contentUrl) {
    try {
        // Set the large size
        var windowContainer = document.getElementById("modalpopup");
        if (windowContainer) {
            windowContainer.className = "modalpopuplarge";
        }

        var body = document.getElementById("main");
        if (body) {
            body.className = "nonScrollable";
        }

        var coverContainer = document.getElementById("coverall");
        var contentFrame = document.getElementById("modalpopupframe");

        if (coverContainer && contentFrame) {
            coverContainer.className = "coverall";
            contentFrame.src = contentUrl;
        }
    }
    catch (ex) { }
}

// Closes the modal window and clears the content
function ClosePopUpWindow() {
    try {
        var coverContainer = document.getElementById("coverall");
        var contentFrame = document.getElementById("modalpopupframe");

        if (coverContainer && contentFrame) {
            coverContainer.className = "donotcoverall";
            contentFrame.src = "PopupFiller.htm";
        }

        var titleElem = document.getElementById("modalpopuptitle");
        if (titleElem) {
            titleElem.innerHTML = "";
        }


        var body = document.getElementById("main");
        if (body) {
            body.className = "";
        }
    }
    catch (ex) { }
}

function CloseAndOpenPopUpWindow(contentUrl) {
    ClosePopUpWindow();
    ShowPopUpWindow(contentUrl);
}
