/********A little hack to keep things from becoming visible before we are ready *************/
document.write("<style type='text/css'>#TwoHalves tr td#LeftHalf div.visible {display: none !important;}</style>");

/*********************************************************************************
 * Cycling of #Features
 *********************************************************************************/
 
var arrayOfFeatures = new Array();

function assembleArrayOfFeatures() {
	if( arrayOfFeatures.length > 0 ) return; // already assembled
	var featureParent = document.getElementById('BigLeftArea');
	var featureContainer = null;
	for (var i =0; i < featureParent.childNodes.length; i++) {
    if (featureParent.childNodes[i].className == 'view view-feature') {
      featureContainer = featureParent.childNodes[i];
      break;
    }
  }
	if( !featureContainer ) return; // could not find feature container

	// Find all features within container
	var featureIdx = 0;
	for(var i = 0; i < featureContainer.childNodes.length; i++) {
		var feature = featureContainer.childNodes[i];
		if( feature.nodeType != 1 || !feature.childNodes.length) continue; // not a feature
		var featureClassNames = ("" + feature.className).split(" ");
		for(var j = 0; j < featureClassNames.length; j++)
			if( featureClassNames[j] == 'view-content' || featureClassNames[j] == 'view-empty' ) break;
		if (j == featureClassNames.length) continue; // not a feature
		for (var k = 0; k < feature.childNodes.length; k++)
			if (feature.childNodes[k].className == 'node') {
				arrayOfFeatures[featureIdx++] = feature.childNodes[k];
			}
	}
};

function indexOfVisibleFeature() {
	if( arrayOfFeatures.length == 0 ) return null; // cannot find in an empty array
	for(var i = 0; i < arrayOfFeatures.length; i++) {
		var feature = arrayOfFeatures[i];
		if( feature.className.indexOf('hidden') == -1 ) return i;
	}
	return 0; // default to first one if one could not be determined.
};

function hideFeatureNavigationIfAppropriate() {
	var nav = document.getElementById('FeatureNavigation');
	if( !nav ) return;
	var navAnchors = getImmediateChildrenByTagName(nav, 'A');
	if( !navAnchors.length ) return;
	if( navAnchors[0].href.substring(0,11) != 'javascript:' ) return; // not default setup
	if( arrayOfFeatures.length < 2 ) nav.style.display = 'none';
};

function prepareImagePlacement() {
	var featureContainer = document.getElementById('BigLeftArea');
	var rightSide = /*featureContainer.className.indexOf('leftSideImage') == -1;*/true;
	for( var idx = 0; idx < arrayOfFeatures.length; idx++ ) {
		var imgs = arrayOfFeatures[idx].getElementsByTagName('IMG');

		// Use TILT to get layout right for image.
		var tbl, tr1, tr2, tdText, tdImg, tdNav;
		tbl = document.createElement('table');
		tbl.border = 0;
		tbl.cellSpacing = 0;
		tbl.cellPadding = 0;
		tr1 = tbl.insertRow(0);
		if( rightSide ) {
			tr1.appendChild( tdText = document.createElement('td') );
			tr1.appendChild( tdImg = document.createElement('td') );
		} else {
			tr1.appendChild( tdImg = document.createElement('td') );
			tr1.appendChild( tdText = document.createElement('td') );
		}
		tdText.vAlign = "top";
		tdImg.rowSpan = 2;
		tdImg.vAlign = "top";
		tr2 = tbl.insertRow(isSafari() ? 2 : 1); // 1 is correct, but Safari chokes if not 2
		tr2.appendChild( tdNav = document.createElement('td') );
		tdNav.style.paddingTop = '5px';
		tdNav.vAlign = "bottom";
		if( !rightSide ) tdNav.align = 'right';

		// copy image: one for a placeholder, one for the visible, bottom-right corner image
		if( imgs.length == 1 ) {
			var img = imgs[0].cloneNode(true);
			//imgs[0].style.visibility = 'hidden'; // imgs[0] is the placeholder
			imgs[0].style.display = 'none';
			tdImg.appendChild(img);
			tdImg.appendChild(imgs[0]);
			/*
			NP: This code causes problems with IE. I'm not even sure why it's necessary.
			// shove the visible image down to top-right corner
			img.style.position = "absolute";
			img.style.top = '0px';
			if( rightSide )
				img.style.right = isIE() ? '-1px' : '0px'; // IE leaves white band
			else
				img.style.left = '0px';
			*/
		}
		// move feature text elements into left cell
		while( arrayOfFeatures[idx].childNodes.length )
			tdText.appendChild(arrayOfFeatures[idx].childNodes[0]);
		// inject new table
		arrayOfFeatures[idx].appendChild(tbl);
	}
}

