var SEO = {
    init: function() {
        $(document).ready(SEO._init);
    },

    _init: function() {
        $('a').each(function(index) {
            var href = $(this).attr('href');
            if (href != null) {
                if (href.search(/^mailto\:/gi) > -1) {
					$(this).click(function() {
						SEO.tracking('/email/' + escape(href));
					});
                } else if (href.search(/\.(pdf|doc)$/gi) > -1) {
					$(this).click(function() {
						SEO.tracking('/download/' + escape(href));
					});
                } else if (
						(href.search(/^http\:\/\//gi) > -1) ||
						(href.search(/^https\:\/\//gi) > -1)
					) {
					if (href.indexOf(window.location.hostname) == -1) {
						$(this).click(function() {
							SEO.tracking('/outgoing/' + escape(href));
						});
					}
                }
            }
        });
    },
    tracking: function(path) {
		if (typeof(_gat) != 'undefined') {
	        var pageTracker = _gat._getTracker("UA-8367389-11");
	        pageTracker._trackPageview(path);
		}
    }
}

SEO.init();
