Cufon.replace('#branches h2');
Cufon.replace('#custtype em');
Cufon.replace('#puff strong');
Cufon.replace('#strap');
Cufon.replace('#custtype a', {
	hover: true
});

window.onload = function(e) {
	externalLinks();
	trackLinkLoc('content','related');
}

// Converts links with an attribute of rel="external" to target="_blank"
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
			var anchor = anchors[i];
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
				 anchor.target = "_blank";
				 anchor.title = "This link will open in a new window.";
		}
	}
}

// This looks for links, inside IDs passed as parameters, then adds an attribute to them
function trackLinkLoc() {
	for( var i = 0; i < arguments.length; i++ ) {
		// Does this element exist on the page?
		if (document.getElementById(arguments[i])) {
			// The containing element for the links
			objBlock = document.getElementById(arguments[i]);
			// All the links inside it
			objLinks = objBlock.getElementsByTagName("a");
			// For every link
			for (var j=0; j<objLinks.length; j++) {
				var objLink = objLinks[j];
				// If the link's got a href, and does not already have an onclick
				if (objLink.getAttribute("href") && !objLink.getAttribute("onclick")) {
					 objLink.onclick = "pageTracker._trackEvent('click_location', '" + arguments[i] + "', this.href + ' - ' + document.location.href);";
					 // Debug
					 //objLink.title = "pageTracker._trackEvent('click_location', '" + arguments[i] + "', this.href + ' - ' + document.location.href);";
				}
			}
		}
	}
}