var map = null;
var layer = null;
function fadein() {
    $(".kopfbereich").animate({ "padding-top": 155 }, 500, function() {
        $("#plus").attr("href", "javascript:fadeout()");
        $("#plus").css("background-image", "none");
        $(".kopfbereich").css("padding-top", 155);
    });
}
function fadeout() {
    $(".kopfbereich").animate({ "padding-top": 0 }, 500, function() {
        $("#plus").attr("href", "javascript:fadein()");
        $("#plus").css("background-image", "url(\"/domains/www.diakonie-hannovers.de/images/corporate/plus.png\")");
        $(".kopfbereich").css("padding-top", 0);
    });
}
function ratundhilfe() {
    $("#diakonierathilfe").slideToggle();
}
function module_diakonie_einrichtungssuche_changepage(i) {
    document.forms["module_diakonie_einrichtungssuche_ergebnisse"].elements["mders_page"].value = i;
    document.forms["module_diakonie_einrichtungssuche_ergebnisse"].submit();
}
function orgslide(el, d) {
    if (d == 1) {
        if (orglast2 != null && el.html() == orglast2.html()) {
            orglast2.siblings('div.organigrammtext').slideUp();
            orglast2.parent().attr("class", "unsel");
            orglast2 = null;
        }
        else {
            if (orglast2 != null) {
                orglast2.siblings('div.organigrammtext').slideUp();
                orglast2.parent().attr("class", "unsel");
            }
            el.siblings('div.organigrammtext').slideDown();
            el.parent().attr("class", "sel");
            orglast2 = el;
        }
    }
    else {
        if (orglast!=null&&el.html() == orglast.html()) {
            orglast.siblings('ul').slideUp();
            orglast.parent().attr("class", "unsel");
            orglast = null;
        }
        else {
            if (orglast != null) {
                orglast.siblings('ul').slideUp();
                orglast.parent().attr("class", "unsel");
            }
            el.siblings('ul').slideDown();
            el.parent().attr("class", "sel");
            orglast = el;
        }
    }
}
var diakoniepointer = 0;
var diakonietimer = null;
var orglast = null;
var orglast2 = null;
$(document).ready(function() {
    $("div.monitor").mouseleave(function() { if (diakonietimer == null) { restarttimer(); } });
    $("div.monitor").mouseenter(function() { if (diakonietimer != null) { clearInterval(diakonietimer); diakonietimer = null; } });
    restarttimer();
});
function restarttimer() {
    clearInterval(diakonietimer);
    diakonietimer = null;
    diakonietimer = setInterval(function() {
        diakoniepointer++;
        $("div.stage_menu_" + diakoniepointer).trigger('mouseover');
        if (diakoniepointer == 4) {
            diakoniepointer = 0;
        }
    }, 5000);
}
function show_erd(ort, name) {
    tb_show('Titel', '#TB_inline?height=400&width=620&inlineId=erd_'+name, false);
    GetMap(52.01073110103607, 10.132329538464546, 10,name,ort);
}
function GetMap(x, y, z,name,ort) {
    if (typeof (VEMap) != "undefined") {
        map = new VEMap("map_"+name);
        map.SetDashboardSize(VEDashboardSize.Tiny);
        map.LoadMap(new VELatLong(x, y), z, 'r', false);
        layer = new VEShapeLayer();
        layer.SetClusteringConfiguration(VEClusteringType.Grid);
        map.AddShapeLayer(layer);
        map.Find(null, ort, null, layer);
        map.Find(null, ort, null, layer, null, null, null, null, null, null, addPin);
    }
}
function addPin() {
    var shape = new VEShape(VEShapeType.Pushpin, map.GetCenter());
    map.AddShape(shape);
}
