// Copyright © 2003-2009 Edgar Soberón.  All rights reserved.


var popupName = "popup";  // the pop-up window's name (for programming)
var size = "height=525,width=525";  // the pop-up window's dimensions
var bgColor = "#5D4736";  // the pop-up window's background color

var popup;  // the pop-up window
var popupTitle;  // the pop-up window's title

// Determines if it's an older version of the browser, i.e., Navigator
// 2 or Internet Explorer 3.
var oldBrowser = parseInt(navigator.appversion) < 3;


// Creates the new window if it doesn't already exist, using the given
// title in the window's title bar.
function makePopup(itsTitle) {
    popupTitle = itsTitle;
    popup = window.open("", popupName, size);

    // Handle Navigator 2, which doesn't have an opener property.
    if (!popup.opener) {
        popup.opener = window;
    }

    // Workaround for Internet Explorer 3:  Delay writing until window
    // exists.
    setTimeout("updateWindow()", 750);

    if (!oldBrowser) {
        // Window is already open, so bring it to the front.
        popup.focus();
    }
}


function updateWindow() {
    popup.document.bgColor = bgColor;
    popup.document.title = popupTitle;
    popup.onResize = setBgColor;
}


function setBgColor() {
    popup.document.bgColor = bgColor;
}
