/*--------------------------------------------------------------------------------*/
/*                                      XITI                                      */
/*--------------------------------------------------------------------------------*/


function addSRTrackingInfo() {
  <!-- Search results page action -->
  $("#rm .jqaRefine").each(function() {
    $(this).data("trackingInfo", {type:"A", xtn2:27, label:"Fonctionnalites_retour_moteur::Bouton_affiner"});
  });

  $("#rm .rm-pics a").click(function() {
    return xt_click(this, "C", 27, "Fonctionnalites_retour_moteur::Plus_de_photos", "A");
  });

  $("#rm .rm-resume a:not(.rm-resume-content a)").click(function() {
    return xt_click(this, "C", 27, "Fonctionnalites_retour_moteur::Lire_description_complete", "A");
  });

  $("#rm .rm-comment a").click(function() {
    return xt_click(this, "C", 27, "Fonctionnalites_retour_moteur::Lire_avis_experts", "A");
  });

  $("#rm .rm-tools ul")
    .find("li.comp a").each(function(){$(this).data("trackingInfo", {type:"A", xtn2:27, label:"Fonctionnalites_retour_moteur"});}).end()
    .find("li.fav a").each(function(){$(this).data("trackingInfo", {type:"A", xtn2:27, label:"Fonctionnalites_retour_moteur"});}).end()
    .find("li.sat a").each(function(){$(this).data("trackingInfo", {type:"A", xtn2:27, label:"Fonctionnalites_retour_moteur::Vue_satellite"});}).end()
    .find("li.met a").each(function(){$(this).data("trackingInfo", {type:"A", xtn2:27, label:"Fonctionnalites_retour_moteur::Meteo_sur_place"});}).end()
    .find("li.pays a").each(function(){$(this).data("trackingInfo", {type:"A", xtn2:27, label:"Fonctionnalites_retour_moteur::Infos_pays"});});

  $("#rm .rm-topbar")
    .find("#prix").each(function(){$(this).data("trackingInfo", {type:"A", xtn2:27, label:"Fonctionnalites_retour_moteur::Trier_par_prix"});}).end()
    .find("#note").each(function(){$(this).data("trackingInfo", {type:"A", xtn2:27, label:"Fonctionnalites_retour_moteur::Trier_par_note"});}).end()
    .find("#preferrence").each(function(){$(this).data("trackingInfo", {type:"A", xtn2:27, label:"Fonctionnalites_retour_moteur::Afficher_commentaires_de_mon_agence"});});

  $("#rm .load").each(function(){$(this).data("trackingInfo", {callback: addSRTrackingInfo});});
}

function addFlashTrackingInfo() {
  $("#html_menu a[id^=lien]").each(function(){
    $(this).data("trackingInfo", {type:"C", xtn2:27, label:"Caroussel_flash::" + $.removeInvalidUrlChars($(this).attr("title")).replace(/[^\w]/g, "_")});
  });
}

function addSETrackingInfo() {
  $("#kwSearch").each(function(){
    $(this).data("trackingInfo", {xtconf:"rm-keyword"});
  });
  $("#rm #engineSearch").each(function(){
    $(this).data("trackingInfo", {xtconf:"rm-refine"});
  });
  $("#search #engineSearch").each(function(){
    $(this).data("trackingInfo", {xtconf:"rm"});
  });
  $("#searchEngine").each(function(){$(this).data("trackingInfo", {callback: addSETrackingInfo});});
}

function addASTrackingInfo() {
  $("div.agence .ok, div.bloc-agency .ok").each(function(){
    $(this).data("trackingInfo", {type:"F", xtn2:19, label:"Changer_d'agence"});
  });
}

function linksTracking(xtn2, xtpage) {

  if (xtn2) {
    if ($.cookies && $.cookies.get("agency") != null) {
      var agence = $.map($.cookies.get("agency").split("&&&"), function(val) { return val.replace(/\+/g, " ").replace("null", ""); });
      $("div.chosen").find("li.mail a").data("trackingInfo", {type:"A", xtn2: xtn2, label:"Envoi_email_" + agence[5].replace(/[^\w]/g, "_")});
    }

    $("#gmap").one("click", function() {
      xt_click(this, "C", xtn2, "Comment_s_y_rendre_agence_" + $("#agc").find("h1 span").text().replace(/[^\w]/g, "_"), "N");
      return false;
    });

    $("#sa").find("ul.results li").each(function(i) {
      $(this).find("button").click(function() {
        xt_click(this, "C", xtn2, "Choisir_agence_" + $("#sa").find("ul.results li:eq(" + i + ") h3 a").text().replace(/[^\w]/g, "_"), "N");
        return false;
      });
    });

    if (xtpage) {
        $("#fc-tab")
          .find("a:eq(0)").one("click", function() {xt_med("F", xtn2, xtpage.replace(/[^:]+/, "Avis_des_experts")); return false;}).end()
          .find("a:eq(1)").one("click", function() {xt_med("F", xtn2, xtpage.replace(/[^:]+/, "Description_detaillee")); return false;}).end()
          .find("a:eq(2)").one("click", function() {xt_med("F", xtn2, xtpage.replace(/[^:]+/, "Info_destination")); return false;}).end()
          .find("a:eq(3)").one("click", function() {xt_med("F", xtn2, xtpage.replace(/[^:]+/, "Devis_et_reservation")); return false;});
    }
  }

  $("#lien7").click(function() {xt_med("F", "9", "Accueil_Vol");});
  $("#lien8").click(function() {xt_med("F", "9", "Accueil_Train");});

  <!-- Click serment -->
  $(".serment a").each(function(){
    $(this).data("trackingInfo", {type:"C", xtn2:27, label:"Serment_d_hyppocampe::" + $.removeInvalidUrlChars($(this).html()).replace(/[^\w]/g, "_")});
  });
}

