// start profiler tracking function

function profilerLink() 
	{ document.cookie = "profilerCookie=true;path=/"; }

function profilerRepeat(session) {
	var date = new Date();
	date.setTime(date.getTime()+(60*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	document.cookie = "profilerRepeat=" + session + expires + ";path=/";
}

function writeCookieall(item, session) {
	var date = new Date();
	date.setTime(date.getTime()+(60*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	document.cookie = item + "=" + session + expires + ";path=/";
}

function readCookie(nameEQ) {  
	var ca = document.cookie.split(';'); 
		for(var i=0;i < ca.length;i++) 
			{ var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); 
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } 
	return "FALSE"; }

var profilerCookieValue = "FALSE";
var profilerRepeatValue = "FALSE";
if (document.cookie) profilerCookieValue = readCookie("profilerCookie=");
if (document.cookie) profilerRepeatValue = readCookie("profilerRepeat=");

document.write("<s" + "cript language='javascript' src='http://www.profilertracking.com/profiler/recordClicks_inside.asp?HREF="  + document.location.href + "&TITLE=" + document.title + "&PLINK=" + profilerCookieValue + "&PREPEAT=" + profilerRepeatValue + "&REF=" + document.referrer + "'></sc" + "ript>"); 


var profloadedobjects=""

function loadobjsprof(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (profloadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".asp")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
profloadedobjects+=file+" " //Remember this object as being already added to page
}
}
}


document.onclick = function(e){    
e = e || window.event;    
var t = e.target || e.srcElement;    
	if(t.nodeName=='A' || t.nodeName=='a'){     
		if( t.href.match(".pdf")){
			var linktext = t.innerHTML.replace(/&/g, "");
			if (!document.location.href.match("https:")) {
			var target = "http://www.profilertracking.com/profiler/recordClicks_inside.asp?HREF=" + t.href + "&TITLE=" + "test" + "&PLINK=" + profilerCookieValue + "&PREPEAT=" + profilerRepeatValue + "&REF=";
			} else {
			var target = "https://www.profilertracking.com/profiler/recordClicks_inside.asp?HREF=" + t.href + "&TITLE=" + linktext + "&PLINK=" + profilerCookieValue + "&PREPEAT=" + profilerRepeatValue + "&REF=";
			}
			loadobjsprof(target);		
			}    
		}
	}


// end profiler tracking function

