
function tweakForm(context) {
	$(document).ready(function() {

		$(':text', context).attr('title', function(){return this.value}).focus(function() {
			if(this.value == this.title) this.value = '';
		}).blur(function() {
			if(this.value == '') this.value = this.title;
		});

	});

	$("textarea[name='description']").keyup(function(e) {
		if(this.value.length > 256) this.value = this.value.substring(0,256);
	});
	
	context.submit(function() {
		var valid = true;
		$(":text, textarea").map(function() {
			if(r[this.name] && this.value == '' && valid) {
				alert("Você deixou um campo obrigatório em branco, por favor corrija.");
				this.focus();
				valid = false;
			}

			if(this.value == this.title) this.value = '';
		});

		return valid;
	});
}
