/* ----------------------------------------------------------------------
	Methods to show/hide awaitng layer when working with VIE Portal software
-----------------------------------------------------------------------	*/

/* ----------------------------------------------------------------------
	Methods to show/hide a layer in the VIE Portal
-----------------------------------------------------------------------	*/

function __showLayer(parent, id, position, offsetLeft, offsetTop){

	// check layer existing first
	var obj = document.getElementById(id);
	if(!obj)
		return;
		
	// computing positions
	var nTop = 0, nLeft = 0;
	var objParent = parent;	
	while (objParent.tagName!="BODY")
	{
		nTop = nTop + objParent.offsetTop;
		nLeft = nLeft + objParent.offsetLeft;
		objParent = objParent.offsetParent;
	}
	
	// computing offset for the positions
	var nWidth = 0, nHeight = 0;
	switch(position)
	{
		case "left":
			nWidth = 0 - parent.offsetWidth;
			break;

		case "right":
			nWidth = parent.offsetWidth;
			break;
		break;

		case "top":
			nHeight = 0 - parent.offsetHeight;
		break;

		case "under":
			nHeight = parent.offsetHeight;
			break;

		default:
			break;
	}
	
	// re-position and show the layer
	obj.style.top = nTop + nHeight + offsetTop;
	obj.style.left = nLeft + nWidth + offsetLeft;
	obj.style.display = "";
	obj.style.visibility = "visible";
}

// hide a layer by Id on a webpage
function __hideLayer(id){
	var obj = document.getElementById(id);
	if(!obj)
		return;
	obj.style.visibility = "hidden";
}


// hide an inline element in the HTML document (by Id)
function __hide(id){
	var objElement = document.getElementById(id);
	if(!objElement) return;
	if(!objElement.style) return;
	objElement.style.display = "none";
	objElement.style.visibility = "hidden";
}

// show an element itself
function __showMe(obj){
	obj.style.visibility = "visible";
}

// hide an element itself
function __hideMe(obj){
	obj.style.visibility = "hidden";
}

