$(document).ready(function(){

	$("input:text.check").blur(function () {
		 if($.trim($(this).val()) == ""){
			$(this).css({ border: "1px solid red"});
			erro = true;
		} else {
			$(this).css({ border: "1px solid #0f0"});        	        	
		}
	});
	
	$("input:text").focus(function () {
		 $(this).addClass("typeform");
	});
	$("input:text").blur(function () {
		if($.trim($(this).val()) == ""){
			$(this).removeClass("typeform");
		} else {
			$(this).addClass("typeform");			
		}
	});

});

function validaform(){    
    var erro = false;
    
	$(":text.check").each(function() {
		if($.trim($(this).val()) == ""){
			$(this).css({ border: "1px solid red"});
			$("this").focus();
			erro = true;
		} else {
			$(this).css({ border: "1px solid green"});        	        	
		}
	});
	
	
	$(":checkbox.check").each(function() {
		var declaro = $("input:checked.check").val();
		if(declaro == "sim"){
			$(".envolve").css({ border: "1px solid green"});
		} else {
			$(".envolve").css({ border: "1px solid red"});        	        	
			erro = true;
		}
	});	
   

	if (erro == true){
        alert ("Ops... verefique os campos marcados em vermelho.");
        return false;
    }
    
    return true;
};