
$(document).ready(function(){
	// when page loads, populate "TITLE" into each field if it is empty
	$('.clearOnEnter').each(function() {
		if ($(this).val() == '') $(this).val($(this).attr('title'));								 
	 });
	
	// when cursor enters a field, clear is out if it is set to the TITLE
	$('.clearOnEnter').focus(function(){
		if ($(this).val() == $(this).attr('title')) $(this).val('');
	});
	
	// when cursor leaves a field, set it back to TITLE if it is empty
	$('.clearOnEnter').blur(function() {
		if ($(this).val() == '') $(this).val($(this).attr('title'));								 
	});
	
	// when form submits, set field to empty if is is still set to the TITLE
	$("#theform").submit(function() {
		$(".clearOnEnter").each(function() {
			if ($(this).val() == $(this).attr('title')) $(this).val('');
		});
	});
});
