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

    $('#id_nome').focus(function() {
        if($(this).attr('value').replace(/\s/g, '') == 'Seunome') {
            $(this).attr('value', '');
        };
    });

    $('#id_nome').blur(function() {
        if($(this).attr('value') == '') {
            $(this).attr('value', 'Seu nome');
        };
    });

    $('#id_email').focus(function() {
        if($(this).attr('value').replace(/\s/g, '') == 'Seue-mail') {
            $(this).attr('value', '');
        };
    });

    $('#id_email').blur(function() {
        if($(this).attr('value').replace(/\s/g, '') == '') {
            $(this).attr('value', 'Seu e-mail');
        };
    });

    $('#contato').submit(function() {
        if ($('#id_nome').attr('value').replace(/\s/g, '') == '' ||
            $('#id_nome').attr('value').replace(/\s/g, '') == 'Seunome') {
            erro('Nome obrigatório.');
            return false;
        }

        if (!$('#id_email').attr('value').match(
            /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)) {
            erro('E-mail inválido.')
            return false;
        }

        if ($('#id_comentario').attr('value').replace(/\s/g, '') == '') {
            erro('Comentário obrigatório.');
            return false;
        }

        return true;
    });
});