function hideFeature(idx) {
	arrayOfFeatures[idx].className = 'node hidden';
};

function showFeature(idx) {
	arrayOfFeatures[idx].className = 'node';
	var fn = document.getElementById('FeatureNavigation');
	if( fn )
		getImmediateChildrenByTagName(arrayOfFeatures[idx], 'table')[0].rows[1].cells[0].appendChild(fn);
};

function nextFeature() {
	var idx = indexOfVisibleFeature();
	hideFeature(idx);
	showFeature((idx+1)%arrayOfFeatures.length);
};

function previousFeature() {
	var idx = indexOfVisibleFeature();
	hideFeature(idx);
	showFeature((idx + arrayOfFeatures.length - 1) % arrayOfFeatures.length);
};

function getRandom(low, high) { 
	return Math.floor(Math.random() * (1 + high - low) + low); 
};

function showRandomFeature() {
	var idx = indexOfVisibleFeature();
	hideFeature(idx);
	showFeature(getRandom(0,arrayOfFeatures.length-1));
};

function featureInitialize() {
	assembleArrayOfFeatures();
	for (var i = 0; i < arrayOfFeatures.length; i++)
		arrayOfFeatures[i].className += ' hidden';
	hideFeatureNavigationIfAppropriate();
	prepareImagePlacement();
	if( arrayOfFeatures.length > 0 && arrayOfFeatures[0].className.indexOf('alwaysFirst') == -1 )
		showRandomFeature();
	else
		showFeature(0);
};

/*********************************************************************************
 * Layering of the #MenuTabs.
 *********************************************************************************/
function changeTabContent(tabAnchor, layerId, showNews) {
	var newsLayer = document.getElementById('RightHalf');
	if (showNews) {
		newsLayer.style.display = 'block';
	} else {
		newsLayer.style.display = 'none';
	}
	swapLeftSide(tabAnchor, layerId);
}

function swapLeftSide(tabAnchor, layerId) {
	var leftHalf = document.getElementById('LeftHalf');
	var tabs = document.getElementById('Tabs');
	var clickedTab = tabAnchor.parentNode;
	
	// unselect all tabs, and select the appropriate one.
	var eachTab = getImmediateChildrenByTagName(tabs, 'LI');
	for( var i = 0; i < eachTab.length; i++ ) {
		var tab = eachTab[i];
		tab.className = (tab == clickedTab) ? 'current' : null;
	}
	
	// first hide all layers
	for( var i = 0; i < leftHalf.childNodes.length; i++ ) {
		var layer = leftHalf.childNodes[i];
		if( layer.id == layerId && layer.className != 'visible' ) continue; // avoid flicker by not hiding the one we want to show
		
		if( layer.style ) layer.style.display = 'none';
		if( layer.className == 'toVisible' || layer.className == 'visible' )
			layer.className = '';
	}
	
	// show just the one layer
	var layer = document.getElementById(layerId);
	if( !layer ) return; // layer id is probably wrong.
	layer.style.display = 'block';
	if( layer.className.length == 0 )
		layer.className = 'toVisible';

	// Look for input boxes on new tab, and select the first one if found
	var inputFields = layer.getElementsByTagName("input");	//is this the problem with the RY form not submitting on the "enter" key on IE?
	for( var i = 0; i < inputFields.length; i++ ) {						//maybe it just contributes to IE's bugginess
		if( inputFields[i].type != 'hidden' ) {
			inputFields[i].focus();
			break;
		}
	}
};

/* Finds the "selected" (class=curent) tab and simulates a click on it.
	This was important in crushing the "menu flicker" bug */
function initializeMenus() {
	var tabs = document.getElementById('Tabs');
	var eachTab = getImmediateChildrenByTagName(tabs, 'LI');
	for( var i = 0; i < eachTab.length; i++ ) {
		var tab = eachTab[i];
		if (tab.className == 'current') {
			var eachAnchor = tab.getElementsByTagName('A');
			var selectedTab = eachAnchor[0];
			selectedTab.onclick();
			tab.className = 'current'; //don't know why this has to be here, but IE was unselecting the tab
			break;
		}
	}
};

