// Init - Tab Content
$(".tabcontent .content").each(function() {
	$(this).find(".topic").css("left",0);
	$(this).find(".topic").not(".isOn").hide();
	$(this).height($(this).find(".isOn").height());
});
$(".tabcontent .menu").each(function() {
	$(this).find("li").each(function(i) {
		$(this).attr("rel",i);
	});
	
	if ($(this).parent().hasClass("hover")) {
		$(this).children("li").hoverIntent(function() {
			$(this).click();
		}, function() {});
	}
});
$(".tabcontent .menu li").click(function() {
	if (!$(this).hasClass("isOn")) {
		var speed = 500;
		var $liOn = $(this);
		var $content = $liOn.parent().siblings(".content");
		var aniH = $content.find(".topic:eq("+ $liOn.attr("rel") +")").height();
		if (aniH < 300) aniH = 300;
		
		$liOn.addClass("isOn").siblings(".isOn").removeClass("isOn")
		$content.find(".isOn").fadeOut(speed).removeClass("isOn");
		$content.find(".topic:eq("+ $liOn.attr("rel") +")").fadeIn(speed).addClass("isOn");
		if ($content.height() != aniH)
			$content.stop().animate({"height": aniH}, speed);
	}
	
});


var thisLocation = location.href;
if (thisLocation.indexOf("#tab-")>0) {
	var thisLocationParts = thisLocation.split("#tab-");
	var thisAnchor = thisLocationParts[1] - 1;
	$(".tabcontent .menu a:eq("+thisAnchor+")").trigger("click");
}

$(".panel-toggle").click(function() {
	$(".tabcontent .menu a:eq(1)").trigger("click");
});
 

// Init - Top Menu Hover
var config = { sensitivity: 1, interval: 100, over: showProductFlyover, timeout: 250, out: hideProductFlyover };
$("#menu-product-link").hoverIntent(config);
var config2 = { sensitivity: 1, interval: 100, over: showSigninFlyover, timeout: 250, out: hideSigninFlyover };
$("#menu-signin-link").hoverIntent(config2);
var config3 = { sensitivity: 1, interval: 100, over: showSupportMoreFlyover, timeout: 250, out: hideSupportMoreFlyover };
$("#menu-support-more-link").hoverIntent(config3);

// Init - Footer Expander
$("#foot-notes-toggle").click(function(){
	$(this).toggleClass("footer-graphic-expanded");
	$("#foot-notes-content").slideToggle("fast");
});
