
$(document).ready(function() {
	// Attach onclick event to all links.
	$("a").click(function() {
		// Expression to check for absolute internal links.
		var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
		// Expression to check for download links.
		var isDownload = new RegExp("\\.(7z|aac|avi|csv|doc|exe|flv|gif|gz|jpe?g|js|mp(3|4|e?g)|mov|pdf|phps|png|ppt|rar|sit|tar|torrent|txt|wma|wmv|xls|xml|zip)$", "i");

		try {
			if (isDownload.test(this.href)) {
				// Download link clicked.
				pageTracker._trackEvent("Downloads", "", this.href);
			}
			else if ($(this).is("a[href^=mailto:]")) {
			// Mailto link clicked.
				pageTracker._trackEvent("Mails", "Click", this.href.substring(7));
			}
			else {
				// External link clicked.
				pageTracker._trackEvent("Outgoing links", "Click", this.href);
			}
		} catch (err) {  }
	});
	
	
	$('form').submit(function() {
	
		pageTracker._trackEvent("Forms", "Submit", $(this).attr("action"));
	
	});

});