jQuery(document).ready(function($) {
	// left tree menu
	var container = '#wrapper .contentColSet .col.left ul'
	// loop through tree menu items
	$(container).children('li[class!=selected]').each(function() {
		// hide sub tree nav
		$(this).children('ul').css('display', 'none')
	})
	// click event
	$(container + ' li a').click(function() {
		if($(this).parent().children('ul').length > 0) {
			// close any visible tree menu options and reset the minus BG to a plus
			$(container + ' li ul:visible').hide().parent().children('a').css('background-image', 'url(/img/plus.gif)')
			// show the clicked tree item
			$(this).parent().children('ul').toggle()
			// Make the plus BG into a minus to denote an open branch of the tree menu
			$(this).parent().children('a:first').css('background-image', 'url(/img/minus.gif)')
			// Override the default A tag behaviour
			return false
		} else {
			// we want the default behaviour to kick in because we don't have any child tree nav items
		}
	})
	// we want to preserve the clicks on the tree nav sub items
	$(container + ' li ul li a').unbind()
	// remove last bullet bg image from menu item
	$('#wrapper .menu ul li:last-child').css('background', 'transparent').css('padding','0')
	// colorbox init
	$('a[rel="lightbox"]').colorbox({maxHeight:'100%'})
})