// JavaScript Document

document.observe('dom:loaded',function(){
	//create brand tabset
	if($('moduleList')){
		var maxHeight = 0;
		if ($('moduleList').select('dd').length > 0) {
		var offsetY = $('moduleList').down('dd').positionedOffset().top;
		
		$('moduleList').select('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";
		$('moduleList').select('dd').each(function(v){
			v.style.height = ""+(maxHeight)+"px";;
		})


		var brandBar = $('moduleList').tabset({
			animate: {
				opacity: 1	
			}	
		})
		
		brandBar.getItems().each(function(v){
			if(!v.element.down('ul').down('li')){
				v.eventType(false)
				v.element.previous('dt').addClassName('disabled')
			}
/*			
			v.element.observe(':show', function(e){
				e.target.up().setStyle({
					height: (e.target.getHeight() + e.target.positionedOffset().top + e.target.style.paddingBottom + e.target.style.marginBottom + 'px')
				})
			})
*/			
		})
		
		brandBar.showItem(0)
   	}
	}
},false)
	