var Expander = {
	accordion : null,
	
	init : function(toggler,content) {
		Expander._init(toggler,content);
	},
	
	_init : function (toggler,content) {
		window.addEvent('load', function(){
			accordion = new Accordion(toggler, content, {opacity: false,display: -1});
			accordion.addEvent('background',Expander.onBackground);
			accordion.addEvent('active',Expander.onActive);
			
			$$(toggler).forEach(function(item,index) {
				item.href = "javascript:void(null);";
				item.setStyle('cursor', 'pointer');
				item.onfocus = function() { this.blur(); }
			});
			
			var myFile = document.location.toString();
			if (myFile.match('#')) { // the URL contains an anchor
				// click the navigation item corresponding to the anchor
				var position = '#' + myFile.split('#')[1];
				
				if ($$('h3' + position + ' a'))
					$$('h3' + position + ' a').fireEvent('click');
			}
		});
	},
	
	onBackground : function (toggle,element) {
		toggle.removeClass('active');
	},
	
	onActive : function (toggle,element) {
		toggle.addClass('active');
		//alert(pageTracker);
		if (pageTracker) {
			pageTracker._trackPageview(window.location.pathname + '/' + toggle.get('text') + '/');
		}
	}
}