﻿function neuesFenster(url, width, height) {
    w = window.open(url, "nw", "width=" + width + ",height=" + height + ",scrollbars=yes,resizable=yes");
    w.focus();
}

function newsTeaser() {
    $(document).ready(function() {
        // Erstmal alle zuklappen
        var url = location.href;
        elId = "j" + url.replace(/.*#[aA-zZ]_|[^0-9].*/g, "");
        //alert(typeof elId);
        if (elId != "")
            elId = document.getElementById(elId);
        if (elId != null) {
            $("div.block.meldungen").not(elId).find("div.newsinhalt:visible").fadeTo("fast", 0).slideUp("fast", function() {
                window.scrollTo(0, elId.offsetTop);
            });
        }
        else {
            $("div.block.meldungen").not(".meldungen:first").find("div.newsinhalt:visible").fadeTo("fast", 0).slideUp("fast");
        }
        // an alle nötigen Elemente die Funktion anhängen
        $("div.block.meldungen h2,div.block.meldungen h3").click(function() {
            var el = $(this).parent().find("div.newsinhalt:visible");
            if (el.size() > 0) {
                $(this).parent().toggleClass("meldungaktiv");
                $(el).fadeTo("normal", 0).slideUp("normal");
            }
            else {
                el = $(this).parent().find("div.newsinhalt:hidden")
                $(this).parent().toggleClass("meldungaktiv");
                $(el).slideDown("normal").fadeTo("normal", 1);
            }
        });
    });

}