if(typeof('isAdmin') == 'undefined')
	var isAdmin = false;
	
var prePath = isAdmin ? '../' : '';

var images = new Array();

images[0] = prePath + "images/gear-on.gif";
images[1] = prePath + "images/clothing-on.gif";
images[2] = prePath + "images/boots-shoes-on.gif";
images[3] = prePath + "images/shop-by-brand-on.gif";
images[4] = prePath + "images/shop-by-activity-on.gif";

for (i = 0; i < images.length; i++) {
	image = new Image();
	image.src = images[i];
}

var subNavConfig = {
	sensitivity: 10,		// number = sensitivity threshold (must be 1 or higher)
	interval: 50,			// number = milliseconds for onMouseOver polling interval
	over: FadeInSubNav,		// function = onMouseOver callback (REQUIRED)
	timeout: 50,			// number = milliseconds delay before onMouseOut
	out: FadeOutSubNav		// function = onMouseOut callback (REQUIRED)
};

var subListConfig = {
	sensitivity: 10,		// number = sensitivity threshold (must be 1 or higher)
	interval: 50,			// number = milliseconds for onMouseOver polling interval
	over: FadeInSubList,	// function = onMouseOver callback (REQUIRED)
	timeout: 50,			// number = milliseconds delay before onMouseOut
	out: FadeOutSubList		// function = onMouseOut callback (REQUIRED)
};

$(document).ready(function() {
	$("#gear").hoverIntent(subNavConfig);
	$("#clothing").hoverIntent(subNavConfig);
	$("#boots-shoes").hoverIntent(subNavConfig);
	$("#shop-by-brand").hoverIntent(subNavConfig);
	$("#shop-by-activity").hoverIntent(subNavConfig);
	$("#mens").hoverIntent(subListConfig);
	$("#womens").hoverIntent(subListConfig);
	$("#juniors").hoverIntent(subListConfig);
	$("#kids").hoverIntent(subListConfig);
});

function CheckSearch(id) {
	var searchText = "Search by name or style...";
	if (document.getElementById(id).value == searchText) {
		document.getElementById(id).value = "";
	} else if (document.getElementById(id).value == "") {
		document.getElementById(id).value = searchText
	}
}

function FadeInSubNav() {
	$("#" + this.id + "-sub-nav").fadeIn("fast");
	document.getElementById(this.id + "-img").src = prePath + "images/" + this.id + "-on.gif";
}

function FadeOutSubNav() {
	$("#" + this.id + "-sub-nav").fadeOut("fast");
	document.getElementById(this.id + "-img").src = prePath + "images/" + this.id + "-off.gif";
}

function FadeInSubList() {
	$("#" + this.id + "-sub-list").fadeIn("fast");
}

function FadeOutSubList() {
	$("#" + this.id + "-sub-list").fadeOut("fast");
}

function ValidateNumber(val) {
	var i = parseInt(val);
	if (!isNaN(i)) {
		if (i > 0) {
			return i;
		} else {
			return 0;
		}
	} else {
		return 0;
	}
}