function procWidth(obj){
	var curwidth = 0;
	if (obj.offsetParent){
		curwidth = obj.offsetWidth;
	}else if (obj.x){
		curwidth = obj.width;
	}
	return curwidth;
}

function procHeight(obj){
	var curheight = 0;
	if (obj.offsetParent){
		curheight = obj.offsetHeight;
	}else if (obj.x){
		curheight = obj.height;
	}
	return curheight;
}

function procPosX(obj){
	var curleft = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}else if (obj.x){
		curleft += obj.x;
	}
	return curleft;
}

function procPosY(obj){
	var curtop = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}else if (obj.y){
		curtop += obj.y;
	}
	return curtop;
}

function posicao(pObj, pReference, dist) {
	var obj = document.getElementById(pObj);
	var iObj = document.getElementById("i"+pObj);
	var reference = document.getElementById(pReference);
	var newX = procPosX(reference);
	var newY = procPosY(reference);
	var newWidth = procWidth(reference);
	var newHeight = procHeight(reference);
	
	obj.style.display = "block";
	iObj.style.display = "block";
	obj.style.left = newX + newWidth + dist + "px";
	iObj.style.left = newX + newWidth + 20 + dist + "px";
	obj.style.top = newY + -2 + "px";
	iObj.style.top = newY + -2 + "px";
}

function showaba(what) {
	var aba = document.getElementById(what);
	//
	aba.style.display='block';
}

function hideaba(what) {
	var aba = document.getElementById(what);
	//
	aba.style.display='none';
}

function showItem(pItem){
	var _item = document.getElementById(pItem);
	//
	if(_item != null){
	    _item.style.display = "block";
	}
}

function hideItem(pItem){
    var _item = document.getElementById(pItem);
	//
	if(_item != null){
	    _item.style.display = "none";	
	}
}

function selecItem(pItem, pClass){
	_item = document.getElementById(pItem);
	_class = pClass;
	//
	_item.className = _class;
}

function showHide(item){
	var _item = document.getElementById(item);
	//
	if(_item != null){
	   if (_item.style.display == "block"){
	    _item.style.display = "none";
	   } else {
	    _item.style.display = "block";
	   }
	}
}