window.addEvent('domready', function() {
	
	new Accordion($('menu'), 'h3.level1', 'div.cont1', {
		opacity: true,
		display: -1,
		alwaysHide: true,
		show: show,
		onBackground: function(toggler, element){
			var els = $$('div.cont2');
			els.each(function(itm, index) {
				//itm.fade('hide');
				itm.style.display = 'none';
			});
		}
	});
	
	/*
	var els = $$('div.menuIn');
	els.each(function(itm, index) {
		new Accordion(itm, 'h3.level2', 'div.cont2', {
			opacity: true,
			display: -1,
			alwaysHide: true
		});
	});
	*/
	var els = $$('div.cont2');
	els.each(function(itm, index) {
		//itm.fade('hide');
		itm.style.display = 'none';
	});
});

function showSub(id) {
	var els = $$('div.cont2');
	els.each(function(itm, index) {
		if(itm.id != 'sub_'+id)
			//itm.fade('hide');
			itm.style.display = 'none';
	});
	
	//$('sub_'+id).fade('toggle');
	$('sub_'+id).style.display = ($('sub_'+id).style.display == 'none') ? 'block' : 'none';
	return false;
}
