      var arNavHeads = new Array(null, null, null, null, null, null, null, null, null);
      var arGroups   = new Array(null, null, null, null, null, null, null, null, null);
	  var arGrpDivs  = new Array(null, null, null, null, null, null, null, null, null);
	  var arDrugItems = new Array();
	  var timerID;
	  
	  onload = function()
	    {
	      setNavArrays();		  
		  
		  for (var i = 0; i < arGroups.length; i++)
		    {
			  setNavHeadEvents(arNavHeads, arGroups, i);
			  arGroups[i].style.display = 'none';			  
			}
		  		  	
		  getDrugItems('nav', 'a', arDrugItems);
		  
		  for (var i = 0; i < arDrugItems.length; i++)
		    {
		      setDrugItemEvent(arDrugItems, i);
			}		  
	    }
		
	  function setNavArrays()
	    {		  		  
		  var i;
		  		  
		  for (i = 0; i < arNavHeads.length; i++)
		    {
			  arNavHeads[i] = document.getElementById('refHead_' + i);
			  arGroups[i]   = document.getElementById('grp_' + i);
			  arGrpDivs[i]	= document.getElementById('divHead_' + i);		  			  				
			}			
		}
	
	  function setNavHeadEvents(headglob, grpglob, counter)
	    {
		  if ((headglob[counter] != null) && (grpglob[counter] != null))
		    {
			  headglob[counter].onmouseover = function()
			    {
				  hideAllElems();
				  styleHead(this);
				  showElem(grpglob[counter], counter);
				}  
			}  
		}
	      	  
	  function styleHead(d)
	    {		  		  
		  var par = d.parentNode;
		  par.style.backgroundColor = '#cfd6e1';
		}
			  	  	
      function showElem(d, dex)
	    {		  		
		  var lft = 0;
		  var tp  = 0;
		  var ht  = 0
		  var wid = 0;
		  		  		  
		  var arDim = getDim(arGrpDivs[dex]);
		  var arPos = getPos(arGrpDivs[dex]);
		  
		  lft = arPos[0];
		  tp  = arPos[1];
		  ht  = arDim[0];
		  wid = (arDim[1]);
		
		  d.style.display  = 'inline';
		  d.style.position = 'absolute';
		  d.style.top      = tp + 'px';
		  d.style.left     = ((lft + wid) - 20) + 'px';
		  
		  /*Reset the timer; Close the submenu after a reasonable period;*/
		  if (timerID != null)
		    {
			  clearTimeout(timerID);
			}
		  
		  timerID = setTimeout('hideAllElems()', 5000);
		  
		}
		
	  function hideElem(d)
	    {
		  d.style.display = 'none';
		}
		
	  function hideAllElems()
	    {
		  for (var i = 0; i < arNavHeads.length; i++)
		    {
			  arGroups[i].style.display          = 'none';			  
			  arNavHeads[i].style.fontWeight     = 'normal';
			  arNavHeads[i].style.color          = '#000000';
			  arGrpDivs[i].style.backgroundColor = '#dbdce3';
			}
	    }
	
	  function getPos(el)
	    {
		  var posX = 0;
		  var posY = 0;
		  
		  while (el != null)
		    {
			  posX += el.offsetLeft;
			  posY += el.offsetTop;
			  el    = el.offsetParent;
			}
			
		  return [posX, posY];
		}
		      		
	  function getDim(el)
	    {
		  var ht  = 0;
		  var wid = 0;
		  
		  ht  = el.offsetHeight;
		  wid = el.offsetWidth;
		  		  
		  return [ht, wid];
		}
		  	  		
	  function getCellRefs(baseVal)
	    {
		  var arItems = new Array();
		  
		  var tbl = baseVal.firstChild;  
		  var trs = tbl.firstChild;
		  var tds = trs.firstChild;
		  
		  var nn  = tds.nodeName;
		  alert(nn);
		  
		  tds.onmouseover = function()
		    {
			  tds.style.backgroundColor = '#cfd6e1';
			}		
		}
		
	  function setDrugItemEvent(arGlob, counter)
	    {
		  arGlob[counter].onmouseover = function()
		    {
			  arGlob[counter].parentNode.style.backgroundColor = '#cfd6e1';
			}
			
		  arGlob[counter].onmouseout = function()
		    {
			  arGlob[counter].parentNode.style.backgroundColor = '#e5e6eb';
			}
		}
		
	  function getDrugItems(baseid, tag, arGlob)
	    {
		  var clsName   = '';
		  var itemsBase = document.getElementById(baseid);
		  if (itemsBase != null)
		    {
			  var items = itemsBase.getElementsByTagName(tag);
			  if (items != null)
			    {
				  for(var i = 0; i < items.length; i++)
				    {					  
					  if (items[i].className == 'DrugItem')
					    {
						  arGlob[arGlob.length] = items[i];						  
						}
					}
				}
			  else
			    {
				  alert('ej: items is null');
				  return;
				}
			}
		  else
		    {
			  alert('ej: itemsBase is null');
			  return;
			}					  
		}
