$.fn.defaultValue = function(text, options){
	var defaults = {
		emptyClass: null
	};

	// Extend our default options with those provided.
	var opts = $.extend(defaults, options);

	return this.each(function(){
		if (this.type != 'text' && this.type != 'password' && this.type != 'textarea') return;

		var field = this;
		var $this = $(this);

		if (this.value == '') {
			this.value = text;
			if (opts.emptyClass !== null) $this.addClass(opts.emptyClass);
		} else {
			if (opts.emptyClass !== null) $this.removeClass(opts.emptyClass);
			return;
		}

		$this.focus(function() {
			if (this.value == text || this.value == '') {
				this.value = '';
				if (opts.emptyClass !== null) $this.removeClass(opts.emptyClass);
			}
		});

		$this.blur(function() {
			if (this.value == text || this.value == '') {
				this.value = text;
				if (opts.emptyClass !== null) $this.addClass(opts.emptyClass);
			} else {
				if (opts.emptyClass !== null) $this.removeClass(opts.emptyClass);
			}
		});

		$this.parents("form:eq(0)").submit(function() {
			if (field.value == text) field.value = '';
		});
	});
};

jQuery.preloadImages = function(){
	for(var i = 0; i<arguments.length; i++) {
		jQuery("<img>").attr("src", arguments[i]);
	}
}