// inserts labels into associated text elements// replaces all labelsfunction labelize(form){	var l = $('.labels label');	l.each(function(i){		var label = this;		$(this).css('display', 'none');		inpt = $('.labels input#' + this.htmlFor);		inpt.set('value', this.innerHTML);						// toggle the values		inpt.focus(function(){			if ($(this).val() == $('.labels label[@for='+this.id+']').html())				$(this).set('value', '') ;		});		inpt.blur(function(){			if ($(this).val() == '')				$(this).set('value', $('.labels label[@for='+this.id+']').html());		});	});			$('form.labels').submit(function(e) {		var err = []; 		// catch errors		$('.labels input').each(function(){			var v = $('.labels label[@for='+this.id+']').html()			if((this.value == v) || this.value == '' && typeof v == 'string')										err.push(v);		});		//make pretty and stop the submit		if(err.length > 0){			err = 'Error:\n' + err.join('\n');			alert(err);			e.preventDefault();		}	});}$(document).ready(labelize);
