/* -------------------------------------------------------------------
	File: common.js
	Description: holds common javascript for the web site.
------------------------------------------------------------------- */


// constants for titles.
var g_sGENERAL_MAIN_TITLE = 'Pete\'s Web Site';
var g_sFRAMESET_TITLE = g_sGENERAL_MAIN_TITLE;
var g_sMAIN_TITLE_ANTARCTIC_PICTURES = 'Pete\'s Antarctic Pictures, 1984 - 1988';
var g_sMAIN_TITLE_ANTARCTIC_SITE = 'Pete\'s Antarctic Site';
var g_sMAIN_TITLE_HIKING = 'Pete\'s Hikes';

// Constants for the image scale mode.
var g_iSCALE_ACTUAL_SIZE = 0;
var g_iSCALE_SCALE_TO_FIT = 1;
var g_iSCALE_PERCENT = 2;

// Constants for body style classes.
var g_sCLASS_BODY_ANTARCTIC = "BodyAntarctic";
var g_sBODY_HOME = "BodyHome";
var g_sBODY_HIKES = "BodyHikes";
var g_sBODY_DEFAULT = g_sBODY_HOME;
var g_sBODY_TRAVELS = "BodyTravels";

// height of the scale selector frame when it's not hidden.
//var g_sSCALE_SELECTOR_FRAME_HEIGHT = '55';

// Menu text for back and home buttons.
var g_sMenuText_Back = '<b>Back:</b><br>Back one page.';
var g_sMenuText_Home = '<b>Home:</b><br>Back to my home page.';

function IsBrowserIE() {
	if ('Microsoft Internet Explorer' == window.navigator.appName) {
		return (true);
	}
	else {
		return (false);
	}
}


function OnWindowResize() {
	if (!window.top.oBanner.AdjustBannerHeight()) {
		window.setTimeout(window.top.oBanner.AdjustBannerHeight,100);
	}
	
	window.top.oDetails.Resize();
}

/* -------------------------------------------------------------------
              GLOBAL WINDOW CALLBACK FUNCTIONS.
------------------------------------------------------------------- */



// This will launch the image in a separate window.	
function LaunchImage(oImg, iWidth, iHeight) {
	var iCurrWidth = oImg.width;
	var sPos = '';
	var iMaxHeight = screen.availHeight - 50;
	var iMaxWidth = screen.availWidth - 50;
	var iBrowserWidth;
	var iBrowserHeight;

	if (3 == arguments.length ) {
		// Passed an actual width and hieght of the image, use those.
		iBrowserWidth = iWidth + 20;
		iBrowserHeight = iHeight + 20;
	}
	else {
		// Use the dimensions in the scale selector.
		iBrowserWidth = window.top.oScaleSelector.ImageActualWidth;
		iBrowserHeight = window.top.oScaleSelector.ImageActualHeight;
	}

	
	if (iBrowserWidth > iMaxWidth) {
		iBrowserWidth = iMaxWidth;
		// Position it also.
		sPos = 'top=10,';
	}
	if (iBrowserHeight > iMaxHeight) {
		iBrowserHeight = iMaxHeight;
		sPos += 'left=10,';
	}
	
	window.open(oImg.src,'_blank',sPos + 'height=' + iBrowserHeight +'px,width=' + iBrowserWidth + 'px,location=no,menubar=no,status=no,titlebar=no,toolbar=no,resizable=yes');
}

// Called from the onload event of pages in the "navigation" frame.
function DoNavPageOnload(oPage,sMainTitle, sSubTitle, sBannerText, sBodyClassName, sDetailsPagePassed) {
	var sDetailsPage;
	var oNavShortcut; // CNavShortcut object

	// Now that we have set up the requested nav page, if there's anything in the requested 
	// nav path object, we'll load that one.
	if (0 < window.top.oRequestedNavPath.GetLength()) {
		while ( 1 < window.top.oRequestedNavPath.GetLength()) {
			 oNavShortcut = window.top.oRequestedNavPath.PopNav();
			 window.top.oNavInfo.PushNav(oNavShortcut.Title, oNavShortcut.Href, 'navigation');
		}
	 oNavShortcut = window.top.oRequestedNavPath.PopNav();
		SetNavpage(oNavShortcut.Href);
		return false;
	}

	// If they didn't pass a details page to use for this banner...
	if (arguments.length == 5) {	
		// Default to the main one used for displaying thumbnails..
		sDetailsPage = window.top.oNavInfo.BuildPath('common/details.htm');
	}
	else {
		sDetailsPage = sDetailsPagePassed;
	}

	// Set the page's class to the passed in name.
	oPage.document.body.className = sBodyClassName;

	// Set the scale frame to the matching class.
	window.top.oScaleSelector.SetBodyClass(sBodyClassName);
	
	// hide the scale frame, no matter what.
	window.top.oScaleSelector.Hide();

	
	// reload the details page now, no matter what. ThumbnailOnclick() will reset it when displaying an image.
	//window.top.oDetails.SetSrcPage(sDetailsPage,sBodyClassName);

	window.parent.oNavInfo.PushNav(oPage.document.title, oPage.location.href, "navigation");
	
	window.top.oBanner.SetupBanner(sMainTitle,sSubTitle,sBannerText,sBodyClassName);
	
	// And hide any pictures in the details frame.
	window.top.oDetails.HideDetails();
	window.top.oDetails.SetMouseOverText(' ');
	return true;
}		// DoNavPageOnload();


// this is used from the onclick handler for a menu item that links to another navigation page.
function SetNavpage(sSrc) {
	window.top.frames["navigation"].document.location.href= sSrc;
}


// Used for launching a new browser window for off-site links.
function LaunchNewWindow(sSrc,sName) {
	var oNewWindow = window.open(sSrc,sName);
	oNewWindow.focus();
}


// This will handle the mouse over or mouse out events on menu items.
function DoMenuMouseOverOrOut(oObject, bOver, sText) {
	var sFontStyle;
	var sCursor;

//!	try {
		if (bOver) {
			oObject.className = "MenuItemReverse";
		}
		else {
			oObject.className = "MenuItem";
		}
		if (arguments.length > 2) {
			window.top.oDetails.SetMouseOverText(sText);
		}
//	}
//	catch (e) {
//		null;
//	}
}

// This is called from a onPageLoaded event handler, to do the
// choice if there was one passed in the "choice=" argument.
function DoMenuChoiceIfPassed() {
	var asArgs;
	var sChoice = '';
	try {
		// Select the choice, if it was passed. Format is ?choice=[id of <td> menu item with an onclick event to click.]
		if (0 < document.location.search.length) {
			asArgs = (document.location.search).split('=');
			if (1 < asArgs.length) {
				sChoice = asArgs[1];
				if (IsBrowserIE()) {
					document.getElementById(asArgs[1]).click();
				}
				else {
					document.getElementById(asArgs[1]).onclick();
				}
				if ('hr' == sChoice.substring(0,2)) {
					// Choice was an href, so we just positioned the page on it. Now look
					// for a td object to do a click (by my convention, if you pass an href as a 
					// choice, you can have a matching td object (with the same name except it starts
					// with td instead of hr) whose click() function will be invoked.
					sChoice = 'td' + sChoice.substr(2,sChoice.length);
					if (IsBrowserIE()) {
						document.getElementById(sChoice).click();
					}
					else {
						document.getElementById(sChoice).onclick();
					}
				}
				// If it's an image, we're gonna want to resize it.
				window.setTimeout(DoResizeOnly,100);
			}
		}
	}
	catch (e) {
	}
	return sChoice;
}

function DoResizeOnly() {
	window.top.oDetails.Resize();
}

