﻿$(document).ready(function() {
    $('.fancybox').fancybox();

    $(".answer").hide();

    $(".question").click(function() {
        $(this).parent().siblings(".answer").slideToggle();
        $("img", this).toggleClass("close");
        return false;
    });

    // show random map on right side
    var maps = $("#cont-teaser-aktuell .cont-teaser-karte");
    maps.hide();
    if (maps.length > 0) {
        var randomBoxNumber = Math.floor(Math.random() * maps.length);
        $(maps[randomBoxNumber]).show();
    }

    // show question if hash is available
    var hashKey = window.location.hash;
    if (hashKey.length > 1) {
        $("a[name='" + hashKey.substring(1) + "']").click();
    }

});
