	$().ready(function()
	{
		$("a:not(#various4,#various3,.notrack)").each(function () {
			var href = $(this).attr("href");
			if (href != undefined && href != '' && internalUrls != '' && trackedFiles != '')
			{
				href = href.toLowerCase();
				var external = !(href.substr(0,7) != 'http://' || (href.indexOf('.dk') >= 0 && internalUrls.indexOf("," + href.substr(0, href.indexOf('.dk') + 3) + ",") >= 0));
				var file = (trackedFiles.indexOf("," + href.substr(href.length - 4).toLowerCase() + ",") >= 0);
				var mailto = (href.substr(0, 7) == "mailto:");
				if (external)
				{
					$(this).click(function ()
					{
						var h = $(this).attr("href");
						var s = ($(this).text() || $(this).children('img:first').attr('alt')) + " : " + h;
						_gaq.push(['_trackEvent', 'External link', 'Click', s]);
						log(s);
						if ($(this).attr("target") != '_blank')
						{
							log("track link now, open in 3");
							setTimeout("document.location='" + h + "'", 3000);
							return false;
						}
					});
					log(external + " : " + href);
				} else if (file)
				{
					$(this).click(function ()
					{
						var h = $(this).attr("href");
						var s = ($(this).text() || $(this).children('img:first').attr('alt')) + " : " + h;
						_gaq.push(['_trackEvent', 'Download', 'Click', s]);
						log(s);
						if ($(this).attr("target") != '_blank')
						{
							log("track file now, open in 3");
							setTimeout("document.location='" + h + "'", 3000);
							return false;
						}
					});
					log("file tracked: " + $(this).attr("href"));
				} else if (mailto)
				{
					$(this).click(function ()
					{
						var h = $(this).attr("href");
						var s = ($(this).text() || $(this).children('img:first').attr('alt')) + " : " + h.substr(7);
						_gaq.push(['_trackEvent', 'Mailto', 'Click', s]);
						log(s);
						setTimeout("document.location='" + h + "'", 3000);
						return false;
					});
					log("email tracked: " + $(this).attr("href").substr(7));
				}
			}
		});
	});

