$(document).ready(function() {
  $("#regionSelector .middle div").each(function(index){
      $(this).addClass("hidden");
  });  
  
  $("#regionSelector .right div").each(function(index){
      $(this).addClass("hidden");
  });  

});

function toggle(id)
{
  // Höhe des Seite sliden
  var minHeight = $("#regionSelector .left").outerHeight() + 20;
  var countriesHeight = $("#countries" + id).outerHeight();
  
  if(countriesHeight > minHeight) 
    $("#regionSelector").animate({"height": countriesHeight + 60}, {duration: "slow" });
  else if(countriesHeight < minHeight)
    $("#regionSelector").animate({"height": minHeight + 40}, {duration: "slow" });
    
  // Alle Länder und Kontake sicherheitshalber ausblenden
  $("#regionSelector .middle div").each(function(index){
    $(this).hide();
  });
  $("#regionSelector .right div").each(function(index){
      $(this).hide();
  }); 
  
  // Alle "active"-Marker bei den Regionen entfernen
  $("#continents a").each(function(index){
      $(this).removeClass("active");
  });
  
  // Geklickte Region als "active" markieren
  $("#region" + id).addClass("active");
  
  // Länder für geklickte Region anzeigen
  $("#countries" + id).show();

  return false;
}

function show(anchor, id, region) {
  // Alle Länder sicherheitshalber ausblenden
  $("#regionSelector .right div").each(function(index){
      $(this).hide();
  }); 

  // Alle "active"-Marker bei den Ländern entfernen
  $("#countries" + region + " a").removeClass("active");
  // Geklickten Link als "active" markieren
  $(anchor).addClass("active");

  // Kontakt zu geklicktem Land einblenden
  $("#address" + id).show();
  return false;
}

