// INSTRUCTIONS:
//
// 1.  Create your site structure using folders and files with useful names.
//     Use underscores to signify spaces when naming everything.
//
//     Example: http://www.squid.com/My_Pet_Squid/Meet_Rocky.html shows good
//     name choices to describe an area of content and the contents of a page.
//    
//     Alternatively, you can setup mod_rewrite to create friendly URLs such
//     as the one above.
//
//     Every folder *must* have a default document in it (such as index.html
//     or default.asp or whatever your host specifies).  You can also use
//     301/302 redirection to push the folder root to one of the pages within
//     that folder.  This will replace an index page, if you don't wish to
//     have one.
//
// 1a. If you want to use something other than underscores for spaces (such
//     as hyphens), you can make edits to the actual script to recognize
//     your preference.  A set of prewritten code lines have been inserted
//     below and commented out.  Feel free to use them, or to create your
//     own based on them.
//
// 2.  Fill in the settings for the variables in the next section of this
//     script.  They should be pretty self-explanatory.
//
// 3.  Add the following to your site wherever you want your breadcrumbs
//     to appear (change the path to point to wherever you put this script):
//
//     <div id="breadcrumbs"></div>
//     <script type="text/javascript" src="path/to/breadcrumbs.js">
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
// Change the following variables as instructed                             //
//////////////////////////////////////////////////////////////////////////////

// Enter your domain name here, 
var url = "www.goletworld.com";

// Enter the word you want to use to describe the home page of your site
var home = "Home";

// Enter the character(s) you want to use to separate your breadcrumbs
var divide = "&raquo;";

// Enter text you'd like to see.  You can make this blank as well - "";
var pre = "";

// Enter the extension you use for your pages
var ext = ".asp";

// Enter the default file name you use for the root file of your folders
var root = "index";

//////////////////////////////////////////////////////////////////////////////
// DO NOT TOUCH ANYTHING BELOW THIS LINE                                    //
// unless done in accordance with the instructions at the top of the page.  //
//////////////////////////////////////////////////////////////////////////////

divide = " " + divide + " ";
var a = "" + window.location;
var b = "";
var bar = divide + root;
var code = "";
var foo = root + ext;
var left = "";

a = a.replace(ext,"");
left = a.lastIndexOf("/");

if (a.substring(a.lastIndexOf("/")) == "/") {
	a = a + root;
}

b = a.substring(left+1);
b = b.replace(/_/g," ");
b = b.replace(/#/g,divide);

// Alternative spacer: hyphen. Remove comment tags in the next line to activate
// b = b.replace(/-/g," ");

code = divide + b;
b = "/" + b
b = b.replace(divide,"#");
b = b.replace(/ /g,"_");

// Alternative spacer: hyphen. Remove comment tags in the next line to activate
// b = b.replace(/ /g,"-");

a = a.replace(b,"");

if (a.substring(left-1) != "/") {
	do  {
		left = a.lastIndexOf("/");
		b = a.substring(left+1);
		b = b.replace(/_/g," ");
		
		// Alternative spacer: hyphen. Remove comment tags in the next line to activate
		// b = b.replace(/-/g," ");

		code = divide + "<a href=\"" + foo + "\">" + b + "</a>" + code;
		foo = "../" + foo;
		b = "/" + b;
		b = b.replace(/ /g,"_");
		
		// Alternative spacer: hyphen. Remove comment tags in the next line to activate
		// b = b.replace(/ /g,"-");

		a = a.replace(b,"");
	} while (a.substring(left-1) != "/");
}

code = code.replace(url,home);
code = code.replace(bar,"");
code = (code.substring(code.indexOf("<")));
code = pre + code;
document.getElementById('breadcrumbs').innerHTML = code;