$(function() {
	if (document.all&&document.getElementById) {
		// this is needed for the IE 6 pseudo hover class bug
		$(".topNav > li").mouseover(function () {
			$(this).addClass("hover");
		});
		$(".topNav > li").mouseout(function () {
			$(this).removeClass("hover");
		});
	} else {
		// this is needed for safari when nav covers flash
		$(".topNav li ul").mouseover(function () {
			$(this).addClass("redraw");
		});
		$(".topNav li ul").mouseout(function () {
			$(this).removeClass("redraw");
		});
	}
});

$(function() {
	// set subnav invisible only if js is disabled
	$("ol").css({display: "none"});

	// display subnav if on a subnav page
	$(".mainNav li li a").each(function() {
		var anchor = [];
		anchor = $(this).attr("href").split(/\//);
		var path = [];
		path = location.pathname.split(/\//);
		if (anchor[anchor.length - 1] == path[path.length - 1]) {
			$(this).parents("ol").css({display: "block"});
		}
	});

	// slider for subnav
	$(".mainNav > li").each(function() {
	  $(this).click(function() {
	    $(this).toggleClass("slider");
	    $("ol", this).slideToggle().addClass("slideDown");
	  });
	});
	$(".mainNav li li").each(function() {
		$(this).click(function(event) {
			event.stopPropagation();
		})
	})
});

// display "click here" link for accessories slider if js enabled and
// make the accessories boxes invisible if js is enabled
$(function() {
	$(".acc_container").css({display: "none"});
	$(".clicker").css({display: "inline"});
});

// accessories slider
function slide(slider, slided)
{
	if ($(slider).text() == 'Hide Available Accessories')
	{
		$(slider).text("View Available Accessories");
	}
	else
	{
		$(slider).text("Hide Available Accessories");
	}
	$("."+slided).slideToggle("fast").addClass("slideDown");
	$("."+slided).addClass("ie6Fix"); // fix margin-top for ie6
}
