/* jQuery plugin: putLabelInside */

(function($) {
	$.fn.putLabelInside = function() {
		return this.each(function(){
			$this = $(this);
			
			labelText = $($this.prev("label")).text();
			
			// Grab the text from the label and put it in the text field
			if ($(this).val() == "") {
				$this.val(labelText);
			}
			
			$this.bind("focus", {labelText:labelText}, removeLabel);
			$this.bind("blur", {labelText:labelText}, addLabel);
		});
	};
	
	function removeLabel(e) {
		if ($(this).val() == e.data.labelText) {
			$(this).val("")
		}
	};
	
	function addLabel(e) {
		if ($(this).val() == "") {
			$(this).val(e.data.labelText);
		}
	};
})(jQuery);