$(document).ready(function()
{
	if(typeof pageTracker == 'undefined')
		return;

	$("#naviheader > div > div > a").click(function()
	{
		pageTracker._trackEvent("Navigation", "Top", this.href);
	});
	
	$("#choosetax a").click(function()
	{
		pageTracker._trackEvent("Settings", "Changetax", $(this).text());
	});
	
	$("#productmenu a").click(function()
	{
		pageTracker._trackEvent("Navigation", "Category", this.href);
	});
	
	$("#we_recommend a").click(function()
	{
		pageTracker._trackEvent("Navigation", "We recommend", this.href);
	});
	
	$("#right_column .box_white:has(:not(.boxed))").each(function()
	{
		$("a", this).click(function()
		{
			pageTracker._trackEvent("Navigation", "Right", this.href);	
		});
	});
	
	$("#right_column .box_white:has(.boxed)").each(function()
	{
		$("a", this).click(function()
		{
			pageTracker._trackEvent("Navigation", "Offer", this.href);	
		});
		
		$(":submit", this).click(function()
		{
			var name = $(this).attr("name");
			var result;
			
			if(result = name.match(/read_more_([0-9]+)/i))
			{
				pageTracker._trackEvent("Navigation", "Offer", 'product/' + result[1] + '.html');
			}
			else if(result = name.match(/buy_([0-9]+)/i))
			{
				pageTracker._trackEvent("Navigation", "Offer", 'product/' + result[1] + '.html');
				pageTracker._trackEvent("Cart", "Add", result[1]);
			}
		});
	});
	
	$(".otherproducts a").click(function()
	{
		pageTracker._trackEvent("Navigation", "Other products", this.href);	
	});
	
	$(".otherproducts :submit").click(function()
	{
		var name = $(this).attr("name");
		var result;
		
		if(result = name.match(/read_more_([0-9]+)/i))
		{
			pageTracker._trackEvent("Navigation", "Other products", 'product/' + result[1] + '.html');
		}
		else if(result = name.match(/buy_([0-9]+)/i))
		{
			pageTracker._trackEvent("Navigation", "Other products", 'product/' + result[1] + '.html');
			pageTracker._trackEvent("Cart", "Other products - Add", result[1]);
		}
	});
});
