$(document).ready(function(){
    //Utilizar este apenas para a validação
    $('.form').submit(function(){
        $('.form > .obrigatorio').each(function(){
            if( $(this).val() == $(this).attr('title') ) {
                $(this).css('color', '#f70707');
                return false;
            }else{
                $(this).css('color', '#AAA');
                return true;
            }
        }); 
    });

    $("input[type=text], textarea").each(function(){
        if ( $(this).val() == '' )
            $(this).val($(this).attr('title'));
    });
    //Caso o campo tenha alguma informa limpa
    $("input[type=text], textarea").focusin(function(){
        if ( $(this).val() == $(this).attr('title') ) $(this).val('');
    }).focusout(function(){
        if ( $(this).val() == '' ) $(this).val($(this).attr('title'));
    });
    
    $("table tbody tr:odd > td.linha").css("background-color", "#EFF6E8");
//$("table tbody tr td:first-child, table tbody tr td:last-child").css("background", "#FFF");
});

function SubmitById(id){
    var retorno = true;
    $("#"+id+" input[type=text], #"+id+" textarea").each(function(){
        if ( $(this).val() == $(this).attr('title') ){
            retorno = retorno && false;
            if ( $(this).hasClass('obrigatorio') ) $(this).css('color', '#f70707');
            else $(this).css('color', '#AAA');
        }
    });
    if (retorno) $("#"+id).submit();
}
