
function sfShow(t) {	
	$(t).find(" > ul").css("left","-1px");
	$(t).addClass("sfhover");
	}

function sfHide(t) {
  $(t).find(" > ul").css("left","-5000px");
	$(t).removeClass("sfhover");
	}

function init() {
	$("#nav li").hover(	
		function(){
			sfShow(this);
			},
		function(){
		  sfHide(this);
			}
		)
	};

/* ------------------------------------------------------------
 * INITIALIZATION
 * ------------------------------------------------------------ */

$(document).ready(init);

$(document).ready(function(){

	// set form field actions
	$("").toggleActive();

	// set bottom border on last sub navigation item
  $("#nav li ul").find("li:last").css("border-bottom","1px solid #CCD9E5");
	
	// specs listing
	$("ol.twoColumn li:nth-child(odd)").css("background","#F5F7FA");

	// setup galleries
  $("div.gallery").each(function(){
		$(this).find("img:not(:first)").css("display","none")
	  });
	
	// remove right margin from last store item in row
	// $("div.storeItem:nth-child(5n)").css("marginRight","0");
	$("div.storeItem:nth-child(3n)").css("marginRight","0");

	});

/* ------------------------------------------------------------
 * 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: "#000",
		blurBG:  "#FFF",
		blurFG:  "#666"
		}, settings);
	this.each(function() {
		$(this)
			.focus(function() {
				$(this).css({ backgroundColor: settings.focusBG, color: settings.focusFG });
				if (this.value == this.defaultValue && this.value != "http://") {
					this.value = "";
					}
				})
			.blur(function() {
				$(this).css({ backgroundColor: settings.blurBG, color: settings.blurFG });
				if (this.value == "") {
					this.value = this.defaultValue;
					}
				});
		});
	};

/* ------------------------------------------------------------
 * TABLES
 * ------------------------------------------------------------ */

$(document).ready(function(){
													 
	// datatable
	$("table.dataTable tbody").each(function(){
		$("tr:nth-child(even)").addClass("alt");
		$("tr:last-child").addClass("lastRow");
		$("tr").hover(
		  function() {$(this).addClass("over"); },
			function() {$(this).removeClass("over"); }
			);
		});
	
	}); // end ready function
