function updateNav(bannerImg, classification, selectedWebAppItemName) {
	var sideNav = document.getElementById(classification + 'SubNav');
	
	// update side nav
	
	if (sideNav != null) {
		sideNav.className = 'selected';
		
		var sideNavChildren = sideNav.getElementsByTagName('li');
		
		// make all li IDs  valid IDs
		for (i = 0; i < sideNavChildren.length; i++) {
			sideNavChildren[i].id = makeIDValid(sideNavChildren[i].id);
		}
		
		var selectedWebAppItemID = makeIDValid('subnav_listing_' + selectedWebAppItemName);
		var selectedWebAppItem = document.getElementById(selectedWebAppItemID);
		
		if (selectedWebAppItem != null) {
			if (selectedWebAppItem.childNodes[0].tagName.toLowerCase() == 'a') {
				selectedWebAppItem.childNodes[0].className = 'selected';
			}
		}
		
		// update banner navigation
		var bannerNav = document.getElementById(classification + 'Nav');
	
		if (bannerNav != null)
			bannerNav.className = 'selected';
		
		//swfobject.embedSWF('/images/healing_recipes_' + classification + '.swf', "banner_content", "505", "290", "9.0.0", false, {}, {}, {});
		
		var bannerContent = document.getElementById('banner_content');
		
		if (bannerContent != null)
			bannerContent.innerHTML = '<img src="/images/' + bannerImg + '">';
	}
}

// converts given string to a valid XHTML ID.  Replaces all none alphanumeric character into a "_"
function makeIDValid (id) {
	return id.replace(/[^|a-z|A-Z|0-9|_|-]/g, "_");
}

function getDate() {
	var today = new Date();
	var months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
	
	var formattedDate = today.getFullYear() + '-' + months[today.getMonth()];
	return formattedDate;
}

/**
  *  Adds event handler for specified event to an element
  *  
  *  @param	element	Element to add event listener to
  *  @param	type		Event to listen for.  Do not prepend event with 'on', as the functions automatically prepends it
  *  @param	expression	Javascript function to execute on event.  Can be either a function name or anonymous function
  *  @param	bubbling	Sets whether to register the event on bubbling phase (true) or capturing phase (false).  Only applies to W3C compliant browsers.
  *  @return			True on success, false on failure
  */
function addListener(element, type, expression, bubbling)
{
	bubbling = bubbling || false;
	
	if(window.addEventListener) { // Standard
		element.addEventListener(type, expression, bubbling);
		return true;		
	} else if(window.attachEvent) { // IE
		element.attachEvent('on' + type, expression);
		return true;
	} else return false;
}
