﻿// Purpose: Launch an aspx page in a modal dialog window.
// Note that single letter variable names are used to maintain
// a smaller code foot print on the client. --> all comments should be stripped before sending.
function doPopupCustom(title, controlUrl, height, width, flags) {
    // Prepare shell htm for launching control
    var strHTML = '';
    strHTML = strHTML + '<html>';
    strHTML = strHTML + '  <head>';
    strHTML = strHTML + '    <title>' + title + '</title>';
    strHTML = strHTML + '  </head>';
    strHTML = strHTML + '  <body id="modalBody" name="modalBody" topmargin="0" marginwidth="0" marginheight="0" leftmargin="0" style="background-color: #FFFFCC;">';
    strHTML = strHTML + '    <img width="100%"  src="' + controlUrl + '" />';
    strHTML = strHTML + '  </body>';
    strHTML = strHTML + '</html>';

    // Calculate coordinates of popup. -- center
    var x = window.screenX + ((window.outerWidth - width) / 2)
    var y = window.screenY + ((window.outerHeight - height) / 2)
    flags += ",screenX=" + x + ",screenY=" + y + ",resizable=yes,width=" + width + ",height=" + height;

    var x = (screen.width - width) / 2;
    var y = (screen.height - height) / 2;

    flags += ",left=" + x + ",top=" + y + ",resizable=yes,width=" + width + ",height=" + height;
    w = window.open('', '_blank', flags);
    w.document.open();
    w.document.write(strHTML);
    w.document.close();
    return;

};
