//
// Functions to help facilitate popup windows
//

// Default values
var _leftOffset = 100;
var _topOffset = 100;

var _width = 450;
var _height = 350;
var _location = 'no';
var _menubar = 'no';
var _resizeable = 'yes';
var _scrollbars = 'auto';
var _status = 'no';
var _toolbar = 'no';

// Display a popup with generic features
function displayPopup(url, windowName)
{
    displayPopupWithFeatures(url, windowName, 'width='+_width+',height='+_height+',location='+_location+',menubar='+_menubar+',resizable='+_resizeable+',scrollbars='+_scrollbars+',status='+_status+',toolbar='+_toolbar);
}

// Display a popup with scrolling
function displayPopupWithScroll(url, windowName)
{
    displayPopupWithFeatures(url, windowName, 'width='+_width+',height='+_height+',location='+_location+',menubar='+_menubar+',resizable='+_resizeable+',scrollbars=yes,status='+_status+',toolbar='+_toolbar);
}

// Display a popup with the supplied features list
function displayPopupWithFeatures(url, windowName, features)
{
    var left;
    var top;
    
    if (window.screenLeft)
    {
        // for IE
        // note: this is from the client area left/top
        left = window.screenLeft + _leftOffset;
        top = window.screenTop + _topOffset;
    }
    else if (window.screenX)
    {
        // for Mozilla
        // note: this is set from the browser window left/top
        left = window.screenX + _leftOffset;
        top = window.screenY + _topOffset;
    }
    else
    {
        // all others
        left = _leftOffset;
        top = _topOffset;
    }
    window.open(url,windowName,'top='+top+',left='+left+','+features);
}