jQuery(document).ready(function(){
	// The slashes are to ensure the period is in the url, the $ is to make sure it is the end of the url, the i is to make it case insensitive.
	filetypes = /\.doc$|\.xls$|\.exe$|\.zip$|\.pdf$|\.mp3$|\.psd$/i;
	jQuery("a").live("click", function(){
		// Track downloads (links with a given extension)
		if (jQuery(this).attr("href").match(filetypes)) {
			// The URL needs to be changed for each site this is applied to.
			var host = location.host.replace(/\./, "\\.");
			var pattern = new RegExp('^(http\:\/\/)*(www\.)*('+host+')*\/','i');
			var url = jQuery(this).attr("href").replace(pattern, "");
			pageTracker._trackPageview("/downloads/" + url);
		}
	});
});
