//////////////////////////////////////////////////////////////////////////////
//                         Nifty Breadcrumbs Script                         //
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
// Change the following variables as instructed                             //
//////////////////////////////////////////////////////////////////////////////

// Enter your domain name here, 
var url = "www.bcfamilyhearing.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

// Enter the character that replaces spaces in your URL (i.e. - or _ or %20)
var sp = "_";

var ext = ".asp";

// Enter the default file name you use for the root file of your folders
var root = "index";

swap = new Array(); // Don't touch this line!
//swap[0] = 'site-wip|Home';
// swap[1] = 'Replace Me|My Replacement';
// etc.

//////////////////////////////////////////////////////////////////////////////
// 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;

//get rid of everything after the question mark for queries
if(code.indexOf("?") != -1){
	code = code.substring(0, code.indexOf("?"));
}

document.getElementById('breadcrumbs').innerHTML = code;