$(document).ready(function() {
	///<summary>
	///on nav load, append Sale link to each DDL as long as it is not the first or the last
	///</summary>
	$("#main-navigation").ready(function() {
		//get the length of the nav menu now, so we dont get it each time through the loop
		var len = $("#main-navigation").children().length;
		$("#main-navigation").children().each(function(idx) {
			//ignore the first and last elements in the nav
			if (idx === 0 || idx === (len-1)) {}
			else {
				//pull the href url from the top-level link of the li
				var loc = $("li." + $(this).attr("class")).find(".anchor-indent:first").attr("href");
				var clrLnk = "http://www.stbernardsports.com" + loc + "/clearance/yes";
				//append the clrLnk to the last dd-nav menu in the div
				
				if (loc != "/category.cfm/apparel/equipment" && loc != "/category.cfm/apparel/kids" && loc != "/category.cfm/apparel/footwear" && loc != "/category.cfm/apparel/snowboard" && loc != "/category.cfm/apparel/ski") {
				$("li." + $(this).attr("class") + " .dd-holder .dd-ul-holder .dd-nav:last").append(
					'<li> <a href="' + clrLnk + '" style="font-weight:bold; color:red;">On Sale!</a></li>'
				);
				}
			}
		});
	});
});

$(document).ready(function() {
	///<summary>
	///on nav load, append Sale link to each side nav UL in the left hand navigation
	///</summary>
	$(".side-nav").each(function(i) {
		var len = $(this).children().length;
		
		$(this).children().each(function(x) {
			if (x === (len-1)) {
				var loc = location.href;
				var clrLnk = loc + "/clearance/yes";
				if (loc != "http://www.stbernardsports.com/category.cfm/apparel/Sale") {
					$(this).append('<li> <a href="' + clrLnk + '" style="font-weight:bold; color:red;">On Sale!</a></li>');
				}
			}
		});
	});
});