function changeIcon(img){

var imageToUpdate=document.getElementById(img);
var pageName = window.location.pathname;
//this returns just the page name and its extension
pageName = pageName.substring(pageName.lastIndexOf('/') + 1);
//this identifies just the page extension of the current page
var pageExtension = pageName.substring(pageName.lastIndexOf('.'));
//this replaces the current page name extension with the help extension
iconName = pageName.replace(pageExtension, ".png");
iconPreTitle = pageName.replace(pageExtension, "");
iconTitle = iconPreTitle.replace("_", " ");

if(pageName=="") {
imageToUpdate.src = "./glcicons/index.png";
imageToUpdate.title = "home icon";
return;
}
imageToUpdate.src = "./glcicons/" + iconName;
imageToUpdate.title = iconTitle + " icon";
}