//MENU IMPLEMENTATION
function getElementLeft(Elem) {
	var elem = document.getElementById(Elem);
	xPos = elem.offsetLeft;
	tempEl = elem.offsetParent;
	while (tempEl != null) {
		xPos += tempEl.offsetLeft;
 		tempEl = tempEl.offsetParent;
	}
	return xPos;
}
function getElementTop(Elem) {
	var elem = document.getElementById(Elem);
	yPos = elem.offsetTop;
	tempEl = elem.offsetParent;
	while (tempEl != null) {
		yPos += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
	}
	return yPos;
}
function getElementHeight(Elem) {
	var elem = document.getElementById(Elem);
	if (elem.style.pixelHeight) {
		xPos = elem.style.pixelHeight;
	} else {
		xPos = elem.offsetHeight;
	}
	return xPos;
}
function getElementWidth(Elem) {
	var elem = document.getElementById(Elem);
	if (elem.style.pixelWidth) {
		xPos = elem.style.pixelWidth;
	} else {
		xPos = elem.offsetWidth;
	}
	return xPos;
}



var menu_maxheight=0;
var menu_t_hide=0;
var menu_t_ani=0;

function menu_hide() {
	clearTimeout(menu_t_hide);
	menu_t_hide=setTimeout("menu_hide_ta()",50);
}
function menu_show(id,div,top,left) {
	//alert(id);
	clearTimeout(menu_t_hide);clearTimeout(menu_t_ani);
	var divelem=document.getElementById(id+"_div");
	var maindiv=document.getElementById("menu_content");
	//alert(id);
	maindiv.style.top=top+"px";
	maindiv.style.left=left+"px";
	maindiv.innerHTML=divelem.innerHTML;
	maindiv.style.height="auto";
	menu_maxheight=getElementHeight(maindiv.id);
	maindiv.style.height=0;
	menu_ani_extend(maindiv);
	maindiv.style.visibility="visible";
	menu_ani_extend(maindiv);
}
function menu_hide_ta() {
	var maindiv=document.getElementById("menu_content");
	maindiv.innerHTML='';
	maindiv.style.visibility="hidden";
}
function menu_lhide(elem) {
	menu_hide();
}
function menu_ani_extend(elem) {
	if (menu_maxheight<1) {return;}
	elem.style.height=(getElementHeight(elem.id)+(Math.round(menu_maxheight/70)))+"px";
	if (getElementHeight(elem.id)>=menu_maxheight) {elem.style.height=(menu_maxheight-2)+'px';return false;}
	menu_t_ani=setTimeout("menu_ani_extend(document.getElementById('"+elem.id+"'))",30);
}
