/*
 * Gets the left coordinate of the textbox.
 * @scope private
 * @return The left coordinate of the textbox in pixels (int).
 */
function getContainerLeft() {

    var oNode = arguments[0];
    var iLeft = 0;
   
    while( oNode.tagName != "BODY" && oNode.tagName != "HTML" ) {
        iLeft += oNode.offsetLeft;
        oNode = oNode.offsetParent;       
    }
    
    return iLeft;
}


/*
 * Gets the top coordinate of the textbox.
 * @scope private
 * @return The top coordinate of the textbox in pixels (int).
 */
function getContainerTop() {

    var oNode = arguments[0];
    var iTop = 0;
    
    while(oNode.tagName != "BODY" && oNode.tagName != "HTML") {
        iTop += oNode.offsetTop;
        oNode = oNode.offsetParent;
    }
    
    return iTop;
}


/*
 * Gets highest z-index
 */
function getHighestZIndex() {
	var allElems = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all;
	var maxZIndex = 0;
	
	for(var i=0;i<allElems.length;i++) {
		var elem = allElems[i];
		var cStyle = null;
		
		if (elem.currentStyle) {
			cStyle = elem.currentStyle;
		}
		else if (document.defaultView && document.defaultView.getComputedStyle)
		{
			cStyle = document.defaultView.getComputedStyle(elem,"");
		}
		
		var sNum;
		if (cStyle) {
			sNum = Number(cStyle.zIndex);
		} else {
			sNum = Number(elem.style.zIndex);
		}
		
		if (!isNaN(sNum)) {
			maxZIndex = Math.max(maxZIndex,sNum);
		}
	}
	
	return maxZIndex;
}


function gotoxy( id, x, y ) {
	var oNode = document.getElementById( id );	
	
	oNode.style.zIndex = getHighestZIndex + 1;
	oNode.style.position = 'absolute';
	oNode.style.x = x + 'px';
	oNode.style.y = y + 'px';
	
}