/* ------------------------------------------------------------
 * PROJECT        : 
 * FILENAME       : jqload.js
 * ------------------------------------------------------------
 * LAST UPDATED   : 07 May 2009
 * ------------------------------------------------------------
 * AUTHOR(S)      : Kevin Scholl (kevin@ksscholl.com)
 * ------------------------------------------------------------
 * NOTE(S)        : 
 * ------------------------------------------------------------ */
 
$(document).ready(function(){
													 
	// remove bottom margin on last child element(s)
  $(""
		+ "div:last-child,"
		+ "fieldset:last-child,"
		+ "form:last-child,"
		+ "img:last-child,"
		+ "li:last-child,"
		+ "ol:last-child,"
		+ "p:last-child,"
		+ "table:last-child,"
		+ "ul:last-child,"
		+ "").css("margin-bottom","0");

	$(".subnav").hide();

	$("ul.nav li a").click(function () {
		var sn = $(this).attr("rel");
		if ($("#" + sn).is(":visible"))
  		$("#" + sn).hide();			
		else {
  		$(".subnav").hide();			
		  $("#" + sn).fadeIn("slow");
			}
		return false;
		});

	});


/* ------------------------------------------------------------
 * JQUERY PLUGINS
 * ------------------------------------------------------------ */

// toggle default value and coloring on form field focus/blur
// usage: $("#elementID").toggleActive(settings);
jQuery.fn.toggleActive = function(settings) {
	settings = jQuery.extend({
		focusBG   : "#F5F5F5",
		focusFG   : "#333",
		blurBG    : "#FFF",
		blurFG    : "#666",
		toggleVal :  true
		}, settings);
	this.each(function() {
		$(this)
		  .css("border","1px solid #7F9DB9")
			.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;
					}
				});
		if ($(this).is("select"))
		  $(this).css("padding","1px")
		});
	};
