function loadpays(idpays){
  $("#edito").load("/spip.php?page=mot&id_mot="+idpays+""); 
}

function hideOnglets() {
  $("#cartes").hide(); 
  $("#sommaire").hide(); 
  $("#buy").hide();
  $("#showCartes").removeClass("selected");
  $("#showSommaire").removeClass("selected");
  $("#showBuy").removeClass("selected");
  $("#showCartes").addClass("notselected");
  $("#showSommaire").addClass("notselected");
  $("#showBuy").addClass("notselected");
  $("#cartes h3").hide();
  $("#buy h3").hide();
  $("#sommaire h3").hide();
}

function showOngletCarte() {
  hideOnglets();
  $("#cartes").show(); 
  $("#showCartes").addClass("selected");
  $("#showCartes").removeClass("notselected");
}

function showOngletSommaire() {
  hideOnglets();
  $("#sommaire").show(); 
  $("#showSommaire").addClass("selected");
  $("#showSommaire").removeClass("notselected");
}

function showOngletBuy() {
  hideOnglets();
  $("#buy").show(); 
  $("#showBuy").addClass("selected");
  $("#showBuy").removeClass("notselected");
}

$(document).ready(function() {
  if ($("#cartes h3").html() == "Cartes") showOngletCarte();

  $("#showCartes").click(function () {showOngletCarte();});
  $("#showSommaire").click(function () {showOngletSommaire()});

  $("#showBuy").click(function () {showOngletBuy()});

  if(($("#cartes h3").html() == "Cartes")&&(($("#sommaire h3").html() == "Sommaire"))) {
    $("#onglet-first-line").html("<span id='showCartes'>CARTES</span> - <span id='showSommaire'>SOMMAIRE</span>") ;
    $("#showCartes").click(function () {showOngletCarte();});
    $("#showSommaire").click(function () {showOngletSommaire();});
//     showOngletCarte();
  } else if ($("#cartes h3").html() == "Cartes") {
    $("#onglet-first-line").html("<span id='showCartes'>CARTES</span>") ;
    $("#showCartes").click(function () {showOngletCarte();});
//     showOngletCarte();
  } else if($("#sommaire h3").html() == "Sommaire") {
    $("#onglet-first-line").html("<span id='showSommaire'>SOMMAIRE</span>") ;
    $("#showSommaire").click(function () {showOngletSommaire();});
//     showOngletSommaire();
  }else {
    $("#onglet-first-line").hide() ;
//     showOngletBuy();
  }
  hideOnglets();
  (function(){for(var l=document.links,h=window.location.hostname,i=0,a;a=l[i];i++){if(a.hostname!=h){a.target='_blank';}}})();
});