﻿function breadcrumbs()
{
    sURL = new String;
    bits = new Object;
    var x = 0;
    var stop = 0;
    //edit the following line to change root directory when displaying breadcrumbs 
    //or breadcrumbs will include directory name in path
    var output = "<div id=topnav><A HREF=/index.html>Home</A> &raquo; ";

    sURL = location.href;
    sURL = sURL.slice(8,sURL.length);
    chunkStart = sURL.indexOf("/");
    sURL = sURL.slice(chunkStart+1,sURL.length)

    while(!stop){
    //edit the following line to change root directory when displaying breadcrumbs 
    //or breadcrumbs will include directory name in path
      chunkStart = sURL.indexOf("/");
      if (chunkStart != -1){
        bits[x] = sURL.slice(0,chunkStart)
        sURL = sURL.slice(chunkStart+1,sURL.length);
      }else{
        stop = 1;
      }
      x++;
    }

    for(var i in bits){
      output += "<A HREF=\"";
      for(y=1;y<x-i;y++){
        output += "../";
      }
      output += bits[i] + "/\">" + bits[i] + "</A> &raquo; ";
    }
    //following line is used to remove prefix from site name if you have one in use. eg. Edna Manley | Home
    //*document.write(output + document.title.replace(/Edna Manley \| /,""));
    document.write(output + document.title);
	document.write("</div>");
}

/*load links*/
function loadlinks(filename)
{       
    var xmlDoc=null;
    if (window.ActiveXObject)
    {// code for IE
        xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    }
    else if (document.implementation.createDocument)
    {// code for Mozilla, Firefox, Opera, etc.
        xmlDoc=document.implementation.createDocument("","",null);
    }
    else
    {
        alert('Your browser cannot handle this script');
    }
    if (xmlDoc!=null)
    {
        xmlDoc.async=false;
        xmlDoc.load(filename);
        /*document.write("<table border='1'>");*/

        var x=xmlDoc.getElementsByTagName("link");
        for (i=0;i<x.length;i++)
        { 
            document.write("<li>");            
            document.write("<a href=");
            document.write(x[i].getElementsByTagName("url")[0].childNodes[0].nodeValue);
            document.write(" ");
            document.write("target=");
            document.write(x[i].getElementsByTagName("target")[0].childNodes[0].nodeValue);
            document.write(" >");
            document.write(x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
            document.write("</a>");
            document.write("</li>");
            if (i != x.length - 1 && filename=="sidelinks.xml")
            {
                document.write("<li>&nbsp;</li>")
            }
        }
            
    }
}

function loadlinks2(filename)
{       
    var xmlDoc=null;
    if (window.ActiveXObject)
    {// code for IE
        xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    }
    else if (document.implementation.createDocument)
    {// code for Mozilla, Firefox, Opera, etc.
        xmlDoc=document.implementation.createDocument("","",null);
    }
    else
    {
        alert('Your browser cannot handle this script');
    }
    if (xmlDoc!=null)
    {
        xmlDoc.async=false;
        xmlDoc.load(filename);
        /*document.write("<table border='1'>");*/

        var x=xmlDoc.getElementsByTagName("link");
        for (i=0;i<x.length;i++)
        { 
            document.write("<div>");            
            document.write("<a href=");
            document.write(x[i].getElementsByTagName("url")[0].childNodes[0].nodeValue);
            document.write(" ");
            document.write("target=");
            document.write(x[i].getElementsByTagName("target")[0].childNodes[0].nodeValue);
            document.write(" >");
            document.write(x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
            document.write("</a>");
            document.write("</div>");
            if (i != x.length - 1 && filename=="sidelinks.xml")
            {
                document.write("<div>&nbsp;</div>")
            }
        }
            
    }
}
