
cacheBackgroundImage('bg0p','menu/m_1_back_p.gif')
cacheBackgroundImage('bg0a','menu/m_1_back_a.gif')

strColPassive10 = "#000000"

strColActive10 = "#405C7A"
strColActive20 = "#04909D"
strColActive30 = "#058257"
strColActive40 = "#A5E2EB"

defineLayer('divmenu0',false,0,127,25,160,0,1,getMenu(),'',false,true,false,false)
makeLayer('divmenu0')
cacheImages()
redrawAll()

function getMenu(){
  var strMenu = ''
  strMenu += '' +'<table width="160"  border="0" cellpadding="0" cellspacing="0" bgcolor=#FFFFFF>\n'
  var counter = 0
  arrow_pic=""

for(var intA=1; intA<arrMenu.length; intA++){
    intIndex = arrMenu[intA][0]
    intParent = arrMenu[intA][1]
    
    if(counter == 4){
      counter = 0 
    } 

    if(intParent==0){
       strName = arrMenu[intA][2]
       intColourFamily = arrMenu[intA][3]
       strUrl = arrMenu[intA][4]
       strTarget = arrMenu[intA][5]
       strLongName = arrMenu[intA][6]
       
       firstFound = false; 
       
       for(var intB=1; intB<arrMenu.length; intB++){
         if(arrMenu[intB][1]==intIndex && !firstFound){
           strUrl=arrMenu[intB][4];
           firstFound=true;
         }
       }

       
      counter++ 
      if(counter == 1){
         arrow_pic ="menu/menuarrow1.gif"
      }   
      else if(counter == 2){
        arrow_pic ="menu/menuarrow2.gif"
      }  
      else if(counter == 3){
        arrow_pic ="menu/menuarrow3.gif"
      }  
      else{
        arrow_pic ="menu/menuarrow4.gif"
      }       

      basePrefix = "m_0_"
      strMenu += ''
      +'<tr height="16"><td height=16 width=16 background='+arrow_pic+'>&nbsp;</td><td width=144 height=16 background="menu/menuitem.gif" class="menuitem">'
      + '&nbsp;' +strName
      +'</td></tr>\n'
      + getSubMenu(intIndex,intActiveItem)
      +'<tr><td  colspan="2" background="menu/m_1_back_a.gif"></td></tr>'
      
         }
  }
  strMenu += ''
  +'</table>\n'
  return strMenu
}


function getSubMenu(intIndex,intActive){
   var strSubMenu = ''
   for(var intB=1; intB<arrMenu.length; intB++){
      intIndexSub = arrMenu[intB][0]
      intParentSub = arrMenu[intB][1]
     
   if(intParentSub==intIndex){
         strNameSub = arrMenu[intB][2]
         intColourFamilySub = arrMenu[intB][3]
         strUrlSub = arrMenu[intB][4]
         strTargetSub = arrMenu[intB][5]
         strLongNameSub = arrMenu[intB][6]
         
                 
         
         if(intActive == intIndexSub){
          strEvents = 'background="menu/m_1_back_a.gif"'
           strClass = 'class="menu"'
         }
         else{
            strEvents = 'background="menu/m_1_back_p.gif" onmouseover="submenuHighlight(this.id,'+intColourFamilySub+',true)" onmouseout="submenuHighlight(this.id,'+intColourFamilySub+',false)"'
            strClass = 'class="menu"'
         }
         
         strSubMenu += ''
         +'<tr><td colspan="2" id="tr'+intIndexSub+'"  '+strEvents+' >'
         +'<img src="menu/spacing.gif" alt="" border="0" width="27" height="12" align="left" hspace="0" vspace="0">'
         +'<a href="'+strUrlSub+'" target="'+strTargetSub+'" '+strClass+' id="tr'+intIndexSub+'txt" onmouseclick="getSubMenu(intIndex,intIndexSub)">'
         +strLongNameSub 
         +'</a>'
         +'</td></tr>\n'
      }
    }
  return strSubMenu
}

function setMenu(intId,intGroup,booState){

}




function submenuHighlight(strId,intGroup,booState){ 
    strColActive = eval('strColActive'+intGroup)
    if(booState){
      setBackgroundImage(strId,'bg0a')
      setColour(strId+'txt',strColActive)
    }
    else{
      setBackgroundImage(strId,'bg0p')
      setColour(strId+'txt',strColPassive10)
    }
}

function menuHighlight(intId,booState){
    if(booState){
    }
    else{
    }
}


