function bubblesInit(){

  timeout = new Array;
  active = new Array;
  currentActive = null;

  $(".hotspot").each(function(){

    // Bubbletip erstellen
    bubbletip = $("#"+$(this).attr("id")+"-bubbletip");
    $('.bt-content', bubbletip).html('<div class="bt-content-text">' + $(".hotspot-content", this).html() + '</div>');
    $("body").append(bubbletip);

    // MouseOver
    $([bubbletip.get(0), $(this).get(0)]).mouseover(function(){

      var key = $(this).attr("id").split("-bubbletip")[0];

      if (timeout[key]) {
        clearTimeout(timeout[key]);
      }

      if(active[key]){
        return
      }

      var thisBubbbleTip = $("#" + $(this).attr("id") + "-bubbletip");
      thisBubbbleTip.css("display", "block");

      var top = $(this).offset().top - thisBubbbleTip.height() / 2 - 20 - 50;
      var left = $(this).offset().left - thisBubbbleTip.width() / 2 + 17;

      thisBubbbleTip.css("top", top +"px");
      thisBubbbleTip.css("left", left +"px");

      active[key] = true;
      thisBubbbleTip.animate({ 'opacity': 0.8, 'top': top + 50 +'px' }, 250, "swing",function() {
        currentActive = key;
      });

      return false;

    // MouseOut
    }).mouseout(function(){

      var key = $(this).attr("id").split("-bubbletip")[0];

      var thisBubbbleTip = $("#" + key + "-bubbletip");

      timeout[key] = setTimeout(function(){
        //thisBubbbleTip.animate({ 'opacity': 0, 'top': top - 60 +'px' }, 250, "swing",function() {});
        active[key] = false;
        thisBubbbleTip.css("opacity", 0);
        thisBubbbleTip.css("display", "none");
      }, 400);

    });

  });

}

function needHelp(){

  timeout = new Array;
  active = new Array;
  currentActive = null;

  $(".need-help").each(function(){

    // Bubbletip erstellen
    bubbletip = $("#"+$(this).attr("id")+"-bubbletip");
    $('.bt-content', bubbletip).html('<div class="bt-content-text">' + $("#need-help-content").html() + '</div>');
    $("body").append(bubbletip);

    // MouseOver
    $([bubbletip.get(0), $(this).get(0)]).mouseover(function(){

      var key = $(this).attr("id").split("-bubbletip")[0];

      if (timeout[key]) {
        clearTimeout(timeout[key]);
      }

      if(active[key]){
        return
      }

      var thisBubbbleTip = $("#" + $(this).attr("id") + "-bubbletip");
      thisBubbbleTip.css("display", "block");

      var top = $(this).offset().top - thisBubbbleTip.height() / 2 - 20 - 113;
      var left = $(this).offset().left - thisBubbbleTip.width() / 2 + 28;

      thisBubbbleTip.css("top", top +"px");
      thisBubbbleTip.css("left", left +"px");

      active[key] = true;
      thisBubbbleTip.animate({ 'opacity': 0.8, 'top': top + 50 +'px' }, 250, "swing",function() {
        currentActive = key;
      });

      return false;

    // MouseOut
    }).mouseout(function(){

      var key = $(this).attr("id").split("-bubbletip")[0];

      var thisBubbbleTip = $("#" + key + "-bubbletip");

      timeout[key] = setTimeout(function(){
        //thisBubbbleTip.animate({ 'opacity': 0, 'top': top - 60 +'px' }, 250, "swing",function() {});
        active[key] = false;
        thisBubbbleTip.css("opacity", 0);
        thisBubbbleTip.css("display", "none");
      }, 400);

    });

  });

}
