﻿function AlertOnContinue()
{
    setTimeout('AlertOnContinueDone();', 100);
}
function AlertOnContinueDone()
{
    if (oOnContinueExitPopup)
    {
        eval(oOnContinueExitPopup);
    }

    oOnContinueExitPopup = null;

    return true;
}

var oOnContinueExitPopup;
function Alert(sTitle, sMessage, iHeight, iWidth, oOnContinue)
{
    try
    {
        var iErrorOnLine = 0;
        var sURL;
        var oBTN_Open = $get("ctl00_Popup_BTN_ShowPopup");
        var oLBL_Title = $get("ctl00_Popup_LBL_Title");
        var oP_Body = $get("ctl00_Popup_P_Body");
        var oTable = $get("ctl00_Popup_TBL_Alert");
        var oBTN_ClosePopup = $get("ctl00_Popup_BTN_Close");

        iErrorOnLine = 20;
        if (!iWidth)
        {
            iWidth = 300;
        }

        iErrorOnLine = 40;

        //alert(sMessage)
        //oObject.text = sMessage;


        iErrorOnLine = 60;
        
        if (oBTN_Open && oLBL_Title && oP_Body && oTable)
        {

            oLBL_Title.innerHTML = sTitle;

            iErrorOnLine = 100;
            //var sValue = showModalDialog(sURL, sMessage, 'scroll:1;resizable:yes;help:0;status:0;dialogWidth:' + iWidth + 'px;dialogHeight:' + iHeight + 'px;');

            oTable.width = iWidth + 'px';
            oTable.style.width = iWidth + 'px';
            
            iErrorOnLine = 120;
            if (iHeight)
            {
                oTable.height = iHeight + 'px';
            }
            else
            {
                oTable.height = '';
            }

            oP_Body.innerHTML = sMessage;

            iErrorOnLine = 140;
            if (oOnContinue)
            {
                oOnContinueExitPopup = oOnContinue;
            }

            iErrorOnLine = 170;
            oBTN_Open.click();

            oBTN_ClosePopup.focus();
            //alert(sTitle + '\n---------------\n' + sMessage);
        }
        else
        {
            alert(sTitle + '\n\n' + sMessage);
        }
        //$get("ctl00_Popup_BTN_Close").focus();


    }
    catch (oErr)
    {
        alert(oErr + '\n\niErrorOnLine=' + iErrorOnLine);
    }

}