/*********************************************************************************
 * Convert the pretty outline bulleted list of menus into the ugly HTML of yonder-year
 *********************************************************************************/
// Reimplemented better by Nathaniel Price. Depends on Prototype.

var tabIndexCount = 50; // this is a static counter, since no anchor tag should share a tabindex with another

var mpm_Counter = 0;
var mpm_menuCounter = 0;
var MosaicPopMenu = Class.create(); 

MosaicPopMenu.prototype = {
	initialize: function(menuUlObj) {
		this.ul = $(menuUlObj)	//The UL object to transform
		this.html = null; //The generated html
		this.menus = document.createElement('div');		//keeps all transformed submenu divs.
		this.rootmenu = null;
		this.selected_path = new Array();
		
		if (this.ul.id) {
			this.prefix = this.ul.id;		//The prefix to use for all sub-items
		} else {
			this.ul.id = this.prefix = "menu"+mpm_Counter++;
		}
		this.depth = 0;
		this.cellInternals = '<div id="PREFIX-smd-DEPTH" style="visibility: hidden;">'+
			'<table cellpadding="0" cellspacing="0" align="left">'+
				'<tr>'+
					'<td><span style="background-position: bottom" class="popupMenusHorizLine"/></td>'+
				'</tr>'+
				'<tr>'+
					'<td id="PREFIX-smtd-DEPTH" valign="top" class="mb" height="250"></td>'+
				'</tr>'+
				'<tr>'+
					'<td><span style="background-position: top" class="popupMenusHorizLine"/></td>'+
				'</tr>'+
			'</table>'+
		'</div>';
		this.firstMenuSetArea = null;
		
		this.menus.id = this.getHiddenHoldingArea();
		Element.hide(this.menus);
		
		this.traverseHtmlUl(this.ul, new Array());
		
		this.buildMenu();
		
		return;
	},
	
	getPrefix: function() {
		return this.prefix;
	},
	
	pathToString: function(path) {
		if (path.length == 0) {
			return this.getPrefix()+'-root';
		} else {
			return this.getPrefix()+'-menu-'+path.join('_');
		}
	},
	
	stringToPath: function(menu_id) {
		//Extract the path from the menu_id
		var path = menu_id.split('-');
		path = path.pop();
		path = path.split('_');
		return path;
	},
	
	pathToLinkString: function(path) {
		return this.getPrefix()+'-link-'+path.join('_');
	},
	
	traverseHtmlUl: function(ul, path) {
		if (!path) {
			path = new Array();
		}
		var submenus = 0;
		var li_els = getImmediateChildrenByTagName(ul, 'LI');
		var target = document.createElement('div');
		
		//Set our depth, if it's deeper than anything encountered yet.
		if (this.depth <= path.length) {
			this.depth = path.length + 1;
		}
		
		//Traverse each li in the ul.
		li_els.each( function(li) {
			var currmenu = null;
			var div = document.createElement('div');
			
			//Look at the LI's children to see if it contains a UL (submenu)
			var children = $A(li.childNodes);
			children.each( function(child) {
				if (child.nodeName == 'UL') {
					//Submenu found - recurse
					//@@TODO: copy/move link from this li to the submenu
					currmenu = submenus++;
					path.push(currmenu);
					this.pushDownMenuLink(li, child);
					this.traverseHtmlUl(child, path);
					path.pop();
					return;
				} else {
					//Otherwise, stick the child node in the div.
					div.appendChild(child.cloneNode(true));
				}
			}.bind(this));
			
			if (currmenu != null) {
				//There was a submenu found - Create a new link on the menu that will open the 
				//submenu.
				this.transformSubmenuLink(div, path, currmenu);
			} else {
				this.addStylesToMenuItemLink(div.getElementsByTagName('A')[0]);
				this.addStylesToMenuItem(div);
			}
			
			
			target.appendChild(div);
		}.bind(this));		
		
		this.insertMenuIntoTree(target, path);
		
	},
	
	pushDownMenuLink: function(li, subul) {
		var anchors = li.getElementsByTagName('A');
		if (anchors.length == 0 || anchors[0].href == '') return;
		//Create a link to stick into the submenu.
		var newli = document.createElement('LI');
		var link = anchors[0].cloneNode(true);
		if (anchors[0].title != null && anchors[0].title != '') {
			Element.update(link, anchors[0].title);
		}
		newli.appendChild(link);
		subul.insertBefore(newli, subul.firstChild);
		
	},
	
	transformSubmenuLink: function(div, path, menu_num) {
		var anchors = div.getElementsByTagName('A');
		var link = null;
		path.push(menu_num);
		if (anchors.length == 0) {
			//No existing links in the menu item. Create one.
			link = document.createElement('a');
			link.href = "#";
			while( div.childNodes.length ) {
				link.appendChild(div.childNodes[0]);
			}
			div.appendChild(link);
		} else {
			//Use the first available link as the submenu show link
			link = anchors[0];
		}
		//Attach the showMenu function to the link. The href property is left alone to allow us
		//to support new window/new tab clicking on the link.
		function link_show_menu(o, mypath) {
			return (function () {
				o.showMenuByPath(mypath);
				return false;
			});
		}
		
		//path.slice(0) makes a copy of the array.
		var lsm = link_show_menu(this, path.slice(0));
		link.onclick = lsm;
		
		this.addStylesToSubmenuLink(link);
		this.addStylesToSubmenu(div);
		div.id = this.pathToLinkString(path);
		
		//Apply and increment tabIndex
		link.tabIndex = tabIndexCount++;
		
		path.pop();
	},
	
	addStylesToMenuItem: function(div) {
		Element.addClassName(div, 'sublink');
		return;
	},
	
	addStylesToMenuItemLink: function(link) {
		Element.addClassName(link, 'navLink');
	},
	
	addStylesToSubmenu: function(div) {
		Element.addClassName(div, 'submenu');
	},
	
	addStylesToSubmenuLink: function(link) {
		Element.addClassName(link, 'navBranch');
	},
	
	insertMenuIntoTree: function(target, path) {
		if (path.length == 0) {
			this.rootmenu = target;
		}
		target.id = this.pathToString(path);
		this.menus.appendChild(target);
	},
	
	preloadMenus: function() {
		var saved_menu = getCookie(this.getCookieName());
		if (saved_menu != null && saved_menu != '') {
			this.showMenu(saved_menu);
		} else {
			this.showMenu(this.pathToString([0]));
		}
	},
	
	showMenu: function(menu_id) {
		//Get the path of this menu item.
		var path = this.stringToPath(menu_id);
		return this.showMenuByPath(path); 
	},
	
	showMenuByPath: function(p) {
		var path = p.slice(0);
		
		//hide old stuff.
		this.hideUnusedMenuTable(path.length);
		this.unselectMenus(this.path);
		
		//show new stuff.
		while (path.length) {
			this.showMenuWithPath(path);
			path.pop();
		}
		this.path = p.slice(0);
		
		//Set the cookie to remember where we are
		setCookie(this.pathToString(this.path), this.getCookieName());
	},
	
	hideUnusedMenuTable: function(depth) {
		var hidden_menus = $(this.getHiddenHoldingArea());
		for (i = this.depth - 1; i > depth; --i) {
			var parent_cell = $(this.getMenuParentTableCellId(i));
			var table_cell = $(this.getMenuTableCellId(i));
			
			Element.removeClassName(parent_cell, 'selected');
			Element.addClassName(parent_cell, 'hiddenMenu');
			$(this.getMenuDivId(i)).style.visibility = 'hidden';
			if (table_cell.firstChild != null) {
				hidden_menus.appendChild(table_cell.firstChild);
			}
		}
	},
	
	unselectMenus: function(old_path) {
		//get old link and remove styles.
		if (typeof old_path == 'undefined') {
			return;
		}
		var old_link = null;
		while (old_path.length) {
			old_link = $(this.pathToLinkString(old_path));
			Element.removeClassName(old_link, 'selected');
			old_path.pop();
		}
	},
	
	showMenuWithPath: function(path) {
		var depth = path.length;
		if (this.depth <= depth) return;
		
		//Get appropriate elements.
		var menu = $(this.pathToString(path));
		var link_div = $(this.pathToLinkString(path));
		var parent_cell = $(this.getMenuParentTableCellId(depth));
		var table_cell = $(this.getMenuTableCellId(depth));
		var table_cell_div = $(this.getMenuDivId(depth));
		
		if (typeof menu == 'undefined' || typeof link_div == 'undefined' || 
			typeof parent_cell == 'undefined' || typeof table_cell == 'undefined' || 
			typeof table_cell_div == 'undefined') 
		{
			return;
		}
		
		var hidden_menus = $(this.getHiddenHoldingArea());
		
		//Set the styles
		Element.removeClassName(parent_cell, 'hiddenMenu')
		Element.addClassName(parent_cell, 'shown');
		Element.addClassName(link_div, 'selected');
		table_cell_div.style.visibility = 'visible';
		
		
		//Move the menu.
		if (table_cell.firstChild == null) {
			table_cell.appendChild(menu);
		} else if (menu != table_cell.firstChild) {
			hidden_menus.appendChild(table_cell.firstChild);
			table_cell.appendChild(menu);
		}		
	},
	
	buildMenu: function() {
		this.html = document.createElement('div');
		this.html.className = 'popupMenus';
		this.html.appendChild( this.buildMenuTable() ); // build the skeletal table
		this.insertMenusIntoHtml();
		this.ul.parentNode.replaceChild(this.html, this.ul);
		this.preloadMenus();
	},
	
	buildMenuTable: function() {
		var tbl, tbody, tr, td;
		tbl = document.createElement('table');
		tbody = tbl.getElementsByTagName("tbody")[0];
		tbl.cellPadding = 0;
		tbl.cellSpacing = 0;
		tr = tbl.insertRow(0);
		for( var i = 0; i < this.depth; i++ )
		{
			tr.appendChild( td = document.createElement('td') );
			td.id = this.getMenuParentTableCellId(i);
			
			if ( i == 0 ) {
				Element.addClassName(td, 'menuRoot');
				this.firstMenuSetArea = td;
				
			} else {
				Element.addClassName(td, 'menuSub');
				var html = this.cellInternals;
				html = html.replace(/PREFIX/g, this.getPrefix()).replace(/DEPTH/g, i);
				td.innerHTML = html; 
			}
		}
		return tbl;
	},
	
	getMenuParentTableCellId: function(depth) {
		return this.getPrefix()+'-td-'+depth;
	},
	
	getMenuTableCellId: function(depth) {
		return this.getPrefix()+'-smtd-'+depth;
	},
	
	getMenuDivId: function(depth) {
		return this.getPrefix()+'-smd-'+depth;
	},
	
	getHiddenHoldingArea: function() {
		return this.getPrefix()+'HiddenMenus';
	},
	
	getCookieName: function() {
		return this.getPrefix()+'mid';
	},
	
	insertMenusIntoHtml: function() {
		this.firstMenuSetArea.appendChild(this.rootmenu);
		this.html.appendChild(this.menus);
	}
	
}

