// JavaScript Document

// the following are Dreamweaver auto-generated functions

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// This breadcrumbs script created in Feb 2005 by Vivian Black, www.BlacksDesign.com.
// A few parts of this script came from evolt.org, but the script has been almost entirely re-written.

function breadcrumbs(){
	// The key to the breadcrumbs function is the urlTree array.  The 0th element of each array
	// position is the url of every page in the site - a one-to-one mapping. The 1st element is the 
	// url of the parent page. The 3rd element is the actual breadcrumb name you wish to use.  
	// It is critical to load this array properly. Function breadcrumbs identifies the current page, 
	// looks up the currrent page in the urlTree array, extracts the parent page url plus the page's 
	// breadcrumb name, and stores the name in breadCrumbList array.  Function breadcrumbs then starts 
	// looping to find each successive parent page url, putting the url into the breadCrumbsList as it 
	// goes. When function breadcrumbs sees "theEnd" as the parent name, it knows it has reached the
	// root of the tree. Breadcrumbs then stops looping and prints out the array breadCrumbsList.
	
	var COUNT = 0, MAXLOOPS = 100;  // these form the safety break, just in case code goes out of control
	var delimiter = '>';
	var f1 = false
	var treeRoot = "theEnd"; 
	var urlTree = new Array();   // Array should be formed like this: [page url, parent url, breadcrumb name]
	urlTree[0] = ["index.htm", treeRoot, "Home"]; // the zero-th entry should be the root of your tree (home page)
	urlTree[1] = ["bio.htm", "index.htm", "Bio"];
	urlTree[2] = ["contact.htm", "index.htm", "Contact"];
	urlTree[3] = ["consulting.htm", "index.htm", "Consulting"];
	urlTree[4] = ["media.htm", "index.htm", "Media Source"];
	urlTree[5] = ["stockphotography.htm", "index.htm", "Stock Photography"];
	urlTree[6] = ["speaking.htm", "index.htm", "Speaking & Teaching"];
	urlTree[7] = ["travel.htm", "index.htm", "Travel Tips"];
	urlTree[8] = ["whatsnew.htm", "index.htm", "What's New"];
	urlTree[9] = ["writing.htm", "index.htm", "Writing"];
	urlTree[10] = ["publishedPhotos.htm", "stockphotography.htm", "Published Photo Samples"];
	urlTree[11] = ["writingClips.htm", "writing.htm", "Writing Clips"];
	urlTree[12] = ["corporatework.htm", "consulting.htm", "Corporate Work Sample"];
	urlTree[13] = ["StockPhotos/list.htm", "stockphotography.htm", "Alphabetical List of Destinations and Subjects"];
	urlTree[14] = ["search.htm", "stockphotography.htm", "Search"];
	urlTree[15] = ["PublishedPhotos/culturalcrossroads2.htm", "stockphotography.htm", "Fiji-Cultural Crossroads of the Pacific"];
	urlTree[16] = ["PublishedPhotos/fodorsNZ.htm", "publishedPhotos.htm", "Fodor's Exploring New Zealand"];
	urlTree[17] = ["PublishedPhotos/frommers.htm", "publishedPhotos.htm", "Frommer's Australia"];
	urlTree[18] = ["PublishedPhotos/newcal.htm", "publishedPhotos.htm", "New Caledonia Photo Essay"];
	urlTree[19] = ["PublishedPhotos/shanghai2.htm", "publishedPhotos.htm", "Shanghai-China's Rising Star"];
	urlTree[20] = ["PublishedPhotos/stringofpearls.htm", "publishedPhotos.htm", "La Jolla Cove"];
	urlTree[21] = ["PublishedPhotos/vintageblue.htm", "publishedPhotos.htm", "Vintage Blue Bugattis"];
	urlTree[22] = ["travelWritingClips/costco.htm", "writingClips.htm", "Romantic Destinations"];
	urlTree[23] = ["travelWritingClips/insiders.htm", "writingClips.htm", "Insiders' San Diego"];
	urlTree[24] = ["travelWritingClips/knockedup.htm", "writingClips.htm", "Getting Knocked Up Down Under"];
	urlTree[25] = ["travelWritingClips/roomswithaview.htm", "writingClips.htm", "New Zealand Rooms With A View"];
	urlTree[26] = ["travelWritingClips/sydneyoperahouse.htm", "writingClips.htm", "'The House' Is A Home, Too"];
	urlTree[27] = ["travelWritingClips/travelwiseNZ.htm", "writingClips.htm", "Travelwise New Zealand"];
	urlTree[28] = ["travelWritingClips/undiscoveredmexico.htm", "writingClips.htm", "Undiscovered Mexico"];
	urlTree[29] = ["travelWritingClips/vietnam.htm", "writingClips.htm", "Finding Peace in Vietnam"];
	urlTree[30] = ["StockPhotos/afternoontea.htm", "stockphotography.htm", "Afternoon Tea"];
	urlTree[31] = ["StockPhotos/alaska.htm", "stockphotography.htm", "Alaska"];
	urlTree[32] = ["StockPhotos/australia.htm", "stockphotography.htm", "Australia"];
	urlTree[33] = ["StockPhotos/beaches.htm", "stockphotography.htm", "Beaches"];
	urlTree[34] = ["StockPhotos/california.htm", "stockphotography.htm", "California"];
	urlTree[35] = ["StockPhotos/canada.htm", "stockphotography.htm", "Canada"];
	urlTree[36] = ["StockPhotos/cars.htm", "stockphotography.htm", "Cars"];
	urlTree[37] = ["StockPhotos/children.htm", "stockphotography.htm", "Children"];
	urlTree[38] = ["StockPhotos/china.htm", "stockphotography.htm", "China"];
	urlTree[39] = ["StockPhotos/england.htm", "stockphotography.htm", "England"];
	urlTree[40] = ["StockPhotos/fiji.htm", "stockphotography.htm", "Fiji"];
	urlTree[41] = ["StockPhotos/floridakeys.htm", "stockphotography.htm", "Florida Keys"];
	urlTree[42] = ["StockPhotos/flowersGardens.htm", "stockphotography.htm", "Flowers / Gardens"];
	urlTree[43] = ["StockPhotos/france.htm", "stockphotography.htm", "France"];
	urlTree[44] = ["StockPhotos/frenchpoly.htm", "stockphotography.htm", "French Polynesia"];
	urlTree[45] = ["StockPhotos/germany.htm", "stockphotography.htm", "Germany"];
	urlTree[46] = ["StockPhotos/hawaii.htm", "stockphotography.htm", "Hawaii"];
	urlTree[47] = ["StockPhotos/hongkong.htm", "stockphotography.htm", "Hong Kong"];
	urlTree[48] = ["StockPhotos/india.htm", "stockphotography.htm", "India"];
	urlTree[49] = ["StockPhotos/indonesia.htm", "stockphotography.htm", "Indonesia"];
	urlTree[50] = ["StockPhotos/italy.htm", "stockphotography.htm", "Italy"];
	urlTree[51] = ["StockPhotos/markets.htm", "stockphotography.htm", "Markets"];
	urlTree[52] = ["StockPhotos/mexico.htm", "stockphotography.htm", "Mexico"];
	urlTree[53] = ["StockPhotos/montana.htm", "stockphotography.htm", "Montana"];
	urlTree[54] = ["StockPhotos/nevada.htm", "stockphotography.htm", "Nevada"];
	urlTree[55] = ["StockPhotos/newcaledonia.htm", "stockphotography.htm", "New Caledonia"];
	urlTree[56] = ["StockPhotos/newzealand.htm", "stockphotography.htm", "New Zealand"];
	urlTree[57] = ["StockPhotos/indigenousPeople.htm", "stockphotography.htm", "Indigenous People"];
	urlTree[58] = ["StockPhotos/sandiego.htm", "stockphotography.htm", "San Diego"];
	urlTree[59] = ["StockPhotos/singapore.htm", "stockphotography.htm", "Singapore"];
	urlTree[60] = ["StockPhotos/washington.htm", "stockphotography.htm", "Washington"];
	urlTree[61] = ["StockPhotos/panama.htm", "stockphotography.htm", "Panama"];
	urlTree[62] = ["StockPhotos/vietnam.htm", "stockphotography.htm", "Vietnam"];
	urlTree[63] = ["StockPhotos/newmexico.htm", "stockphotography.htm", "New Mexico"];
	urlTree[64] = ["StockPhotos/lajolla.htm", "stockphotography.htm", "La Jolla"];
	urlTree[65] = ["travelWritingClips/escondido.htm", "writingClips.htm", "Vaya Con Escondido"];
	urlTree[66] = ["travelWritingClips/gimmeshelterNZ.htm", "writingClips.htm", "Gimme Shelter, New Zealand Style"];
	urlTree[67] = ["PublishedPhotos/hongkong.htm", "publishedPhotos.htm", "Insiders' Hong Kong"];
	urlTree[68] = ["PublishedPhotos/maori.htm", "publishedPhotos.htm", "Indigenous Peoples - Maori"];
	urlTree[69] = ["PublishedPhotos/shearer.htm", "publishedPhotos.htm", "Animals that Live on the Farm - Sheep"];
	
	var breadCrumbList = new Array();
	var i = 0, j, k = 0;
	var outputStr = "", parentName = "";
    var urlString = (location.pathname.indexOf('?') != -1) ? location.pathname.substring(0, location.pathname.indexOf('?')) : location.pathname;
        urlString = (location.pathname.charAt(0) == '/') ? location.pathname.substring(1) : location.pathname;
    // var aURL = sURL.split('/');
	
	outputStr = '<A HREF="/' + urlTree[0][0] + '">' + urlTree[0][2] + '</A> ' + delimiter + ' ';
	while (i < urlTree.length && !f1) {
		if (urlString == urlTree[i][0]) {
			// get the breadcrumb name and stick it into the list
			breadCrumbList[k] = urlTree[i][2];
			k++;
			// now find the parents of the current page and start building the breadcrumb list
			j = 0;
			parentName = urlTree[i][1];
			while ((j < urlTree.length) && (COUNT < MAXLOOPS)) {
				COUNT++;
				if (parentName == urlTree[j][0]) {
					if (urlTree[j][1] != treeRoot) {
						// we found a parent and we're not at the root of the tree yet; add parent 
						// to breadcrumb list and grab the next parent name to look for
						breadCrumbList[k] = '<A HREF="/' + urlTree[j][0] + '">' + urlTree[j][2] + '</A> ' + delimiter + ' '; 
						k++;
						parentName = urlTree[j][1];
						j = -1;
					} // end if (urlTree)
					else {
						j = urlTree.length;
					} // end else (urlTree)
				} // end if (parentName)
				j++;
			} // end middle while
			// we found the page name so set flag to true to knock ourselves out of the loop
			f1 = true;
		} // end if (urlString)
		i++;
	} // end outer while
	
    // now extract the breadcrumbs out of array breadCrumbList and format for output to HTML
	for (i = breadCrumbList.length - 1; i >= 0; i--) {
		outputStr += breadCrumbList[i];
	} // end for
    document.write(outputStr);
} // end  function breadcrumbs
