/* 
 * This is a test to replace vsLinks.js
 * 
 * According to jQuery docs, v1.4.1 should allow duplicate events, so
 * we want to ensure this is only run once per page, even if script is included twice.
*/

if (typeof(tagLinksExecuted) == 'undefined') var tagLinksExecuted = 0;

if (vsActive || vsActiveExt) {
	$(document).ready(function() {
		tagLinks();
		});
	}

function tagLinks() {
	if (tagLinksExecuted) { return; } 
	/* 
	 * Add click listener to all links. Method "live" is similar to "bind",
	 * except that it also handles links dynamically-created after ready(). Fancy.
	*/ 
	$('a').live('click', function(e) {
		captureLinkName(this.href);
		});
	tagLinksExecuted = 1;
	}

/* 
 * Sure, this could be included directly in the live() function, but
 * I've separated it out just in case we want to add any other 
 * functionality later.
 */
function captureLinkName(link) {
	vsLinkClicked = link; 
	}





