function externalLinkClick(theClient) {

	s=s_gi(s_account);
	s.linkTrackVars="events,eVar24";
	s.linkTrackEvents="event14";
	s.eVar24=theClient
	s.events="event14";
	s.tl(this,'o','External Client Link Click - ' + theClient);
	
}

function getUserInfo(type) {
	var info = "";
	var userInfo = getMeta('AccInfo').split("|");
	
	switch (type) {
		case 'type':
			info = userInfo[0];
		break;
		case 'expired':
			info = userInfo[1];
		break;
		case 'source':
			info = userInfo[2];		
		break;
	}
		return info;

}

function getContentInfo() {

	var info = "";
	var contentInfo = getMeta('ContentInfo').split("|");;
	if (contentInfo.length > 1) {
		info = "restricted";
		switch (contentInfo[1]) {
			case '0':
				info += " - barrier shown";
			break;
			case '1':
				info += " - paid";
			break;
			case '2':
				info += " - fcf";
			break;
		}
	} else {
		info = "unrestricted";
	}
	return info;
}

//Used for tracking clicks on Most Comment, Most Popular etc
function blockItemClicked(item, type, thePageName) {

	switch (type) {
	
		case 1:
			s.linkTrackVars = "prop20,prop23";
			s.prop20 = item;
			s.prop23 = thePageName;
			s.tl(this,'o','most popular - ' + item); 
		break;
		case 2:
			s.linkTrackVars = "prop21,prop23";
			s.prop21 = item;
			s.prop23 = thePageName;
			s.tl(this,'o','most commented - ' + item);
		break;
		case 3:
			s.linkTrackVars = "prop22,prop23";
			s.prop22 = item;
			s.prop23 = thePageName;			
			s.tl(this,'o','most emailed - ' + item);
		break;
	}
	
	

}

function cleanForSiteCatalyst(theString) {

	var result = theString.replace(/\u2019|\u2018|\u201C|\u201D|[\u0080-\uFFFF]|;|,|'|"|\/|<|>|&/g, "");
	return result.toLowerCase();
}



//Various Functions that help with analytics
//gets the value of the given url parameter
function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ) {
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return unescape(strReturn);
}


//Should be edited depending on analytics system
//HBX prefers to have spaces replaced with + signs
function stripUnwantedCharactersExceptCommas(theString) {

	var result = theString.replace(/;|'|"|<|>| |&/g, "+");
	return result;
}

function stripUnwantedCharacters(theString, replacement) {

	var result = theString.replace(/;|,|'|"|\/|<|>| |&/g, replacement);
	return result;
}

//get the contents of the given meta-tag
function getMeta(metatag)  {
	metas = document.getElementsByTagName("meta");
	for (i=0;i<metas.length;i++) {
		if (metas[i].name == metatag) {return metas[i].content; }
	}
	return "";
}



//Returns the filename of the page
function getFileName() {

	var fileName = location.pathname.substring(location.pathname.lastIndexOf('/')+1);

	if (fileName.indexOf(".") > -1) {
		return fileName;
	} else {
		return "index";
	}

}

//Returns title from URL on .detail pages
function getTitleURL() {
	var strPath = window.location.pathname;
	var strTitle = "";
	if (strPath.indexOf("/") > -1) {
		var arrPath = strPath.split("/");
		strTitle = arrPath[arrPath.length-2];
		return strTitle;
	}
}


//returns the headline from the title tag
function getHeadline() {

	var theTitle = document.title;
	var theHeadline = theTitle.substring(0, theTitle.indexOf("|"));
	return theHeadline;

}

//return the name of the event from the URl
function getEventName() {
	
	var levels = removeSlashesFromDirectoryNames(getDirectory()).split("/");
	return levels[2];
	
}


//return the directorys/depth of current page
function getDirectory() {

	var theFile = getFileName();
	if (theFile.indexOf(".") > -1) {
		return location.pathname.substring(0, location.pathname.indexOf(theFile));
	} else {
		return location.pathname;
	}

}



//returns the filename without the extension
function fileNameWithoutExtension(fileName) {
	
	var thefile;
	thefile = fileName.substring(0, fileName.indexOf("."));
	return thefile;
	
}
