// Enter your domain name here, 
var url = "draperandassociates.com";
//var url = "webdocs";

//var devDirectoryStructure = "cybertron/active_projects/2007/Draper%20&%20Assoc";
var devDirectoryStructure = "";

// 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 breadbrumbs
var divide = "&#8250;";

// Enter text you'd like to see.  You can make this blank as well - "";
var pre = "";

// Enter the character that replaces spaces in your URL (i.e. - or _ or %20)
var sp = "_";

// Enter the extension you use for your pages
var ext = ".html";

// Enter the default file name you use for the root file of your folders
var root = "index";

// Want to replace any folder names with custom names of your own?  Create
// replacement pairs in the following format: swap[i] = 'Old Words|New Words';
swap = new Array(); // Don't touch this line!
// Remove comments from swap array variables below to put them into use.
// Create additional replacement items by increasing the array number [i] as
// you add more lines.

swap[0] = 'about|About';
swap[1] = 'engagements|Engagements';
swap[2] = 'locations|Locations';
swap[3] = 'markets|Markets';
swap[4] = 'search|Search';
swap[5] = 'services|Services';
// etc.

//////////////////////////////////////////////////////////////////////////////

divide = ' ' + divide + ' ';
var a = '' + window.location;

a = a.replace(devDirectoryStructure, "");
//alert("a:" + a + "\n" + a.indexOf(devDirectoryStructure));

var b, code, left, x, y = '';
var foo = root + ext;
var bar = divide + root;

a = a.replace(ext,'');
left = a.lastIndexOf("/");

if (a.substring(a.lastIndexOf('/')) == '/') {
	a = a + root;
}

b = a.substring(left+1);
b = b.replace(new RegExp(sp, 'g'),' ');
b = b.replace(/#/g,divide);

code = divide + b;
b = '/' + b;
b = b.replace(divide,'#');
b = b.replace(/ /g,sp);

a = a.replace(b,'');

if (a.substring(left-1) != '/') {
	do  {
		left = a.lastIndexOf('/');
		b = a.substring(left+1);
		b = b.replace(new RegExp(sp, 'g'),' ');

		code = divide + '<a href="' + foo + '">' + b + '</a>' + code;
		foo = '../' + foo;
		b = '/' + b;
		b = b.replace(/ /g,sp);

		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;
var qIndex = code.lastIndexOf("?");
if(qIndex>=0) {
	//alert("gonna replace ?" );
	code = code.substr(0, qIndex);
}

for (i=0 ; i<swap.length ; i++) {
	x = swap[i].substr(0,swap[i].lastIndexOf('|'));
	
	y = swap[i].substr(swap[i].lastIndexOf('|')+1);
	code = code.replace(new RegExp(x, "g"),y);
}

document.getElementById('breadcrumbs').innerHTML = code;
