/*
----------------------------------------------
 Sense2Love / Custom JS
 Developed by Ollie Bettany / Artist Haus
 Created: 09/12/09
----------------------------------------------
*/

/* ------------------------------ */
/* Form overlabels					*/
/* ------------------------------ */
jQuery.fn.overlabel = function() {
	this.each(function(index) {
		var label = $(this); var field;
		var id = this.htmlFor || label.attr('for');
		
		if (id && (field = document.getElementById(id))) {
			var control = $(field);
			label.addClass("overlabel-apply");
			
			if (field.value !== '') {
				label.fadeOut(100);
			}
			control.focus(function () {label.fadeOut(100);}).blur(function () {
			
			if (this.value === '') {
				label.fadeIn(100);
			}
		});
			
		label.click(function() {
			var label = $(this); var field;
			var id = this.htmlFor || label.attr('for');
			
			if (id && (field = document.getElementById(id))) {
				field.focus();
			}
		});
		}
	});
};

/* ------------------------------ */
/* END Form overlabels				*/
/* ------------------------------ */


