function ajaxListeForm(Url, listeCible, messageAttente)
{
	$('#' + listeCible + ' option').remove();
	$('#' + listeCible).append('<option value="">' + messageAttente + '</option>');


	$.ajax({
		type: "GET",
		url: Url,
		success: function(msg){
			// $('#imgAjax_' + listeCible).remove();
			chargerListe(listeCible, eval(msg));
		}
	});
}

function chargerListe(listeCible, optionsListe)
{
    $('#' + listeCible + ' option').remove();
    nbOptions 	= optionsListe.length;

    if (nbOptions > 0) {
        for ( i=0; i < nbOptions; i++ ) {
            $('#' + listeCible).append('<option value="' + optionsListe[i].valeur + '">' + optionsListe[i].intitule + '</option>');
        }
    } else {
        $('#' + listeCible).append('<option value="">Indifférent</option>');
    }
}

function str_replace(search, replace, subject) {
    var s = subject;
    var ra = r instanceof Array, sa = s instanceof Array;
    var f = [].concat(search);
    var r = [].concat(replace);
    var i = (s = [].concat(s)).length;
    var j = 0;

    while (j = 0, i--) {
        if (s[i]) {
            while (s[i] = (s[i]+'').split(f[j]).join(ra ? r[j] || "" : r[0]), ++j in f){};
        }
    }

    return sa ? s : s[0];
}

function prettyGalerie(listeBigs) {
    $.prettyPhoto.open(listeBigs);
}
