﻿/*#################################################################### js_paths.js						Version1.5# Copyright (c) 2001-2003 by Henning Poerschke          WebMediaConception.com## This script's idea is based on code by Kevin Lynn Brown found at:# The JavaScript Source!! http://javascript.internet.com# # This program is free software; you can redistribute it and/or modify it under the terms# of the GNU General Public License as published by the Free Software Foundation; # either version 2 of the License, or (at your option) any later version.# # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.# See the GNU General Public License for more details.# # You should have received a copy of the GNU General Public License along with this program;# if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA# #####################################################################*//*# ABOUT THIS SCRIPT## js_paths.js takes the current document's location.href and splits it up into its# various elements: protocol, folder hierarchy, and file name.# It then offers choices if and how to display these elements.## There's a built in naming convention that can be overridden at will for specific# folders and/or files.## Finally it puts everything back together and spits out the breadcrumb.## HANDLING OF FOLDER HIERARCHY## Since js_paths.js was created to work offline# unwanted results are to be expected, like a breadcrumb that is so long that it fills half the page# because of a gazillion folders in its path.*/if (window.location){	//just in case. haven't checked this out. are there any browser quirks with location.href?var path="";		// to hold the complete breadcrumb pathvar href=window.location.href;pref = new Array();	// for "partial href"s=href.split("/");		// s: array that hold the folders' namesfname=new Array();	// fname: "full name" that will be displayedparts=new Array();	// hold fname's parts[1]_parts[2]for (i=2;i<(s.length-1);i++){pref[2]=s[2]+"\/";pref[i+1]=pref[i]+s[i+1]+"/";};i=s.length-2;pref[i+1]=pref[i]+s[i+1];for (i=2;i<(s.length-1);i++){fname[i]=s[i];/* Here you can suppress display of folders' namesby assigning an empty fname string,or change names to be displayed.*/if 	(s[i]=="depts.washington.edu"){fname[i]=""}			//This is where you may rename or suppress directorieselse if (s[i]=="localhost"){fname[i]=""}else if (s[i]=="depts.washington.edu/safs/res/"){fname[i]="SAFS Reservations"}				//This makes "yourdomain.com" invisibleelse if (s[i]=="www.depts.washington.edu/safs/res/"){fname[i]="SAFS Reservations"}else if (s[i]=="C\:"){fname[i]=""}			//When developing your site locally, suppress local directorieselse if (s[i]=="C|"){fname[i]=""}			//this is for Communicator 4.77winelse if (s[i]=="MY%20SITES"){fname[i]=""}else if (s[i]=="MY SITES"){fname[i]=""}		//this is for Communicator 4.77winelse if (s[i]=="consulting"){fname[i]="[Consulting]"}	//If you have a folder/directory you want to show but not have else if (s[i]=="design"){fname[i]="web_design"}		//a link to it, put it in [square brackets]									//Note: this will disable auto capitalization/* Parse fname string and put it back togather as pnoun ('propper noun')You can actually give a name to a folder here, consisting of more than one word.To do so, separate the words with an underline "_". */if (fname[i].charAt(0) !== "<")			// look at the first character. unless it's an '<'...e.g.<img>	{	pnoun = fname[i].charAt(0).toUpperCase();	// first character to upper case	for (j=1;j<(fname[i].length);j++)		{		var k = j-1;					// k designates the character following the "_"		if (fname[i].charAt(j) == "_")		// if there is an "_"...			{			pnoun+= " ";			// ...replace it with a space.			}		else if (fname[i].charAt(k) == "_")	// If  there is a "_" in front... 			{			pnoun+=fname[i].charAt(j).toUpperCase(); // ...capitalize the following character			}		else 		{			pnoun+=fname[i].charAt(j);	// Append each original character in fname onto pnoun		}		}	fname[i]=pnoun.toUpperCase();	// Replace fname with pnoun. (Optionally add ".toUpperCase()" if you want ALL upper case names.)	}};	//ops! Just a reminder to myself--was afraid this might get lost :-)/* This writes the breadcrumb links.Notice: I'm appending "index.htm" to the link here. Change this to your file type extension.*/for (i=2;i<(s.length-2);i++){(fname[i] == "")?(path+=""):((fname[i].charAt(0)=="[")?(path+=fname[i]+" "):(path+="<a href=\""+href.substring(0,href.indexOf(pref[i])+pref[i].length)+"index.html\">"+fname[i]+"</a> \: "));}i=s.length-2;(fname[i] == "")?(path+=""):((fname[i].charAt(0)=="[")?(path+=fname[i]+"  "):(path+="<a href=\""+href.substring(0,href.indexOf(pref[i])+pref[i].length)+"index.html\">"+fname[i]+"</a> \:\&nbsp;<span id=\"crumbwhite\"> "));/*maybe someday get the final page of the trail to take a custom color without it applying to all ensuing text<span id=\"crumbwhite\"> </span> */i=s.length-1;fullname=s[i].substring(0,s[i].indexOf("."));/* For any files not adhering to the naming scheme, you may specify a custom display name here: You can give a name to a page here, consisting of more than one word.To do so, separate the words with an underline "_".*/if (fullname==""){fullname="Home"}if (fullname=="index"){fullname="Home"}else if (fullname=="crptcnme"){fullname="some_name"}else {};pnoun = fullname.charAt(0).toUpperCase();		// first character to upper casefor (i=1;i<(fullname.length);i++){var k = i-1;								// k designates the character following the "_"if (fullname.charAt(i) == "_")					// if there is an "_"...	{	pnoun+= " ";						// ...replace it with a space.	}else if (fullname.charAt(k) == "_")				// If  there is a "_" in front...	{	pnoun+=fullname.charAt(i).toUpperCase();	// ...capitalize the following character	}else	{	pnoun+=fullname.charAt(i);				// Append each original character in fullname onto pnoun	}};path+=pnoun;//url=window.location.protocol+"//"+path;	                    //use only to display protocol type (ftp://; http://)url=path;								//If you do, comment out this line insteaddocument.write(url);}//done