	slogan = " . . . samples of writing and life";
	var elem;
	var index = 0;
	var tid;
	var currDisplay = "home";
	var currTitle = "";
	var sectionTimer;
	var sectionIndex = 0;
	var currSectionElem;
	writingIndexLoaded = false;
	etceteraIndexLoaded = false;
	onthetownIndexLoaded = false;
	indices = new Array(3);

	function writeSlogan()
	{
		if (elem == null) {
			elem = document.getElementById("tagline");
		}
		writeSloganArg(elem);
	}

	function writeSloganArg(e)
	{
		if (index < slogan.length)
		{
			if (index >= 1)
			{
				tempId = "font"+(index-1);
				document.getElementById(tempId).style.color = "#4B0082";
			}

			e.innerHTML += "<font id=font"+index+" color='#FF8888'>" + slogan.charAt(index++) + "</font>";
		}
		else
		{
			tempId = "font"+(index-1);
			document.getElementById(tempId).style.color = "#4B0082";
			clearInterval(tid);
		}
	}
	
	function byTitle()
	{
		return 1;
	}
	function byTheme()
	{
		return 2;
	}
	function byDate()
	{
		return 3;
	}
	

	function startWriting()
	{	
		tid = setInterval( "writeSlogan()", 200);
	}

	function highlight(tab)
	{
		tab.style.background = "#4B0082";
		tab.style.color = "white";
		tab.style.fontWeight = "bold";
		tab.style.borderColor = "#C0C0C0";
		tab.style.left = "-1px";
		tab.style.top = "1px";
	}

	function unHighlight(tab)
	{
		tab.style.background = "white";
		tab.style.color = "#4B0082";
		tab.style.fontWeight = "normal";
		tab.style.borderColor = "#4B0082";
		tab.style.left = "0px";
		tab.style.top = "0px";
	}

	function line(tab)
	{
		tab.style.textDecoration = "underline";
		tab.style.color = "#4B0082";
		tab.style.fontWeight = "bold";
		tab.style.borderColor = "#4B0082";
	}

	function unLine(tab) 
	{
		
		tab.style.textDecoration = "none";
		tab.style.color = "#4B0082";
		tab.style.fontWeight = "normal";
		tab.style.borderColor = "white";
	}

	function displayMenu(e, title)
	{
		clearInterval(sectionTimer);
		currElem = document.getElementById(currDisplay);
		currElem.style.visibility = "hidden";
		currElem.style.display = "none";
		currElem.style.zIndex = 0;

		newElem = document.getElementById(e);
		newElem.style.display = "inline";
		newElem.style.visibility = "visible";
		currElem.style.zIndex = 1;
		currDisplay = e;
	
		sectionIndex = 0;
		currSectionElem = currDisplay+"Section";
		currTitle = title;
		
		startWritingSectionTitle();	
		
		if (eval(currDisplay+"Loaded") == true)
		{
			displayLinks(currDisplay, byTitle());
		}
		else
		{
			top.topFrame.loadIndex(currDisplay);
		}
			
		eval(currDisplay + "Loaded = true;");
	}

	function writeSectionTitle()
	{
		sectionElem = document.getElementById(currSectionElem);
		sectionElem.innerText = "[ " + currTitle.substring(0, sectionIndex++) + " ]";
		if (sectionIndex > currTitle.length)
		{
			clearInterval(sectionTimer);
		}
	}

	function startWritingSectionTitle()
	{
		code = "writeSectionTitle()";
		sectionTimer = setInterval(code, 40);
	}

	function loadDoc(fileName)
	{
		top.topFrame.loadDoc(fileName);
	}

	function readDoc(htmlData)
	{
		if (htmlData == null)
		{
			return;
		}
		document.getElementById("currentDocument").innerHTML = htmlData;
		document.getElementById(currDisplay).style.visibility = "hidden";
		document.getElementById(currDisplay).style.display = "none";
		document.getElementById(currDisplay).style.zIndex = 0;
		document.getElementById("currentDocument").style.display = "inline";
		document.getElementById("currentDocument").style.visibility = "visible";
		document.getElementById("currentDocument").style.zIndex = 1;
		currDisplay = "currentDocument";
	}

	function readIndex(arrayName, indexArray)
	{
		if (indexArray == null)
		{
			return;
		}

		indices[arrayName] = new Array(indexArray.length);
		clone(indices[arrayName], indexArray);
		displayLinks(arrayName, byTitle());
	}

	function clone(arrayCopy, arrayOrig)
	{
		for (var x = 0; x < arrayOrig.length; x++)
		{
			if (typeof arrayOrig[x] == "object") 
			{
				arrayCopy[x] = new Array(arrayOrig[x].length);
				clone(arrayCopy[x], arrayOrig[x]);
			}
			else
			{
				arrayCopy[x] = arrayOrig[x].toString();
			}
		}
	}
	
	function displayLinks(section, sortBy)
	{
		var x;
		var y;

		for (x = 0; x < indices[section].length; x++)
		{			
			for (y = x; y < indices[section].length; y++)
			{
				if (indices[section][x][sortBy] > indices[section][y][sortBy])
				{
					temp = indices[section][x];
					indices[section][x] = indices[section][y];
					indices[section][y] = temp;
				}
			}
		}


		var newHtml = "<SPAN style=\"width : 33%; text-decoration: underline; font-weight: bold;\">Title</SPAN><SPAN style=\"width : 33%; text-decoration: underline; font-weight: bold;\">Theme</SPAN><SPAN style=\"width : 33%; text-decoration: underline; font-weight: bold;\">Date</SPAN><BR>";
		for (x = 0; x < indices[section].length; x++)
		{
			newHtml += "<SPAN style=\"color : #4B0082\" onMouseOver=\"line(this)\" onMouseOut=\"unLine(this)\"><SPAN style=\"width : 33%;\">" + indices[section][x][0] + "</SPAN><SPAN style=\"width : 33%;\">" + indices[section][x][byTheme()] + "</SPAN><SPAN style=\"width : 33%;\">" + formatDate(indices[section][x][byDate()]) + "</SPAN></SPAN><BR>";
		}

		document.getElementById(section+"Links").innerHTML = newHtml;
	}

	function formatDate(currDate)
	{
		year = currDate.substring(0,4);
		mon  = currDate.substring(4,6);
		day  = currDate.substring(6,8);
		return mon+"/"+day+"/"+year;
	}