var menuSystems = new Array(); // stores all the variables required to manage the popup menu(s) on the page

// Performs the transformation of the nice bulleted list
// into the ugly HTML tables that work the pop-up menus.
function popmenuInitialize()
{
	popmenuInitMenu($('LayerMenus'));
	//popmenuInitMenu($('LayerRoles'));
	return;
}

function popmenuInitMenu(menuParent) {
	for (var i = 0; i < menuParent.childNodes.length; i++) {
	  if (menuParent.childNodes[i].tagName == 'UL') {
			menuSystems[mpm_menuCounter++] = new MosaicPopMenu(menuParent.childNodes[i]);
		}
	}
};


/*********************************************************************************
 * Automatic index generation
 *********************************************************************************/

function initializePopupIndex() {
	var layerMenus = document.getElementById('LayerMenus');
	var layerIndex = document.getElementById('LayerIndex');
	var bl = getImmediateChildrenByTagName(layerMenus, 'UL')[0];
	if( !bl || !layerIndex || !layerMenus || layerIndex.childNodes.length > 0 )
		return;
	
	var targetArea = layerIndex;
	var arrayIndex = new Array();
	generateIndex(bl, arrayIndex);
	arrayIndex.sort();
	indexToHtml(targetArea, arrayIndex);
};

function getInnerText(inputHtml)
{
	var outputHtml = "";
	var findClose = false;
	
	inputHtml = stripWhitespace(inputHtml);
	
	for (var i = 0; i < inputHtml.length; i++)
	{
		if (findClose == true)
		{
			if ( inputHtml.substr(i, 1) == ">" )
				findClose = false;
		}

		else if ( inputHtml.substr(i, 1) == "<" )
		{
			findClose = true;
		}

		else if ( isAlphanumeric(inputHtml.substr(i, 1)) )
			outputHtml = outputHtml + inputHtml.substr(i, 1);
	}
	
	return outputHtml;
};

