

var d_menutext1 = '<div id="menu';
var d_menutext2 = 'Div" style="position:absolute; top:132; left:163; visibility:hidden; z-index:10" onmouseout="mout(\'menu';
var d_menutext3 = 'Div\')">'
    + '  <table cellspacing="0" cellpadding="0" border="0">'
    + '  <tr>'
    + '    <td bgcolor="#9C9A63" width="120">'
    + '      <table cellspacing="1" cellpadding="0" border="0" width="100%">'
    + '      <tr>'
    + '        <td width="100%" bgcolor="#ffffff">'
    + '          <table cellspacing="0" cellpadding="0" border="0" width="100%">';
var d_menurowstart = '<tr><td width="100%"><a class="dropmenu" href="';
var d_menurowmiddle = '" onmouseover="linkover()" onmouseout="linkout()">';
var d_menurowend = '</a></td></tr>';
var d_menutext4 = '          </table>'
    + '        </td>'
    + '      </tr>'
    + '      </table>'
    + '    </td>'
    + '  </tr>'
    + '  </table>'
    + '</div>';
    
    
var a_link = new Array();
var a_text = new Array();

a_link[0] = new Array();
  a_link[0][0] = 'events.htm#activities';
a_link[1] = new Array();
  a_link[1][0] = 'program/training.htm#programs';
  a_link[1][1] = 'program/training.htm#natlresources';
a_link[2] = new Array();
  a_link[2][0] = 'program/advancement.htm#cubscouts';
  a_link[2][1] = 'program/advancement.htm#boyscouts';
  a_link[2][2] = 'program/advancement.htm#eaglehelp';
  a_link[2][3] = 'program/oa.htm';
  a_link[2][4] = 'program/advancement.htm#venturing';
  a_link[2][5] = 'program/advancement.htm#scholarships';
a_link[3] = new Array();
  a_link[3][0] = 'camping/camping.htm#camps';
  a_link[3][1] = 'camping/outdoors.htm#outdoors';
a_link[4] = new Array();
  a_link[4][0] = 'districts/districts.htm#districts';
  a_link[4][1] = 'districts/districts.htm#contacts';
  a_link[4][2] = 'districts/districts.htm#roundtables';
a_link[5] = new Array();
  a_link[5][0] = 'resources.htm#volunteers';
  a_link[5][1] = 'resources.htm#fundraising';
  a_link[5][2] = 'forms.htm';
  a_link[5][3] = 'contact.htm';
a_link[6] = new Array();
  a_link[6][0] = '';
  a_link[6][1] = '';
  a_link[6][2] = '';
  a_link[6][3] = '';
a_link[7] = new Array();
  a_link[7][0] = '';
  a_link[7][1] = '';
  a_link[7][2] = '';
a_link[8] = new Array();
  a_link[8][0] = 'commissioners/comcal.htm';
  a_link[8][1] = 'commissioners/commain.htm';
  a_link[8][2] = 'commissioners/commtraining.htm';

a_text[0] = new Array();
  a_text[0][0] = 'Council Activities';
a_text[1] = new Array();
  a_text[1][0] = 'Programs';
  a_text[1][1] = 'National Resources';
a_text[2] = new Array();
  a_text[2][0] = 'Cub Scouts';
  a_text[2][1] = 'Boy Scouts';
  a_text[2][2] = 'Eagle Help';
  a_text[2][3] = 'Order of the Arrow';
  a_text[2][4] = 'Venturing';
  a_text[2][5] = 'Scholarships';
a_text[3] = new Array();
  a_text[3][0] = 'Camping';
  a_text[3][1] = 'Outdoor Activities';
a_text[4] = new Array();
  a_text[4][0] = 'Districts';
  a_text[4][1] = 'Contacts';
  a_text[4][2] = 'Round Tables';
a_text[5] = new Array();
  a_text[5][0] = 'Volunteers';
  a_text[5][1] = 'Fundraising';
  a_text[5][2] = 'Forms';
  a_text[5][3] = 'Contact Us';
a_text[6] = new Array();
  a_text[6][0] = 'Find a Unit Section';
  a_text[6][1] = 'Description of Program';
  a_text[6][2] = 'Information Submission Page';
  a_text[6][3] = 'Unit Resource for Joining';
a_text[7] = new Array();
  a_text[7][0] = 'Friends of Scouting (FOS)';
  a_text[7][1] = 'Popcorn';
  a_text[7][2] = 'Family Fun Day';
a_text[8] = new Array();
  a_text[8][0] = 'Commissioners\' Calendar';
  a_text[8][1] = 'Annual Service Plan';
  a_text[8][2] = 'Commissioner Training';


var aMenuBg = new Array();
aMenuBg[0] = new Image();
aMenuBg[0].src = 'images/bgmenuitem2.gif';
aMenuBg[1] = new Image();
aMenuBg[1].src = 'images/bgmenuitem2_o.gif';


