// http://mickweb.com/javascript/tutorials/breadcrumbs/explanation.html

function spawn(expr,qty,reversed)
{
   var spawnee=[expr];
   for(s=1;s<qty;s++)
   {
	  spawnee[s]=expr+spawnee[s-1];
   }
   return reversed? spawnee.reverse() : spawnee();
}

function mw_crumbs(divider,default_page,root)
{
   if(!divider) {divider="&nbsp;<span class='small'>>></span>&nbsp;"}
   if(!default_page){default_page="index.php"}
   
   var m=location.toString();
   url=m.split("?");
   m=url[0];
   //alert(m);
   var h="";
   m=m.substring(m.indexOf("/")+1);
   m=m.split("/");
   var howmany=spawn("../",m.length,true);
   howmany[m.length]=default_page;
   
   for(i=1;i<m.length-1;i++)
   {
	  m[i] = m[i].replace(/_/g, " "); 

	 // alert(m[i]);
	  if( i>1)
	  {
		 m[i] = m[i].replace("pas", "PAS"); 
		 m[i] = m[i].replace("elearn", "E-Learning"); 
		 m[i] = m[i].replace("access articles", "Accessible Technology articles"); 
		 m[i] = m[i].replace("assist articles", "Assistive Technology articles"); 
		 
		 
		 //alert(m[i]);
		// ignore used by footnoteLinks.js
		 h+=("<a class='ignore' href="+howmany[i+2]+">"+unescape( m[i].substr(0, 1).toUpperCase() +m[i].substr(1)+"</a>"+divider))
	  }
	  else
	  {
		  h+=("<a class='ignore' href="+howmany[i+2]+">"+unescape( m[i]+"</a>"+divider))
	  }
	  
	  //alert(h);
   }
   //h += "<span style='color:#666666;'>" + document.title + "</span>";
   if(root)
   {
	  h=h.replace(eval("/"+location.host+"/"),root);
   }
   return "<div id='breadcrumb'>"+h+"</div>";
}// JavaScript Document
