function nav_hover(elem,page_id,action) {
	var id = elem.id*1;
	var page = page_id*1;
	var inC = '#2d4f8f';
	var outC = 'white';
	var background = '#d6dce8';
	
	above = document.getElementById('sep'+id);
	below = document.getElementById('sep'+(id+1));

	switch(id) {
		case id=page:
		break;
		
		case id=1:
		// only change the element below
		if (action=='in') {
			below.style.backgroundColor = inC;
			elem.style.backgroundColor = background;
		} else {
			below.style.backgroundColor = outC;
			elem.style.backgroundColor = '';
		}
		break;
		
		case id=(page+1)*1:
		// only change the element below
		if (action=='in') {
			below.style.backgroundColor = inC;
			elem.style.backgroundColor = background;
		} else {
			below.style.backgroundColor = outC;
			elem.style.backgroundColor = '';
		}
		break;
		
		case id=(page-1)*1:
		// only change the element above
		if (action=='in') {
			above.style.backgroundColor = inC;
			elem.style.backgroundColor = background;
		} else {
			above.style.backgroundColor = outC;
			elem.style.backgroundColor = '';
		}
		break;
		
		default:
		if (action=='in') {
			above.style.backgroundColor = inC;
			below.style.backgroundColor = inC;
			elem.style.backgroundColor = background;
		} else {
			above.style.backgroundColor = outC;
			below.style.backgroundColor = outC;
			elem.style.backgroundColor = '';
		}
	}
}

function initMenu(theId) {
	var id = theId*1;
	var inC = '#2d4f8f';

	if (id>1) {
		document.getElementById('sep'+id).style.backgroundColor = inC;
	}
	document.getElementById('sep'+(id+1)).style.backgroundColor = inC;
	document.getElementById('nav_'+id).className='on';
	resize_menu();
}

function resize_menu() {
	var h=(document.getElementById('main').offsetHeight);
	document.getElementById('menu_bar').style.height=h+"px";
}