

var visiblelist = "";
var mouseovermenu = "No";
var timerid = 0;

function boxhead(fullcat, leftoffset, topoffset)
{
  cnt=1;
  do
  {
    thiscat = items(fullcat,cnt,":");
    if (thiscat == "") break;
    name = thiscat;
    cnt++;
  } while (1==1);
  document.write('      <table border="0" cellspacing="0" cellpading="0" class="catsidebox" style="background : url(images/menuback4.png) no-repeat; width : 225px; height : 109px;" id="'+fullcat+'" style="margin-left : '+leftoffset+'px; margin-top : '+topoffset+'px;" onMouseOver="mouseovermenu = \'Yes\'" onMouseOut="mouseovermenu = \'No\'"><tr><td style="width: 0px;"></td><td><table cellpadding="3" cellspacing="0" border="0">\n');
}

function boxfoot()
{
  document.write('        </table>\n</td></tr></table>');
}

function createlinks(list, prefix, phpfile, style)
{
  cnt = 1;
  do
  {
    listitem = items(list, cnt, "|");
    if (listitem == "") break;
    cat = prefix+":"+listitem;
    document.write('<tr><td class="menucell" '+style+'> <a href="'+phpfile+'?cat='+cat+'" class="l-two">'+listitem+'</a> </td></tr>\n');
    cnt++;
  } while (1==1);
}

function drawhotspots()
{
  document.write('<map name="main">');
  document.write('<area shape="rect" coords="0,0, 241, 10"  alt="" href="javascript:swapmenu(\'Aircraft\')">');
  document.write('<area shape="rect" coords="0, 13, 241, 23"  alt="" href="javascript:swapmenu(\'Beechcraft\')">');
  document.write('<area shape="rect" coords="0, 27, 241, 37"  alt="" href="charter_brokerage.html">');
  document.write('<area shape="rect" coords="0, 41, 241, 51"  alt="" href="aircraft_helecopter_management.html">');
  document.write('<area shape="rect" coords="0, 56, 241, 66"  alt="" href="marine_services.html">');
  document.write('<area shape="rect" coords="0, 70, 241, 80"  alt="" href="enquiry_form.html">');
  document.write('</map>');
  document.write('<map name="aircraft">');
  document.write('<area shape="rect" coords="0,0, 241, 10"  alt="" href="javascript:swapmenu(\'Aircraft\')">');
  document.write('<area shape="rect" coords="16, 12, 241, 24"  alt="" href="new_aircraft_sales.html">');
  document.write('<area shape="rect" coords="16, 29, 241, 40"  alt="" href="aircraft_and_helicopter_acquisitions.html">');
  document.write('<area shape="rect" coords="16, 47, 241, 60"  alt="" href="brokerage_of_pre-owned_aircraft.html">');
  document.write('<area shape="rect" coords="16, 64, 241, 74"  alt="" href="aircraft_for_sale.html">');
  document.write('<area shape="rect" coords="0, 79, 241, 90"  alt="" href="javascript:swapmenu(\'Beechcraft\')">');
  document.write('<area shape="rect" coords="0, 95, 241, 105"  alt="" href="charter_brokerage.html">');
  document.write('<area shape="rect" coords="0, 110, 241, 120"  alt="" href="aircraft_helecopter_management.html">');
  document.write('<area shape="rect" coords="0, 128, 241, 138"  alt="" href="marine_services.html">');
  document.write('<area shape="rect" coords="0, 143, 241, 153"  alt="" href="enquiry_form.html">');
  document.write('</map>');
  document.write('<map name="beechcraft">');
  document.write('<area shape="rect" coords="0,0, 241, 10"  alt="" href="javascript:swapmenu(\'Aircraft\')">');
  document.write('<area shape="rect" coords="0, 79, 241, 90"  alt="" href="javascript:swapmenu(\'Beechcraft\')">');
  document.write('<area shape="rect" coords="16, 29, 241, 40"  alt="" href="commercial_aircraft.html">');
  document.write('<area shape="rect" coords="16, 45, 241, 58"  alt="" href="special_mission_aircraft.html">');
  document.write('<area shape="rect" coords="0, 61, 241, 71"  alt="" href="charter_brokerage.html">');
  document.write('<area shape="rect" coords="0, 77, 241, 87"  alt="" href="aircraft_helecopter_management.html">');
  document.write('<area shape="rect" coords="0, 93, 241, 103"  alt="" href="marine_services.html">');
  document.write('<area shape="rect" coords="0, 109, 241, 119"  alt="" href="enquiry_form.html">');
  document.write('</map>');
}

function drawmenus()
{

  document.write('<img src="images/menu1.png" border="0" class="expandmenu" id="Main" usemap="#main">');
  document.write('<img src="images/menu2.png" border="0" class="expandmenu" id="Aircraft" usemap="#aircraft" style="visibility : hidden;">');
  document.write('<img src="images/menu3.png" border="0" class="expandmenu" id="Beechcraft" usemap="#beechcraft" style="visibility : hidden;">');
  drawhotspots();

}

function drawmenus_index()
{

  document.write('<img src="images/menu1.png" border="0" class="expandmenuindex" id="Main" usemap="#main">');
  document.write('<img src="images/menu2.png" border="0" class="expandmenuindex" id="Aircraft" usemap="#aircraft" style="visibility : hidden;">');
  document.write('<img src="images/menu3.png" border="0" class="expandmenuindex" id="Beechcraft" usemap="#beechcraft" style="visibility : hidden;">');
  drawhotspots();

}

function showmenu(which, x, y, parenttable)
{
  if (parenttable != "")
  {
//    x = (x*1) + (items(document.getElementById(parenttable).style.marginLeft, 1 ,"px")*1);
//    y = (y*1) + (items(document.getElementById(parenttable).style.marginTop, 1, "px")*1);
//    x = (x*1) + document.getElementById(parenttable).offsetLeft-5;
//    y = (y*1) + document.getElementById(parenttable).offsetTop;
  }


  var subcat = items(which,2,":");
  if (subcat == "") hideallmenus();
  hideallmenus();
  document.getElementById(which).style.visibility = "visible";
  document.getElementById(which).style.marginLeft = x+"px";
  document.getElementById(which).style.marginTop = y+"px";

  visiblelist = visiblelist+which+"|";
  if (timerid != 0) clearTimeout(timerid);
  timerid = setTimeout("checkhide()", 5000);

}

function hideallmenus()
{
  // hide all the menus
  var cnt = 1;
  do
  {
    nextitem = items(visiblelist,cnt,"|");
    if (nextitem == "") break;
    document.getElementById(nextitem).style.visibility = "hidden";
    cnt++;
  } while (1 == 1)

  visiblelist = "";
}

function hidesubmenus()
{
  // hide all menus with a : in their ids
  cnt = 1;
  do
  {
    nextitem = items(visiblelist,cnt,"|");
    if (nextitem == "") break;
    if (nextitem.indexOf(":") > -1)
    {
      visiblelist.replace(nextitem+"|","");
      document.getElementById(nextitem).style.visibility = "hidden";
    } 
    cnt++;
  } while (1 == 1)

}

function checkhide()
{

  if (mouseovermenu == "Yes")
  {
    timerid = setTimeout("checkhide()", 5000);
  } else
  {
    hideallmenus();
  }
}

function swapmenu(menuname)
{
  document.getElementById("Main").style.visibility = "hidden";
  document.getElementById("Aircraft").style.visibility = "hidden";
  document.getElementById("Beechcraft").style.visibility = "hidden";
  
  document.getElementById(menuname).style.visibility = "visible";
}

