function OpenEasyPopUp_Oud(url, reloadpage) {
    var wh = ($(window).height() / 100) * 90;
    var ww = ($(window).width() / 100) * 90;

    var callback = null
    if (reloadpage == 1) {
        callback = function () { SysSubmit(1); }
    }

    SysShowModalPopup(url, null, ww + 'px', wh + 'px', callback, true);
}
function OpenEasyPopUp(url, reloadpage) {
    var targetWindow = null;
    var $targetWindow = $(window); // default: huidige window

    try {
        if (window.top && window.top !== window && window.top.SysShowModalPopup) {
            targetWindow = window.top;
            $targetWindow = $(window.top);
        }
        else if (window.parent && window.parent !== window && window.parent.SysShowModalPopup) {
            targetWindow = window.parent;
            $targetWindow = $(window.parent);
        }
    } catch (e) {
        // Cross-origin, gebruik fallback
    }

    var wh = ($targetWindow.height() / 100) * 90;
    var ww = ($targetWindow.width() / 100) * 90;

    var callback = null
    if (reloadpage == 1) {
        callback = function () { SysSubmit(1); }
    }

    if (targetWindow) {
        targetWindow.SysShowModalPopup(url, null, ww + 'px', wh + 'px', callback, true);
    } else {
        SysShowModalPopup(url, null, ww + 'px', wh + 'px', callback, true);
    }
}

function ShowEasyPopUp(anchorElement, reloadpage) {
    OpenEasyPopUp(anchorElement.href, reloadpage);
    return false;
}