// JavaScript Document
function getBody(w){
    return (w.document.compatMode && w.document.compatMode == "CSS1Compat") ? w.document.documentElement : w.document.body || null;
} 

function setSize(){
	var avail_height=window.innerHeight?window.innerHeight:getBody(window).clientHeight;
	if(avail_height > 1){
		document.body.style.height=(avail_height-308)+"px";	
		document.getElementById("contentarea1").style.height=(avail_height-310)+"px";		
	}
	else{
		 window.setTimeout("setSize()",5);
	}
	
	window.onresize = function(){
		setSize();	
	}
}
	
function changeFontSize(arg0){
	var current_size=parseInt(document.getElementById("contentarea1").style.fontSize);
	
	if(arg0=="-"){
		document.getElementById("contentarea1").style.fontSize=(current_size-2)+"px";
	}
	if(arg0=="+"){
		document.getElementById("contentarea1").style.fontSize=(current_size+2)+"px";
	}
}
	
function moveNaviPoint(x_val,y_val,d){
	document.getElementById("naviPoint").style.bottom=x_val+"px";	
	document.getElementById("naviPoint").style.right=y_val+"px";		
	document.getElementById("naviPoint").style.display=d;	
}

var activeChild = "";
function showChild(element){
	
	if(element){
		if (activeChild != "") {
			activeChild.style.display = "none";
		}
		
		if(element.getElementsByTagName("UL").length > 0){
			
			var child = element.getElementsByTagName("UL")[0];
			child.style.display = "block";
			child.onmouseout = function(){
				hideChild(this);	
			}
			activeChild = child;
			
		}		
	}
}

function hideChild(element){
	if(element){
		element.style.display = "none";	
	}	
}

function addFunction(){
	var list = document.getElementById("mainNaviList");
	for(var i = 0; i < list.childNodes.length; i++){
		
		var item = list.childNodes[i];
		if(item.nodeName == "LI"){
			
			item.onmouseover = function(){
				showChild(this);
			}
		}
	}
}

window.onload = function(){
	addFunction();
	setSize();
}

