/*====================================
  DyNAMiC-cOre.Net
   Toolbar
	modified by DHill 07.19.01
    modified by DCollins 09.04.01

    GHA Website Contents (c)2001 Georgia Hospital Association
    All Rights Reserved. Used by permission.
====================================*/

var Toolbar='<DIV ID="Toolbar" class="tbToolbar" NOWRAP><table border=0 cellspacing="0" cellpadding="0"><tr><!-- TB_ITEMS --></tr></table><div id="tray" TRAYENABLE><!-- TRAY --></div><!-- TB_SUBITEMS --></DIV>'
var currentMenu=null
var currentSubMenu=null
var currentItem=null
var focusTimer=null
var root=''
var blank=' '

function drawToolbar() { 
document.write(Toolbar) 
}

function addButton(id,imgref,href,w,h) {
    if (imgref.indexOf('/') == 0) imgref = root + imgref;
    if (href.indexOf('/') == 0) href = root + href;
	var tmpTag='<!-- TB_ITEMS -->'
	Toolbar=Toolbar.replace(tmpTag,'<TD id="IT_'+id+'" class="tbItem" NOWRAP align="left"><p class="tbItemLink"><a href="'+ href + '"><img src="' + imgref + '" width="' + w + '" height="'+h+'" border="0"></a></p></td>\n'+tmpTag)
}                                                                                                                                                   
function addMenu(id,caption) {
	var tmpTag='<!-- TB_ITEMS -->'
	Toolbar=Toolbar.replace(tmpTag,'<TD id="IT_'+id+'" class="tbItem" NOWRAP align="left"><p class="tbItemLink" onmouseover="doAction(\''+id+'\');setFocus10(\''+id+'\')" onClick="doAction(\''+id+'\');setFocus10(\''+id+'\')" onmouseout="setFocus(\''+id+'\')">'+caption+'</p></td>\n'+tmpTag)
	var tmpTag='<!-- TB_SUBITEMS -->'
	Toolbar=Toolbar.replace(tmpTag,'<DIV id="TBS_'+id+'" class="tbSubMenu" align="left" onmouseover="setFocus10(\''+id+'\')" onmouseout="setFocus(\''+id+'\')" NOWRAP ALIGN="left"><!-- TBS_'+id+' --></div>\n'+tmpTag)
}
function addMenuButton(id,imgref,w,h) {
    if (imgref.indexOf("/") == 0)
        imgref = root + imgref;
	var tmpTag='<!-- TB_ITEMS -->'
	Toolbar=Toolbar.replace(tmpTag,'<TD id="IT_'+id+'" class="tbItem" NOWRAP align="left"><p class="tbItemLink" onmouseover="doAction(\''+id+'\');setFocus10(\''+id+'\')" onClick="doAction(\''+id+'\');setFocus10(\''+id+'\')" onmouseout="setFocus(\''+id+'\')"><img src="'+imgref+'" width="'+w+'" height="'+h+'" border="0"></p></td>\n'+tmpTag)
	var tmpTag='<!-- TB_SUBITEMS -->'
	Toolbar=Toolbar.replace(tmpTag,'<DIV id="TBS_'+id+'" class="tbSubMenu" align="left" onmouseover="setFocus10(\''+id+'\')" onmouseout="setFocus(\''+id+'\')" NOWRAP ALIGN="left"><!-- TBS_'+id+' --></div>\n'+tmpTag)
}
function addMenuItem(p,id,caption,turl,hint) {
	var tmpTag='<!-- TBS_'+p+' -->'
    if (addMenuItem.arguments.length==6) { // 6th element is imageref
        imgRef = '<img src="' + fixRef(addMenuItem.arguments[5]) + '" border="0">';
    } else
        imgRef = "";
	Toolbar=Toolbar.replace(tmpTag,'<DIV id="TBSI_'+id+'" class="tbSubItemLink" onmouseover="showSelect(\''+p+'\',\''+id+'\',\''+hint+'\')" onmouseup="navI(\''+turl+'\')" NOWRAP ALIGN="left">'+caption+imgRef+'</div>\n'+tmpTag) 
}
function addSubMenuItem(p,id,caption,turl,hint) {
	var tmpTag='<!-- TBS_'+p+' -->'
	Toolbar=Toolbar.replace(tmpTag,'<DIV id="TBSI_'+id+'" class="tbSubItemLink" onmouseover="showSelect(\''+p+'\',\''+id+'\',\''+hint+'\')" onmouseup="navI(\''+turl+'\')" NOWRAP ALIGN="left">'+caption+'</div>\n'+tmpTag)
}
function addSubMenu(p,caption) {
	var tmpTag='<!-- TB_SUBITEMS -->'
	Toolbar=Toolbar.replace(tmpTag,'<DIV id="TBSUB_'+p+'" class="tbSubMenu" onmouseover="setFocus10(\''+p+'\')" onmouseout="setFocus(\''+p+'\');setFocus(\''+p+'\')" NOWRAP><!-- TBS_'+p+' --></div>\n'+tmpTag)
	var tmpTag='<!-- TBS_'+p+' -->'
	Toolbar=Toolbar.replace(tmpTag,'<DIV id="TBSI_'+p+'" class="tbSubItemCaption" onmouseover="showSelect(\''+p+'\',\''+p+'\',\''+caption+'\')" NOWRAP>'+caption+'</div>\n'+tmpTag)
}

