function setSubmenuTab()
{	// Function:		Parse URI string and set document variables
	// Author:			E3webdesign
	// Modified:		28-Jan-2008	- First setup.
	//					25-Oct-2008 - Reorganised, to follow pageSection re-definition.
	//					30-Nov-2008 - Search menu on page "News.php" now supported.
	//					05-Dec-2008 - Handling of search menu on page "News.php" and "Services.php" is now
	//								  uniform for all sub-tabs.
	// Notes:			-
	// Known bugs:		-
	// Suggestions:		-

	var variables = new Array();
	var uriQuery;
	var address;
	var contentClass;
	var menuClass;

	uriQuery	= location.href.split("?");
	address		= uriQuery[uriQuery.length-2];
	variables 	= getUriVariables();

	//Set classes to control the active page section and the page menu tabs
	if (!variables['pageSection'])
	{	//No page section specified, set default values
		contentClass = 'pageSection1';
		menuClass	 = 'tab1';
	}
	else
	{	contentClass = 'pageSection' + variables['pageSection'];
		menuClass	 = 'tab' + variables['pageSection'].charAt(0);	//First digit of the page number only
	}
	document.getElementById('pageContent').className = contentClass;
	document.getElementById('pageMenu').className = menuClass;

	//Set class to control the search menu on dedicated subpages
	if ((address.indexOf("Services.php")!=-1) && (menuClass == 'tab1')) document.getElementById('pageSectionSearchMenu').className='pageSectionX';
	if ((address.indexOf("Services.php")!=-1) && (menuClass == 'tab2')) document.getElementById('pageSectionSearchMenu').className='pageSectionX';
	if ((address.indexOf("News.php")!=-1)) 								document.getElementById('pageSectionSearchMenu').className='pageSectionX';

	//Set class to enable the alphabet selection menu
	if ((address.indexOf("Services.php")!=-1) && (menuClass == 'tab3')) document.getElementById('alphabetMenu').className='active';

//D	window.alert('Function setSubmenuTab: ' +
//D		'\nPageTab: ' + menuClass +
//D		'\nPageSection: ' + variables['pageSection'] +
//D		'\nPagesection (first digit): ' + variables['pageSection'].charAt(0) +
//D		'\npageContent.className: ' + document.getElementById('pageContent').className )
////D	'\npageSectionSearchMenu.className: ' + document.getElementById('pageSectionSearchMenu').className )	//NB: Not valid code for all pages
////D	'\npageSubMenu.className: ' + document.getElementById('pageSubMenu').className )	//NB: Not valid code for all pages
}

function getUriVariables()
{	// Function:		Parse URI string and return the name-value pairs of the query in an array
	// Author:			E3webdesign
	// Modified:		25-Oct-2008	- First setup.
	// Notes:			-
	// Known bugs:		-
	// Suggestions:		-

	var vars = [], hash;
	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

	for(var i = 0; i < hashes.length; i++)
	{	hash = hashes[i].split('=');
		vars.push(hash[0]);
		vars[hash[0]] = hash[1];
	}

//D	window.alert('Function getUriVariables: ' +
//D		'\nURI hashes: ' + hashes )

	return vars;
}
