/*****
Dynamic Javascript Breadcrumb Navigation by Adam DuVander
http://duvinci.com/projects/javascript/crumbs/

Released under Creative Commons License:
http://creativecommons.org/licenses/by/2.5/
*****/
var crumbsep = " &raquo; ";
var precrumb = "<span class=\"breadcrumb\">";
var postcrumb = "</span>";
var sectionsep = "/";
var rootpath = "/"; // Use "/" for root of domain.
var rootname = "SURIN";

var ucfirst = 1; // if set to 1, makes "directory" default to "Directory"
var showpage = document.title; // this contains what to show as the current page in the crumb. Set to "" to show nothing

//
// objurl elements have values that are two-element arrays. The first
// element is a string which will become the text for the hyperlink.
// The second element is the server-relative link address.  Most entries
// have this second element equal to the index value. I.e., the entry
// whose index value is 'xyz' have a server-relative link address equal
// to '/xyz'.  There are a few exceptions to this rule. E.g.,
//
//    /Districts
//    /Services
//    /utahlink
//
// Also note below the note for 'utahlink'

var objurl = new Object;
objurl['arin'] = new Array('ARIN','/arin'); 
objurl['board'] = new Array('SURIN Board Information','/board'); 
objurl['ip_address'] = new Array('IP Addressing','/ip_address'); 
objurl['tac'] = new Array('Technical Advisory Council','/tac'); 
//
// If you don't want the directory to be represented in the breadcrumb, define
// it's entry as shown here for the utahlink directory
// 

objurl['utahlink'] = new Array('','');




// Grab the page's url and break it up into directory pieces
var pageurl = (new String(document.location));
var protocol = pageurl.substring(0, pageurl.indexOf("//") + 2);
pageurl = pageurl.replace(protocol, ""); // remove protocol from pageurl
var rooturl = pageurl.substring(0, pageurl.indexOf(rootpath) + rootpath.length); // find rooturl
if (rooturl.charAt(rooturl.length - 1) == "/") //remove trailing slash
{
  rooturl = rooturl.substring(0, rooturl.length - 1);
}
pageurl = pageurl.replace(rooturl, ""); // remove rooturl fro pageurl
if (pageurl.charAt(0) == '/') // remove beginning slash
{
  pageurl = pageurl.substring(1, pageurl.length);
}

var page_ar = pageurl.split(sectionsep);
var currenturl = protocol + rooturl;
var allbread = precrumb + "<a href=\"" + currenturl + "\">" + rootname + "</a>" + postcrumb; // start with root

for (i=0; i < page_ar.length-1; i++)
{
  var displayname = "";
  var displayTheLink = false;
  if (objurl[page_ar[i]])
  {
    displayname = objurl[page_ar[i]][0];
    if (objurl[page_ar[i]][1] != '') {
      currenturl += objurl[page_ar[i]][1];
      displayTheLink = true;
    }
  }
  else
  {
    displayTheLink = true;
    currenturl += "/" + page_ar[i];
    if (ucfirst == 1)
    {
      displayname = page_ar[i].charAt(0).toUpperCase() + page_ar[i].substring(1);
    }
    else
    {
      displayname = page_ar[i];
    }
  }

  if (displayTheLink == true) {
    allbread += crumbsep + precrumb + "<a href=\"" + currenturl + "\">" + displayname + "</a>" + postcrumb;
  }
}

if (showpage != "")
{
  allbread += crumbsep + precrumb + showpage + postcrumb;
}
document.write(allbread);

