function childWindowRegister() {
  this.theRegister = new Array();

  this.setChildWindow     = setChildWindow;
  this.isRegistered       = isRegistered;
  this.cleanupChildWindow = cleanupChildWindow;
}

function setChildWindow(childWindow) {
  this.theRegister[childWindow.name] = childWindow;

  for (var key in this.theRegister) {
    if (this.theRegister[key] != null
        && this.theRegister[key].closed) {
      this.theRegister[key] = null;
    }
  }

  return;
}

function isRegistered(windowName) {
  for (var key in this.theRegister) {
    if (this.theRegister[key] != null
        && this.theRegister[key].closed) {
      this.theRegister[key] = null;
    }

    if (this.theRegister[key] != null) {
      if (key == windowName) {
        return this.theRegister[key];
      }
    }
  }

  return null;
}

function cleanupChildWindow() {
  for (var key in this.theRegister) {
    if (this.theRegister[key] != null) {
      this.theRegister[key].close();
      this.theRegister[key] = null;
    }
  }

  return;
}

var childWindowRegister = new childWindowRegister();

