/*
 * InputLabel
 * Copyright 2010 Martino Flynn
 * Author Mike Ruschak
 *
 * Version 1.0
 *
 * This plugin will allow for labels in input fields.  Will handle the blur
 * and focus events.
 */

(function($) {
	$.fn.inputLabel = function(options) {
		var defaults = {
			value: ""
		};

		var options = $.extend(defaults, options);
		
		$(this).val(options.value);
		
		$(this).focus(function() {
			var field_value = $(this).val();
		
			if (field_value == options.value) {
				$(this).val('');
			}
		});
	
		$(this).blur(function() {
			var field_value = $(this).val();
		
			if (field_value == '' || field_value == options.value) {
				$(this).val(options.value);
			}
		});
	};
})(jQuery);

$(function () {
	$('#inpt_search').inputLabel({value: 'Search'});
});
