
if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span");
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") 
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function moveLyr(lyrObj,x,y) {
	lyrObj.top = y;
	lyrObj.left = x;
}

function mouseMove(e) {
	if (lyr) moveLyr(lyr,event.x + xOs + document.body.scrollLeft,event.y + yOs + document.body.scrollTop);
}

function showTip(which,MPX,MPY) {
	lyr = document.all[which].style;
	moveLyr(lyr,MPX + xOs + document.body.scrollLeft,MPY + yOs + document.body.scrollTop);
	document.onmousemove = mouseMove;
	lyr.visibility = "visible";

}

function hideTip(which) {
	document.all[which].style.visibility = "hidden";
	lyr=null;
}

// JS Tree
function openTree(link, openSub)
{
    ctExposeItem(0,link);
    if (openSub)
        openSubLevel(0,link);
}

function openSubLevel (treeIndex, link)
{
        if (treeIndex < 0 || treeIndex >= _ctTreeList.length)
                return;
        var tree = _ctTreeList[treeIndex];
        var endIndex = tree.endIndex;
        var i;
        for (i = tree.beginIndex; i < endIndex; ++i)
        {
                if (_ctItemList[i].length > 2 &&
                        _ctItemList[i][2] == link)
                {
                    var item = ctGetObject ('ctItemID' + (_ctTreeList[treeIndex].beginIndex + i)).parentNode;
                    if (!item)
                       return null;
                    ctOpenFolder(item);
                    return true;
                }
        }
}

function findElementByID(id, win)
{
	// current window
	var w = (win != null) ? win : window; 
	var field = null;
	
	var isFirst = true;
	do
	{
		if (!isFirst)
		{
			w = w.parent;
		}
		field = w.document.getElementById(id);
		isFirst = false;
	}
	while (field == null && w != null && w.parent != null && w != w.top);
	
	// Don't found? Get opener window!
	if (field == null && w != null && w.opener != null)
	{
		field = findElementByID(id, w.opener);
	}
	
	return field;
}
