// trim function to remove white space at front and back of a string.
String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}


function breadcrumb()
	{

		// Get title of current page
		var gtTitle = document.title;
		var gtControl = '/';

		// get absolute URL
		var gtGetUrl = escape(location.pathname.indexOf('?') != -1) ? location.pathname.substring(0, location.pathname.indexOf('?')) : location.pathname;
		gtGetUrl = (location.pathname.charAt(0) == '/') ? location.pathname.substring(1) : location.pathname;
		var gtUrl = gtGetUrl.split('/');
	
		// indentifying URL and creating it
		if(gtUrl)
		{
			// defining output of breadcrumb
			var gtOutput = '<ul><li><a href="/" target="_self">Home</a></li> ';
			
			// for controlling sub-sites where the / isn't the root
			

			var gtPath = '' + gtControl;
	
			// looping through folders
			// i = 0 for site root, i= 1 for folder within site
			for(var i = 0; i < gtUrl.length - 1; i++)
			{
				gtPath += gtUrl[i] + '/';						
				//gtOutput += '<li><a href="' + gtPath + '"';
				var gtVpath = '';
				var gtVurl = '/';
				gtVurl = gtUrl[i].split('-');
				if(gtVurl)
				{
					for(var n= 0; n < gtVurl.length; n++)
					{
						gtVpath += gtVurl[n] + ' ';
					}
				}
			
				var trimmed01 = new String(gtVpath);
				var trimmed02 = new String(gtTitle);
				// trim it!
				trimmed01 = trimmed01.trim();
				trimmed02 = trimmed02.trim();

				//if (trimmed01 == trimmed02) {
				
				//}

				//if (i == gtUrl.length - 2)
				gtVpath = gtVpath.replace('_',' ');
				if (trimmed01 == trimmed02 && i == (gtUrl.length -1)) {
					gtOutput += '<li>' + gtTitle + '</li>'; //</ul>';
				} else if (i == gtUrl.length - 2) {
					gtOutput += '<li><a href="' + gtPath + 'index.asp' + '" target="_self">' + gtVpath + '</a></li>' + '<li>' + gtTitle + '</li>'; //</ul>';
				} else {
					gtOutput += '<li><a href="' + gtPath + 'index.asp' + '" target="_self">' + gtVpath + '</a></li>';
				}
			}	
			gtOutput += '</ul>';							
			document.write(unescape(gtOutput));
		}
	}





