// JavaScript Document

var dropMenu;
var content;
var td_body;
function initMenu(){
	var anchors = dropMenu.getElementsByTagName('a');
	for(var i=0; i<anchors.length; i++){
		var menu_item = anchors[i].parentNode;
		menu_item._children = document.getElementById(menu_item.id+'_sub_menu');
		if(menu_item._children){
			anchors[i].onclick = dropSubMenu;
			if(menu_item._children.parentNode.id!=dropMenu.id) menu_item._children.className = 'sub_menu_line';
			else menu_item._children.className = 'sub_menu';
		}
	}
}
function dropSubMenu(){
	var subMenu = this.parentNode._children;
	if(subMenu.style.display!='block'){
		subMenu.style.display='block';
		this.parentNode.className='drop_open';
	}else{
		subMenu.style.display='none';
		this.parentNode.className='drop_close';
	}
	setContentLeftBackgroundHeight();
	return false;
}

function setEvents(){
	dropMenu = document.getElementById('drop_menu');
	initMenu();
	
	content = document.getElementById('content');
	td_body = document.getElementById('td_body');
	setContentLeftBackgroundHeight();
}
function setContentLeftBackgroundHeight(){
	content.style.height = (td_body.offsetHeight-10)+'px';
}

if (typeof document.attachEvent!='undefined') window.attachEvent('onload',setEvents);
else window.addEventListener('load',setEvents,false);
