function axah(url, dom, loading, animation) {

        loading = typeof(loading) != 'undefined' ? loading : false;
        animation = typeof(animation) != 'undefined' ? animation : 0;

        if( animation == 1 ) {
                dom.animate({ opacity: 0.0, fontSize: "0px", height: "0%"});
        }
	else if( animation == 2 ) {
                dom.animate({ opacity: 0.0 }, 100);
        }

        if( loading ) {

                if( $("#AxahLoading").exists() ) {
                        $("#AxahLoading").html('<center><img src="http://www.kaearien.com/v2/images/ajax-loader.gif"></center>');
                }
                else if( $("#AxahLoadingFAT").exists() ) {
                        $("#AxahLoadingFAT").html('<center><img src="http://www.kaearien.com/v2/images/ajax_indicator.gif"></center>');
                }
                else {
                        var tmp = dom.html();
                        dom.html('<center><img src="http://www.kaearien.com/v2/images/ajax-loader.gif"></center>' + tmp + '');
                }
        }

        $.ajax({
                type: "GET",
                url: url,
                cache: false,
                success: function(result) {
                        dom.html(result);
                        if( loading ) {
                                if( $("#AxahLoading").exists() ) {
                                        $("#AxahLoading").html('');
                                }
                                else if( $("#AxahLoadingFAT").exists() ) {
                                        $("#AxahLoadingFAT").html('');
                                }
                        }
                        if( animation == 1 ) {
                                dom.animate({ opacity: 1.0, fontSize: "12px", height: "100%"});
                        }
			else if( animation == 2 ) {
                                dom.animate({ opacity: 1.0 });
                        }
                }
        });
}
function ReadEmail( nickname, MessageID, to_delete) {
	to_delete = typeof(to_delete) != 'undefined' ? to_delete : false;

	var url = "admin.php?page=email&email="+getUrlParameter('email')+"&messageid="+MessageID+"&ajax=1";
	if( to_delete ) {
		url = url+"&action=delete";
		axah(url, $("#eMailAjax"), false, 2);
		MakingAlert("Supprim&eacute;", "Le message a &eacute;t&eacute; supprim&eacute; avec succ&egrave;s.");
	}
	else {
		axah(url, $("#eMailAjax"), false, 2);
	}
}
function getUrlParameter(name) {

    var searchString = location.search.substring(1).split('&');

    for (var i = 0; i < searchString.length; i++) {

        var parameter = searchString[i].split('=');
        if(name == parameter[0])    return parameter[1];

    }

    return false;
}