/* -------------------------------------------------------------------
	Object: CRequestedNavPath
	Description: This object stores a list of navigation pages, in the order
	             they need to be navigated in. DoNavPageOnload() checks to
	             see if this object has anything in it, and if it does,
	             calls SetNavPage() with the last item in this list instead
	             of the requested page.
------------------------------------------------------------------- */
function CRequestedNavPath() {
	var aRequestedNavPaths = new Array();
	this.PushNav = _PushNav;
	this.PopNav = _PopNav;
	this.GetLength = _GetLength;
	this.GeneratePaths = _GeneratePaths;
	
	
	function _PushNav(sPath) {
		aRequestedNavPaths.push(sPath);
	}
	
	function _PopNav() {
		return aRequestedNavPaths.pop();
	}
	
	function _GetLength() {
		return aRequestedNavPaths.length;
	}
	
	// Pass this a nav page, and this function will load up the navigation
	// path to get there. Note that items are pushed in last on first out order!
	// sSearch is formatted as:
	//		?page=[nav page]&choice=[menu choice]
	function _GeneratePaths(sSearch) {
		var sNavPage;
		var asArgs;
		var sChoice;
		var oNavInfo;
		aRequestedNavPaths = new Array();

		if (0 < sSearch.length) {
			asArgs = (document.location.search).split('&');
			if ( 0 < asArgs.length) {
				sNavPage = ((asArgs[0]).split('='))[1];
				if ( 1 < asArgs.length) {
					sChoice = '?choice=' + ((asArgs[1]).split('='))[1];
				}
				else {
					sChoice = '';
				}
			}
		}
		
		// -------------------------------------------------------------------
		// admin
		// -------------------------------------------------------------------
		if ('navpage_admin.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Site Admin', window.top.oNavInfo.BuildPath('admin/navpage_admin.htm') + sChoice));
			_PushNav(new CNavShortcut('Home',       window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// hikes
		// -------------------------------------------------------------------
		else if ('navpage_hikes.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Pete\'s Hiking Site', window.top.oNavInfo.BuildPath('hikes/navpage_hikes.htm') + sChoice));
			_PushNav(new CNavShortcut('Home',                window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		else if ('navpage_granvillenotchvt.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Granville Notch, VT', window.top.oNavInfo.BuildPath('hikes/navpage_granvillenotchvt.htm') + sChoice));
			_PushNav(new CNavShortcut('Pete\'s Hiking Site', window.top.oNavInfo.BuildPath('hikes/navpage_hikes.htm')));
			_PushNav(new CNavShortcut('Home',                window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		else if ('navpage_monasterymountainvt.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Monastery Mountain, VT', window.top.oNavInfo.BuildPath('hikes/navpage_monasterymountainvt.htm') + sChoice));
			_PushNav(new CNavShortcut('Pete\'s Hiking Site',    window.top.oNavInfo.BuildPath('hikes/navpage_hikes.htm')));
			_PushNav(new CNavShortcut('Home',                   window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		else if ('navpage_goosepondandwoodwardmt.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Goose Pond and Woodward Mountain, VT', window.top.oNavInfo.BuildPath('hikes/navpage_goosepondandwoodwardmt.htm') + sChoice));
			_PushNav(new CNavShortcut('Pete\'s Hiking Site', window.top.oNavInfo.BuildPath('hikes/navpage_hikes.htm')));
			_PushNav(new CNavShortcut('Home',                   window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// interesting_stuff
		// -------------------------------------------------------------------
		else if ("navpage_telemarketing.htm" == sNavPage)  {
			_PushNav(new CNavShortcut('Telemarketing "Hall of Fame"', window.top.oNavInfo.BuildPath('interesting_stuff/navpage_telemarketing.htm') + sChoice));
			_PushNav(new CNavShortcut('Interesting Stuff',            window.top.oNavInfo.BuildPath('interesting_stuff/navpage_interestingstuff.htm')));
			_PushNav(new CNavShortcut('Home',                         window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		else if ('navpage_interestingstuff.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Interesting Stuff', window.top.oNavInfo.BuildPath('interesting_stuff/navpage_interestingstuff.htm') + sChoice));
			_PushNav(new CNavShortcut('Home',              window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// oddsandends
		// -------------------------------------------------------------------
		else if ('navpage_oddsandends.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Odds and Ends', window.top.oNavInfo.BuildPath('oddsandends/navpage_oddsandends.htm') + sChoice));
			_PushNav(new CNavShortcut('Home',          window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		else if ('navpage_funny_dogs.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Funny Dogs',    window.top.oNavInfo.BuildPath('oddsandends/funny_dogs/navpage_funny_dogs.htm') + sChoice));
			_PushNav(new CNavShortcut('Odds and Ends', window.top.oNavInfo.BuildPath('oddsandends/navpage_oddsandends.htm')));
			_PushNav(new CNavShortcut('Home',          window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		else if ('navpage_kibbe.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Kibbe Glover',  window.top.oNavInfo.BuildPath('oddsandends/kibbe/navpage_kibbe.htm') + sChoice));
			_PushNav(new CNavShortcut('Odds and Ends', window.top.oNavInfo.BuildPath('oddsandends/navpage_oddsandends.htm')));
			_PushNav(new CNavShortcut('Home',          window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		else if ('navpage_more_dogs.htm' == sNavPage) {
			_PushNav(new CNavShortcut('More Dogs',    window.top.oNavInfo.BuildPath('oddsandends/more_dogs/navpage_more_dogs.htm') + sChoice));
			_PushNav(new CNavShortcut('Odds and Ends', window.top.oNavInfo.BuildPath('oddsandends/navpage_oddsandends.htm')));
			_PushNav(new CNavShortcut('Home',          window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica
		// -------------------------------------------------------------------
		else if ('navpage_antarctica.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Antarctica', window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm') + sChoice));
			_PushNav(new CNavShortcut('Travels',    window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',       window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (cargoid reunion)
		// -------------------------------------------------------------------
		else if ('navpage_cargoid_reunion.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Cargoid Reunion', window.top.oNavInfo.BuildPath('travels/antarctica/navpage_cargoid_reunion.htm') + sChoice));
			_PushNav(new CNavShortcut('Antarctica',      window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',         window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',            window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (memorabilia)
		// -------------------------------------------------------------------
		else if ('navpage_antarcticmemorabilia.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Antarctic Memorabilia', window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarcticmemorabilia.htm') + sChoice));
			_PushNav(new CNavShortcut('Antarctica',            window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',               window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',                  window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}

		// -------------------------------------------------------------------
		// travels/antarctica (In the Air Over Antarctica)
		// -------------------------------------------------------------------
		else if ('navpage_intheair.htm' == sNavPage) {
			_PushNav(new CNavShortcut('In the Air Over Antarctica', window.top.oNavInfo.BuildPath('travels/antarctica/navpage_intheair.htm') + sChoice));
			_PushNav(new CNavShortcut('Antarctica',                 window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',                    window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',                       window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (McMurdo)
		// -------------------------------------------------------------------
		else if ('navpage_mcmurdo.htm' == sNavPage) {
			_PushNav(new CNavShortcut('McMurdo Station',window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo.htm') + sChoice));
			_PushNav(new CNavShortcut('Antarctica',     window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',        window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',           window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (McMurdo Scenery)
		// -------------------------------------------------------------------
		else if ('navpage_mcmurdo_scenery.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Scenery',        window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo_scenery.htm') + sChoice));
			_PushNav(new CNavShortcut('McMurdo Station',window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo.htm')));
			_PushNav(new CNavShortcut('Antarctica',     window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',        window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',           window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (McMurdo Aircraft)
		// -------------------------------------------------------------------
		else if ('navpage_mcmurdo_aircraft.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Aircraft',        window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo_aircraft.htm') + sChoice));
			_PushNav(new CNavShortcut('McMurdo Station',window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo.htm')));
			_PushNav(new CNavShortcut('Antarctica',     window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',        window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',           window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (McMurdo Castle Rock)
		// -------------------------------------------------------------------
		else if ('navpage_mcmurdo_castlerock.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Castle Rock Hike', window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo_castlerock.htm') + sChoice));
			_PushNav(new CNavShortcut('McMurdo Station',  window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo.htm')));
			_PushNav(new CNavShortcut('Antarctica',       window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',          window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',             window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (McMurdo Scott's Discovery Hut)
		// -------------------------------------------------------------------
		else if ('navpage_mcmurdo_discoveryhut.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Scott\'s Discovery Hut', window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo_discoveryhut.htm') + sChoice));
			_PushNav(new CNavShortcut('McMurdo Station',        window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo.htm')));
			_PushNav(new CNavShortcut('Antarctica',             window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',                window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',                   window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}

		// -------------------------------------------------------------------
		// travels/antarctica (McMurdo Ice Caves)
		// -------------------------------------------------------------------
		else if ('navpage_mcmurdo_icecaves.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Ice Caves',       window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo_icecaves.htm') + sChoice));
			_PushNav(new CNavShortcut('McMurdo Station', window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo.htm')));
			_PushNav(new CNavShortcut('Antarctica',      window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',         window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',            window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (McMurdo People)
		// -------------------------------------------------------------------
		else if ('navpage_mcmurdo_people.htm' == sNavPage) {
			_PushNav(new CNavShortcut('People',          window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo_people.htm') + sChoice));
			_PushNav(new CNavShortcut('McMurdo Station', window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo.htm')));
			_PushNav(new CNavShortcut('Antarctica',      window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',         window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',            window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (McMurdo USCGC Polar Star)
		// -------------------------------------------------------------------
		else if ('navpage_mcmurdo_polarstar.htm' == sNavPage) {
			_PushNav(new CNavShortcut('USCGC Polar Star', window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo_polarstar.htm') + sChoice));
			_PushNav(new CNavShortcut('McMurdo Station',  window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo.htm')));
			_PushNav(new CNavShortcut('Antarctica',       window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',          window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',             window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}

		// -------------------------------------------------------------------
		// travels/antarctica (McMurdo Wildlife)
		// -------------------------------------------------------------------
		else if ('navpage_mcmurdo_wildlife.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Wildlife',         window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo_wildlife.htm') + sChoice));
			_PushNav(new CNavShortcut('McMurdo Station',  window.top.oNavInfo.BuildPath('travels/antarctica/navpage_mcmurdo.htm')));
			_PushNav(new CNavShortcut('Antarctica',       window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',          window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',             window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (South Pole)
		// -------------------------------------------------------------------
		else if ('navpage_southpole.htm' == sNavPage) {
			_PushNav(new CNavShortcut('South Pole Station',window.top.oNavInfo.BuildPath('travels/antarctica/navpage_southpole.htm') + sChoice));
			_PushNav(new CNavShortcut('Antarctica',        window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',           window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',              window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (South Pole facilities)
		// -------------------------------------------------------------------
		else if ('navpage_southpole_facilities.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Facilities',        window.top.oNavInfo.BuildPath('travels/antarctica/navpage_southpole_facilities.htm') + sChoice));
			_PushNav(new CNavShortcut('South Pole Station',window.top.oNavInfo.BuildPath('travels/antarctica/navpage_southpole.htm')));
			_PushNav(new CNavShortcut('Antarctica',        window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',           window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',              window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (South Pole Work)
		// -------------------------------------------------------------------
		else if ('navpage_southpole_work.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Work',              window.top.oNavInfo.BuildPath('travels/antarctica/navpage_southpole_work.htm') + sChoice));
			_PushNav(new CNavShortcut('South Pole Station',window.top.oNavInfo.BuildPath('travels/antarctica/navpage_southpole.htm')));
			_PushNav(new CNavShortcut('Antarctica',        window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',           window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',              window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (South Pole People)
		// -------------------------------------------------------------------
		else if ('navpage_southpole_people.htm' == sNavPage) {
			_PushNav(new CNavShortcut('People',            window.top.oNavInfo.BuildPath('travels/antarctica/navpage_southpole_people.htm') + sChoice));
			_PushNav(new CNavShortcut('South Pole Station',window.top.oNavInfo.BuildPath('travels/antarctica/navpage_southpole.htm')));
			_PushNav(new CNavShortcut('Antarctica',        window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',           window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',              window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (South Pole Scenery)
		// -------------------------------------------------------------------
		else if ('navpage_southpole_scenery.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Scenery',           window.top.oNavInfo.BuildPath('travels/antarctica/navpage_southpole_scenery.htm') + sChoice));
			_PushNav(new CNavShortcut('South Pole Station',window.top.oNavInfo.BuildPath('travels/antarctica/navpage_southpole.htm')));
			_PushNav(new CNavShortcut('Antarctica',        window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',           window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',              window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/antarctica (Palmer)
		// -------------------------------------------------------------------
		else if ('navpage_palmer.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Palmer Station', window.top.oNavInfo.BuildPath('travels/antarctica/navpage_palmer.htm') + sChoice));
			_PushNav(new CNavShortcut('Antarctica',     window.top.oNavInfo.BuildPath('travels/antarctica/navpage_antarctica.htm')));
			_PushNav(new CNavShortcut('Travels',        window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',           window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/Georgia
		// -------------------------------------------------------------------
		else if ('navpage_koinonia.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Georgia (Koinonia Farm)', window.top.oNavInfo.BuildPath('travels/Georgia/navpage_koinonia.htm') + sChoice));
			_PushNav(new CNavShortcut('Travels',    window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',       window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/Italy/May2001
		// -------------------------------------------------------------------
		else if ('navpage_ItalyMay2001.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Italy, May 2001', window.top.oNavInfo.BuildPath('travels/Italy/May2001/navpage_ItalyMay2001.htm') + sChoice));
			_PushNav(new CNavShortcut('Travels',         window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',            window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/NewZealand
		// -------------------------------------------------------------------
		else if ('navpage_NewZealand.htm' == sNavPage) {
			_PushNav(new CNavShortcut('New Zealand', window.top.oNavInfo.BuildPath('travels/NewZealand/navpage_NewZealand.htm') + sChoice));
			_PushNav(new CNavShortcut('Travels',     window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',        window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/NewZealand/March1987
		// -------------------------------------------------------------------
		else if ('navpage_NewZealandMarch1987.htm' == sNavPage) {
			_PushNav(new CNavShortcut('March 1987', window.top.oNavInfo.BuildPath('travels/NewZealand/March1987/navpage_NewZealandMarch1987.htm') + sChoice));
			_PushNav(new CNavShortcut('New Zealand', window.top.oNavInfo.BuildPath('travels/NewZealand/navpage_NewZealand.htm')));
			_PushNav(new CNavShortcut('Travels',     window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',        window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/NewZealand/March1987 Abel Tasman
		// -------------------------------------------------------------------
		else if ('navpage_AbelTasman.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Abel Tasman National Park', window.top.oNavInfo.BuildPath('travels/NewZealand/March1987/navpage_AbelTasman.htm') + sChoice));
			_PushNav(new CNavShortcut('March 1987',                window.top.oNavInfo.BuildPath('travels/NewZealand/March1987/navpage_NewZealandMarch1987.htm')));
			_PushNav(new CNavShortcut('New Zealand',               window.top.oNavInfo.BuildPath('travels/NewZealand/navpage_NewZealand.htm')));
			_PushNav(new CNavShortcut('Travels',                   window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',                      window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}

		// -------------------------------------------------------------------
		// travels/NewZealand/March1987 Routeburn and Greenstone Tracks
		// -------------------------------------------------------------------
		else if ('navpage_RouteburnAndGreenstoneTracks.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Routeburn and Greenstone Tracks', window.top.oNavInfo.BuildPath('travels/NewZealand/March1987/navpage_RouteburnAndGreenstoneTracks.htm') + sChoice));
			_PushNav(new CNavShortcut('March 1987',                      window.top.oNavInfo.BuildPath('travels/NewZealand/March1987/navpage_NewZealandMarch1987.htm')));
			_PushNav(new CNavShortcut('New Zealand',                     window.top.oNavInfo.BuildPath('travels/NewZealand/navpage_NewZealand.htm')));
			_PushNav(new CNavShortcut('Travels',                         window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',                            window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/NewZealand/March1992
		// -------------------------------------------------------------------
		else if ('navpage_NewZealandMarch1992.htm' == sNavPage) {
			_PushNav(new CNavShortcut('March 1992', window.top.oNavInfo.BuildPath('travels/NewZealand/March1992/navpage_NewZealandMarch1992.htm') + sChoice));
			_PushNav(new CNavShortcut('New Zealand', window.top.oNavInfo.BuildPath('travels/NewZealand/navpage_NewZealand.htm')));
			_PushNav(new CNavShortcut('Travels',     window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',        window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/NewZealand/March1992 Nelson Lakes
		// -------------------------------------------------------------------
		else if ('navpage_NelsonLakes.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Nelson Lakes National Park', window.top.oNavInfo.BuildPath('travels/NewZealand/March1992/navpage_NelsonLakes.htm') + sChoice));
			_PushNav(new CNavShortcut('March 1992',                 window.top.oNavInfo.BuildPath('travels/NewZealand/March1992/navpage_NewZealandMarch1992.htm')));
			_PushNav(new CNavShortcut('New Zealand',                window.top.oNavInfo.BuildPath('travels/NewZealand/navpage_NewZealand.htm')));
			_PushNav(new CNavShortcut('Travels',                    window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',                       window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/NewZealand/March1992 West Coast
		// -------------------------------------------------------------------
		else if ('navpage_westcoast.htm' == sNavPage) {
			_PushNav(new CNavShortcut('West Coast',  window.top.oNavInfo.BuildPath('travels/NewZealand/March1992/navpage_westcoast.htm') + sChoice));
			_PushNav(new CNavShortcut('March 1992',  window.top.oNavInfo.BuildPath('travels/NewZealand/March1992/navpage_NewZealandMarch1992.htm')));
			_PushNav(new CNavShortcut('New Zealand', window.top.oNavInfo.BuildPath('travels/NewZealand/navpage_NewZealand.htm')));
			_PushNav(new CNavShortcut('Travels',     window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',        window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels/Russia/August1997
		// -------------------------------------------------------------------
		else if ('navpage_russia_august1997.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Russia, 1997', window.top.oNavInfo.BuildPath('travels/Russia/August1997/navpage_russia_august1997.htm')));
			_PushNav(new CNavShortcut('Travels',      window.top.oNavInfo.BuildPath('travels/navpage_travels.htm')));
			_PushNav(new CNavShortcut('Home',         window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
		// -------------------------------------------------------------------
		// travels
		// -------------------------------------------------------------------
		else if ('navpage_travels.htm' == sNavPage) {
			_PushNav(new CNavShortcut('Travels', window.top.oNavInfo.BuildPath('travels/navpage_travels.htm') + sChoice));
			_PushNav(new CNavShortcut('Home',    window.top.oNavInfo.BuildPath('navpage_home.htm')));
		}
	}		// function _GeneratePaths()
	
}		// function CRequestedNavPath() 


/* -------------------------------------------------------------------
	Object: CNavShortcut
	Description: This is the object that the CRequestedNavPath() object
	   stores in it's array that contains the titles and hrefs of the
	   requested navigation path.
------------------------------------------------------------------- */
function CNavShortcut(sTitle, sHref) {
	this.Title = sTitle;
	this.Href = sHref;
	return this;
}

/* -------------------------------------------------------------------
	Object: CNavInfo
	Description: This is the object that we store in the frameset that
	             holds the data for all the links in the banner page.
------------------------------------------------------------------- */
function CNavInfo(sStartNavPage) {
	var aLinkInfo = new Array();
	var sVirtualRoot = _GetVirtualRoot();
	
	this.PopNav = _PopNav;
	this.PushNav = _PushNav;
	this.GetNavLinks = _GetNavLinks;
	this.BuildPath = _BuildPath;
	this.GetDirFromPath = _GetDirFromPath;
	this.StartNavPage = sStartNavPage;
	
	// Create the variable we can use for the virtual root.
	this.VirtualRoot = sVirtualRoot;
	
	function _GetVirtualRoot() {
		if ('localhost' == document.location.hostname) {
			return '/personalweb/';
		}
		// Mozilla doesn't work with "localhost!".
		else if ('10.19.57' == document.location.hostname.substr(0,8)) {
			return '/personalweb/';
		}
		else if ('127.0.0.1' == document.location.hostname.substr(0,9)) {
			return '/personalweb/';
		}
		else {
			return '/';
		}
	}
	
	function _BuildPath(sDocPathname) {
		return sVirtualRoot + sDocPathname;
	}
	
	// This will return just the directory from the path passed.
	function _GetDirFromPath(sDocPath) {
		var asPath = sDocPath.split("/");
		var iNrOfParts = asPath.length;
		var bOkayToBuild = false;
		var sDir;
		
		if ('/' != sVirtualRoot) {
			sDir = '/';
		}
		else {
			sDir = '';
		}
		
		var x;
		for (x = 0; x < (asPath.length - 1); x++) {
			if (!bOkayToBuild && ((sVirtualRoot == "/" + asPath[x] + "/") || (sVirtualRoot == asPath[x] + "/")) ) {
				bOkayToBuild = true;
			}
			if (bOkayToBuild) {
				sDir += asPath[x] + '/';
			}
		}
		return sDir;
	}
	
	// Adds a page to the links.
	function _PushNav(sPageTitle, sPageHref, sTarget) {
		var x;
		var bOkayToPush = true;
		var oNavObj;
		var iIndexToRemove;
		
		// Don't re-push this page onto the stack, and
		// if we find this page anywhere in the stack,
		// make it the last one!
		for (x = (aLinkInfo.length -1); x >= 0; x--) {
			if (aLinkInfo[x].title == sPageTitle) {
				bOkayToPush = false;
				iIndexToRemove = x + 1;
				break;
			}
		}
		if (bOkayToPush) {
			oNavObj = new Object;
			oNavObj.title = sPageTitle;
			// Insure that only the main page is part of the navigation, no arguments!
			oNavObj.location_href = sPageHref.split('?')[0];
			oNavObj.target = sTarget;
			aLinkInfo.push(oNavObj);
		}
		else {
		// Remove ALL THE ONES AFTER THIS ONE if we found it...
		_RemoveLink(iIndexToRemove);
		}
		
	}		// function _PushNav()
	
	// Removes a page from the links (not used anymore..)
	function _PopNav(oPage) {
		var x;
		var iIndexToRemove = -1;
		// First, find the index of this page in the array.
		for (x = (aLinkInfo.length - 1); x >=0; x--) {
			if (aLinkInfo[x].title == oPage.document.title) {
				iIndexToRemove = x;
				break;
			}
		}
		// Remove it if we found it...
		_RemoveLink(iIndexToRemove);

	}		// function _PopNav()
	
	// Removes a link from the array. Pass it the index of the one
	// you want to remove. It will remove it and all the other ones
	// that follow it.
	function _RemoveLink(iIndexToRemove) {
		if (iIndexToRemove >= 0) {
			// Remove everything greater than and equal to this one.
			while (aLinkInfo.length > iIndexToRemove) {
				aLinkInfo.pop()
			}
		}
	}		// function _RemoveLink(iIndexToRemove) {
	
	// This returns the HTML for the navigation links.
	function _GetNavLinks() {
		var sLinks = '';
		var x;
		for (x = 0; x < aLinkInfo.length; x++) {
			if (x > 0) {
				sLinks += "-&gt;"
			}
			// Don't make a hyperlink if this is the last one, since this is the page we're on.
			if (x < (aLinkInfo.length - 1)) {
				sLinks += "<a href='";
				sLinks += aLinkInfo[x].location_href;
				sLinks += "' target='";
				sLinks += aLinkInfo[x].target;
				sLinks += "'>";
			}
			sLinks += aLinkInfo[x].title;
			if (x < (aLinkInfo.length - 1)) {
				sLinks += "</a>"
			}
		}
		return sLinks;
	}		// function _GetNavLinks()
		

} // function CNavInfo()


/* -------------------------------------------------------------------
		functions to support details.htm.
------------------------------------------------------------------- */
// This function is called when a "menu" item contains a thumbnail.
function MenuItemWithThumbnailOnClick(oTD) {
	// We will assume that the one-and-only child of this <TD> is the <img> of the thumbnail...
	oTD.getElementsByTagName("img")[0].onclick();
}

// This function is the main click function for diplaying the pictures and details from a thumbnail click.
function ThumbnailOnclick(oImg,iImageActualWidth,iImageActualHeight,sSrc,sDate,sLocation,sNotes, sPhotoCredit) {
	// Hide the initial div text now, no matter what.
	
	// If there was a previously-selected thumb...
	if (window.top.oSelectedThumbnail.Image) {
		// Deselect it.
		try {
			window.parent.oSelectedThumbnail.Image.className = "Thumbnail";
		}
		catch (e) {
		}
	}
	// Select this one.
	if (oImg) {
		window.top.oSelectedThumbnail.Image = oImg;
		window.top.oSelectedThumbnail.Image.className = "ThumbnailSelected";
	}
	
	// Set the details.
	
	// The sSrc arg comes in relative to the doc path. Have to make it fully-qualified first.
	var sFullSrcPath = window.parent.oNavInfo.GetDirFromPath(document.location.pathname) + sSrc;
	
	window.top.oDetails.SetDetails(iImageActualWidth,iImageActualHeight, sFullSrcPath,sDate,sLocation,sNotes, sPhotoCredit);
	
	// resize the	scale selector frame to show it.
	window.top.oScaleSelector.Show();

}

/* -------------------------------------------------------------------
            BANNER PAGE OBJECT
------------------------------------------------------------------- */
function CBanner(sBannerMainTitle,sBannerSubTitle,sBannerText) {
	var m_sMainTitle = sBannerMainTitle;
	var m_sSubTitle = sBannerSubTitle;
	var m_sText = sBannerText;
	var m_sTextClassName = '';
	this.MainTitle = m_sMainTitle;
	this.SubTitle = m_sSubTitle;
	this.Text = m_sText;
	this.Initialized = false;
	
	this.SetupBanner = _SetupBanner;
	this.AdjustBannerHeight = _AdjustBannerHeight;
	
	var m_sBodyClassName;
	var m_oSelf = this;
	
	function _SetupBanner(sMainTitle, sSubTitle, sBannerText, sBodyClassName) {
		var bInitialized = true;
		
		if (!_SetBodyClass(sBodyClassName)) {
			bInitialized = false;
		}
		
		if (!_SetBannerMainTitle(sMainTitle)) {
			bInitialized = false;
		}
		
		if (!_SetBannerSubTitle(sSubTitle)) {
			bInitialized = false;
		}
		
		if (!_SetBannerText(sBannerText)) {
			bInitialized = false;
		}
		
		if (!_SetNavLinks()) {
			bInitialized = false;
		}
		
		if (!_AdjustBannerHeight()) {
			bInitialized = false;
		}
		
		// Make sure that the banner has been resized correctly.
		var iRequiredBannerHeight = _GetRequiredBannerHeight();
		var iActualBannerHeight = _GetActualBannerHeight()
		if (-1 == iRequiredBannerHeight) {
			bInitialized = false;
		}
		else if (-1 == iActualBannerHeight) {
			bInitialized = false;
		}
		else if (iActualBannerHeight < iRequiredBannerHeight) {
			if (!_AdjustBannerHeight()) {
				bInitialized = false;
			}
//			else {
//			bInitialized = false;
		}
		
		m_oSelf.Initialized = bInitialized;
		if (!bInitialized) {
			// we need to pass the args for Mozilla!
			window.setTimeout(window.top.oBanner.SetupBanner, 100, sMainTitle, sSubTitle, sBannerText, sBodyClassName);
		}
		
	}
	
	function _SetBannerMainTitle(sMainTitle) {
		try {
			// gotta check for null instead of arguments.length to be compatible with Mozilla 1.7!!!!
			if (null != sMainTitle) {
				m_oSelf.m_sMainTitle = sMainTitle;
			}
			window.top.frames['banner'].document.getElementById('divMainTitle').innerHTML = m_oSelf.m_sMainTitle;
			return (true);
		}
		catch (e) {
			return (false);
		}
	}
	
	function _SetBannerSubTitle(sSubTitle) {
		try {
			// gotta check for null instead of arguments.length to be compatible with Mozilla 1.7!!!!
			if (null != sSubTitle) {
				m_oSelf.m_sSubTitle = sSubTitle;
			}
			window.top.frames['banner'].document.getElementById('divSubTitle').innerHTML = m_oSelf.m_sSubTitle;
			return (true);
		}
		catch (e) {
			return (false);
		}
	}
	
	function _SetBannerText(sBannerText) {
		var bNoText;
		try {
			
			// gotta check for null instead of arguments.length to be compatible with Mozilla 1.7!!!!
			if (null == sBannerText) {
				if (0 == m_oSelf.m_sText.length) {
					bNoText = true;
				}
			}
			else if (0 == sBannerText.length) {
				bNoText = true;
				m_oSelf.m_sText = sBannerText;
			}
			else {
				bNoText = false;
				m_oSelf.m_sText = sBannerText;
			}
			
			if (bNoText) {
				window.top.frames['banner'].document.getElementById("divBannerTextOuter").style.display = "none";
			}
			else {
				window.top.frames['banner'].document.getElementById("divBannerTextOuter").style.display = "inline";
				window.top.frames['banner'].document.getElementById("divBannerText").innerHTML =  m_oSelf.m_sText;
			}
			return (true);
		}
		catch (e) {
			return (false);
		}
	}
	
	function _SetNavLinks() {
		try {
			window.top.frames['banner'].document.getElementById("divNavLinks").innerHTML = window.parent.oNavInfo.GetNavLinks();
			return (true);
		}
		catch (e) {
			return (false);
		}
	}
	
	function _AdjustBannerHeight() {
		try {
			var iHeight = _GetRequiredBannerHeight();
			if (-1 == iHeight) {
				return (false);
			}
			window.top.frames['banner'].frameElement.parentNode.setAttribute("rows", iHeight.toString() + ",*");
			window.top.oDetails.Resize();
			return (true);
		}
		catch (e) {
			return (false);
		}
	}
	
	function _GetRequiredBannerHeight() {
		try {
			var iHeight = 0;
			iHeight += window.top.frames["banner"].document.getElementById("divNavLinks").offsetTop;
			iHeight += window.top.frames["banner"].document.getElementById("divNavLinks").offsetHeight;
			iHeight += 3;
			return (iHeight);
		}
		catch (e) {
			return (-1);
		}
	}
	
	function _GetActualBannerHeight() {
		try {
			var sRows = window.top.frames['banner'].frameElement.parentNode.getAttribute("rows");
			var asRows = sRows.split(',');
			var iHeight = parseInt(asRows[0]);
			return (iHeight);
		}
		catch (e) {
			return (-1);
		}
	}
	
	function _SetBodyClass(sBodyClassName) {
		try {
			// gotta check for null instead of arguments.length to be compatible with Mozilla 1.7!!!!
			if (null != sBodyClassName) {
				m_oSelf.m_sBodyClassName = sBodyClassName;
			}
			window.top.frames["banner"].document.body.className = m_sBodyClassName;
			// The classname of the banner text is the name of the class, with "BannerText" appended.
			window.top.frames['banner'].document.getElementById('divBannerText').className = m_oSelf.m_sBodyClassName + "BannerText";
			return (true);
		}
		catch (e) {
			// only mozilla seems to use the arguments for setTimeout...
			window.setTimeout(window.top.oDetails.SetBodyClass,100,sBodyClassName);
			return (false);
		}
	}
}		// CBanner()


/* -------------------------------------------------------------------
            SCALE SELECTOR OBJECT
------------------------------------------------------------------- */
function CScaleSelector() {
	// This holds the image's ACTUAL width, in pixels.
	this.ImageActualWidth = 0;
	this.ImageActualHeight = 0;
	// Used to hold the last picture scale mode used.
	this.ScaleMode = g_iSCALE_SCALE_TO_FIT;
  this.ScalePercent = '100';
  
	this.SetScaleMode = _SetScaleMode;
	this.ScalePicture = _ScalePicture;
	this.SetBodyClass = _SetBodyClass;
	this.Hide = _Hide;
	this.Show = _Show;
	this.SetScalePercentText = _SetScalePercentText;
	this.Visible = false;
	
	var m_sBodyClass;
	var m_oSelf = this;
	
	function _SetScaleMode(iSelectedMode) {
		var nScalePercent;
		
		if ( 0 == arguments.length) {
			iSelectedMode = this.ScaleMode;
		}
		
		this.ScaleMode = iSelectedMode;

		if (g_iSCALE_ACTUAL_SIZE == iSelectedMode) {
			window.top.frames["details"].document.getElementById("imgMain").width = this.ImageActualWidth ;
			window.top.frames["details"].document.getElementById("imgMain").height = this.ImageActualHeight;
			window.top.frames["ScaleSelector"].document.getElementsByName("ScaleMode")[0].checked = true;
			window.top.frames["ScaleSelector"].document.getElementsByName("ScaleMode")[1].checked = false;
			window.top.oScaleSelector.SetScalePercentText('100');
			
		}
		else if ( g_iSCALE_SCALE_TO_FIT == iSelectedMode) {
			window.top.oDetails.Resize();
			window.top.frames["ScaleSelector"].document.getElementsByName("ScaleMode")[0].checked = false;
			window.top.frames["ScaleSelector"].document.getElementsByName("ScaleMode")[1].checked = true;
		}
		else {
			nScalePercent = (window.top.frames["ScaleSelector"].document.getElementById("txtScalePercent").value / 100);
			window.top.frames["details"].document.getElementById("imgMain").width = (this.ImageActualWidth * nScalePercent);
			window.top.frames["details"].document.getElementById("imgMain").height = (this.ImageActualHeight * nScalePercent);
			window.top.frames["ScaleSelector"].document.getElementsByName("ScaleMode")[0].checked = false;
			window.top.frames["ScaleSelector"].document.getElementsByName("ScaleMode")[1].checked = false;
		}
	}
	
	function _ScalePicture(iPercent) {
		this.ScaleMode = g_iSCALE_PERCENT;
		this.ScalePercent = iPercent;
		window.top.frames["details"].document.getElementById("imgMain").width = (this.ImageActualWidth * (iPercent / 100));
		window.top.frames["details"].document.getElementById("imgMain").height = (this.ImageActualHeight * (iPercent / 100));
		window.top.frames["ScaleSelector"].document.getElementsByName("ScaleMode")[0].checked = false;
		window.top.frames["ScaleSelector"].document.getElementsByName("ScaleMode")[1].checked = false;
	}
		
	function _SetBodyClass(sBodyClassName) {
		try {
			// need to test for null for IE.
			if (null != sBodyClassName) {
				m_oSelf.m_sBodyClassName = sBodyClassName;
			}
			window.top.frames["ScaleSelector"].document.body.className= m_oSelf.m_sBodyClassName;
			return (true);
		}
		catch (e) {
			window.setTimeout(window.top.oScaleSelector.SetBodyClass,100,sBodyClassName);
			return (false);
		}
	}
	
	function _Hide() {	
		// hide the scale frame.
//		window.parent.document.getElementById("fsDetails").setAttribute("rows","0,*");	
//!		window.top.document.getElementById('details').frameElement.parentNode.setAttribute("rows","0,*");
//!		window.parent.frames('details').frameElement.parentNode.setAttribute("rows","0,*");
		window.top.frames['details'].frameElement.parentNode.setAttribute("rows","0,*");
		this.Visible = false;
	}
	
	function _Show() {
		// Since we're showing it, resize it also.
		var iHeight = 0;
		iHeight += window.top.frames["ScaleSelector"].document.getElementById("divScaleMode").offsetTop;
		iHeight += window.top.frames["ScaleSelector"].document.getElementById("divScaleMode").offsetHeight;
		//!top.document.getElementById("fsDetails").setAttribute("rows", iHeight + ",*")
		window.top.frames['details'].frameElement.parentNode.setAttribute("rows", iHeight + ",*");

		this.Visible = true;
	}
	
	function _SetScalePercentText(sText) {
		window.top.frames["ScaleSelector"].document.getElementById("txtScalePercent").value = sText;
	}
	
}	// CScaleSelector

/* -------------------------------------------------------------------
            DETAILS OBJECT
------------------------------------------------------------------- */
function CDetails(sLocationHref) {
	this.SetDetails = _SetDetails;
	this.HideDetails = _HideDetails;
	this.SetBodyClass = _SetBodyClass;
	this.SetSrcPage = _SetSrcPage;
	this.Resize = _Resize;
	this.SetMouseOverText = _SetMouseOverText;
	this.LocationHref = sLocationHref;
	this.GetDetailsDocument = _GetDetailsDocument;
	this.LaunchPageInDetailsFrame = _LaunchPageInDetailsFrame;
	this.SetDetailsIntroText = _SetDetailsIntroText;
	this.SetDetailsMediaObject = _SetDetailsMediaObject;
	this.HideMediaDiv = _HideMediaDiv;
	this.StopMedia = _StopMedia;
	
	var m_iImageActualWidth = 0;
	var m_iImageActualHeight = 0;
	var m_sSrc = '';
	var m_sDate = ''
	var m_sLocation = '';
	var m_sNotes = '';
	var m_sPhotoCredit = '';
	var m_sBodyClassName = '';
	var m_oSelf = this;
	
	function _SetDetails(iImageActualWidth, iImageActualHeight, sSrc,sDate,sLocation,sNotes, sPhotoCredit) {
		// gotta test for null instead of arguments.length because of Mozzilla.
		if (null != iImageActualWidth) {
			m_oSelf.m_iImageActualWidth = iImageActualWidth;
		}
		if (null != iImageActualHeight) {
			m_oSelf.m_iImageActualHeight = iImageActualHeight;
		}
		if (null != sSrc) {
			m_oSelf.m_sSrc = sSrc;
		}
		if (null  != sDate) {
			m_oSelf.m_sDate = sDate;
		}
		if (null != sLocation) {
			m_oSelf.m_sLocation = sLocation;
		}
		if (null != sNotes) {
			m_oSelf.m_sNotes = sNotes;
		}
		if (null  != sPhotoCredit) {
			m_oSelf.m_sPhotoCredit = sPhotoCredit;
		}
		try {
			window.top.frames["details"].document.getElementById("imgMain").src = m_oSelf.m_sSrc;
			window.top.frames["details"].document.getElementById("divDate").innerHTML = m_oSelf.m_sDate;
			window.top.frames["details"].document.getElementById("divLocation").innerHTML = m_oSelf.m_sLocation;
			window.top.frames["details"].document.getElementById("divNotes").innerHTML = m_oSelf.m_sNotes;
			window.top.frames["details"].document.getElementById("divPhotoCredit").innerHTML = "Photo Credit: " + m_oSelf.m_sPhotoCredit;

			window.top.oScaleSelector.ImageActualWidth = m_oSelf.m_iImageActualWidth;
			window.top.oScaleSelector.ImageActualHeight = m_oSelf.m_iImageActualHeight;
		
			if (!_ShowDetails()) {
				// IE doesn't handle the arguments!
				window.setTimeout(window.top.oDetails.SetDetails,100,iImageActualWidth, iImageActualHeight, sSrc,sDate,sLocation,sNotes, sPhotoCredit);
			}
		
			if ( (m_oSelf.m_sDate.length > 0) || (m_oSelf.m_sLocation.length > 0) || (m_oSelf.m_sNotes.length > 0) ) {
				_ShowText();
			}
			else {
				_HideText();
			}
			return (true);
		}
		catch (e) {
			// IE doesn't handle the arguments!
			window.setTimeout(window.top.oDetails.SetDetails,100,iImageActualWidth, iImageActualHeight, sSrc,sDate,sLocation,sNotes, sPhotoCredit);
			return (false);
		}
	}

	function _HideDetails() {
		try {
			window.top.frames["details"].document.getElementById("divMain").style.visibility = "hidden";
			window.top.frames["details"].document.getElementById("divMain").style.display = "none";
			if (!_HideText()) {
				window.setTimeout(window.top.oDetails.HideDetails,100);
			}
			return (true);
		} 
		catch (e) {
			window.setTimeout(window.top.oDetails.HideDetails,100);
			return (false);
		}
	}

	function _ShowDetails() {
		try {
			// Hide the mouse over div and the initial div.
			window.top.frames["details"].document.getElementById("divMouseOverText").style.visibility = "hidden";
			window.top.frames["details"].document.getElementById("divMouseOverText").style.display = "none";
			window.top.frames["details"].document.getElementById("divDetailsIntroText").style.visibility = "hidden";
			window.top.frames["details"].document.getElementById("divDetailsIntroText").style.display = "none";

			window.top.frames["details"].document.getElementById("divMain").style.visibility = "visible";
			window.top.frames["details"].document.getElementById("divMain").style.display = "";
			window.top.oScaleSelector.SetScaleMode();
			
			return (true);
		}
		catch (e) {
			return (false);
		}
	}
	
	function _ShowText() {
		window.top.frames["details"].document.getElementById("divTableText").style.visibility = "visible";
		window.top.frames["details"].document.getElementById("divTableText").style.display = "";
	}
	
	function _HideText() {
		try {
			window.top.frames["details"].document.getElementById("divTableText").style.visibility = "hidden";
			window.top.frames["details"].document.getElementById("divTableText").style.display = "none";
			return (true);
		}
		catch (e) {
			return (false);
		}
	}
	
	function _SetMouseOverText(sText) {
		var sInnerHtml;
		try {
			// If no text was passed...
			if (0 == sText.length) {
				// Hide the mouse over div.
				window.top.frames["details"].document.getElementById("divMouseOverText").style.visibility = "hidden";
				window.top.frames["details"].document.getElementById("divMouseOverText").style.display = "none";
			}
			else {
				// show the mouseover div.
				window.top.frames["details"].document.getElementById("divMouseOverText").style.visibility = "visible";
				window.top.frames["details"].document.getElementById("divMouseOverText").style.display = "";
			}
			sInnerHtml = '<table width="80%" align="center"><tr><td>' + sText + '</td></tr></table>'		
			window.top.frames["details"].document.getElementById("divMouseOverText").innerHTML = sInnerHtml;
		}
		catch (e) {
		}
	}
	
	function _SetBodyClass(sBodyClassName) {
		try {
			// need to test args for IE.
			if (null != sBodyClassName) {
				m_oSelf.m_sBodyClassName = sBodyClassName;
			}
			window.top.frames["details"].document.body.className = m_oSelf.m_sBodyClassName;
		}
		catch (e) {
			window.setTimeout(window.top.oDetails.SetBodyClass,100,sBodyClassName);
		}
	}

	function _SetSrcPage(sSrcPage,sBodyClassName) {
		window.top.frames["details"].document.location.href = sSrcPage;
		_SetBodyClass(sBodyClassName);
		m_oSelf.LocationHref = sSrcPage;
	}
	
	function _Resize() {
		// Don't do anything if we're not scaling to fit!
		if (g_iSCALE_SCALE_TO_FIT != window.top.oScaleSelector.ScaleMode) {
			return;
		}
		if (!window.top.oScaleSelector.Visible) {
			return;
		}
		
		try {
			var oDoc = window.top.frames["details"].document;
			var oImage = oDoc.getElementById("imgMain");

			var iImgActualHeight = window.top.oScaleSelector.ImageActualHeight;
			var iImgActualWidth = window.top.oScaleSelector.ImageActualWidth;
			var iTotalHeight = window.top.frames['details'].frameElement.offsetHeight;
			var iLeftoverHeight = (iTotalHeight - ((oDoc.getElementById("divDblClick").offsetHeight) + (oDoc.getElementById("divTableText").offsetHeight) + (oDoc.getElementById("divDetailsIntroText").offsetHeight) + (oDoc.getElementById("divMedia").offsetHeight) + (oDoc.getElementById("divMouseOverText").offsetHeight)));
			iLeftoverHeight *= .90;
			if (iLeftoverHeight < 0) {
				return;
			}		



			var iTotalWidth = window.top.frames['details'].frameElement.offsetWidth;
			var iLeftoverWidth = iTotalWidth;
//			if (iLeftoverWidth < 0) {
//				return;
//			}



			var nRatio;
			var iFinalWidth = iImgActualWidth;
			var iCalculatedHeight = iImgActualHeight;
			
			if (iImgActualHeight > iImgActualWidth) {
				// Don't exceed the image's actual height!
				if (iLeftoverHeight <= iImgActualHeight) {
					nRatio = iImgActualWidth / iImgActualHeight;
					oImage.height = iLeftoverHeight;
					iFinalWidth = iLeftoverHeight * nRatio;
					oImage.width = iFinalWidth;
					iCalculatedHeight = iLeftoverHeight;
				}
				else {
					// There's room to make the image full size, so do it.
					oImage.width = iImgActualWidth;
					oImage.height = iImgActualHeight;
	top.window.oDebugWindow.Write("making image full size 1.<BR>",false)
				}
			}
			else if (iImgActualWidth >= iImgActualHeight) {
				// Don't exceed the image's actual width!
				if (iLeftoverWidth <= iImgActualWidth) {
					nRatio = iImgActualHeight / iImgActualWidth;
					oImage.width = iLeftoverWidth;
					iFinalWidth = iLeftoverWidth;
					iCalculatedHeight = iLeftoverWidth * nRatio
					oImage.height = iCalculatedHeight;
				}
				else {
					// There's room to make the image full size, so do it.
					oImage.width = iImgActualWidth;
					oImage.height = iImgActualHeight;
	top.window.oDebugWindow.Write("making image full size 2.<BR>",false)
				}
			}
			
			// Finally, make sure it fits in the height:
			if (iLeftoverHeight < iCalculatedHeight) {
				nRatio = iImgActualWidth / iImgActualHeight;
				oImage.height = iLeftoverHeight;
				iFinalWidth = iLeftoverHeight * nRatio;
				oImage.width = iFinalWidth;
			}

			// Update the percentage.
			window.top.oScaleSelector.SetScalePercentText(Math.floor((iFinalWidth / iImgActualWidth) * 100));
		}
		catch (e) {
		}
	}		// _Resize()
	
	function _GetDetailsDocument() {
		return window.top.frames["details"].document;
	}
	
	// This will launch the URL passed in sSrc in the details frame,
	// optionally hiding the scale selector frame.
	function _LaunchPageInDetailsFrame(sSrc,bHideScaleSelectorFrame) {
		// gotta check for null instead of arguments.length because Mozilla doesn't handle arguments.length the same.
		if (null == bHideScaleSelectorFrame) {
			bHideScaleSelectorFrame = true;
		}
		if (bHideScaleSelectorFrame) {
			window.top.oScaleSelector.Hide();
		}
		_SetSrcPage(sSrc,m_sBodyClassName);
	}

	function _SetDetailsIntroText(sText,bShowMouseRollOverInstructions,bShowMouseRollOverText) {
		try {
			if ( 0 == sText.length && !bShowMouseRollOverInstructions) {
				window.top.frames["details"].document.getElementById("divDetailsIntroText").style.visibility = 'hidden';
				window.top.frames["details"].document.getElementById("divDetailsIntroText").style.display = "none";
			}
			else {
				window.top.frames["details"].document.getElementById("divDetailsIntroText").style.visibility = 'visible';
				window.top.frames["details"].document.getElementById("divDetailsIntroText").style.display = "";
			}
			
			if (bShowMouseRollOverInstructions) {
				sText += '<br><br>'
				// If we're also showing the mouse roll over text...
				if (bShowMouseRollOverText) {
					sText += 'Roll your mouse over the menu items at left to see a description below, or just '
					sText += 'select an item and continue...'
				}
				else {
					sText += 'Click on the thumbnails on your left to display a larger image of them here, '
					sText += 'with detailed info about them...'
				}
			}
			// Just make sure that the td is visible!
			window.top.frames["details"].document.getElementById("tdDetailsIntroText").style.visibility = 'visible';
			window.top.frames["details"].document.getElementById("tdDetailsIntroText").style.display = '';
			window.top.frames["details"].document.getElementById("tdDetailsIntroText").innerHTML = sText;
			
			if (!bShowMouseRollOverText) {
				_SetMouseOverText('');
			}
			
			return (true);
				
		}
		catch (e) {
			return (false);
		}
	}		// function _SetDetailsIntroText(sText,bShowMouseRollOverText)
		

	function _SetDetailsMediaObject(sInnerHTML) {
		try {
			if ( 0 == sInnerHTML.length) {
				_HideMediaDiv();
				_StopMedia();
			}
			else {
				_ShowMediaDiv();
			}
			
			window.top.frames["details"].document.getElementById("tdMediaObject").innerHTML = sInnerHTML;
			
			_SetMouseOverText('');
			return (true);
				
		}
		catch (e) {
			return (false);
		}
	}		// function _SetDetailsMediaObject(sText,bShowMouseRollOverText)

	function _HideMediaDiv() {
		try {
			window.top.frames["details"].document.getElementById("divMedia").style.visibility = 'hidden';
			window.top.frames["details"].document.getElementById("divMedia").style.display = "none";

			window.top.frames["details"].document.getElementById("divDblClick").style.visibility = 'visible';
			window.top.frames["details"].document.getElementById("divDblClick").style.display = "";
			window.top.frames["details"].document.getElementById("divImg").style.visibility = 'visible';
			window.top.frames["details"].document.getElementById("divImg").style.display = "";
			window.top.frames["details"].document.getElementById("divDetailsIntroText").style.visibility = 'visible';
			window.top.frames["details"].document.getElementById("divDetailsIntroText").style.display = "";

			_StopMedia();
			window.top.oScaleSelector.Show();
			return (true);
		}
		catch (e) {
			return (false);
		}
	}		// function _HideMediaDiv()

	function _ShowMediaDiv() {
		window.top.frames["details"].document.getElementById("divMedia").style.visibility = 'visible';
		window.top.frames["details"].document.getElementById("divMedia").style.display = "";

		window.top.frames["details"].document.getElementById("divDblClick").style.visibility = 'hidden';
		window.top.frames["details"].document.getElementById("divDblClick").style.display = "none";
		window.top.frames["details"].document.getElementById("divImg").style.visibility = 'hidden';
		window.top.frames["details"].document.getElementById("divImg").style.display = "none";
		window.top.frames["details"].document.getElementById("divDetailsIntroText").style.visibility = 'hidden';
		window.top.frames["details"].document.getElementById("divDetailsIntroText").style.display = "none";
		window.top.oScaleSelector.Hide();
		return true;
	}

	function _StopMedia() {
		var oDetailsDoc = _GetDetailsDocument();
		if (undefined != oDetailsDoc.MediaPlayer) {
			oDetailsDoc.MediaPlayer.Stop();
			oDetailsDoc.MediaPlayer.FileName ="";
		}
	}
		
}	// CDetails	

// Small object to just hold the currently selected thumbnail <img> object.
function CSelectedThumbnail() {
	this.Image = null;
}

/* -------------------------------------------------------------------
	Class: CDebugWindow
	Description: Allows debugging output to be written to a separate window.
------------------------------------------------------------------- */
function CDebugWindow() {

	var m_oWindow = null;
	var m_nLineNumber = 1;
	this.Open = _Open;
	this.Write = _Write;
	this.Close = _Close;
	this.WriteBrowserInfo = _WriteBrowserInfo;
	
	function _Open() {
		if (null != m_oWindow) {
			_Close();
		}
		m_oWindow = window.open(oNavInfo.BuildPath("common/debug.htm"),"DebugWindow","directories=no,fullscreen=no,height=200,left=0,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toobar=no,top=0,width=200",true);
	}
	
	function _Write(sText,bReplace) {
		var sExistingHtml;
		if (null == m_oWindow) {
			return;
		}
		try {		
			if (bReplace) {
				m_oWindow.document.getElementById('divMain').innerHTML = '';
			}
			// Write it at the TOP of the window, so you don't have to scroll the window
			// to see the latest one...
			sExistingHtml = m_oWindow.document.getElementById('divMain').innerHTML;
			m_oWindow.document.getElementById('divMain').innerHTML = m_nLineNumber.toString() + ': ' + sText + sExistingHtml;

		} catch (e) {
		}
		m_nLineNumber++;
	}
	
	function _Close() {
		if (null == m_oWindow) {
			return;
		}
		m_oWindow.close();
		m_oWindow = null;
		m_nLineNumber = 1;
	}

	function _WriteBrowserInfo(bReplace) {
		_Write("window.navigator.appName:     " + window.navigator.appName + "<BR>",bReplace);
		_Write("window.navigator.appVersion:  " + window.navigator.appVersion + "<BR>",false);
		_Write("window.navigator.userAgent:   " + window.navigator.userAgent + "<BR>",false);
		_Write("window.navigator.appCodeName: " + window.navigator.appCodeName + "<BR>",false);
	}

	return (this);
		
}		// unction CDebugWindow()


/* -------------------------------------------------------------------
	End of File: common.js
------------------------------------------------------------------- */

