//this javascript check if the link is an external link and apply the tracker code

function isPdfDownloadLink(className){
	var bIsPdfLink = false;
	
	if (className == 'pdf-download') {
		bIsPdfLink = true;
	}

	return bIsPdfLink;
}

//the main function
function checkPdfDownload(){
	var a = document.getElementsByTagName("a");
	
	for (var i=0;i<a.length;i++){
		
		if(isPdfDownloadLink(a[i].className)){

			a[i].onclick = function(){
				// track pdf download event
				pageTracker._trackEvent('Downloads', 'PDF', this.rel);
				
			}
		}
	};
	
}

//load the function on DOM ready or window load

//prototype
Event.observe(window, 'load', checkPdfDownload);
