//	<!--
//	========================================================================
//
//	Functions
//
//	------------------------------------------------------------------------
//
//	Create an index page entry
function	index(pageName, title)
{
	return	'<tr>' +
			'<td' +
			'	class="index"' +
			'	id="Index1' + pageName + '"' +
			'	width="100%"' +
			'	nowrap' + 
			'	>' + 
				'<a' + 
				'	class="Index"' +
				'	id="Index2' + pageName + '"' +
				'	href="?' + pageName + '"' + 
				'	onclick="return show(\'' + pageName + '\');"' + 
				'	>' +
					title +
				'</a>' +
			'</td>' +
		'</tr>';
}	// index
//
//	------------------------------------------------------------------------
//
//	Show a page selected from the index
function	show(
	page		// Page name
	)	// Always returns false to suppress jumps to hrefs
{
	// Create environment
	var	wd	= show.window.document;
	if	(! wd.getElementById && wd.all)	// Probably using Microsoft Internet Explorer 4.0
		// Emulate the getElementById function
		wd.getElementById	= new Function("id", "return	this.all.item(id); ");

	// Only do the change if the new page exists
	var	newPage	= wd.getElementById(page);
	if	(newPage)
	{
		// Hide current page
		var	oldPage	= wd.getElementById(show.currentPage);
		if	(oldPage)
		{
			var	temp	= wd.getElementById('Index1' + show.currentPage); 
			if	(temp)	// Page is in the index
			{
				temp.style.color	= 'yellow';
				temp.style.backgroundColor	= 'blue';
				var	temp	= wd.getElementById('Index2' + show.currentPage); 
				temp.style.color	= 'yellow';
				temp.style.backgroundColor	= 'blue';
			}	// if

			oldPage.style.display	= 'none';	// Hide old page
		}	// if

		newPage.style.display	= 'inline';
		newPage.style.height	= Math.max(360, parseInt(show.window.screen.height ? show.window.screen.height : 640) - 400) + 'px';

		// Show new page
		show.currentPage	= page;
		var	temp	= wd.getElementById('Index1' + page); 
		if	(temp)	// New page is in the index
		{
			temp.style.color	= 'blue';
			temp.style.backgroundColor	= 'yellow';
			var	temp	= wd.getElementById('Index2' + page); 
			temp.style.color	= 'blue';
			temp.style.backgroundColor	= 'yellow';
		}	// if
	}	// if

	return	false;
}	// show
show.window	= void 0;	// Not set up, yet
show.currentPage	= 'XPWarning';	// Initially displayed page section as page is loaded
//
//	------------------------------------------------------------------------
//
//	Show one of the 'Decision' pages
function	showDecision(
	page		// Sub-page number
	)	// Always returns false to suppress jumps to hrefs
{
	// Create environment
	var	wd	= show.window.document;
	if	(! wd.getElementById && wd.all)	// Probably using Microsoft Internet Explorer 4.0
		// Emulate the getElementById function
		wd.getElementById	= new Function("id", "return	this.all.item(id); ");

	var	p	= showDecision.currentPage;
	var	f	= wd.formDecision;

	// Hide current page
	if	(p)
	{
		wd.getElementById('Decision' + p).style.display	= 'none';
		f['button' + p].disabled	= false;
	}	// if

	// Show new page
	showDecision.currentPage	= page;

	wd.getElementById('Decision' + page).style.display	= 'inline';
	f['button' + page].disabled	= true;
	f['buttonPrev'].disabled	= page == 1;
	f['buttonNext'].disabled	= page == showDecision.maxPage;

	return	false;
}	// showDecision
//
showDecision.maxPage	= 7;
//
//	------------------------------------------------------------------------
//
//	Display a YouTube video
function	showYouTubeVideo(targetElement, youTubeURL)
{
	targetElement.outerHTML	= 
		'<object' +
		'	width="425"' +
		'	height="344"' +
		'	style="border: 3px solid raised; "' +
		'	>' +
		'	<param	name="movie"	value="' + youTubeURL + '"	><\/param>' +
		'	<param	name="allowFullScreen"	value="true"	><\/param>' +
		'	<param	name="allowscriptaccess"	value="always"	><\/param>' +
		'	<embed' +
		'		src="' + youTubeURL + '"' +
		'		type="application/x-shockwave-flash"' +
		'		allowscriptaccess="always"' +
		'		allowfullscreen="true"' +
		'		width="425"' +
		'		height="344"' +
		'		>' +
		'	<\/embed>' +
		'<\/object>' +
		'<p	class="center">&copy; Days of Wonder Trust 2008. By kind permission of New Life Church, Hull<\/p>';
}	// showYouTubeVideo
//
//	========================================================================
//
window.onload	= new Function(
	// "alert(window.onload); " +
	"show.window	= window; " +	// Main window for showing page sections
	"var	s	= location.search.split(','); " +
	"showDecision(s[1] ? s[1] : 1); " +
	"show(s[0].substr(1) ? s[0].substr(1) : 'Page1');"
	);

//
//	-->

