var TrackDocsInGA = function() {
	// Define file extensions to check for, get all the links in this page, and declare other vars
	var extensions = ['pdf', 'ppt', 'doc', 'docx', 'mp3', 'wax', 'wmv', 'xls', 'zip'],
		links = document.getElementsByTagName('A'),
		link,
		href,
		isDocLink,
		i, j, k, l;

	// Define the click handler
	function clickHandler(href) {
		return function() {
			// Call the Google Analytics function
			eventTracker._trackEvent('documentation', href);
		};
	}

	// For each link...
	for (i = 0, j = links.length; i < j; i++) {
		link = links[i];
		// Get the href attribute
		href = link.getAttribute('href');
		// Reset the isDocLink flag
		isDocLink = false;

		if (href !== null) {
			// Convert the href to lowercase
			href = href.toLowerCase();
			// Determine if this is a link to a document
			for (k = 0, l = extensions.length; k < l; k++) {
				if (href.indexOf('.' + extensions[k]) !== -1) {
					isDocLink = true;
				}
			}
		}

		if (isDocLink) {
			// The link is a link to a document, so add the handler to its click event
			link.onclick = clickHandler(href);
		}
	}
};
