﻿function PagePopup(url, width, height) {
  
    var popWidth = 0;
    var popHeight = 0;
    var options = "'location=1,directories=1,toolbar=1,menubar=1,status=1,resizable=1,scrollbars=1{0}'";

    if (typeof (width) != 'undefined' && width != null) {
        popWidth = width;
    }
    if (typeof (height) != 'undefined' && height != null) {
        popHeight = height;
    }

    if (popWidth > 0 && popHeight > 0) {
        options = options.replace("{0}", ",width=" + popWidth + ",height=" + popHeight);
    }
    else {
        options = options.replace("{0}", "");
    }

    var pagePop = window.open(url, "newwindow", options);
    if (pagePop != null) {
        pagePop.focus();
    }
}

