
///////////////////
// dom is loaded //
///////////////////

var init = function() {						 
	// preload some images
	preloadImages('/images/leftcol/nav_highlight.gif');
	
	<!-- primary navigation -->

	// initialize fx.accordion
	var togglers = $$("img.navToggler"); 
	var stretchers = $$("div.stretcher");
	myAccordion = new Fx.Accordion(togglers, stretchers ,{
		duration:350,
		alwaysHide: true,
		start: true,
		onActive: function(toggler) { toggler.setProperty("src","/images/leftcol/nav_minus.gif"); },
		onBackground: function(toggler) { toggler.setProperty("src","/images/leftcol/nav_plus.gif"); },		
		transition:Fx.Transitions.sineInOut
	});
	
	// all nav stretchers start out hidden, now that the accordion is initialized make them visible
	stretchers.each(function(el){el.setStyle('display', 'block')});	

	// highlight active nav element
	activeNav = "Home";
	$(activeNav).setStyle('background', 'url(/images/leftcol/nav_highlight_active.gif) no-repeat top left');

	// set mouseover actions for the nav element highlights
	$$('.navHighlight').each(function(el) {
		el.addEvent('mouseover', function() {	el.addClass('navHighlightOver'); });
		el.addEvent('mouseout', function() { el.removeClass('navHighlightOver'); });
	});

	// capture enter button press to submit search form
	$E('html').addEvent('keydown', function(event) {
		event = new Event(event);
		if (event.key == 'enter') {
			SiteConfig.validate_search(SiteConfig.searchBoxID);
			return false;
		}
	});	
};

window.addEvent('domready', init);
 
////////////////////
// page is loaded //
////////////////////

window.onload = function() {

	<!-- Home Boxes -->
	
	// fix home boxes height (must be an even number for the bg image to display correctly)
	$$('.leftContent','#rightContent').each(function(el) {
		var n = el.offsetHeight.toInt();
		if (n%2 == 1) { n++; el.setStyle('margin-bottom','-1px');	}
	});

}
