function getElement(name) {
  if(document.all) {
    return document.all[name];
  } else {
    return document.getElementById(name);
  }
}
var menuSelect=[];
menuSelect[0]=new Image(); menuSelect[0].src='/_ii/menu1sel.gif';
menuSelect[1]=new Image(); menuSelect[1].src='/_ii/menu2sel.gif';
menuSelect[2]=new Image(); menuSelect[2].src='/_ii/menu3sel.gif';
menuSelect[3]=new Image(); menuSelect[3].src='/_ii/menu4sel.gif';
menuSelect[4]=new Image(); menuSelect[4].src='/_ii/menu5sel.gif';
menuSelect[5]=new Image(); menuSelect[5].src='/_ii/menu6sel.gif';
menuSelect[6]=new Image(); menuSelect[6].src='/_ii/menu7sel.gif';

var currentMenu=null;
var currentTimer=null;
function selectMenu(name) {
  if(currentTimer) clearTimeout(currentTimer);
  currentTimer=null;
  if(currentMenu) {
    document.images['img'+currentMenu].src='/_ii/'+currentMenu+'.gif';
    getElement(currentMenu).style.display='none';
  }
//  if(flash = getElement('map')) flash.style.display='none';
  currentMenu=name;
  document.images['img'+currentMenu].src='/_ii/'+currentMenu+'sel.gif';
  getElement(currentMenu).style.display='block';
}
function overMenu() {
  if(currentTimer) clearTimeout(currentTimer);
}
function unselectMenu() {
  currentTimer=setTimeout('closeMenu()',10);
}
function closeMenu() {
  if(currentMenu) {
    document.images['img'+currentMenu].src='/_ii/'+currentMenu+'.gif';
    getElement(currentMenu).style.display='none';
  }
  if(currentTimer) clearTimeout(currentTimer);
//  if(flash = getElement('map')) flash.style.display='block';
  currentTimer=null;
  currentMenu=null;
}
function selectMenu2(menu) {
	var e=menu.childNodes[menu.childNodes.length-1].childNodes[0];
	if(! e) return;
	e.style.display='block';
}
function unselectMenu2(menu) {
	var e=menu.childNodes[menu.childNodes.length-1].childNodes[0];
	if(! e) return;
	e.style.display='none';
}
function createMenu(menu) {
  if(menu.length<=0) return;
  document.write('<table border="0" cellspacing="0" cellpadding="0" width="100" height="'+(menu.length*31)+'">');
  document.write('<tr>');
  document.write('<td colspan="2" rowspan="2" class="menushadow menushadow1" width="100%" valign="top">');
  document.write('<table width="100%" border="0" cellspacing="0" cellpadding="8">');
  for(var i=0; i<menu.length; i++) {
    document.write('<tr onmouseover="this.style.backgroundColor=\'#006EAC\'; selectMenu2(this);" onmouseout="this.style.backgroundColor=\'\'; unselectMenu2(this);"><td width="16" nowrap="nowrap"></td><td nowrap="nowrap"><a href="'+menu[i][0][1]+'" style="color:#FFFFFF;" onclick="closeMenu()">'+menu[i][0][0]+'</a></td><td width="32" nowrap="nowrap" align="center"><div id="d_menu2_'+i+'" style="position:absolute; display:none; margin-top:-13px;">');
    if(menu[i].length>1) {
      document.write('<table border="0" cellspacing="0" cellpadding="0" width="100" height="'+((menu[i].length-1)*31)+'">');
      document.write('<tr>');
      document.write('<td colspan="2" rowspan="2" class="menushadow1" width="100%" valign="top">');
      document.write('<table width="100%" border="0" cellspacing="0" cellpadding="8">');
      for(var j=1; j<menu[i].length; j++) {
        document.write('<tr onmouseover="this.style.backgroundColor=\'#006EAC\';" onmouseout="this.style.backgroundColor=\'\';"><td width="16" nowrap="nowrap"></td><td nowrap="nowrap"><a href="'+menu[i][j][1]+'" style="color:#FFFFFF;" onclick="closeMenu()">'+menu[i][j][0]+'</a></td><td width="32" nowrap="nowrap"></td></tr>');
      }
      document.write('</table>');
      document.write('</td>');
      document.write('<td width="8" height="8" nowrap="nowrap"></td>');
      document.write('</tr>');
      document.write('<tr><td class="menushadow2" width="8" nowrap="nowrap" height="'+((menu[i].length-1)*31-8)+'"></td></tr>');
      document.write('<tr>');
      document.write('<td colspan="2" height="13" nowrap="nowrap">');
      document.write('<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td width="8" height="13" nowrap="nowrap"></td><td class="menushadow2" height="13" width="100%"></td></tr></table>');
      document.write('</td>');
      document.write('<td class="menushadow2" height="13" width="8" nowrap="nowrap"></td>');
      document.write('</tr>');
      document.write('</table>');
    }
    document.write('</div>'+(menu[i].length>1?'<img src="/_i/arrowmenu.gif" width="5" height="9" alt="" border="0">':'')+'</td></tr>');
  }
  document.write('</table>');
  document.write('</td>');
  document.write('<td width="8" height="8" nowrap="nowrap"></td>');
  document.write('</tr>');
  document.write('<tr><td class="menushadow2" width="8" nowrap="nowrap" height="'+(menu.length*31-8)+'"></td></tr>');
  document.write('<tr>');
  document.write('<td colspan="2" height="13" nowrap="nowrap">');
  document.write('<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td width="8" height="13" nowrap="nowrap"></td><td class="menushadow2" height="13" width="100%"></td></tr></table>');
  document.write('</td>');
  document.write('<td class="menushadow2" height="13" width="8" nowrap="nowrap"></td>');
  document.write('</tr>');
  document.write('</table>');
}
