<!--
	var sGraphicsDir = "../images";
	
	function NameClicked(iIndiId, sIndiName, sSurname)
	{
		parent.frames["topFrame"].document.Settings.IndiId.value = iIndiId;
		parent.frames["topFrame"].document.Settings.Surname.value = sSurname;
		if (is_gecko || is_ie4up)
		{
			SetSelectedIndiHeading(sIndiName)
		}
		TriggerDisplay("PersPage");
	}

	function PutPicListBySurname(sSortOrder, sSurname)
	{
		parent.frames["topFrame"].document.Settings.SortOrder.value = sSortOrder;
		parent.frames["topFrame"].document.Settings.IndiId.value = -1;
		parent.frames["topFrame"].document.Settings.Surname.value = sSurname;
		TriggerDisplay("PicList");
	}

	function PutPicList(sSortOrder, iIndiId, sIndiName)
	{
		parent.frames["topFrame"].document.Settings.SortOrder.value = sSortOrder;
		parent.frames["topFrame"].document.Settings.IndiId.value = iIndiId;
		parent.frames["topFrame"].document.Settings.Surname.value = "";
		if (is_gecko || is_ie4up)
		{
			//alert ("sIndiName = " + sIndiName);
			SetSelectedIndiHeading(sIndiName)
		}
		TriggerDisplay("PicList");
	}

	function Thumbs(iIndiId, sSortOrder, sSurname, iSelectedPicId, iChunkNo)
	{
		// iIndiId, sSortOrder, iSelectedPicId are not used here, but the calling sequence 
		// includes them for compatibility with Thumbs for admin
		parent.frames["topFrame"].document.Settings.Surname.value = sSurname;
		if (sSurname)
		{
			parent.frames["topFrame"].document.Settings.IndiId.value = -1;
		}
		parent.frames["topFrame"].document.Settings.ChunkNo.value = iChunkNo;
		TriggerDisplay("Thumbs");
	}

	function PicPage(iPicId, sIndiName, bCancelPicIdList)
	{
		// In case the only picture of given indi is going to be displayed
		//alert ("bCancelPicIdList = " + bCancelPicIdList);
		if (bCancelPicIdList)
		{
			parent.frames["topFrame"].document.Settings.PicIdList.value = iPicId;
		}
		
		parent.frames["topFrame"].document.Settings.SelectedPicId.value = iPicId;
		if (is_gecko || is_ie4up)
		{
			SetSelectedIndiHeading(sIndiName)
		}
		TriggerDisplay("PicPage");
	}
	
	function TextPage(iTextPageNo, iNumOnPage, iIndiId,sIndiName)
	{
		parent.frames["topFrame"].document.Settings.TextPageNo.value = iTextPageNo;
		parent.frames["topFrame"].document.Settings.NumOnPage.value = iNumOnPage;
		parent.frames["topFrame"].document.Settings.IndiId.value = iIndiId;
		if (is_gecko || is_ie4up)
		{
			//alert ("sIndiName = " + sIndiName);
			SetSelectedIndiHeading(sIndiName)
		}
		TriggerDisplay("TextPage");
	}

	function TextPageList(iIndiId, sIndiName)
	{
		parent.frames["topFrame"].document.Settings.IndiId.value = iIndiId;
		if (is_gecko || is_ie4up)
		{
			//alert ("sIndiName = " + sIndiName);
			SetSelectedIndiHeading(sIndiName)
		}
		TriggerDisplay("TextPageList");
	}

	function PutDisplay(iIndiId, sDispType, sIndiName)
	{
		parent.frames["topFrame"].document.Settings.IndiId.value = iIndiId;
		if (is_gecko || is_ie4up)
		{
			SetSelectedIndiHeading(sIndiName)
		}
		TriggerDisplay(sDispType);
	}
	
	function TriggerDisplay(sDispType)
	{
		var iClientW;
		var iClientH;
		if (document.body.clientLeft > 0)
				// This test was added for Mozilla
		{
			iClientW = document.body.offsetWidth - 2 * document.body.clientLeft; 
					// This is better than document.body.clientWidth, because the latter changes when the vertical scrollbar appears
			iClientH = document.body.clientHeight;
		}
		else // Probably, this is Mozilla
		{
			iClientW = 750;
			iClientH = 650;
		}
		// alert ("(document.body.offsetWidth, iClientW, iClientH) = " + document.body.offsetWidth + ", " + iClientW + ", " + iClientH);

		// If the window dimensions were changed, the grouping of thumbs into chunks can be corrupted.
		with (parent.frames["topFrame"].document.Settings)
		{
			//alert ("WinW.value = " + WinW.value + ", iClientW = " + iClientW + ", WinH.value = " + WinH.value + ", iClientH = " + iClientH);
			if (WinW.value != iClientW || WinH.value != iClientH)
			{
				// Reset the chunk number to 1
				ChunkNo.value = 1;
				// Change WinW and WinH values according to new window dimensions
				WinW.value =iClientW;
				WinH.value = iClientH;
			}
			DispType.value = sDispType;

			// For text pages, add the anchor
			if (sDispType == "TextPage")
			{
				action = "matter.pl#IndiRef_" + NumOnPage.value;
			}
			submit();
		}
	}

	function SetSelectedIndiHeading (sIndiName)
	{
		// alert ("In SetSelectedIndiHeading(" + sIndiName + ")");
		with (parent.frames["topFrame"].document)
		{
			if (sIndiName)
			{
				if (Settings.Design.value == "orange")
				{
					getElementById("SelIndi").innerHTML = 
						'<IMG height=13 src="' + sGraphicsDir + '/nav_arrow_o.gif" width=14 align=baseline>' + 
						'Selected Individual: ' + sIndiName;
				}
				else if (Settings.Design.value == "classic")
				{
					getElementById("SelIndi").innerHTML = "<I>Selected Individual:</I>&nbsp;" + sIndiName;
				}
			}
			else
			{
				getElementById("SelIndi").innerHTML = "&nbsp;";
			}
			
		}
	}
	
	// To be run after a page with piclist or thumb gallery is loaded
	function picListInit(sPicIdList)
	{
		//alert ("sPicIdList = " + sPicIdList);
		parent.frames["topFrame"].document.Settings.PicIdList.value = sPicIdList;
	}

	function setBookmark(sGETStuff, sTitle)
	{
		if (!is_ie4up)
		{
			alert("This function is available only in Microsoft Internet Explorer. Sorry.");
			return;
		}
		var sURL = bookmarkURL(sGETStuff);
		//alert (sURL);
		//alert ("title = " + parent.document.title);
		var sFullTitle = sTitle + " - " + parent.document.title;
		window.external.AddFavorite(sURL, sFullTitle);
	}

	function emailLink(sGETStuff, sTitle)
	{
		
		var sURL = bookmarkURL(sGETStuff);
		//alert (sURL);
		var sFullTitle = sTitle + " - " + parent.document.title;
		document.MailLink.URL.value = sURL;
		document.MailLink.PageTitle.value = sFullTitle;
		document.MailLink.submit();
	}

	function bookmarkURL(sGETStuff)
	{
		// Build the path for bookmark.pl
		//-------------------------------

		// Get current URL
		var sCurrPath = document.location.href;
		
		// Get rid of matter.pl
		var iLastSlashPosition = sCurrPath.lastIndexOf("/");
		var sCurrDir = sCurrPath.substr(0, iLastSlashPosition);
		//alert ("bookmarkURL(1): sCurrDir = " + sCurrDir);

		// Get rid of user directory
		iLastSlashPosition = sCurrDir.lastIndexOf("/");
		sCurrDir = sCurrDir.substr(0, iLastSlashPosition);
		//alert ("bookmarkURL(2): sCurrDir = " + sCurrDir);

		var sURL = sCurrDir + "/cgi-bin/bookmark.pl" + sGETStuff;
		return sURL;
	}

	function showSource(sUserPrefix, sSourceCitReferer)
	{
		var oSourceWindow = window.open("../cgi-bin/source.pl?UserPrefix=" + sUserPrefix + "&SourceCitReferer=" + sSourceCitReferer, 
										"source", "width=700,height=500,scrollbars=yes");
		oSourceWindow.focus();
	}

	function showPrintTip()
	{
		//alert (readCookie("DontRemindEnableBackground"));
		if (readCookie("DontRemindEnableBackground") != "")
		{
			parent.print();
		}
		else
		{
			var oIcon = document.getElementById('PrintIcon');
			with (document.getElementById("PrintTip"))
			{
				style.left = oIcon.offsetLeft + 0.5 * oIcon.offsetWidth ;
				style.top = oIcon.offsetTop  + 0.5 * oIcon.offsetHeight;
				style.visibility = "visible";
			}
		}
	}

	function hidePrintTip()
	{
		document.getElementById('PrintTip').style.visibility = 'hidden';
	}

	function goAheadPrinting()
	{
		//alert ("document.getElementById('DontRemindBackground').checked = " + document.getElementById('DontRemindBackground').checked);
		if (document.getElementById('DontRemindBackground').checked)
		{
			// Set a cookie
			dExpdate = new Date();
			dExpdate.setYear(dExpdate.getYear() + 1);
			//alert (dExpdate.toGMTString());
			document.cookie = "DontRemindEnableBackground=" + escape("1") + "; expires=" + dExpdate.toGMTString();

		}
		hidePrintTip(); 
		parent.print();
	}
	
	function readCookie(sName)
	{
		// cookies are separated by semicolons
		//alert ("Cookie = " + document.cookie);
		var aCookie = document.cookie.split("; ");
		for (var i=0; i < aCookie.length; i++)
		{
			// a name/value pair (a crumb) is separated by an equal sign
			var aCrumb = aCookie[i].split("=");
			if (sName == aCrumb[0])
				return unescape(aCrumb[1]);
		}

		// a cookie with the requested name does not exist
		return "";
	}

	function openBrWindow(theURL,winName,features)  
    {
        window.open(theURL,winName,features);
    }

//-->

