// $Id: popup.js,v 1.7 2006/12/05 04:54:39 jen Exp $

function launch_popup (URL, winWidth, winHeight) {
    var options;
    var winNamePrefix = 'game_';
    var winName;

    if (!winWidth) {
        winWidth = 300;
    }
    if (!winHeight) {
        winHeight = 500;
    }
    winName = winNamePrefix + 'popup';
    options = "width=" + winWidth + ",height=" + winHeight + ",location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=no,dependent=yes";
    var win = window.open('', winName, options);
    if (URL) {
        if (URL.indexOf('?') >= 0) {
            var now = new Date();
            URL = URL + '&_time=' + now.getTime();
        }
    }
    win.location = URL;

    if (! URL) {
        return false;
    }

    // Note that focus does not work if your security settings prevent JS
    // from raising and lowering windows (the default on Firefox 2.0 for Mac)
    if (window.focus && win.focus) {
	win.focus();
    }
}

