var profileId = "UA-18447920-1"

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-18447920-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

if (typeof jQuery != "undefined"){ 
	$(document).ready(function(){
		
		//Track external links , Not DMS
		$("a[href*='http://']:not([href*='" + location.hostname + "']):not([href*='dms'])").click(function(event){
			var url = $(this).attr('href')
			var pageTracker = _gat._getTracker(profileId);
			pageTracker._trackPageview('/external/' + url);
		});
		
		//Track document (doc, txt, rtf, pdf, zip, ppt, xls) links not hosted on DMS 
		$("a[href$='.doc'], a[href$='.txt'], a[href$='.rft'], a[href$='.pdf'], a[href$='.zip'], a[href$='.ppt'], a[href$='.xls']").click(function(event){
			var url = $(this).attr('href')
			var pageTracker = _gat._getTracker(profileId);
			pageTracker._trackPageview('/documents/' + url);
		});
		
		//Track All DMS links
		//This is needed because DMS links dont have an extension at the end
		$("a[href*='http://dms.']").click(function(event){
			var url = $(this).attr('href')
			var pageTracker = _gat._getTracker(profileId);
			pageTracker._trackPageview('/documents/' + url);
		});
		
		//Track mailto links
		$("a[href*='mailto']").click(function(event){
			var url = $(this).attr('href')
			var pageTracker = _gat._getTracker(profileId);
			pageTracker._trackPageview('/mailto/' + url);
		});
	});
}
