function AC_searchGlf(inputString, inputValue)
{
  if(inputValue.length < 3) {
    // Hide the suggestion box.
    $('#suggestions').hide();
  } else {
    
    $.post("stats_terrain_cps_filter.php", {type: 'getglf', str: ""+inputValue+"" }, function(data){
      if(data.length >0) {
        var obj = document.getElementById(inputString);
        posX = getobj_left(obj);
        posY = getobj_top(obj)+obj.offsetHeight+10;
        
        document.getElementById('suggestions').style.top = posY+"px";
        document.getElementById('suggestions').style.left = posX+"px";
        $('#suggestions').show();
        $('#autoSuggestionsList').html(data);
      }
    });
  }
} // lookup

function AC_selGlf(thisCod, thisValue)
{
  if (thisCod && thisValue) {
    $('#glf_lib').val(thisValue);
    $('#glf_cod').val(thisCod);
    
    $('#suggestions').hide();
  }
  recup_terrains(thisCod);
  $('#stats').fadeOut('fast',function() {
    $('#stats').html('<img src="images/green-elka.jpg" />');
    $('#stats').fadeIn('slow');
  });
  $('#ter_cod').val('');
}

function recup_terrains(cod)
{
  $.ajax({
    type: "POST",
    url:  "stats_terrain_cps_filter.php",
    data: {type: 'getter', cod: cod },
    success: function (rep) {
      if ($('#menufiche2'))
        $('#menufiche2').remove();
      $('#bandeauTitre').append('<div id="menufiche2">'+rep+'</div>');
    }
  });
}
var ternumSel = '';
function change_ter(ternum)
{
  if (ternumSel != '')
    $('#ter'+ternumSel).removeClass('selItem1').addClass('detailcliquable');
  $('#ter'+ternum).removeClass('detailcliquable').addClass('selItem1');
  $('#ter_cod').val(ternum);
  ternumSel = ternum;
}
