/*
    Utility objects and functions
    version 1.0
    gpeters@gcpeters.com
    07/31/01
    
    Copyright (c) 2001 Grant Peters.
    This code is free for use, and modify 
    with the precept that this copyright information
    remains with all implementations of this source code.
    
    Thank you, and enjoy.
*/

// Dimension object
function Dimension(width,height) {
    this.width  = width;
    this.height = height;
}
Dimension.prototype.getWidth  = function(){return this.width;}
Dimension.prototype.getHeight = function(){return this.height;}

// Util Object
// do nothing c'tor
function Util(){}

Util.prototype.launchWindow = function (htmlSrc, name, dimension, windowProps, x, y) {
                                  var w = dimension.getWidth();
                                  var h = dimension.getHeight();
                                  var props = 'width=' + w + ',height=' + h;
                                  if(windowProps) props += ',' + windowProps;
                                  var mw = window.open(htmlSrc,name,props);
                                  mw.moveTo(x,y);
                                  return mw;
                              }
Util.prototype.launchWindowCentered = function (htmlSrc, name, dimension, windowProps) {
                                          var x = (screen.width / 2) - (dimension.getWidth() / 2);
                                          var y = (screen.height / 2) - (dimension.getHeight() / 2);
                                          return this.launchWindow(htmlSrc, name, dimension, windowProps, x, y);
                                      }


