/* Luxusversion von openWindow mit o2 spezifischer _opener Behandlung und AutoClose Funktionalitaet */
function handleWindow(destUrl, doOpener, doClose, doFocus, name, x, y, width, height, params) {
    if (doOpener != null && doOpener == "1") {
        if (top.opener != null &&
            typeof top.opener.closed == "boolean" && !top.opener.closed) {
            top.opener.location.href = destUrl;
            if (doFocus != null && doFocus == "1") {
                top.opener.focus();
            }
            if (doClose != null && doClose == "1") {
                top.close();
            }
        } else {
            openWindow(destUrl);
            if (doClose != null && doClose == "1") {
                top.close();
            }
        }
    } else {
        if (name != null || params != null) {
            openWindow(destUrl, name, x, y, width, height, params);
            if (doClose != null && doClose == "1") {
                top.close();
            }
        } else {
            window.location.href = destUrl;
        }
    }
}

/* open window function */
function openWindow(url, name, x, y, width, height, params) {
    if (name != null) {
        name = name.replace(/ /g, "");
    }
    if (!isNaN(x) && x > 0) {
        params += ",left=" + x;
    }
    if (!isNaN(y) && y > 0) {
        params += ",top=" + y;
    }
    if (!isNaN(width) && width > 0) {
        params += ",width=" + width;
    }
    if (!isNaN(height) && height > 0) {
        params += ",height=" + height;
    }
    if (params != null && params.charAt(0) == ",") {
        params = params.substring(1);
    }
    var win = window.open(url, name, params);
    if (win) {
        win.focus();
    }
}