
// launch the popup with the customer registration page
function launchRegistrationPopup(targetUrl) {
  aWindow = open(targetUrl,'Neuanmeldung','width=640,height=574,left=100,top=100,resizable=yes,scrollbars=yes');
  aWindow.focus();
  return false;
}

// Achtung: diese Funktionalität erscheint zur Zeit im gleiche Fenster,
//          d.h. es wird kein Popup aufgemacht 
//          (vergleiche Anwendungsfälle Neuanmeldung, Login und Kaufvorgang!!)
// launch the popup with the recover password page
function launchRecoverPasswordPopup(targetUrl) {
  aWindow = open(targetUrl,'PasswortVergessen','width=640,height=300,left=100,top=100,resizable=yes,scrollbars=yes');
  aWindow.focus();
  return false;  
}

// launch the popup with the newsletter subscription page
function launchNewsletterPopup(targetUrl) {
  aWindow = open(targetUrl,'Newsletter','width=952,height=750,left=100,top=100,resizable=yes,scrollbars=yes');
  aWindow.focus();
  return false;  
}

function launchTWPopupPasswordInfo(popupUrl) {
  return launchTWPopup(popupUrl, 'InfoPasswort', 374);
}

function launchTWPopupMaterialKommentar(popupUrl) {
  return launchTWPopup(popupUrl, 'EditDownload', 396);
}

function launchTWPopupAboKuendigen(popupUrl) {
  return launchTWPopup(popupUrl, 'cancelsubscription', 346);
}

function launchTWPopupContactForm(popupUrl) {
  return launchTWPopup(popupUrl, 'Kontaktformular', 600);
}

// launch a normal TeachWeb popup. They all have the same width but different heights.
function launchTWPopup(popupUrl, title, height) {
  aWindow = open(popupUrl,title,'width=800,height=' + height + ',left=100,top=100,resizable=yes,scrollbars=yes');
  aWindow.focus();
  return false;  
}

function launchBOPopupKontostand(popupUrl, reloadUrl) {
  return launchBOPopup(popupUrl, 'Kontostand', reloadUrl, 540, 300);
}

function launchBOPopupQuittung(popupUrl, reloadUrl) {
  return launchBOPopup(popupUrl, 'Quittung', reloadUrl, 460, 307);
}

function launchBOPopupZahlung(popupUrl, reloadUrl) {
  return launchBOPopup(popupUrl, 'Zahlung', reloadUrl, 460, 300);
}

// launch a BO-Popup. In the main browser window the reloadUrl is loaded
function launchBOPopup(popupUrl, title, reloadUrl, width, height) {
  aWindow = open(popupUrl,title,'width=' + width + ',height=' + height + ',left=100,top=100,resizable=yes,scrollbars=yes');
  aWindow.focus();
  window.location.href = reloadUrl;
  // important so that 'href=#' is not concurrently computed
  return false;
}

// launch a BO-Popup for Abos.
function launchBOAboPopup(popupUrl, title) {
  aWindow = open(popupUrl,title,'width=500,height=400,left=100,top=100,resizable=yes,scrollbars=yes');
  aWindow.focus();
  return false;  
}

// launch a popup with the print preview
function launchTWPrintviewPopup(printactionurl, width) {
  // für die Seite mat_subject.jsp ist schon ein Parameter der das 
  // gewählte Fach angibt gesetzt. Der 'print'-Parameter muss dann mit
  // '&' angehaengt werden.
  var connector = printactionurl.indexOf('?') == -1 ? '?' : '&';
  aWindow = open(printactionurl + connector + 'print=true', 'Druckansicht','width=' + width + ',height=600,left=100,top=100,resizable=yes,scrollbars=yes');
  aWindow.focus();
  return false;
}

// add parameter to request to force reload from server (disable cache)
function addArbitraryParam(url) {
  var connector = url.indexOf('?') == -1 ? '?' : '&';
  var dCurrent = new Date();
  return url + connector + 'cuid=' + escape(dCurrent.getTime());
}

// initializes a reload for counting the downloads
// again
function startInit() {	
	window.parent.opener.location.reload();
	return false;
  }
  

// opens a centered Popup
function openCenteredPopup(URI,ti,b,h) {
var eigenschaft,sbreite,shoehe,fenster02;
// stellt die Bildschirmabmessungen fest
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);

if(ns6||ns4) {
sbreite = innerWidth;
shoehe = innerHeight;
}
else if(ie4) {
sbreite = document.body.clientWidth;
shoehe = document.body.clientHeight;
}

// Fensterpossition linke obere Ecke
x = ((sbreite-b)/2);
y = (shoehe-h)/2;

var eigenschaften="left="+x+",top="+y+",screenX="+x+",screenY="+y;
// weitere Attribiute hinzufügen
eigenschaften= eigenschaften + ",width="+b+",height="+h+",menubar=no";

fenster02=window.open(URI,ti,eigenschaften);
}
