//You need an anonymous function to wrap around your function to avoid conflict  
(function($){
	//Attach this new method to jQuery  
	$.fn.extend({
		//This is where you write your plugin's name  
		linkTracker: function() {
			//Iterate over the current set of matched elements 
			return this.each(function() {
				var lnk = jQuery(this).attr('href');
				if (typeof(lnk) != 'undefined') {
					var newLink = jQuery.LT.decorateLink(lnk);
		
					// add decorated onclick event
					if (newLink.length) {
						jQuery(this).click(function() {
							//if (confirm('tracked: ' + newLink)) {
								pageTracker._trackPageview(newLink);
								return true;
							//} else {
							//	return false;
							//}
						});
					}
				}
            });
        }
    });
//pass jQuery to the function,   
//So that we will able to use any valid Javascript variable name   
//to replace "$" SIGN. But, we'll stick to $ (I like dollar sign: ) )         
})(jQuery); 

jQuery.LT = {
	
	// Returns the given URL prefixed if it is:
	//		a) a link to an external site
	//		b) a mailto link
	//		c) a downloadable file
	// ...otherwise returns an empty string.
	decorateLink:function(lnk) {
		var opts = {
			external:'/external/-',
			mailto:'/mailto/-',
			download:'/downloads/-',
			extensions:['hqx','doc','eps','jpg','png','svg','xls','ppt','pdf','xls','zip','txt','rar','exe','wma','mov','avi','wmv','mp3','csv','gif']
		}
		
		var trackingURL = '';
		
		if (lnk.indexOf('://') == -1 && lnk.indexOf('mailto:') != 0) {
			// no protocol or mailto - internal link - check extension
			var ext = lnk.split('.')[lnk.split('.').length - 1];			
			var exts = opts.extensions;
			
			for (i = 0; i < exts.length; i++) {
				if (ext == exts[i]) {
					trackingURL = opts.download + lnk;
					break;
				}
			}				
		} else {
			if (lnk.indexOf('mailto:') == 0){
				// mailto link - decorate
				trackingURL = opts.mailto + lnk.substring(7);					
			} else {
				// complete URL - check domain
				var regex = /([^:\/]+)*(?::\/\/)*([^:\/]+)(:[0-9]+)*\/?/i;
				var linkparts = regex.exec(lnk);
				var urlparts = regex.exec(location.href);					
				if (linkparts[2] != urlparts[2]) trackingURL = opts.external + lnk;
			}
		}
		
		return trackingURL;	
	}
}