function WriteMenus() {
  var str = '';
  var n = 0;
  
  for (i=0; i<a_text.length; i++) {
    n = i + 1;
    str += d_menutext1 + n + d_menutext2 + n + d_menutext3;
    for (j=0; j<a_text[i].length; j++) {
      str += d_menurowstart + a_link[i][j] + d_menurowmiddle + a_text[i][j] + d_menurowend;
    }
    str += d_menutext4;
  }
  
  return str;
}


var cw = 800;
var ch = 600;
var inset = 163;
var offset = 132;

var curMenu = "";
var curLink = "";

function init() {
  SetMenus();
}

function SetMenus() {
  if (brType > 0) {
    cw = document.body.offsetWidth;
    if (brType > 1) {
      x1 = document.getElementById("menu1Div");
      x2 = document.getElementById("menu2Div");
      x3 = document.getElementById("menu3Div");
      x4 = document.getElementById("menu4Div");
      x5 = document.getElementById("menu5Div");
      x6 = document.getElementById("menu6Div");
      x7 = document.getElementById("menu7Div");
      x8 = document.getElementById("menu8Div");
      x9 = document.getElementById("menu9Div");
    }
    else {
      x1 = document.all.menu1Div;
      x2 = document.all.menu2Div;
      x3 = document.all.menu3Div;
      x4 = document.all.menu4Div;
      x5 = document.all.menu5Div;
      x6 = document.all.menu6Div;
      x7 = document.all.menu7Div;
      x8 = document.all.menu8Div;
      x9 = document.all.menu9Div;
    }
    
    x1.style.top = offset;
    x2.style.top = offset + (1 * 22);
    x3.style.top = offset + (2 * 22);
    x4.style.top = offset + (3 * 22);
    x5.style.top = offset + (4 * 22);
    x6.style.top = offset + (5 * 22);
    x7.style.top = offset + (6 * 22);
    x8.style.top = offset + (7 * 22);
    x9.style.top = offset + (8 * 22);
    
    if (brType == 1) {
      x1.style.left = inset;
      x2.style.left = inset;
      x3.style.left = inset;
      x4.style.left = inset;
      x5.style.left = inset;
      x6.style.left = inset;
      x7.style.left = inset;
      x8.style.left = inset;
      x9.style.left = inset;
    }
  }
}

function linkover() {
  if (curLink != "") {
    if (brType > 1) {
      document.getElementById(curLink).style.background = "url(" + aMenuBg[1].src + ")";
    }
    else {
      document.all[curLink].style.background = "url(" + aMenuBg[1].src + ")";
    }
  }
}

function linkout() {
  if (curLink != "") {
    if (brType > 1) {
      document.getElementById(curLink).style.background = "url(" + aMenuBg[0].src + ")";
    }
    else {
      document.all[curLink].style.background = "url(" + aMenuBg[0].src + ")";
    }
  }
}

function mover(tdId, divId) {
  if (brType > 0) {
    if (curMenu != divId && curMenu != "") {
      x = document.getElementById(curMenu);
      x.style.visibility = "hidden";
      if (brType == 3) {
        HideRectangularDynamicDropShadow(x);
      }
    }
  
    if (brType > 1) {
      x = document.getElementById(divId);
      document.getElementById(tdId).style.background = "url(" + aMenuBg[1].src + ")";
    }
    else {
      x = document.all[divId];
      document.all[tdId].style.background = "url(" + aMenuBg[1].src + ")";
    }
    
    x.style.visibility = "visible";
    if (brType == 3) {
      ShowRectangularDynamicDropShadow(x, "#333333", 4);
    }
    
    SetMenuOver(tdId, divId);
  }
}

function mout(tdId, divId) {
  if (brType > 0) {
    if (brType > 1) {
      x = document.getElementById(divId);
      document.getElementById(tdId).style.background = "url(" + aMenuBg[0].src + ")";
    }
    else {
      x = document.all[divId];
      document.all[tdId].style.background = "url(" + aMenuBg[0].src + ")";
    }
    
    mx = event.x;
    my = event.y;
    dLeft = parseInt(x.style.left, 10) + 2;
    dTop = parseInt(x.style.top, 10);
    dRight = dLeft + parseInt(x.offsetWidth, 10) - 2;
    dBottom = dTop + parseInt(x.offsetHeight, 10);
    
    //if (brType > 1) {
    //  dBottom -= 4;
    //}
    
    //str = "mx = " + mx + "\nmy = " + my + "\ndLeft = " + dLeft
    //    + "\ndTop = " + dTop + "\ndRight = " + dRight + "\ndBottom = " + dBottom;
    //alert(str);
    
    if (curMenu == divId && ((mx < dLeft || mx > dRight) || (my < dTop || my > dBottom))) {
      x.style.visibility = "hidden";
      if (brType == 3) {
        HideRectangularDynamicDropShadow(x);
      }
      ResetMenu();
    }
  }
}

function SetMenuOver(tdId, divId) {
  curMenu = divId;
  curLink = tdId;
}

function ResetMenu() {
  curMenu = "";
}
