//
// This file contains all the JavaScript code necessary to 
// populate and maintain the active element:
//
//  pageHeader
//

// function: pageHeaderPopulator
// 'data' is plaintext, which is used "as is" to update the browser title,
// and is embedded within a header tag for appearing on the page

function pageHeaderPopulator( activeElement, data )
{
	// (i) Extract title, region from XML
	
	var TitleArray = data.getElementsByTagName("title");
	var RegionArray = data.getElementsByTagName("region");
	var Title;
	var Region;
	
	Title = TitleArray[0].firstChild.nodeValue;
	Region = RegionArray[0].firstChild.nodeValue;	
	
     // (ii) Update Browser title
	document.title = Title;
	
	// (iii) Update active element
	clearText( activeElement );
	activeElement.innerHTML = "<H1>" + Title + "</H1>";
	
	// (iv) Update class attribute of body element with region
	document.getElementsByTagName("body").item(0).className = Region;
	
}
