// linkTracking - Tracking various link clicks through Google Analytics
// Requires jQuery, Google analytics
 
$(document).ready(function() {
 
	/*
		Track External Link Clicks 
 
		Add the attribute rel="external" to any external link
		on your site, and this function will track the click. 
 
		Click reported as: /custom-tracking/outgoing-link/{url of link clicked}
	*/	
 
	$('a[rel="external"]').click(function(){
		customLink = '/custom-tracking/outgoing-link/' + $(this).attr('href');
		pageTracker._trackPageview(customLink);
	});	
	
	$('a[rel="portImages"]').click(function(){
		customLink = '/custom-tracking/portfolio/' + $(this).attr('href');
		pageTracker._trackPageview(customLink);
	});	
	
	$('a[rel="broImages"]').click(function(){
		customLink = '/custom-tracking/brochure/' + $(this).attr('href');
		pageTracker._trackPageview(customLink);
	});	

 
/* =================================================================== */
 
	/*
		Track Email Link Clicks
 
		This simply tracks the click on any link that uses
		the "mailto:email@domain.com" method.
 
		Click reported as: /custom-tracking/email-link/mailto:{email address clicked}
	*/
 
	$('a[href*=mailto]').click(function () {
		customLink = '/custom-tracking/email-link/' + $(this).attr('href');
		pageTracker._trackPageview(customLink);
	});
 
/* =================================================================== */
 
	/*
		Track PDF File Downloads
 
		This adds the tracking code to any link with a .pdf extension, allowing
		you to track file downloads
 
		Click reported as: /custom-tracking/pdf-link/{url of pdf clicked}
	*/
 
	$('a[href*=.pdf]').click(function () {
		customLink = '/custom-tracking/pdf-link/' + $(this).attr('href');
		pageTracker._trackPageview(customLink);
	});
 
/* =================================================================== */
 
	/*
		Track Custom Page Elements
 
		If you want to track anything specific, this will allow you
		to do so anywhere you want.
 
		To use this:
		- add a class of "customTracker" to your link.
		- add a title attribute to your link to be used in your reports
 
		For example: <a class="customTracker" title="Log in to your account" href="{some url">Click here to log in</a>
		Would report as /custom-tracking/page-element/Log in to your account
	*/
 
	$('a.customTracker').click(function(){
		customLink = '/custom-tracking/page-element/' + $(this).attr('title');
		pageTracker._trackPageview(customLink);
	});	
	
		$('#sa').click(function(){
		customLink = '/custom-tracking/selling-architect/' + $(this).attr('title');
		pageTracker._trackPageview(customLink);
	});	

/* =================================================================== */
 
});
