
function authorTopictextEdit(x_path, x_topicsId, x_topictextId) {
    var oWindow = null;
    var iWidth = 600;
    var iHeight = 350;
    oWindow = window.open(x_path + "/piclease/authors/portrait/edit.do?topicsId=" + x_topicsId + "&topictextId=" + x_topictextId, "POPUP_EDITORIAL", "dependent=yes,locationbar=no,menubar=no,scrollbars=no,resizable=no,status=no,screenX=0,screenY=0,height=" + iHeight + ",width=" + iWidth);
    if (top.window.opener) {
        oWindow.opener = top.window.opener;
    }
    var posX = (screen.availWidth - iWidth) / 2;
    var posY = (screen.availHeight - iHeight) / 2;
    oWindow.moveTo(posX, posY);
    oWindow.focus();
}
function editorialEdit(x_path, x_topictextId) {
    var oWindow = null;
    var iWidth = 600;
    var iHeight = 750;
    oWindow = window.open(x_path + "/piclease/admin/editorial/edit.do?topictextId=" + x_topictextId, "POPUP_EDITORIAL", "dependent=yes,locationbar=no,menubar=no,scrollbars=no,resizable=no,status=no,screenX=0,screenY=0,height=" + iHeight + ",width=" + iWidth);
    if (top.window.opener) {
        oWindow.opener = top.window.opener;
    }
    var posX = (screen.availWidth - iWidth) / 2;
    var posY = (screen.availHeight - iHeight) / 2;
    oWindow.moveTo(posX, posY);
    oWindow.focus();
}
function editorialNew(x_path, x_topicsId) {
    var oWindow = null;
    var iWidth = 600;
    var iHeight = 750;
    oWindow = window.open(x_path + "/piclease/admin/editorial/edit.do?topicsId=" + x_topicsId, "POPUP_EDITORIAL", "dependent=yes,locationbar=no,menubar=no,scrollbars=no,resizable=no,status=no,screenX=0,screenY=0,height=" + iHeight + ",width=" + iWidth);
    if (top.window.opener) {
        oWindow.opener = top.window.opener;
    }
    var posX = (screen.availWidth - iWidth) / 2;
    var posY = (screen.availHeight - iHeight) / 2;
    oWindow.moveTo(posX, posY);
    oWindow.focus();
}
function editorialDelete(x_path, x_topictextId) {
    if (confirm("Wollen Sie den Beitrag wirklich l\ufffdschen?")) {
        document.location.href = x_path + "/piclease/admin/editorial/edit.do?doDelete&topictextId=" + x_topictextId;
    }
}
function pagecontrolListPiclease(x_path, x_id, x_forward) {
    window.top.mainFrame.location.href = x_path + x_forward + x_id;
//    document.pagecontrol["selected" + document.pagecontrol.lastVar.value].src = x_path + "/common/images/layoutelements/onepixel.gif";
//    document.pagecontrol["selected" + x_id].src = x_path + "/piclease/common/images/layoutelements/cuepoint.arrow.gif";
//    document.pagecontrol.lastVar.value = x_id;
}
function popupImageSingle(x_path, x_image_src, x_image_id) {
    var oWindow = null;

	// get the size of the image. NH 
    var sSize = x_image_src.split("_");
    var aSize = sSize[sSize.length - 1].split("x");
    var panelwidth = 6; 
	// close-button(cross)
    var bottomheight = 45;
    var infoheight = 100;
    var infowidth = 200;
    var width = parseInt(aSize[0]);
    var height = parseInt(aSize[1].substr(0, aSize[1].length - 4));
    var format = "L";
	
	// unterscheiden zwischen Hochformat und Querformat
    if (width > height) {
        width = parseInt(aSize[0]) + panelwidth + panelwidth;
        height = parseInt(aSize[1].substr(0, aSize[1].length - 4)) + panelwidth + panelwidth + infoheight;
        format = "L";
    } else {
        width = parseInt(aSize[0]) + panelwidth + panelwidth + infowidth;
        height = parseInt(aSize[1].substr(0, aSize[1].length - 4)) + panelwidth + panelwidth + bottomheight;
        format = "P";
    }
    oWindow = window.open(x_path + "/piclease/image.do?doSingle=&image_id=" + x_image_id + "&format=" + format, "POPUP_IMAGE", "locationbar=no,menubar=no,scrollbars=no,resizable=no,status=no,screenX=0,screenY=0,height=" + height + ",width=" + width);
    if (top.window.opener) {
        oWindow.opener = top.window.opener;
    }
    oWindow.resizeTo(width, height);
    centerTopWindow(oWindow, width, height);
}
function imageRemove(x_url, x_imageId) {
    if (confirm("Soll das Bild aus dem Warenkorb entfernt werden?")) {
        window.location.href = x_url + "&remImage&imageId=" + x_imageId;
    }
}
function popupImageInfo(x_path, x_image_id) {
    var oWindow = null;
    var iWidth = 600;
    var iHeight = 500;
    oWindow = window.open(x_path + "/piclease/search/popup.do?doImageInfo=&imageId=" + x_image_id, "POPUP_IMAGE", "locationbar=no,menubar=no,scrollbars=no,resizable=no,status=no,screenX=0,screenY=0,height=" + iHeight + ",width=" + iWidth);
    if (top.window.opener) {
        oWindow.opener = top.window.opener;
    }
    oWindow.resizeTo(iWidth, iHeight);
    centerTopWindow(oWindow, iWidth, iHeight);
}
function popupKeywordList(x_path) {
    var oWindow = null;
    var iWidth = 600;
    var iHeight = 700;
    oWindow = window.open(x_path + "/piclease/admin/images.do?doKeywordList", "POPUP_KEYWORDLIST", "locationbar=no,menubar=no,scrollbars=no,resizable=yes,status=no,screenX=0,screenY=0,height=" + iHeight + ",width=" + iWidth);
    if (top.window.opener) {
        oWindow.opener = top.window.opener;
    }
    oWindow.resizeTo(iWidth, iHeight);
    centerTopWindow(oWindow, iWidth, iHeight);
}
function popupTextInfo(x_path, iWidth, iHeight) {
    var oWindow = null;
    oWindow = window.open(x_path, "POPUP_INFOTEXT", "locationbar=no,menubar=no,scrollbars=no,resizable=no,status=no,screenX=0,screenY=0,height=" + iHeight + ",width=" + iWidth);
    if (top.window.opener) {
        oWindow.opener = top.window.opener;
    }
    oWindow.resizeTo(iWidth, iHeight);
    centerTopWindow(oWindow, iWidth, iHeight);
}