function generateIndex(bl, arrayIndex, prefixText) {
	var origPrefix = prefixText;
	var liTags = getImmediateChildrenByTagName(bl, 'LI');
	for( var i = 0; i < liTags.length; i++ ) {
		prefixText = origPrefix;
		if( getImmediateChildrenByTagName(liTags[i], 'UL').length ) {
			// recurse deeper into tree
			if( prefixText && prefixText.length > 0 ) 
				prefixText += ', ';
			else
				prefixText = '';
			if( liTags[i].attributes['indexText'] ) {
				if( liTags[i].attributes['indexText'].value.length )
					prefixText += liTags[i].attributes['indexText'].value;
				else
					prefixText = prefixText.substr(0, prefixText.length-2); // trim comma
			} else {
				for( var j = 0; j < liTags[i].childNodes.length; j++ )
					if( liTags[i].childNodes[j].nodeName != 'UL' && liTags[i].childNodes[j].nodeValue )
						prefixText += liTags[i].childNodes[j].nodeValue.replace(/^\s*|\s*$/g,"");
			}
			generateIndex(getImmediateChildrenByTagName(liTags[i], 'UL')[0], arrayIndex, prefixText);
		} else { // leaf node
			var indexElement = new IndexElement(liTags[i].innerHTML);
			if( prefixText ) indexElement.html += "<span class='navLink'> (" + prefixText + ")</span>";
			arrayIndex[arrayIndex.length] = indexElement;
		}
	}
};

