var myScreenHeight = screen.availHeight - 210;
var myScreenWidth = screen.availWidth -110 ;
var clickstat = "";
if(document.layers) {
    layerRef = document.layers;
    layerStyleRef = "document.";
    styleSwitch = "";
    n = true;
} else if(document.all) {
    layerRef = document.all;
    layerStyleRef = "document.all.";
    styleSwitch = ".style";
    isIE = true;
} else if(document.documentElement) {
    layerRef = document.documentElement;
    layerStyleRef = "document.getElementById('";
    styleSwitch = "').style";
    w3c = true;
}

function openZoom(url, width, height, winname) {
    var trails="width="+ width +",height="+ height +",toolbar=no,directories=no,status=no,scrollbars=no,resize=no,menubar=no";
    newWindow=window.open(url,winname,trails);
}

function openPopup(url, width, height, winname) {
    var trails="width="+ width +",height="+ height +",toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no";
    newWindow=window.open(url,winname,trails);
}

function openPopup_fixed(url, width, height, winname) {
    var trails="width="+ width +",height="+ height +",toolbar=no,directories=no,status=no,scrollbars=no,resize=no,menubar=no";
    newWindow=window.open(url,winname,trails);
}

function over(on) {
    eval(layerStyleRef + on + styleSwitch + '.visibility="visible"')
}

function out(off) {
    if(clickstat != off) {
        eval(layerStyleRef + off + styleSwitch + '.visibility="hidden"')
    }

}

function show(obj) {
    document.getElementById(obj).style.visibility="visible";
}

function hide(obj) {
    if(clickstat != obj) {
        document.getElementById(obj).style.visibility="hidden";
    }
}

function send() {
    if(document.faq.frage.value == "") {
        alert ("Bitte geben Sie Ihre Frage ein.")
        document.faq.frage.focus();
    } else if(document.faq.mail.value == "") {
        alert ("Bitte geben Sie Ihre E-Mail-Adresse ein.")
        document.faq.mail.focus();
    } else {
        document.faq.submit();
    }
}

function openImage(img, width, height, winname, left, top, res) {
    url = "show-image.php?img=" + img;
    var trails="width="+ width +",height="+ height +",left="+ left +",top="+ top +",toolbar=no,directories=no,status=no,scrollbars=no,resizable="+res+",menubar=no";
    newWindow=window.open(url,winname,trails);

}

function openGalerie(id, width, height, winname, left, top, res) {
    url = "galerie.php?id=" + id;
    var trails="width="+ width +",height="+ height +",left="+ left +",top="+ top +",toolbar=no,directories=no,status=no,scrollbars=no,resizable="+res+",menubar=no";
    newWindow=window.open(url,winname,trails);

}

function launchWin(url, name, width, height, otherfeatures, center) {
    var str = "height=" + myScreenHeight + ",innerHeight=" + myScreenHeight;
    str += ",width=" + myScreenWidth + ",innerWidth=" + myScreenWidth;
    if (window.screen) {
        var ah = screen.availHeight - 140;
        var aw = screen.availWidth - 10;

        var xc = (aw - myScreenWidth) / 2;
        var yc = (ah - myScreenHeight) / 2;
        if(center > 0) {
            str += ",left=" + xc + ",screenX=" + xc;
            str += ",top=" + yc + ",screenY=" + yc;
        } else {
            str += ",left=218,screenX=" + xc;
            str += ",top=265,screenY=" + yc;
        }
    }
    newwin = window.open(url, name, str + ',' + otherfeatures);
    if(parseInt(navigator.appVersion) >= 4) {
        //delay a bit here because IE4 encounters errors
        //when trying to focus a recently opened window
        setTimeout('newwin.focus();',250);
    }
}

function showElement(id) {
    if(document.getElementById(id)) {
        if(document.getElementById(id).style.display == 'none')
            document.getElementById(id).style.display = 'block';
        else
            document.getElementById(id).style.display = 'none';
    }
}

function centerWin(url, name, width, height, otherfeatures) {
    var str = "height=" + height + ",innerHeight=" + height;
    str += ",width=" + width + ",innerWidth=" + width;
    if (window.screen) {
        var ah = screen.availHeight - 30;
        var aw = screen.availWidth - 10;

        var xc = (aw - width) / 2;
        var yc = (ah - height) / 2;

        str += ",left=" + xc + ",screenX=" + xc;
        str += ",top=" + yc + ",screenY=" + yc;
    }
    newwin = window.open(url, name, str + ',' + otherfeatures);
    if(parseInt(navigator.appVersion) >= 4) {
        //delay a bit here because IE4 encounters errors
        //when trying to focus a recently opened window
        setTimeout('newwin.focus();',250);
    }
}

function showLiftField() {
    $("#liftField").show();
    $("#hiddenIsLift").val("1");
}

function hideLiftField() {
    $("#liftField").hide();
    $("#hiddenIsLift").val("0");
}
