/*
Breadcrumb Navagation

Team211 | Robotic Systems

Used to create breadcrumb navagation. Place breadcrumbs() whereever you would like the navagation to display.

This is used with server redirects. For example, All main pages (about us, products/order, warranty, shipping info, faq, contact)are in root dir, If there is a section that has sub-pages they need to be put into a folder that is named the same as the main page title.  The title for the page in the breadcrumb is got from a substring off the page title. This javasctipt will automatically drop the first 10 chars off the page title and display the 11th char as the first. Example it drops off the Team 221 |. 

You will need to make a redirect when you create a new sub-folder. You will have to create an index file within that folder that will redirect to the main file of that section in the root. Example products_order sub-folder has an index that redirects to /order.html
*/

function breadcrumbs(){
  sURL = new String;
  bits = new Object;
  var x = 0;
  var stop = 0;
  var output = "<a href=\"/\">Home</a>  >  ";
  sURL = location.href;
  sURL = sURL.slice(8,sURL.length);
  chunkStart = sURL.indexOf("/");
  sURL = sURL.slice(chunkStart+1,sURL.length)
  while(!stop){
    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>  >  ";
  }
  document.write(output + document.title.substr(10,30));
}
