function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}



var isBoxVisible = false;
var theBox = null;
var theObj = null;

function showBox(theId,obj){
		
	elem = document.getElementById(theId);
	
	if (obj) {
		theBox = theId;
		theObj = obj;
		moveBox();
		
	}
	if (isBoxVisible){
		elem.style.display = "none";
		isBoxVisible = false;
	}else{
		elem.style.display = "block";
		isBoxVisible = true;
	}
	
}

function moveBox(){
	if (theObj && theBox){
		elem = document.getElementById(theBox);
		xy = findPos(theObj);
		elem.style.left = xy[0];
		elem.style.top = xy[1] + 20;
	}
}


function fixBox(){
	
	if (theBox && theObj){
		moveBox(theBox,theObj);
	}
	
}

function menuon(i){
	var tmb = document.getElementById( "tmb" + i );
	var tml = document.getElementById( "tml" + i );
	
	tmb.style.backgroundColor = "#CB0000";
	tml.style.backgroundColor = "#CB0000";
	
}

function menuoff(i){
	var tmb = document.getElementById( "tmb" + i );
	var tml = document.getElementById( "tml" + i );
	
	tmb.style.backgroundColor = "#E7E7E7";
	tml.style.backgroundColor = "#E7E7E7";
	
}

