﻿function openBrWindow(theURL,Name,popW,popH,scroll,resizable)
{
    // Replace a beginning ~ in the URL
    if (theURL.substring(0,1) == '~')
        theURL = appBasePath + theURL.substring(1);

    if (resizable != '0' && resizable != 'no')
        resizable = '1';

    // Find the window dimensions
    var w, h, x, y;
    if (document.all)
    {
        /* the following is only available after onLoad */
        w = document.documentElement.offsetWidth;
        h = document.documentElement.offsetHeight;
        x = window.screenLeft;
        y = window.screenTop - 70;
    }
    else if (document.layers)
    {
        w = window.innerWidth;
        h = window.innerHeight;
        x = window.screenX;
        y = window.screenY;
    }
    else
    {
        w = window.outerWidth;
        h = window.outerHeight;
        x = window.screenX;
        y = window.screenY;
    }

    var leftPos = ((w-popW)/2)+x, topPos = ((h-popH)/2)+y;

    if (topPos < 0)
        topPos = 0;

    // begin new popup code
    winProp = 'width='+popW+',height='+popH+',left='+leftPos+',top='+topPos+',scrollbars='+scroll+',resizable='+resizable;
    Win = window.open(theURL, Name, winProp)

    if (parseInt(navigator.appVersion) >= 4){
        Win.window.focus();
    }
}
