 /* ------------------------------------------------------------
 * PROJECT        : Virginia Saints
 * FILENAME       : jqload.js
 * ------------------------------------------------------------
 * LAST UPDATED   : 15 Apr 2009
 * ------------------------------------------------------------
 * AUTHOR(S)      : Kevin Scholl (http://www.ksscholl.com/)
 * ------------------------------------------------------------
 * NOTE(S)        : 
 * ------------------------------------------------------------ */

$(document).ready(function(){
													 
	// close open popups on window unload
  $(window).unload(function(){
		closePopWin(POPWIN);
		});
	
	// remove bottom margin on last child element(s)
  $(""
		+ "div:last-child,"
		+ "fieldset:last-child,"
		+ "form:last-child,"
		+ "h2:last-child,"
		+ "img:last-child,"
		+ "li:last-child,"
		+ "ol:last-child,"
		+ "p:last-child,"
		+ "table:last-child,"
		+ "ul:last-child,"
		+ "").css("margin-bottom","0");

	// adjust form types
	$("input:radio").addClass("radioBtn");
	$("input:checkbox").addClass("checkBox");
	$("input:file, input:password, input:text").css("padding","1px 3px");
	$("input#q").css("padding","2px 3px");

	// hide search block, if it exists
	$("div#srchBlock").css("display","none");
	
	});

/* ------------------------------------------------------------
 * 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   : "#F6F6F6",
		focusFG   : "#333",
		blurBG    : "#FFF",
		blurFG    : "#999",
		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")
		});
	};
