var h, hideIt;
function show(n) {
  for (var m = 0; m < menus; m ++) {
    hide(m);
  };

  document.getElementById(n + "overlay").style.visibility = "";
  for (var i = 0; i < items[n]; i ++) {
    document.getElementById(n + "contents" + i).style.visibility = "";
  };
};

function hide(n) {
  if (hideIt == false) {
    hideIt == true;
    return;
  };

  if (document.getElementById(n + "overlay").style.visibility = "") return;

  for (var i = 0; i < items[n]; i ++) {
    document.getElementById(n + "contents" + i).style.visibility = "hidden";
  };
  document.getElementById(n + "overlay").style.visibility = "hidden";
};

function sethide(n) {
  hideIt = true;
  h = setTimeout("hide(" + n + ");", 50);
};

function highlight(n, i) {
  hideIt = false;
  i.style.background = "red";
  i.style.filter = "alpha(style=1,opacity=100";
  i.style.color = "#oooooo";
};

function dehighlight(n, i) {
  i.style.background = "#A67D3D";
  i.style.filter = "alpha(style=1,opacity=100)";
  i.style.color = "#ffffff";
  sethide(n);
};

var menus = 0, items = new Array();
function makeMenu(title, x, y, w) {
  var n = menus;

  var numItems = (arguments.length - 4) / 2;
  items[n] = numItems;

 document.write("<div id='" + n + "overlay' style='visibility:hidden; border:0px solid #EBC177E; background:tan; filter:alpha(style=0,opacity=94); position:absolute; height:" + (numItems * 25 +2) + "px; width:" + (w + 2) + "px;left:" + x + "px; top:" + (y + 20) + "px' onmouseover='hideIt = false;' onmouseout='sethide(" + n + ");'></div>");

  for (var i = 0; i < numItems; i ++) {
    document.write("<div id='" + n + "contents" + i + "' style='padding:1px; cursor:hand; position:absolute; visibility:hidden; height:14px; width:" + w + "px; left:" + (x + 1) + "px; top:" + (y +20 + i*25) + "px' onmouseover='highlight(" + n + ", this);' onmouseout='dehighlight(" + n + ", this);' onclick='location = \"" + arguments[5 + i*2] + "\";'>&nbsp;" + arguments[4 + i*2] + "</div>");
  };

  document.write("<div id='" + n + "title' style='background:#EBC177E; cursor:default; border:0px solid #A67D3D;  filter:alpha(style=0,opacity=100); padding:0px; position:absolute; height:14px; left:" + x + "px; top:" + y + "px' onmouseover='show(" + n + "); hideIt = false;' onmouseout='sethide(" + n + ");'>&nbsp;" + title + "&nbsp;</div>");


  menus ++;
};

makeMenu("Contact", 44,177, 60,
"Contact", "http://www.kkwoodcraft.com/company.html");

makeMenu("Bedroom Sets",110,177, 90,
"Bedroom Sets", "http://www.kkwoodcraft.com/bedroom-sets.html",
"Mission", "http://www.kkwoodcraft.com/mission.html",
"Mission Post", "http://www.kkwoodcraft.com/mission-p.html",
"Tara", "http://www.kkwoodcraft.com/tara.html",
"Tara Low", "http://www.kkwoodcraft.com/tara-low.html",
" New Post", "http://www.kkwoodcraft.com/newpost.html",
"Sleigh", "http://www.kkwoodcraft.com/sleigh.html",
"Condo", "http://www.kkwoodcraft.com/condo.html",
"Metro", "http://www.kkwoodcraft.com/metro.html",
"Harvest", "http://www.kkwoodcraft.com/harvest.html");

makeMenu("Bedroom Furniture", 217,177, 120,
"Chests", "http://www.kkwoodcraft.com/chests.html",
"Dressers", "http://www.kkwoodcraft.com/dressers.html",
"Armoires", "http://www.kkwoodcraft.com/armoires.html",
"Wardrobes", "http://www.kkwoodcraft.com/wardrobes.html");

makeMenu("Pine Shelving",341, 177, 120,
"All Cabinets", "http://www.kkwoodcraft.com/shelving.html",
"Pine Shelving", "http://www.kkwoodcraft.com/pine-shelving.html",
"Entertainment Unit", "http://www.kkwoodcraft.com/entertainment.html",
"TV Stand", "http://www.kkwoodcraft.com/tv-stand.html",
"Wide Screen", "http://www.kkwoodcraft.com/tv-standw.html",
"CD Stand", "http://www.kkwoodcraft.com/cd-stand.html");

makeMenu("Futon Frames",439,177, 120,
"Arm Styles", "http://www.kkwoodcraft.com/arm-styles.html",
"Mission Setting", "http://www.kkwoodcraft.com/mission-sofa.html");

makeMenu("Tables", 536,177, 90,
"Tables", "http://www.kkwoodcraft.com/tables.html",
"Night Tables", "http://www.kkwoodcraft.com/night-tables.html");

makeMenu("Where To Buy", 590,177, 90,
"Retail", "http://www.kkwoodcraft.com/furniturestores.html",
"Wholesale", "http://www.kkwoodcraft.com/company.html");

makeMenu("Images", 690,177, 100,
"Images", "http://www.kkwoodcraft.com/images2/products2.html");

