//gestion du formulaire de recherche en ajax, avec autocompletion  
$(function() {
		function log( message ) {
			$( "<div/>" ).html( message ).prependTo( "#log" );
			$( "#log" ).scrollTop( 0 );
		}

		$.ajax({
			url: "DataFilms.xml",
			dataType: "xml",
			success: function( xmlResponse ) {
				var data = $( "film", xmlResponse ).map(function() {
					return {
						value: $( "titre", this ).text() + ", " +
							( $.trim( $( "annee", this ).text() ) || "(n/a)" ) + " ("+ $( "etoile", this ).text() + "/10)" ,
						id: $( "url_allocine", this ).text(),
						id2: $( "url_imdb", this ).text()
					};
				}).get();
				$( "#birds" ).autocomplete({
					source: data,
					minLength: 0,
					select: function( event, ui ) {
						log( ui.item ?
						//	"Selected: " + ui.item.value + ", url allocine: " + ui.item.id : "Nothing selected, input was " + this.value );
						//"<a href='http://www.allocine.fr/film/fichefilm_gen_cfilm=146622.html'>" + ui.item.value + "  "+ ui.item.id  + this.value);
						"<a href='http://www.allocine.fr/film/fichefilm_gen_cfilm=" + ui.item.id + ".html'>allocin&eacute;</a> - <a href='http://www.imdb.com/title/tt" + ui.item.id2 + "/'>imdb</a>":"" + this.value );
					}
				});
			}
		});
	});

	

<!--
function donner_focus(chp)
{
document.getElementById(chp).focus();
}
// -->

