/* ------------------------------------------------------------
 * PROJECT        : 
 * FILENAME       : jq.toggleActive.js
 * ------------------------------------------------------------
 * LAST UPDATED   : 21 Mar 2010
 * ------------------------------------------------------------
 * AUTHOR(S)      : Kevin Scholl (http://www.ksscholl.com/)
 * ------------------------------------------------------------ */

jQuery.fn.toggleActive = function(settings) {
	settings = jQuery.extend({
		focusBG   : "#F5F5F5",
		focusFG   : "#000",
		blurBG    : "#FFF",
		blurFG    : "#999",
		toggleVal :  false
		}, settings);
	this.each(function() {
		$(this)
			// define border color
		  .css("border","1px solid #5A8787")
			.focus(function() {
				$(this).css({ backgroundColor: settings.focusBG, color: settings.focusFG });
				if (settings.toggleVal == true && this.value == this.defaultValue && this.value != "http://") {
					this.value = "";
					}
				})
			.blur(function() {
				$(this).css({ backgroundColor: settings.blurBG, color: settings.blurFG });
				if (settings.toggleVal == true && this.value == "") {
					this.value = this.defaultValue;
					}
				});
			// provide a little padding to select elements
      if ($(this).is("select"))
			$(this).css("padding","1px 1px 1px 0")
		});
	};
