/*----------------------------------------------------------------------------------------*\
|	File		:	Tracer.js
|	Language	:	JavaScript 2.0
|	Purpose		:	JavaScript code for the Dynamic Navigation application.
|	Naming		:	As the name suggests this code places the navigation
|				path and the Page title of the current page. Helps the
|				user trace back to the originating pages in the web site.
|	Dependancies:	none
|
|	Variables	:	var loc		=	URL of the current Page
|				var base	=	Home Page
|				var delStr	=	Delimiting String e.g.: ">" can also be an image source
|				var defP	=	Default Page in the directory
|								e.g.: "index.html","home.html","default.html"
|				var cStyle	=	CSS Style for the Link ( Anchor)
|				var tStyle	=	CSS Style for the Current Page Title
|				var dStyle	=	CSS Style for the delimiter, if not an image
|
|	Functions	:	Function makeCaps Capitalizes the first letter in the String
|				Function getLoc locates the level of the string in the URL
|				Function rmUnderScore Replaces "_" (under score) with a "" (space)
|
|	Important Instruction:	Please note that every directory in the web site should have a
|				default page that is mentioned as variable "defP".
|
|	Developed	:	February 2003
|
|	By		:	Sree Govindan
| 				for Web Development Unit,DoIT, Illinois Secretary of State.
|
\*-------------------------------------------------------------------------------------*/
function tracer (delStr, defp, cStyle, tStyle, dStyle)
{
  loc = window.location.toString();
  loc = rmUnderScrore(loc);
  base = getBaseURL();
  subs = loc.substr(loc.indexOf(base) + base.length + 1).split("/");
  document.write('<a href="' + getLoc(subs.length - 1) + defp + '" class="' + cStyle + '">Home</a>  '+'<span><font class="' + dStyle + '">' + delStr + '</font></span> ');
  a = (loc.indexOf(defp) == -1) ? 1 : 2;
  for (i = 0; i < (subs.length - a); i++)
  {
    subs[i] = makeCaps(unescape(subs[i]));
    document.write('<a href="' + getLoc(subs.length - i - 2) + defp + '" class="' + cStyle + '">' + subs[i] + '</a>  '+'<span><font class="' + dStyle + '">' + delStr + '</font></span> ');
  }
  document.write("<span><font class=" + tStyle + ">" + document.title + "</font></span>");
}

function makeCaps(a)
{
  g = a.split(' ');
  for (l = 0; l < g.length; l++)
    g[l] = g[l].toUpperCase().slice(0,1) + g[l].slice(1);
  return g.join(" ");
}

function getLoc(c)
{
  var d = "";
  if (c > 0)
    for (k = 0; k < c; k++)
      d = d + "../";
  return d;
}

function rmUnderScrore(str)
{
  var temp = "";
  str = '' + str;
  splitString = str.split("_");
  for(i = 0; i < splitString.length; i++)
    temp += " " + splitString[i];
  return temp;
}

function getBaseURL()
{
  var loc = window.location.toString();
  var endOfBase;
  endOfBase = getEndBaseURL(loc);

  base = loc.substring(0, endOfBase);
  return base;
}

function getEndBaseURL(loc)
{
  var c;

  for (c = 7; c <= loc.length - 1; c++)
    if (loc.charAt(c) == "/")
      return c; //return position the slash was found at
}
-->
