function initOverLabels() {
	var labels, id, field;

	// Set focus and blur handlers to hide and show
	// labels with 'hint' class names.
	labels = document.getElementsByTagName('label');
	for ( var i = 0; i < labels.length; i++) {
		if (labels[i].className == 'hint') {
			// Skip labels that do not have a named association
			// with another field.
			id = labels[i].htmlFor || labels[i].getAttribute('for');
			if (!id || !(field = document.getElementById(id))) {
				continue;
			}

			// Hide any fields having an initial value.
			if (field.value != '' && field.value != '$$null$$') {
				hint(field.getAttribute('id'), true);
			}

			// Set handlers to show and hide labels.
			field.onfocus = function() {
				hint(this.getAttribute('id'), true);
			};
			field.onblur = function() {
				if (this.value == '' || this.value == '$$null$$') {
					hint(this.getAttribute('id'), false);
				}
			};
		}
	}
};

function hint(field_id, hide) {
	var field_for;
	var labels = document.getElementsByTagName('label');
	for ( var i = 0; i < labels.length; i++) {
		if (labels[i].className == 'hint') {
			field_for = labels[i].htmlFor || labels[i].getAttribute('for');
			if (field_for == field_id) {
				labels[i].style.textIndent = (hide) ? '-10000px' : '0px';
				return true;
			}
		}
	}
}

jQuery(document).ready(function() { 
	setTimeout(initOverLabels, 50);
}); 

