// Based on Jon Udell's code in Byte 11/97, p. 98
// Multiple bug fixes and improvements by Andrew Treloar, 9/1/98

// Place list of filenames and slide headings here, in the format
// 'filename|heading'

var docs = new Array (
	'intro.htm|Introduction',
	'overview.htm|Overview',
	'ecology.htm|Ecology of Communicative Transactions',
	'punctuated.htm|Punctuated Equilibrium',
	'genre.htm|Genre-based framework for New Media',
	'integrated.htm|Integrating these Perspectives',
	'form.htm|Transformation in Form of Journals',
	'function.htm|Transformation in Function of Journals',	
	'conc1.htm|Conclusions - I',
	'conc2.htm|Conclusions - II',	
	'conc3.htm|Conclusions - III',
	'question.htm|Acknowledgements/Questions?'
	)
	
var href = document.URL;
var curr = href.substring(href.lastIndexOf('/')+1,href.length);

function itemFromDocs (type,i) 
// returns either the file name or title of entry i based on type
{
if (i < 0) i = 0;
if (i > docs.length-1) i = docs.length-1;
var str = docs[i];
if (type == 'url')       // get the URL
	return str.substring(0,str.lastIndexOf('|'));
else                    // get the title
	return str.substring(str.lastIndexOf('|')+1,str.length);
}

function getLink (which)
// returns correct HTML code for gif links
// modified to handle first and last slide cases by Andrew Treloar
{
var alt = "";
for (var i = 0; i <= docs.length-1; i++) {
  if (curr == itemFromDocs('url',i)) {
     if (which == 'next') // next slide
        if (i < docs.length-1) { // not at end
     		link = itemFromDocs('url',i+1);
     		gif = "next.gif";
     		alt = "Next Slide"; }
     	else
     		gif = "none";
     else                 // previous slide
     	if (i != 0) { // not at start
     		link = itemFromDocs('url',i-1);
     		gif = "prev.gif";
     		alt = "Previous Slide"; } 
     	else
     		gif = "none";
} ; }
if (gif == "none") // at start or end
	return " ";
else // a real link
	return '<a href=' + link + '><img src=' + gif + ' ALT = ' + alt + '></a>'
}

function showHeading ()
// returns the title of the current URL 
{
var heading = "";
for (var i = 0; i <= docs.length-1; i++) {
  if (curr == itemFromDocs('url',i))
  	 heading = itemFromDocs('title',i);
  	 }
return heading;
}

document.bgColor="white";
document.write(
	'<table width=100%><tr>' +
	'<td ALIGN="LEFT">' + getLink('prev') + '</td>' + // left element
	'<td ALIGN="CENTER"><h2>' + showHeading() + '</h2></td>' + // central element
	'<td ALIGN="RIGHT">' + getLink('next') + '</td>' + // right element
	'</tr></table>'+
	'<center><img src="line.gif" ALT="Gratuitous line graphic"></center><P>' // divider line
	);

