function openWindow(theUrl, theType, theTarget)
{
  needContinue = theType == 'confirmation';
  sep = ",";
  showItems = theType == 'new' ? 1 : 0;
  theParams = ("toolbar=" + showItems + sep + "location=" + showItems + sep + "status="  + showItems + sep + 
               "menubar="  + showItems + sep + "scrollbars=" + showItems + sep + "directories=" + showItems + sep +
               "width=" + windowWidth(theType) + sep + "height=" + windowHeight(theType) + sep + "resizable=1");
  newWindow = window.open(theUrl, theTarget, theParams);
  newWindow.focus();
  return needContinue;
}

// Will resize window according to given type
function resizeWindow(theType, isGecko, isWin)
{
  width = windowWidth(theType);
  height = windowHeight(theType, isGecko, isWin);
  window.resizeTo(width, height);
  return false;
}

function windowWidth(theType)
{
  horizontalWinMargin = 20;
  if (theType == "player")
    return 900 + horizontalWinMargin;
  else if (theType == "confirmation")
    return 350 + horizontalWinMargin;
  else if (theType == "new")
    return 800 + horizontalWinMargin;
  else if (theType == "form")
    return 575 + horizontalWinMargin;
}

function windowHeight(theType, isGecko, isWin)
{
  verticalWinMargin = (isGecko) ? (isWin ? 65 : 25) : 45;
  if (theType == "player")
    return 425 + verticalWinMargin;
  else if (theType == "confirmation")
    return 250 + verticalWinMargin;
  else if (theType == "new")
    return 650 + verticalWinMargin;
  else if (theType == "form")
    return 450 + verticalWinMargin;
}

// For backward compatibility with game of old site version
function open_win (theURL,theName,theWidth,theHeight,theScroll) {
  ///// Scrolling on or off?
  var tempScrollStr = 'scrollbars=yes,';
  if ((theScroll != null) && (theScroll == false)) { tempScrollStr = ''; }

  ///// Parameter String erstellen und Fenster oeffnen
  var tempParamStr = 'toolbar=no,location=no,status=no,menubar=no,' + tempScrollStr + 'width=' + theWidth + ',height=' + theHeight;
  var tempWin = window.open (theURL,theName,tempParamStr);
  tempWin.focus();

  return true;
}
