var xpSizePlus = 20;
function sendPopUp(newLocation) {
  var w = 730;
  var h = 740;
  
  /* increase size because status bar is always visible on Windows XP */
  var Ergebnis = navigator.userAgent.match(/Windows NT ([5-9]).([0-9])/);
  if (navigator.userAgent.match(/ MSIE/) && Ergebnis && Ergebnis[2] && Ergebnis[1] && ((Ergebnis[2] >= 1) || (Ergebnis[2] > 5))) 
    h = h+10;
	
  var popUpWindow = window.open(newLocation, 'popup', 'resizable=yes, status=no, toolbar=no, scrollbars, width='+w+', height='+h);
  popUpWindow.resizeTo(w, h);
  popUpWindow.focus();
}

function printPopUp(newLocation) {
  var w = 730;
  var h = 700;
  /* increase size because status bar is always visible on Windows XP */
  var Ergebnis = navigator.userAgent.match(/Windows NT ([5-9]).([0-9])/);
  if (navigator.userAgent.match(/ MSIE/) && Ergebnis && Ergebnis[2] && Ergebnis[1] && ((Ergebnis[2] >= 1) || (Ergebnis[2] > 5))) 
    h = h+10;

  var popUpWindow = window.open(newLocation, 'popup', 'resizable=yes, status=no, toolbar=no, scrollbars, width='+w+', height='+h);
  popUpWindow.resizeTo(w, h);
  popUpWindow.focus();
}

function resizePrintPopUp() {
  var w = 730;
  var h = 700;

  /* increase size because status bar is always visible on Windows XP */
  var Ergebnis = navigator.userAgent.match(/Windows NT ([5-9]).([0-9])/);
  if (navigator.userAgent.match(/ MSIE/) && Ergebnis && Ergebnis[2] && Ergebnis[1] && ((Ergebnis[2] >= 1) || (Ergebnis[2] > 5))) 
    h = h+10;

  if (opener && !window.locationbar && ! window.menubar)
      window.resizeTo(w, h);
}
function glossaryPopUp(newLocation) {
  var h = 400;
  var w = 730;


  /* increase size because status bar is always visible on Windows XP */
  var Ergebnis = navigator.userAgent.match(/Windows NT ([5-9]).([0-9])/);
  if (navigator.userAgent.match(/ MSIE/) && Ergebnis && Ergebnis[2] && Ergebnis[1] && ((Ergebnis[2] >= 1) || (Ergebnis[2] > 5))) 
    h = h+10;

  var popUpWindow = window.open(newLocation, 'glossary', 'resizable=yes, status=no, toolbar=no, scrollbars, width='+w+', height='+h);
  popUpWindow.resizeTo(w, h);
  popUpWindow.focus();  
}


function tablePopUp(newLocation, preferedWidth) {

  var w = (preferedWidth && !isNaN(preferedWidth))? preferedWidth : 800;
  var h = 500;

  // increase width for scroll bar plus body padding
  w += 50;

  var Ergebnis = navigator.userAgent.match(/Windows NT ([5-9]).([0-9])/);
  if (Ergebnis && Ergebnis[2] && Ergebnis[1] && ((Ergebnis[2] >= 1) || (Ergebnis[2] > 5))) 
      h = h+xpSizePlus;

  var popUpWindow = window.open(newLocation, 'tablePopUp', 'scrollbars,resizable=yes,location=no,status=no,toolbar=no,width='+w+', height='+h);

  // get the first image in the new popup
  popUpWindow.resizeTo(w, h);
  popUpWindow.focus();
}

function imagePopUp(newLocation, w, h) {

  w += 15;
  h += 32;

  var Ergebnis = navigator.userAgent.match(/Windows NT ([5-9]).([0-9])/);
  if (Ergebnis && Ergebnis[2] && Ergebnis[1] && ((Ergebnis[2] >= 1) || (Ergebnis[2] > 5))) 
      h = h+10;

  var popUpWindow = window.open(newLocation, 'imagePopUp', 'resizable=yes,location=no,status=no,toolbar=no,width='+w+', height='+h);

  // get the first image in the new popup
  popUpWindow.resizeTo(w, h);
  popUpWindow.focus();
}

