//this gets the full url
var url = document.location.href;
var folderPath = "";
var dir = url;
if (dir.indexOf("/promo/") != -1) { folderPath+="promo"; }
if (dir.indexOf("/salesrep/") != -1) { folderPath+="salesrep"; }
if (dir.indexOf("/storage/") != -1) { folderPath+="storage"; }

//this removes the anchor at the end, if there is one
url = url.substring(0, (url.indexOf("#") == -1) ? url.length : url.indexOf("#"));
//this removes the query after the file name, if there is one
url = url.substring(0, (url.indexOf("?") == -1) ? url.length : url.indexOf("?"));
//this removes everything before the last slash in the path
url = url.substring(url.lastIndexOf("/") + 1, url.length);
var input = url;
var output = input.substr(0, input.lastIndexOf('.')) || input;

if(folderPath != ""){ 
 if(output == ''){
  output='index';
 }
 var filename = folderPath +":"+output;
}
else{
 if(output == ''){
  output='index';
 }
 var filename = output;
}

