/* showlinks.js
	The javascrpt below takes the array arrShows from archive.js
	and creates links at the bottom of the pages to navigate from one page to the other
 	or to go back to the archive list, or to switch to Review or Show (in archive).
 	It requires that file html.js be in the same HTML file, so function getHtmlName() can be used.
*/


function selectChange( locHTML )
{
	this.location = locHTML;
}

// call the function in html.js to get the name of this HTML file
var currHTML = getHtmlName();

// Create a table with 1 row and 5 columns: space | Archive link | top link | Reviews/Description link | space
document.write( '<tr><td>' );
document.write( '<table border=0 cellspacing=0 cellpadding=10 width=100%>' );
document.write( '<tr>' );
document.write( '<td width="*">&nbsp;</td>' );
document.write(	'<td width=350 align="left">' );

document.write( '<A HREF="../archive/archive.htm" target="_top"><font size=-1>Archive</font></A>' );
document.write( '</td>' );

document.write(	'<td width=100 align="center">' );
document.write(	'<a href="#top" target="_self"><font size=-1>top</font></a>' );
document.write( '</td>' );


// Cell with a link to either the review page or the archive page
document.write(	'<td width=350 align="right">' );
if ( pageType == 'Show' ) {
	// put a link to the show's review page
	document.write( '<A HREF="../reviews/' + currHTML + '" target="_top"><font size=-1>Reviews</font></A>' );
} else {
	// put a link from the show's review page to its page in the archive
	document.write( '<A HREF="../archive/' + currHTML + '" target="_top"><font size=-1>Show Description</font></A>' );
}
document.write( '</td>' );
document.write( '<td width="*">&nbsp;</td>' );
document.write( '</tr>' );
document.write( '</table>' );
document.write( '</td></tr>' );

// Next row is a table of 5 columns: space | previous show | drop down of shows | next show | space
document.write( '<tr><td>' );

// Calculate which of the shows should be on the previous and next links, and selected in the dropdown
var cPrior = arrShows.length - 1;
var cNext = 0;
var selectText = '<select name="selectPage" onChange="selectChange(this.value);return true">';
for ( a=0; a < arrShows.length; a++ ) {
	selectText += '<option value="' + arrShows[a].showHTML + '" ';
	if ( arrShows[a].showHTML == currHTML ) {
		selectText += 'SELECTED ';
		// This page matches the one in the array at this point.
		// Set the 'previous' link to the prior one
		if ( a > 0 ) {
			cPrior = a - 1;
		}

		// Set the 'next' link to the next one
		if ( a < (arrShows.length - 1) ) {
			cNext = a + 1;
		}
	}
	selectText += '>' + arrShows[a].showName + '\n';
}

document.write( '<table border=0 cellspacing=0 cellpadding=10 width=100%>' );
document.write( '<td width="*">&nbsp;</td>' );
// prior link
document.write('<td width=200 align="left">' );
document.write( '<font size=-1><A HREF="./' + arrShows[cPrior].showHTML + '" target="_top"><<- ' );
document.write( arrShows[cPrior].showName + '</font></A>' );
document.write( '</td>' );
// drop down select with the show names
document.write('<td width=300 align="center">' );
document.write( selectText + '</SELECT>' );
document.write( '</td>' );
// next link
document.write('<td width=200 align="right">' );
document.write( '<font size=-1><A HREF="./' + arrShows[cNext].showHTML + '" target="_top">' );
document.write( arrShows[cNext].showName + ' ->></font></A>' );
document.write('</td>');
document.write( '<td width="*">&nbsp;</td>' );
document.write( '</tr>' );
document.write( '</table>' );
document.write( '</td></tr>' );

//-->