$(document).ready(function(){
  $("#concoursTabs").tabs();

  var url =window.location.href;
  if (url.indexOf("fiche-concours") > 0)
  {
    var ref = document.referrer;
    if (ref.indexOf("/concours") > 0)
    {
      $("#navig_recherche_top").prepend('<a id="link_back_top" href="/fonction-publique.html">< Retour sélection</a>');
      $("#navig_recherche_bottom").prepend('<a id="link_back_bottom" href="/fonction-publique.html">< Retour sélection</a>');
    }
  }

  $("#link_back_top, #link_back_bottom").click(function(){
    if (!document.referrer) return true;
    var ref = document.referrer;
    var rgx = new RegExp("[fonction-publique]", "g");
    var nbm = ref.match(rgx); if (!nbm) return true;

    window.history.back();

    return false;
  });

  //$("a[title=Portrait]").tooltip({
  //  bodyHandler: function() {
  //    return $($(this).attr("resume")).html();
  //  },
  //  showURL: false,
  //  extraClass: 'leftcontent'
  //});

  $(".quicksearch #concours").change(function() {
    $(this).parents("form").submit();
  });
});