// 7.9.09
function setBestellDaten() {
    var doc = document.bestellung;
    if (doc.vorname.value == "" || doc.nachname.value == "" || doc.strasse.value == "" || doc.plz.value == "" || doc.ort.value == "" || doc.land.value == "" || doc.email.value == "") {
        alert("Bitte alle mit Stern gekennzeichneten Felder ausfüllen!");
        return false;
    }
    var strBestellung = "";
    var arrFlat = new Array();
    var aktFlat = "";
    var filledIn = false;
    arrFlat[1] = "pic-WebFlat";
    arrFlat[2] = "pic-WebFlat+";
    arrFlat[3] = "pic-BasicFlat";
    arrFlat[4] = "pic-FullFlat";
    arrFlat[5] = "pic-FullFlat+";
    for (i = 1; i < 9; i++) {
        aktFlat = "flat" + i;
        if (doc.elements[aktFlat].value != "") {
            strBestellung = strBestellung + doc.elements[aktFlat].value + " x " + arrFlat[i] + "\n";
            filledIn = true;
        }
    }
    if (!filledIn) {
        alert("Sie haben noch keine Bilder-Flat ausgewählt!");
        return false;
    }
    var strRechnungsadresse = "";
    var strCommunication = "";
    var strComment = "";
    var strLieferadresse = "";
    strRechnungsadresse = doc.anrede.value + " " + doc.vorname.value + " " + doc.nachname.value + "\n" + doc.strasse.value + "\n" + doc.plz.value + " " + doc.ort.value + "\n" + doc.land.value;
    strCommunication = "Fax: " + doc.fax.value + "\nTelefon: " + doc.telefon.value + "\nEmail: " + doc.email.value;
    strComment = doc.kommentar.value;
    strLieferadresse = doc.ra_vorname.value + " " + doc.ra_nachname.value + "\n" + doc.ra_strasse.value + "\n" + doc.ra_plz.value + " " + doc.ra_ort.value + "\n" + doc.ra_land.value;
    strBody = "Bestellung:\n" + strBestellung + "\n\nAdresse: " + strRechnungsadresse + "\n" + strCommunication + "\n\nKommentar: " + strComment + "\n\nLieferadresse: " + strLieferadresse + "\n";
    doc.body.value = strBody;
    doc.emailBcc.value = "nobbi@s2you.de";
    doc.to.value = "info@piclease.de";
    doc.subject.value = "piclease Bilderflat-Bestellung";	
	// automatische mail an Besteller
    doc.emailSubject.value = "Bestellbest\ufffdtigung";
    doc.emailBody.value = "Sehr geehrter Kunde,\n\nIhre Bestellung ist eingegangen.\nMit freundlichen Grüßen\n\nIris Göde";
}