$('document').ready(function(){

    $("#share_openpitu a img").animate({opacity: 0.6});
    $( "#share_openpitu a img" ).hover(
        function(){
            jQuery(this).animate({opacity: 1});
        },
        function(){
            jQuery(this).animate({opacity: 0.6});
        }
    );

    $(".small_post").animate({opacity: 0.8});
    $( ".small_post" ).hover(
        function(){
            //$(this).css('background', '#BBB');
            //$(this).css('color', '#444');
            $(this).animate({opacity: 1}, 'fast');

        },
        function(){
            //$(this).css('background', 'url(\'http://openpitu.com/wp-content/themes/starkers-html5/style/images/small_post.png\')');
            //$(this).css('color', '#DDD');
            $(this).animate({opacity: 0.8});
        }
    );

    $('#enviar').hover(function(){ $(this).css('background', '#444'); }, function(){ $(this).css('background', '#666'); });

    $('#enviar').click(function(){
        var nom = $('#nom').html();
        var correu = $('#correu').html();
        var msg = $('#msg').html();
        //alert(nom+" -- "+correu+" -- "+msg);
        $.ajax({
            type: "GET",
            url: 'wp-content/themes/starkers_html5/php_includes/mail.php',
            data: "nom="+nom+"&correu="+correu+"&msg="+msg,
            success: function( mail ){
                if( mail == '' ){
                    $('#enviar').html('El teu missatge s\'ha enviat correctament');
                    $('#enviar').unbind('click');
                    $('#correu_label').html('Correu:');
                }
                else if( mail == '-1' ){
                    $('#correu_label').html('Correu <span style="color: red;">incorrecte: </span>');
                }
            },
            error: function(){
                alert('El teu missatge no s\'ha pogut enviar');
            }

        });
    });

});
