// Breadcrumbs
function writeNavBar(classStyle)
{
   var url = window.location.toString();
   var host = window.location.host;
   var protocol = window.location.protocol;
   //Create the variable for the page title
   var pTitle = myTitle;

   var iPathStartPos = url.indexOf(host) + host.length;
   var path = url.substring(iPathStartPos + 1, url.length);
   var folders = path.split("/");

   document.write('<a href="' + protocol + "//" + host + '" class="' + classStyle + '">Home</a> ');

   var iStopFolder = folders.length-1;

   if ( folders[iStopFolder] == "index.html" )
      iStopFolder =  folders.length-2;

   for (var i=0; i<iStopFolder; i++)
   {
      document.write('<span class="' + classStyle + '">&gt;</span> ');
      document.write('<a href="' + getFolderUrl(protocol, host, folders, i) + '" class="' + classStyle + '">' + getFolderDisplayName(folders[i]) + '</a> ');
   }

   document.write('<span class="' + classStyle + '">:</span> ');
   //Apply page title w/variable to bread crumb
   document.write('<span class="' + classStyle + '">' + pTitle + '</span>');
}

function getFolderDisplayName(folderName)
{
   folderName = folderName.replace("_", " ");

   var folderWords = folderName.split(' ');
   for (var i=0; i<folderWords.length; i++)
   {
      folderWords[i]=folderWords[i].toUpperCase().slice(0,1)+folderWords[i].slice(1);
   }

   return folderWords.join(" ");
}

function getFolderUrl(protocol, host, folders, iFolder)
{
   var url = protocol + "//" + host;
   for (var i=0; i<=iFolder; i++)
   {
         url = url + "/" + folders[i];
   }
   url = url + "/index.html";

   return url;
}