function generateProfilWithGeoLoc(imgsName,sexe,age_min,age_max) {
        if( sexe == 0 ) sexe = 1;
        else if( sexe == 1 ) sexe = 0;
        if( ct == 2 ) sexe = 1;

		//Personnalisation des flux via l'age
		//Possible à l'appel de la fonction
		if (age_min == undefined || age_min < 18)	age_min = 18;
		if (age_max == undefined || age_max > 99)	age_max = 99;
		//Ou définition de variable dans le header/footer personnalisé
		if (typeof carousel_option_age_min != 'undefined')
		{
			age_min = parseInt(carousel_option_age_min);
			if (age_min < 18)	age_min = 18;
		}
		if (typeof carousel_option_age_max != 'undefined')
		{
			age_max = parseInt(carousel_option_age_max);
			if (age_max > 99)	age_max = 99;
		}


    // creer le tableau aleatoire
    var temp = new Array();

    if( sexe == 2 ) {
        $.ajax({
            url : 'webservices/getGeoLocProfiles.php',
            type: 'GET',
            async : true,
            data: 'gender=1&channel_id='+(ct+1)+'&age_min=' + age_min + '&age_max=' + age_max,
            success : function(data) {
                dataAjax1 = $.parseJSON(data);
                $.ajax({
                    url : 'webservices/getGeoLocProfiles.php',
                    type: 'GET',
                    async : true,
                    data: 'gender=2&channel_id='+(ct+1)+'&age_min=' + age_min + '&age_max=' + age_max ,
                        success : function(data) {
                        dataAjax2 = $.parseJSON(data);
                       // Si une des deux requètes n'as pas aboutit ca ne sert a rien de continuer
                            if(dataAjax1 == null || dataAjax2 == null)
                                return 0;
                        dataAjax1.sort(shuffle);
                        dataAjax2.sort(shuffle);
                        var tab0 = dataAjax1.slice( 0 , dataAjax1.length*60/100 );
                        var tab1 = dataAjax2.slice( 0 , dataAjax2.length*40/100 );
                        temp = tab0.concat( tab1 );
                        renewImgSetWithGeoLoc(imgsName,temp);
                        }
                    });
                }
            }); 
    }
    else{
        $.ajax(
            {
            url : 'webservices/getGeoLocProfiles.php',
            type: 'GET',
            async : true,
            data: 'gender='+ (sexe+1) +'&channel_id='+ (ct+1),
            success : function(data) {
                dataAjax = $.parseJSON(data);
                    if(dataAjax == null)
                        return 0;
                renewImgSetWithGeoLoc(imgsName,dataAjax);
                }
            });
    }
}

function renewImgSetWithGeoLoc(imgsName,temp){
    // On mellange le tableau pour afficher des profils aléatoirement
    temp.sort(shuffle);

    // Si on utilise un carousel, on le clean avant d'afficher les nouveaux profils
        if(typeof( window['withCarousel'] ) != "undefined" && withCarousel == 1)
            $().jCarouselLite.clean();

    $("[name=" + imgsName +"]").each (function (i){
        var $this = $(this);
        if(typeof temp[i] != 'object') return;
        info = temp[i];
        $this.attr( {href: '#' + info['id']} );
        $this.css("background-image", 'url(http://www.ezstatic.com' + info['photo'].replace( /thumb\/[0-9]+/, "thumb/100" ) + ')' );
        $this.children(".title-hover").html(info['login']);

        //Si le nom de la ville est trop grand on le tronque
            if(info.loc && info['loc'].length < 15)
                $this.children(".city-hover").html(info['loc']);
            else if(info.loc)
                $this.children(".city-hover").html(info['loc'].slice(0,16) + '...');

        //On enlève toutes les actions précedemment lier au profils avant d'en réaffecter des nouvelles
        $this.unbind();
        
        $this.bind('click',function(){
            $.ajax({
                async: true,
                type: "POST",
                url: "/home/ajx.php",
                data: 'id=' + $this.attr('href').replace(/#/i, "") + '&ct=' + ct,
                success: function(msg) {
                    if(typeof( window['hideWhenFollowProfil'] ) != "undefined" && hideWhenFollowProfil == 1)
                        $("#features").hide();
                    $("#frm_login [name=wanthim]").val($this.attr('href').replace(/#/i, ""));
                    $("#register-form [name=wanthim]").val($this.attr('href').replace(/#/i, ""));
                    $("#follow-profil").removeAttr("style");
                    $("#follow-profil").html("");
                    $("#follow-profil").html(msg);
                }
            });
            return false;
        }
        );
    });
    // Si on utilise un carousel, on le regénère avec les nouveaux profils
    if(typeof( window['withCarousel'] ) != "undefined" && withCarousel == 1)
        $().jCarouselLite.renew();
}

