// JavaScript Document

document.observe('dom:loaded',function(){
	//create brand tabset
	$$('#moduleList').each(function (moduleList) {
		var maxHeight = 0;
		var dd = moduleList.select('dd');
		if (dd.length > 0) {
			var offsetY = dd[0].positionedOffset().top;
			dd.each(function(v){
				v.setStyle({opacity: 0});
				v.distributeChildElements(3, {minimumChildren: 8});
				v.insert('<div class="clear">&nbsp</div>');
				if(v.offsetHeight>maxHeight)
					maxHeight = v.offsetHeight;
			});
			moduleList.style.height = ""+(maxHeight+offsetY)+"px";
			dd.invoke('setStyle', {height: maxHeight+'px'});
			
			var brandBar = moduleList.tabset({
				animate: { 
					opacity: 1 
				}
			});
			window.brandBar = brandBar;
			var first=null;
			brandBar.getItems().each(function(v, i){
				if(!v.element.down('ul').down('li')){
					v.eventType(false);
					v.element.previous('dt').addClassName('disabled');
				} else if (first === null) {
					first = i;
				}
			});
			if (first !== null)
				brandBar.showItem(first);
		}
	});
},false)
	