$(document).ready( function () {
	$(".mainTab").each( function() {
		//grab the short title if it exists, otherwise use the whole section name.
		var txt = ($(this).find("span.shortTitle").length) ? $(this).find("span.shortTitle").text() : $(this).find("h2").text();
		$("#tabLinks").append("<div class='secLink'>"+txt+"</div>");
	});

	$("#tabLinks .secLink").click( function() {
		var idx = $(this).prevAll().length;
		$(".mainTab").eq(idx).each( function() {
			$(this).siblings().hide();
			$(this).show();
		});
		$(this).addClass("active");
		$(this).siblings().removeClass("active");
	});

	$(".mainTab").hide();

	//show first (default) tab
	$("#tabLinks .secLink:first").trigger("click");

	//show only the shipping country list if defined in the URL.
	if(window.location.href.search("#countries") != -1)
		$("body").html($("#destHead").next("div"));
	
	//fancy alternating row styles
	$("table tr:odd").addClass("altRow");	
});

	
