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;
	
}