var voltletWindow = null;

function voltletPopupWindow(url,
                            name,
                            width,
                            height,
                            position,
                            options,
                            positionX,
                            positionY,
                            offsetX,
                            offsetY)
{
  if (position == "random")
  {
    leftPosition =
      (screen.width) ? Math.floor(Math.random() * (screen.width - width)) :
      100;

    topPosition =
      (screen.height) ? Math.floor(Math.random()*((screen.height-height) - 75)):
      100;
  }
  else if (position == "center")
  {
    leftPosition =
      (screen.width) ? (screen.width - width) / 2 : 100;

    topPosition =
      (screen.height) ? (screen.height - height) / 2 : 100;
  }
  else if (((position != "center") && (position != "random")) ||
           (position == null))
  {
    leftPosition = positionX;
    topPosition = positionY;
  }

  if (offsetX)
    leftPosition += offsetX;

  if (offsetY)
    topPosition += offsetY;

  settings = 'width=' + width + ',' +
             'height=' + height + ',' +
             'top=' + topPosition + ',' +
             'left=' + leftPosition;

  optionsList = options.split(",");

  scrollbarsVal = 'no';
  locationVal = 'no';
  directoriesVal = 'no';
  statusVal = 'no';
  menubarVal = 'no';
  toolbarVal = 'no';
  resizableVal = 'no';

  for (i = 0; i < optionsList.length; i++)
  {
    option = optionsList[i];

    namevalue = option.split("=");
    name = namevalue[0];
    value = namevalue[1];

    fixup = name + "Val='" + value + "'";
    eval(fixup);
  }

  if ((options) && (options != null))
    settings = settings + ',' + options;

  settings = settings +
             'scrollbars=' + scrollbarsVal + ',' +
             'location=' + locationVal + ',' +
             'directories=' + directoriesVal + ',' +
             'status=' + statusVal + ',' +
             'menubar=' + menubarVal + ',' +
             'toolbar=' + toolbarVal + ',' +
             'resizable=' + resizableVal;

  voltletWindow = window.open(url, name, settings);
}

