$(document).ready(function() {
  
  //autocomplete ingredient
  $('#inputNomIngredient').focus().autocomplete(tabIng, {
    matchContains:true,
    max: 0,
		formatItem: function(row) {
			id = getId(tabIng,row.nom); 
		  return '<span onclick="window.location=\'' + url_base_cocktail + 'ingredient/' + id + '-' + formatUrl(row.nom) + '/\';">'+row.nom+'</span>';
		},
		formatResult: function(row) {
		  return row.nom;
		}
  });
  
  //autocomplete cocktail
  $('#inputNomCocktail').focus().autocomplete(tabCocktail, {
    matchContains:true,
    max: 0,
		formatItem: function(row) {
		  id = getId(tabCocktail,row.nom); 
		  return '<span onclick="window.location=\'' + url_base_cocktail + 'alcool-cocktail-recette/' + id + '-' + formatUrl(row.nom) + '/\';">'+row.nom+'</span>';
		},
		formatResult: function(row) {
			return row.nom;
		}
  });
  
  //affichage de la liste des ingredients
  $('#affichageListeIngredient').click(function () {
    $('#listeLiensIngredients').toggle();
  });
  
});