function flashPopUp(newLocation) {
  var h = 590;
  var w = 470;
  
  /* increase size because status bar is always visible on Windows XP */
  var Ergebnis = navigator.userAgent.match(/Windows NT ([5-9]).([0-9])/);
  if (navigator.userAgent.match(/ MSIE/) && Ergebnis && Ergebnis[2] && Ergebnis[1] && ((Ergebnis[2] >= 1) || (Ergebnis[2] > 5))) 
    h = h+20;
	
  var popUpWindow = window.open(newLocation, 'flashintro', 'resizable=yes, status=no, toolbar=no, scrollbars=no, width='+w+', height='+h);
  popUpWindow.resizeTo(w, h);
  popUpWindow.focus();
}

function fileLibraryPopUp(newLocation) {
  var h = 400;
  var w = 710;

  /* increase size because status bar is always visible on Windows XP */
  var Ergebnis = navigator.userAgent.match(/Windows NT ([5-9]).([0-9])/);
  if (navigator.userAgent.match(/ MSIE/) && Ergebnis && Ergebnis[2] && Ergebnis[1] && ((Ergebnis[2] >= 1) || (Ergebnis[2] > 5)))
    h = h+20;

  var popUpWindow = window.open(newLocation, 'fileLibrary', 'resizable=yes, status=no, toolbar=no, scrollbars=no, width='+w+', height='+h);
  popUpWindow.resizeTo(w, h);
  popUpWindow.focus();
}


function videoFlashPopUp(newLocation) {
  var h = 540;
  var w = 710;

  /* increase size because status bar is always visible on Windows XP */
  var Ergebnis = navigator.userAgent.match(/Windows NT ([5-9]).([0-9])/);
  if (navigator.userAgent.match(/ MSIE/) && Ergebnis && Ergebnis[2] && Ergebnis[1] && ((Ergebnis[2] >= 1) || (Ergebnis[2] > 5)))
    h = h+20;

  var popUpWindow = window.open(newLocation, 'fileLibrary', 'resizable=yes, status=no, toolbar=no, scrollbars=no, width='+w+', height='+h);
  popUpWindow.resizeTo(w, h);
  popUpWindow.focus();
}


function popUp(URL, Height, Width, id, Resizable, Toolbar, Scrollbars)
{
	var szWndOptions = "";
	var szToolbar = (Toolbar=="ja" || Toolbar=="yes")?"yes":"no";	
	var szScrollbars = (Scrollbars=="ja" || Scrollbars=="yes")?"yes":"no";
	var szResizable = (Resizable=="ja" || Resizable=="yes")?"yes":"no";
	var oPopup;
	szWndOptions += "height=" + Height
	szWndOptions += ",width=" + Width
	szWndOptions += ",resizable=" + szResizable
	szWndOptions += ",scrollbars=" + szScrollbars
	szWndOptions += ",toolbar=" + szToolbar
	szWndOptions += ",menubar=" + szToolbar
	szWndOptions += ",status=" + szToolbar
	szWndOptions += ",directories=no"
	szWndOptions += ",copyhistory=no"
	szWndOptions += ",location=no"
	oPopup = window.open(URL, id, szWndOptions);
	oPopup.focus();
	return(oPopup);
}



function searchResultPopUp(formular, targetURL)
{
  var h = 600;
  var w = 717;

    if (formular == null || targetURL == null)
        return true;

    var queryParam = "?target=_blank";
    for (var i=0; i<formular.elements.length; i++)
    {
        var elem = formular.elements[i];
        if (queryParam.length > 1)
            queryParam += "&";

        queryParam += elem.name + "=" + escape(elem.value);
    }

  return PopUpOpenWindow(targetURL + queryParam, "searchPopUp" + Math.floor(Math.random() * 99999), 'toolbar=yes,location=no,directories=no,scrollbars=yes,status=yes,menubar=no,resizable=yes', w, h);

    return false;
}





function PopUpOpenWindow(newLocation, name, specialFeatures, w, h)
{
  var popUpWindow;

      var Ergebnis = navigator.userAgent.match(/Windows NT ([5-9]).([0-9])/);
      if (navigator.userAgent.match(/firefox/i) || Ergebnis && Ergebnis[2] && Ergebnis[1] && ((Ergebnis[2] >= 1) || (Ergebnis[2] > 5))) 
      {
           if (navigator.userAgent.match(/ MSIE/))
               h = h+20;
           else
               h = h+15;
      }


  if (!specialFeatures)
      specialFeatures = "";

  try
  {
    popUpWindow = window.open(newLocation, name, specialFeatures +  ',width=' + w + ',height=' + h);
  }
  catch (e)
  {
    return false;
  }  
  
  try
  {
    popUpWindow.resizeTo(w, h);
  }
  catch (e) {}
  
  try
  {
    popUpWindow.focus();
  }
  catch (e) {}

  return true;

}
