// JavaScript Document
function clickDynamic(obj, target_url, tracking_code) {
var trackingAlreadyExists = target_url.indexOf("?s_cid=");
if(trackingAlreadyExists < 0)
{
	var pos=target_url.indexOf("?");
	if (pos>-1)
		tracking_code = tracking_code.replace("?","&");
	var linkComponents = target_url + tracking_code;
	obj.href=linkComponents;
}
}
$(document).ready(function(){
	url = document.location.href;
	tab_to_show = url.substring(url.lastIndexOf("#")+1,url.length);
	if(tab_to_show == "hp_products")
	{
		$("#hp_events_tab_item").parent().removeClass("active");
		$("#hp_training_tab_item").parent().removeClass("active");
		$("#hp_products_tab_item").parent().addClass("active");
		$("#hp_products_tab_content").show();
		$("#hp_events_tab_content").hide();
		$("#hp_training_tab_content").hide();
		$("#hp_product_tab_cta").show();
		$("#hp_events_tab_cta").hide();
		$("#hp_training_tab_cta").hide();
	}
	else if(tab_to_show == "hp_events")
	{
		$("#hp_products_tab_item").parent().removeClass("active");
		$("#hp_training_tab_item").parent().removeClass("active");
		$("#hp_events_tab_item").parent().addClass("active");
		$("#hp_products_tab_content").hide();
		$("#hp_events_tab_content").show();
		$("#hp_training_tab_content").hide();
		$("#hp_events_tab_cta").show();
		$("#hp_product_tab_cta").hide();
		$("#hp_training_tab_cta").hide();
	}
	else if(tab_to_show == "hp_training")
	{
		$("#hp_products_tab_item").parent().removeClass("active");
		$("#hp_events_tab_item").parent().removeClass("active");
		$("#hp_training_tab_item").parent().addClass("active");
		$("#hp_products_tab_content").hide();
		$("#hp_events_tab_content").hide();
		$("#hp_training_tab_content").show();
		$("#hp_training_tab_cta").show();
		$("#hp_product_tab_cta").hide();
		$("#hp_events_tab_cta").hide();
	}
});

$(document).ready(function() {
	$(".tabitems a").click(function(event){
			var s = s_gi('mathmain');  
			s.linkTrackVars='prop26,events';               	
		 	s.linkTrackEvents='event51';
			if(event.target.id == "hp_products_tab_item")
			{
				s.prop26='Products tab';
				s.events='event51';
				s.tl(this,'o','HomePage Tabs');
				$("#hp_events_tab_item").parent().removeClass("active");
				$("#hp_training_tab_item").parent().removeClass("active");
				$("#hp_products_tab_content").show();
				$("#hp_events_tab_content").hide();
				$("#hp_training_tab_content").hide();
				$("#hp_product_tab_cta").show();
				$("#hp_events_tab_cta").hide();
				$("#hp_training_tab_cta").hide();
			}
			else if(event.target.id == "hp_events_tab_item")
			{
				s.prop26='Events tab';
				s.events='event51';
				s.tl(this,'o','HomePage Tabs');
				$("#hp_products_tab_item").parent().removeClass("active");
				$("#hp_training_tab_item").parent().removeClass("active");
				$("#hp_products_tab_content").hide();
				$("#hp_events_tab_content").show();
				$("#hp_training_tab_content").hide();
				$("#hp_events_tab_cta").show();
				$("#hp_product_tab_cta").hide();
				$("#hp_training_tab_cta").hide();
			}
			else if(event.target.id == "hp_training_tab_item")
			{
				s.prop26='Training tab';
				s.events='event51';
				s.tl(this,'o','HomePage Tabs');
				$("#hp_products_tab_item").parent().removeClass("active");
				$("#hp_events_tab_item").parent().removeClass("active");
				$("#hp_products_tab_content").hide();
				$("#hp_events_tab_content").hide();
				$("#hp_training_tab_content").show();
				$("#hp_training_tab_cta").show();
				$("#hp_product_tab_cta").hide();
				$("#hp_events_tab_cta").hide();
			}
			if($(event.target).parent().attr('class') != "active")
				$(event.target).parent().addClass("active");

			//return false;
	
	});
});
