
/* -- Subnavigation -- */
YAHOO.gp.SubNav = (function() {
/*
	var accordion = new YAHOO.widget.AccordionView('subNav', {
		collapsible: false,
		width: '225px',
		expandItem: getActiveItemIndex(),
		animationSpeed: '0.2',
		animate: true,
		hoverActivated: true,
		effect: YAHOO.util.Easing.easeBothStrong
	});
*/
	resizeSubNavContainer(getContainerHeight());
/*
	function showSubNav() {
 		var myAnim = new YAHOO.util.Anim('subNav', { opacity: { to: 1, from: 0 } }, 0.25, YAHOO.util.Easing.easeOut);
 		myAnim.onStart.subscribe(function() {
 			YAHOO.util.Dom.setStyle(this.getEl(), 'opacity', 0);
 			YAHOO.util.Dom.setStyle(this.getEl(), 'visibility', 'visible');
 		});
		myAnim.animate();
	}
*/
/*
	function getActiveItemIndex() {
		//var nodes = document.getElementById('subNav').getElementsByTagName('h3');
		var nodes = YAHOO.util.Selector.query('h3 > a', 'subNav');

		for(var i = 0; i < nodes.length; i++) {
			if(YAHOO.util.Dom.hasClass(nodes[i], 'active')) {
				return i;
			}
		}

		return -1;
	}
*/
	function getContainerHeight() {
		var region = YAHOO.util.Dom.getRegion('subNav');
		var height = region.bottom - region.top;
		return height;
	}

	function resizeSubNavContainer(currentHeight) {
		var computedHeight = currentHeight;


		while(computedHeight % 140 != 0) {
			computedHeight++;
		}

		if(computedHeight < 280) {
			computedHeight = 280;
		}

		var subNavBarPadding = parseInt(YAHOO.util.Dom.getStyle('subNavBar', 'paddingTop'));

		YAHOO.util.Dom.setStyle('subNavBar', 'height', (computedHeight - subNavBarPadding) + 'px');
	}


	return {
	};
});

YAHOO.util.Event.onContentReady("subNav", function() {
	var subNav = new YAHOO.gp.SubNav();
});