function activate_menu() { 
	left_lis = $('left_menu').immediateDescendants();
	left_lis.each(function(li){
		var ul = li.down().next('ul');
		li.down().observe('mouseover', mouse_action_over);
		if (ul) {
			li.down().observe('click', click_action);
			ul.setStyle({display:'none'});
			ul.addClassName('startup');
		} else {
			li.down().observe('click', click_action_location);
		}
	});
	var h = window.location.href;
	h = h.split('/');
	var page_id = h[5];
	if (typeof(page_id)=='undefined') page_id = '1';
	if (page_id.indexOf('#')) {
		var break_it = page_id.split('#');
		page_id = break_it[0];
	} 
	if (page_id) {
		open_parents($('tm_li_'+page_id));
	} 
}
function open_parents(ob) {
	//alert(ob.down().next().down().ele)
	ob.down().next().down().setStyle({color:'#F5B847'});
	//alert(ob.inspect())
	var p = ob.ancestors();
	var el = null;
	p.each(function(er){
		if (er.nodeName=="LI") er.down().next().down().setStyle({color:'#F5B847'});
		if (er.nodeName=="UL" && er.id=="left_menu") {
			last.down().next('ul').toggle();
			return;
		}
		last = er;
	});
} 
function click_action(e) {
	Event.stop(e);
	Event.element(e).up().toggleClassName('selected');
	var el = Event.element(e).up();
	var ul = el.down('ul');
	if(ul) {
		Effect.toggle(ul,'blind',{duration:0.4});
	}
}
function click_action_location(e) {
	Event.stop(e);
	var href = Event.element(e).next().down().readAttribute('href');
	var target = Event.element(e).next().down().readAttribute('target');
	window.open(href,target);
}
function mouse_action_over(e) {
	Event.stop(e);
	Event.element(e).up().addClassName('hover');
	Event.element(e).observe('mouseout', mouse_action_out);
}
function mouse_action_out(e) {
	Event.stop(e);
	Event.element(e).up().removeClassName('hover');
}
function adjust() {
	if (!$('col2')) return;
	$('main').addClassName('column');
}
