$(document).ready(function(){

    $('#comm').submit(function(){
    
        newsletter();
        
        return false;
    });
    
    
    $('#email').click(function(){
        $(this).val("");
    });
    
    function newsletter(){
        $('.result_nl').fadeIn("slow");
        $('.result_nl').ajaxSend(function(request, settings){
            $('#charge').show();
            $(this).html("in progress");
            $(this).css("padding", "2px");
            $(this).css("background", "#FFF957");
            $(this).css("display", "inline");
        });
        $.ajax({
            url: 'home/newsletter',
            type: 'POST',
            data: "email=" + $('#email').val()+ "&country=" + $('#country').val(),
            dataType: 'text',
            success: retourProfil,
            error: function(){
                alert('Erreur serveur');
            }
        });
        
    }
    
    function retourProfil(reponse){
        var nouveauResultat = reponse;
        //actualisation du r�sultat   
        $('.result_nl').html(nouveauResultat);
        $("#email").val("");
    }
});
