﻿function popUp(windowProperties) {
    var day = new Date();
    var id = day.getTime();
    var getVal = "";

    if (windowProperties.url.indexOf("[Sitefinity]") != -1) {
        getVal = "/Sitefinity/Admin/ControlTemplates/Pages/Dialogs/GetPageId.ashx?id=" + windowProperties.url.replace("[Sitefinity]", "");
        jQuery.get(getVal, function(data) {
            eval("page" + id + " = window.open('" + data +
            "', '" + id +
            "', 'toolbar=" + windowProperties.toolbar +
            ",scrollbars=" + windowProperties.scrollbars +
            ",location=" + windowProperties.location +
            ",statusbar=" + windowProperties.statusbar +
            ",menubar=" + windowProperties.menubar +
            ",resizable=" + windowProperties.resizable +
            ",width=" + windowProperties.width +
            ",height=" + windowProperties.height + "');");
        });
    } else if (windowProperties.url.indexOf("~/") != -1) {
        getVal = windowProperties.url.replace("~/", "/");
        eval("page" + id + " = window.open('" + getVal +
        "', '" + id +
        "', 'toolbar=" + windowProperties.toolbar +
        ",scrollbars=" + windowProperties.scrollbars +
        ",location=" + windowProperties.location +
        ",statusbar=" + windowProperties.statusbar +
        ",menubar=" + windowProperties.menubar +
        ",resizable=" + windowProperties.resizable +
        ",width=" + windowProperties.width +
        ",height=" + windowProperties.height + "');");
    } else {
        eval("page" + id + " = window.open('" + windowProperties.url +
        "', '" + id +
        "', 'toolbar=" + windowProperties.toolbar +
        ",scrollbars=" + windowProperties.scrollbars +
        ",location=" + windowProperties.location +
        ",statusbar=" + windowProperties.statusbar +
        ",menubar=" + windowProperties.menubar +
        ",resizable=" + windowProperties.resizable +
        ",width=" + windowProperties.width +
        ",height=" + windowProperties.height + "');");
    }
}