
jsStuff = new function () {

  var weekDays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

  this.openCenteredWindow = function (link, width, height, scrollbars, resizable) {
    scrollbars = "scrollbars=" + (scrollbars == "scrollbars" ? "1" : "0");
    resizable = "resizable=" + (resizable == "resizable" && window.resizeTo ? "1" : "0");

    var maxWidth = Math.round(screen.width * .85),
        maxHeight = Math.round(screen.height * .85),
        windowLeft = Math.round((screen.width - width)/2),
        windowTop = Math.round((screen.height - height)/2);

    width = width > maxWidth ? maxWidth : width;
    height = height > maxHeight ? maxHeight : height;

    var windowParams = "menubar=0," + scrollbars + ",titlebar=1," + resizable + ",width=" + width + ",height=" + height + ",left=" + windowLeft + ",top=" + windowTop + ",screenX=" + windowLeft + ",screenY=" + windowTop + ",status=0",
        currWindow = window.open(link.href, link.target, windowParams);

    if (currWindow._alreadyOpened) {
      currWindow.close();
      currWindow = null;
      currWindow = window.open(link.href, link.target, windowParams);
    }
    currWindow._alreadyOpened = true;

    currWindow.focus();
    return currWindow;
  }

  this.doInitialFieldClear = function (field) {
    with (field) {
      value = "";
      onfocus = null;
    }
  }

  this.getDateString = function () {
    var date = new Date();

    return weekDays[date.getDay()] + ",&nbsp;&nbsp;" + date.getMonth() + "." + date.getDate() + "." + date.getFullYear();
  }

}
