(function($) {
	
	$.fn.defaultvalue = function() {
		
		// Scope
		var elements = this;
		var args = arguments;
		var c = 0;
		
		return(
			elements.each(function() {				
				
				// Default values within scope
				var el = $(this);
				var def = args[c++];

				el.val(def).focus(function() {
					if(el.val() == def) {
						el.val("");
					}
					el.blur(function() {
						if(el.val() == "") {
							el.val(def);
						}
					});
				});
				
			})
		);
	}
	
	$.fn.searchvalue = function() {
		
		// Scope
		var elements = this;
		var args = arguments;
		var c = 0;
		
		return(
			elements.each(function() {				
				
				// Default values within scope
				var el = $(this);
				var def = args[c++];

				el.val(def).focus(function() {
					if(el.val() == def) {
						el.val("");
					}
					
					el.keypress(function(){
						if( (el.val() != def) && (el.val() != "") )
						{
							el.after("<div style='opacity:0' class='search-clear'></div>");
							el.parent().find(".search-clear").animate({opacity:"1"});
							el.parent().find(".search-clear").click(function(){
								el.val("");
								el.blur();
								closeSearch();
							});
						}
					});
					
					el.blur(function() {
						if(el.val() == "") {
							el.val(def);
							el.parent().find(".search-clear").animate({opacity:"0"}, function(){$(this).remove()});
						}
					});
				});
				
			})
		);
	}
	
})(jQuery)