function addTray(c) {
	var tmpTag='<!-- TRAY -->'
	Toolbar=Toolbar.replace(tmpTag,c+tmpTag)
	Toolbar=Toolbar.replace('TRAYENABLE','class="tbTray"')
}

function setFocus10(id) {
	if (focusTimer) clearTimeout(focusTimer)
	focusTimer=setTimeout('doHide("'+id+'")',10000)
}
function setFocus(id) {
	if (focusTimer) clearTimeout(focusTimer)
	focusTimer=setTimeout('doHide("'+id+'")',200)
}
function doHide(id) {
	var o=document.getElementById('TBS_'+id)
	if (!o) var o=document.getElementById('TBSUB_'+id)
	o.style.display="none"

	var o=document.getElementById('IT_'+id)
	if (o) o.className='tbItem'
	
	if (currentItem) {
		document.getElementById('TBSI_'+currentItem).className="tbSubItemLink"
		currentItem=''
	}
	if (currentSubMenu) {
		document.getElementById('TBSUB_'+currentSubMenu).style.display="none"
		document.getElementById('TBSI_'+currentSubMenu).className="tbSubItemLink"
		currentSubMenu='';
	}
	status=''
	currentMenu=''
}
function doSubHide(id) {
	if (currentSubMenu) {
		document.getElementById('TBSUB_'+currentSubMenu).style.display="none"
		currentSubMenu='';
		document.getElementById('TBSI_'+id).className="tbSubItemLink"
	}
}
function showSelect(p,id,hint) {
	if (currentItem) {
		if (currentItem != p) {
			document.getElementById('TBSI_'+currentItem).className="tbSubItemLink"
		}
	}
	document.getElementById('TBSI_'+id).className="tbSubItemLinkSelected"
	currentItem=id
	if (hint!='undefined') status=hint
	else status=''

	var o=document.getElementById('Toolbar')
	y=o.offsetTop+o.offsetHeight-4

	// check for showing SubMenu and hide it	
	if (currentSubMenu) {
		if (currentSubMenu != p) {
			doSubHide(currentSubMenu);
			currentSubMenu = "";
		}
	}
	// check for SubMenu and display it	
	var o=document.getElementById('TBSUB_'+id)
	if (o) {
		y=document.getElementById('TBSI_'+id).offsetTop+document.getElementById('TBSI_'+id).offsetParent.offsetTop
		x=document.getElementById('TBSI_'+id).offsetLeft+document.getElementById('TBSI_'+id).offsetParent.offsetLeft+document.getElementById('TBSI_'+id).offsetParent.offsetWidth
	
		o.style.display='block'	
		o.style.left=x
		o.style.top=y
	
		currentSubMenu=id
	}
}
function doAction(id) {
	var o=document.getElementById('Toolbar')
	y=o.offsetTop+o.offsetHeight-4
	
	if (currentMenu) {
		document.getElementById('IT_'+currentMenu).className='tbItem'
		document.getElementById('TBS_'+currentMenu).style.display='none'
		if (currentSubMenu) {
			document.getElementById('TBSUB_'+currentSubMenu).style.display='none'
		}
	}

	var o=document.getElementById('IT_'+id)
	x=o.offsetLeft+o.offsetParent.offsetLeft;
	o.className='tbItemSelected'
	
	o=document.getElementById('TBS_'+id)
	o.style.display='block'	
	o.style.left=x
	//o.style.top=y
	
	currentMenu=id
}

if (!document.getElementById) window.location="upgrade.asp"
ie=(document.all)?true:false; mac=(navigator.platform.indexOf("Mac") != -1)? true:false;
opera=(navigator.userAgent.indexOf("Opera")>0)

function navI(GOHERE) {
 if (GOHERE == "#")
    return;
 if (GOHERE.indexOf('http') != 0) 
    GOHERE = root + GOHERE;
 if (GOHERE.indexOf(',') != -1) {
    GOHERE = GOHERE.substr(0,GOHERE.indexOf(','));
    window.open(GOHERE);
 } else
    location = GOHERE;
}

function fixRef(Ref) {
if (Ref.indexOf('http') != 0)
    Ref = root + Ref;
    return Ref;
}