
/**
 * ---------------------------------------------------------------------------------------
 * Simulate Modal Dialog.
 * ---------------------------------------------------------------------------------------
 */
function openCmsModalDialog(oUrl, oTarget, oParameter) 
{
    var tmpModalDialog = window.open(oUrl, oTarget, oParameter);
    window.modalPopupDialog = tmpModalDialog;
    window.onfocus = function() {
        if (window.modalPopupDialog != null && window.modalPopupDialog)
        {
            try {
                window.modalPopupDialog.focus();
            } catch(e) {
                window.modalPopupDialog = null;
            }
        }
    }
    
    tmpModalDialog.focus();
    return tmpModalDialog;
}

function openPopupLogon(h, w) 
{
    var sw = (screen.availWidth-10);
    sw = (w) ?w :390;
    sh = (h) ?h :180;
    var nw = openCmsModalDialog("popuplogon.do", "plogon", "scrollbars=no,resizable=yes,width=" + sw + ",height=" + sh);
    return nw;
}

function openSystemDB(iddb, target, idr, ido) 
{
    var sw = 1030;
    var sh = 640;
    var nw = null;

    var callSessionID = GetCookie('JSESSIONID'); 
    var targetName    = target + iddb + "_" + getValidString(callSessionID, "qwertzuiopasdfghjklyxcvbnm1234567890"); 

    if (idr && ido) {
        nw = window.open("main-action.do?idr=" + idr + "&ido=" + ido + "&idf=", targetName, "scrollbars=yes,resizable=yes,width=" + sw + ",height=" + sh);
        nw.focus();
    } else {
        nw = window.open("main-action.do?idr=" + iddb + "&ido=" + iddb + "&idf=ffr", targetName, "scrollbars=yes,resizable=yes,width=" + sw + ",height=" + sh);
        nw.focus();
    }
}

function openPrintDokument(idr, ido, target) 
{
    var sw = (screen.availWidth-10);
    sw = 400;
    sh = 300;
    if (!target) target = "_blank";

    window.open("print-action.do?idr=" + idr + "&ido=" + ido, target, "scrollbars=yes,resizable=yes,width=" + sw + ",height=" + sh);
}

/** Funktionsaufruf in DokumentBuilder#appendAbsHtml(ObjektDetailDokumentAbschnitt abs) */
function openPrintBild(imgurl, bbreite, bhoehe) 
{
    var off=0;
    if (navigator.appName == 'Netscape') off=40;
    var sw = bbreite + 65;
    var sh = bhoehe + 100; // - off;
  
    window.open("web/misc/Bildanzeige.jsp?bildUrl=../" + imgurl, "_blank", "scrollbars=no,resizable=yes,width=" + sw + ",height=" + sh);
}

/** Bild Würfel */
function openImageCube(url, bbreite, bhoehe) 
{
    // image cube macht eigenen resize...
    window.open(url, "_blank", "scrollbars=no,resizable=yes,width=430,height=570,left=0,top=0");
}

/** Bild öffnen */
function openImageDirectly(imgurl, bbreite, bhoehe) 
{
    var off=0;
    if (navigator.appName == 'Netscape') off=40;
    var sw = bbreite + 35;
    var sh = bhoehe + 70 - off;

    window.open("web/misc/Bildanzeige.jsp?bildUrl=../../" + imgurl, "_blank", "scrollbars=yes,resizable=yes,width=" + sw + ",height=" + sh );
}

/** Seminar Übersichtliste öffnen  */
function openSeminarUebersichtsliste() 
{
  var sw = (screen.availWidth-10);
  var sh = (screen.availHeight-30);

  window.open("seminar-overview.do", "semOverview", "scrollbars=yes,resizable=yes,width=" + sw + ",height=" + sh + ",left=0,top=0");
}

/** Seminar Teilnehmerliste öffnen  */
function openSeminarTeilnehmerliste(idr, ido) 
{
  var sw = (screen.availWidth-10);
  var sh = (screen.availHeight-30);

  window.open("seminar-action.do?idr=" + idr + "&ido=" + ido + "&tdo=tlnls", "semTlnliste", "scrollbars=yes,resizable=yes,width=" + sw + ",height=" + sh + ",left=0,top=0");
}



var warenkorbWidth = 730;
var warenkorbHeight = 440;

/** Seminar Warenkorb öffnen. Ggf. 'add' durchführen. */
function openSeminarWarenkorb(idr, ido) 
{
    if (typeof idr != "undefined" && typeof ido != "undefined")
    {
        window.open("warenkorb-seminar.do?idr=" + idr + "&ido=" + ido + "&tdo=add", "wbmWarenkorb", "scrollbars=yes,resizable=yes,width=" + warenkorbWidth + ",height=" + warenkorbHeight);
    }
    else
    {
        window.open("warenkorb-seminar.do", "wbmWarenkorb", "scrollbars=yes,resizable=yes,width=" + warenkorbWidth + ",height=" + warenkorbHeight);
    }
}

/** Werbemittel Warenkorb öffnen. Ggf. 'add' durchführen. */
function openArtikelWarenkorb(idr, ido) 
{
    if (typeof idr != "undefined" && typeof ido != "undefined")
    {
        window.open("warenkorb-werbemittel.do?idr=" + idr + "&ido=" + ido + "&tdo=add", "wbmWarenkorb", "scrollbars=yes,resizable=yes,width=" + warenkorbWidth + ",height=" + warenkorbHeight);
    }
    else
    {
        window.open("warenkorb-werbemittel.do", "wbmWarenkorb", "scrollbars=yes,resizable=yes,width=" + warenkorbWidth + ",height=" + warenkorbHeight);
    }
}

/** Werbemittel Web2Print System öffnen. */
function openArtikelWeb2Print(ida, idr, ido) 
{
    if (typeof idr != "undefined" && typeof ido != "undefined")
    {
    	window.open("main-action.do?idr=" + idr + "&ido=" + ido + "&idf=" + ida + "&tdo=w2pObjekt", "w2pSystem", "scrollbars=yes,resizable=yes");
    }
    else
    {
    	window.open("main-action.do?idf=" + ida + "&tdo=w2pObjekt", "w2pSystem", "scrollbars=yes,resizable=yes");
    }
}

/** WBA Warenkorb öffnen. Ggf. 'add' durchführen. */
function openWbaWarenkorb(idr, ido) 
{
    if (typeof idr != "undefined" && typeof ido != "undefined")
    {
        window.open("warenkorb-wba.do?idr=" + idr + "&ido=" + ido + "&tdo=add", "wbaWarenkorb", "scrollbars=yes,resizable=yes,width=" + warenkorbWidth + ",height=" + warenkorbHeight);
    }
    else
    {
        window.open("warenkorb-wba.do", "wbaWarenkorb", "scrollbars=yes,resizable=yes,width=" + warenkorbWidth + ",height=" + warenkorbHeight);
    }
}

/** FBA-Plan (Betrieb) Warenkorb öffnen */
function openPrjmgmtWarenkorb() 
{
    window.open("warenkorb-prjmgmt.do", "prjmgmtWarenkorb", "scrollbars=yes,resizable=yes,width=" + warenkorbWidth + ",height=" + warenkorbHeight);
}

/** 
 * Öffnet Url in entsprechendem Target direkt. 
 * @param url link + parameter 
 * @param ziel
 */
function openPluginUrlDirect(url, urlTarget) 
{
	window.open(url, urlTarget, "scrollbars=yes,resizable=yes,menubar=yes,status=yes,toolbar=yes,location=yes");
}
