var pinInfobox = null;

function GetMap() {
  map = new Microsoft.Maps.Map(document.getElementById("myMap"), {credentials:"Bing Maps Schlüssel"});

  var center = map.getCenter();
  var pin = new Microsoft.Maps.Pushpin(center, {text: '1'});

  pinInfobox = new Microsoft.Maps.Infobox(pin.getLocation(),
      {title: 'My Pushpin',
       description: 'This pushpin is located at (0,0).',
       visible: false,
       offset: new Microsoft.Maps.Point(0,15)});

  Microsoft.Maps.Events.addHandler(pin, 'click', displayInfobox);
  Microsoft.Maps.Events.addHandler(map, 'viewchange', hideInfobox);

  map.entities.push(pin);
  map.entities.push(pinInfobox);

}

function displayInfobox(e) {
  pinInfobox.setOptions({ visible:true });
}

function hideInfobox(e) {
  pinInfobox.setOptions({ visible: false });
}