function IndexElement(html) {
	this.html = html;
	this.text = getInnerText(html);
	this.firstLetter = function() { return this.text.substring(0,1).toUpperCase(); };
	this.toString = function() { return this.text.toUpperCase(); };
	return this;
};

function indexToHtml(targetArea, arrayIndex) {
	printFirstCharacters(targetArea, arrayIndex);
	var lastSubset, ul;
	for( var i = 0; i < arrayIndex.length; i++ ) {
		if( arrayIndex[i].firstLetter() != lastSubset || !ul ) {
			lastSubset = arrayIndex[i].firstLetter();
			ul = document.createElement('ul');
			targetArea.appendChild(ul);
		}
		var indexLI = document.createElement('li');
		indexLI.innerHTML = arrayIndex[i].html;
		if( getImmediateChildrenByTagName(indexLI, 'A').length )
			getImmediateChildrenByTagName(indexLI, 'A')[0].className = 'navLink';
		ul.appendChild(indexLI);
	}
};

function printFirstCharacters(targetArea, arrayIndex) {
	var div = document.createElement('p');
	targetArea.appendChild(div);

	var list = firstCharactersList(arrayIndex);
	for( var i = 0; i < list.length; i++ ) {
		if( i > 0 ) div.innerHTML += '&nbsp;';
		var a = document.createElement('a');
		div.appendChild(a);
		a.className = 'indexSubsetLinks';
		a.innerHTML = list[i];
		a.href = 'javascript:showIndexSet(' + i + ');';
	}

	div.innerHTML += ' | ';
	var showAll = document.createElement('a');
	div.appendChild(showAll);
	showAll.className = 'indexSubsetLinks';
	showAll.innerHTML = 'ALL';
	showAll.href = 'javascript:showIndexSet(-1);';
};

function showIndexSet(ordinalIndex) {
	var uls = document.getElementById('LayerIndex').getElementsByTagName('ul');
	for( var i = 0; i < uls.length; i++ )
		uls[i].style.display = (i == ordinalIndex || ordinalIndex == -1) ? '' : 'none';
};

function firstCharactersList(arrayIndex) {
	var list = new Array();
	var firstCharacter;
	for( var i = 0; i < arrayIndex.length; i++ )
		if( arrayIndex[i].firstLetter() != firstCharacter ) {
			firstCharacter = arrayIndex[i].firstLetter();
			list[list.length] = arrayIndex[i].firstLetter();
		}
	return list;
};

/*********************************************************************************
 * Register all methods that need onLoad event handling.
 *********************************************************************************/
 
/* Moved to end of html for faster menu handling */
/*registerOnLoadHandler(featureInitialize);
registerOnLoadHandler(initializePopupIndex); /* this one must appear above popmenuInitialize */
/*registerOnLoadHandler(popmenuInitialize);
registerOnLoadHandler(initializeMenus);*/
