/*!
 * jquery.labelinside.js 
 */

// Label inside allows the placement of a label inside of a control which disappears when the control gains focus, and reappears when it

$.fn.labelInside = function(label, labelledClass) {


	var cssClass = labelledClass || "";

	$(this).each(function(){
		var target = $(this);

		// Setup the input with the right classes
		if(target.val()=="") {
			target.addClass(cssClass).val(label);
		} else {
			target.removeClass(cssClass);
		}

		target.focus(function() {
			if($(this).val()==label) {
				$(this).val("").removeClass(cssClass);
			}
		}).blur(function() {
			if($(this).val()=="") {
				$(this).val(label).addClass(cssClass);
			}
		});
	});
};
