function ShowTheAlertPopup(ThePopup, Title, Text, AlertType, YesText, NoText, OkText, CancelText)
{
    var Icon = '';
    switch (AlertType)
    {
        case 'yesno':
            Icon = 'QuestionMark';
            break;
        case 'okonly':
        case 'okcancel':
            Icon = 'ExclamationMark';
            break;
    }
    try
    {
        ThePopup.show(Text, Title, Icon);
    }
    catch (e)
    {
    }
    var AlertButtonElement1 = GetElement('Button1');
    var AlertButtonElement2 = GetElement('Button2');
    if (AlertButtonElement1 != null && AlertButtonElement2 != null)
    {
        switch (AlertType)
        {
            case 'yesno':
                AlertButtonElement1.value = YesText;
                AlertButtonElement2.value = NoText;
                break;
            case 'okcancel':
                AlertButtonElement1.value = OkText;
                AlertButtonElement2.value = CancelText;
                break;
            case 'okonly':
                AlertButtonElement1.value = OkText;
                AlertButtonElement2.style.display = 'none';
                break;
        }
    }
}

function ShowThePopup(ThePopup, Callback, PopType, Modal, PopValue1, PopValue2, PopValue3, PopValue4, PopValue5)
{
    Callback.Callback(PopType, PopValue1, PopValue2, PopValue3, PopValue4, PopValue5);
    if (!ThePopup.get_isShowing())
    {
        ThePopup.set_modal(Modal);
        ThePopup.show();
    }
}

function CloseThePopup(ThePopup, Result)
{
    try
    {
        ThePopup.close(Result);
    }
    catch (e)
    {
    }
}