// press.js


window.onload = function()
{
   var categories = getCategories() //
   var posts      = getPosts()     //

	createPressMenu(getPressList(posts), posts)  //

   return null
}


function createPressMenu(months, posts)
{
	for( var cx = 0 ; cx < months.length ; cx++ ) // for each farside subcategory
	{
	   var pressPosts = getPostsByDate(getPostsByCategories(posts, "Press"), months[cx])

		if( pressPosts.length!=0 ) // only display list of months with press posts
		{
		   var menuItem = create("li", "press"+cx, id('pressList'))
		   var menuText = create("span", "press"+cx+"scroller", menuItem)
		       menuText.setAttribute("class", "scroller open")
		       menuText.setAttribute("className", "scroller open")

			listener(text(menuText, months[cx]), "click", scrollMenu)

			createCollapseableMenu(menuItem, pressPosts)

		   var menuHeight = +firstElementChild(menuText.nextSibling).offsetHeight
		   var menuHeightRemainder = ((menuHeight%16)==0 ) ? 0 : (16-(menuHeight%16))
			id("press"+cx+"Menu").style.height = (menuHeight+menuHeightRemainder)+"px"
		}
	}

   return id('pressList').getElementsByTagName('li') // reference to newly created menu items
}

// extracts and returns array of all prefixed farside categories from passed 'categories' array
function getPressList(posts)
{
   var months = new Array()

	for( var cx = 0 ; cx < posts.length ; cx++ ) // for each category
	{
		if( inArray(posts[cx].date, months)<0 ) months.push(posts[cx].date)
	}


   return months
}
<!-- ph=1 -->

