$(document).ready(function(){
    // This code needs to be changed to the code Google Analytics provides for your account
	_uacct = "UA-15141630-1";
    urchinTracker();
    // 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 = /\.zip$|\.pdf$/i;

    $("a").each(function(){
        // Track mailto links
		try {
        	if ($(this).attr('href').match(/^mailto\:/i)) {
	            var url = $(this).attr("href").replace(/^mailto\:/i, "")
	            $(this).click(function() { urchinTracker("/mailto/" + url);	report(url); })
	        }
			// Track downloads (links with a given extension)
	        else if ($(this).attr("href").match(filetypes)) {
	            // The URL needs to be changed for each site this is applied to.
	            var url = $(this).attr("href").replace(/^(http\:\/\/)*(www\.)*(dekom-kommunikation\.de")*\//i, "")
	            $(this).click(function() {urchinTracker("/downloads/" + url); report(url); })
	        }
	        // Track external links
	        else if (location.host != this.host.replace(/\:80$/i, "")) {
	            var url = $(this).attr("href").replace(/^http\:\/\/(www\.)*/i, "")
	            $(this).click(function() {urchinTracker("/outgoing/" + url); report(url); })	
	        } else {
	            var url = $(this).attr("href").replace(/^(http\:\/\/)*(www\.)*(dekom-kommunikation\.de")*\//i, "")
	            $(this).click(function() {urchinTracker("/"+url); report(url); })
			}
		} catch(err)
		{
			
		}
    });
});
