var curMenuHeaderIndex=-1;
var curMenuHeaderOverIndex=-1;
var pendingTabDeselectIndex=-1;
var pendingTabDeselectId=0;


														  
function makeNum(s)
{
  var i,c;
  var j=0;
  if (!s)
    return 0;
  for (i = 0; i < s.length; i++)
  {
    c=s.charAt(i);
    if ((c>='0')&&(c<='9'))
      j=j*10+parseInt(c);
  }
  return j;
}

function doGebi(id)
{
  if (document.getElementById)
    return document.getElementById(id);
  else
  {
    if (document.all)
      return document.all(id);
    else
      return document[id];
  }
}


function menuTabMouseOver(n)
{
  if (pendingTabDeselectIndex>=0)
  {
    if (pendingTabDeselectIndex==n)
    {
      pendingTabDeselectIndex=-1;
      return;
    }
    if (pendingTabDeselectIndex!=curMenuHeaderIndex)
      changeMenuTabSelection(pendingTabDeselectIndex,false);
    pendingTabDeselectIndex=-1;
  }
  if (curMenuHeaderOverIndex!=n)
  {
    if ((curMenuHeaderOverIndex>=0)&&(curMenuHeaderOverIndex!=curMenuHeaderIndex))
      changeMenuTabSelection(curMenuHeaderOverIndex,false);
    curMenuHeaderOverIndex=n;
    if (curMenuHeaderOverIndex!=curMenuHeaderIndex)
      changeMenuTabSelection(curMenuHeaderOverIndex,true);
  }
  return;
}

function menuTabMouseOut(n)
{
  if (n==curMenuHeaderIndex)
  {
    curMenuHeaderOverIndex=-1;
    return;
  }
  pendingTabDeselectIndex=n;
  setTimeout('menuTabPendingDeselect('+pendingTabDeselectIndex+','+(++pendingTabDeselectId)+')', 10);
  return;
}

function menuTabPendingDeselect(n,id)
{
  if ((pendingTabDeselectIndex!=n)||(id!=pendingTabDeselectId))
    return;
  pendingTabDeselectIndex=-1;
  curMenuHeaderOverIndex=-1;
  if (n!=curMenuHeaderIndex)
    changeMenuTabSelection(n,false);
  return;
}

function changeMenuTabSelection(n,isSelected)
{
  if (isSelected)
  {
    document.getElementById('menuTabCell'+n).className='menuTabSelected';
    document.getElementById('menuTabCell'+n+'A').className='menuTabSelectedA';
    document.getElementById('menuTabLeft'+n).className='menuTabLeftSelected';
    document.getElementById('menuTabRight'+n).className='menuTabRightSelected';
  }
  else
  {
    document.getElementById('menuTabCell'+n).className='menuTabNotSelected';
    document.getElementById('menuTabCell'+n+'A').className='menuTabNotSelectedA';
    document.getElementById('menuTabLeft'+n).className='menuTabLeft';
    document.getElementById('menuTabRight'+n).className='menuTabRight';
  }
}

function changeMenuTabSelectionR(n,isSelected)
{
  if (isSelected)
  {
    document.getElementById('menuTabCell'+n).className='menuTabSelectedR';
    document.getElementById('menuTabCell'+n+'A').className='menuTabSelectedAR';
    document.getElementById('menuTabLeft'+n).className='menuTabLeftSelectedR';
    document.getElementById('menuTabRight'+n).className='menuTabRightSelectedR';
  }
  else
  {
    document.getElementById('menuTabCell'+n).className='menuTabNotSelectedR';
    document.getElementById('menuTabCell'+n+'A').className='menuTabNotSelectedAR';
    document.getElementById('menuTabLeft'+n).className='menuTabLeftR';
    document.getElementById('menuTabRight'+n).className='menuTabRightR';
  }
}


function calcXY(e)
{
  var eorig=e;
  var cx=0,cy=0;
  var eparent;
  var eoffset=e;
  while (e)
  {
    eparent=e.parentNode;
    cx-=makeNum(e.scrollLeft);
    cy-=makeNum(e.scrollTop);
    if (e==eoffset)		// If node is also an offset node
    {
      cx+=e.offsetLeft+makeNum(e.style.borderLeftWidth);
      cy+=e.offsetTop+makeNum(e.style.borderTopWidth);
      // Set next offset parent (may be further up hierarchy than parent)
      eoffset=e.offsetParent;
    }
    e=eparent;		// Move on to parent
  }
  eorig.calcx=cx;
  eorig.calcy=cy;
  return;
}


function closeMenuTab(n,keepDivOpen)
{
  changeMenuTabSelection(n,false);
  if (!keepDivOpen)
  {
    var tmd=document.getElementById('tabbedMenuDiv');
    tmd.style.visibility='hidden';
    tmd.style.width=10;
    tmd.style.left=0;
    showSelect();
  }
  for (loop=0; loop<number_of_menus; loop++){
 		on_off[loop]=0;
  }
  return;
}

function openMenuTab(n)
{
  changeMenuTabSelection(n,true);
  var mainTable=document.getElementById('menuTabMainTable');
  calcXY(mainTable);
  var newx,newy;
  newx=mainTable.calcx;
  newy=mainTable.calcy+mainTable.offsetHeight;


  //newx+=65+n*80;
  
  var newContent='';
  switch(n)
  {
		case 0:
			newx+=20;
			newContent='<table style="border: 1px solid black; padding:5px 7px 5px 7px; margin:1px" cellpadding=5 width=400 class="menuTabWindowTable"><tr><td colspan="2" align="right" valign="top"><a href="#" onClick="closeMenuTab(0,false);curMenuHeaderIndex=-1;return false" class="menuTabSectionText">Close [ X ]</a></td></tr><tr><td valign="top"><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=10&parent=2" class="menuTabSectionText">Cases / Enclosures</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=17&parent=2" class="menuTabSectionText">CD / DVD / Blu-Ray</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=24&parent=2" class="menuTabSectionText">Controllers</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=35&parent=2" class="menuTabSectionText">Cooling Devices</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=45&parent=2" class="menuTabSectionText">CPUs / Processors</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=2&DPID=FD&PID= class=menuTabSectionText>Floppy Drives</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=49&parent=2" class="menuTabSectionText">Hard Drives / SSD</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=55&parent=2" class="menuTabSectionText">Input /Keyboard /Mice</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=66&parent=2" class="menuTabSectionText">Memory</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=2&DPID=MDM&PID= class=menuTabSectionText>Modems</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=71&parent=2" class="menuTabSectionText">Monitors - CRT & LCD</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=77&parent=2" class="menuTabSectionText">Motherboards & Bundles</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=81&parent=2" class="menuTabSectionText">Power Protection / UPS</a></br></br></td><td valign="top"><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=87&parent=2" class="menuTabSectionText">Power Supplies</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=94&parent=2" class="menuTabSectionText">Printers</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=2&DPID=REM&PID= class=menuTabSectionText>Removable Drives</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=104&parent=2" class="menuTabSectionText">Scanners</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=111&parent=2" class="menuTabSectionText">Servers</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=2&DPID=SW&PID= class=menuTabSectionText>Software</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=2&DPID=MM-SS&PID= class=menuTabSectionText>Sound Cards</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=123&parent=2" class="menuTabSectionText">Speakers / Headphones</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=124&parent=2" class="menuTabSectionText">Tape Backups</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=2&DPID=TVTUNER&PID= class=menuTabSectionText>TV Tuners</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=129&parent=2" class="menuTabSectionText">USB / Firewire Devices</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=137&parent=2" class="menuTabSectionText">Video Cards</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=2&DPID=videoconferencing&PID= class=menuTabSectionText>Webcams / Conferencing</a></br></br></td></tr></table>';
			break;
		case 1:
		    newx+=140;
			newContent='<table style="border: 1px solid black; padding:5px 7px 5px 7px; margin:1px" cellpadding=5 width=400 class="menuTabWindowTable"><tr><td colspan="2" align="right" valign="top"><a href="#" onClick="closeMenuTab(1,false);curMenuHeaderIndex=-1;return false" class="menuTabSectionText">Close [ X ]</a></td></tr><tr><td valign="top"><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=141&parent=3" class="menuTabSectionText">Batteries</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=147&parent=3" class="menuTabSectionText">Camcorders</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=772&parent=3" class="menuTabSectionText">Cell Phone</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=150&parent=3" class="menuTabSectionText">Digital Cameras</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=3&DPID=ELEC-DIGFRAM&PID= class=menuTabSectionText>Digital Photo Frames</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=3&DPID=DVDPLAYER&PID= class=menuTabSectionText>DVD Players</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=3&DPID=GPS&PID= class=menuTabSectionText>GPS Devices</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=156&parent=3" class="menuTabSectionText">Karaoke</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=3&DPID=ELEC-MISC&PID= class=menuTabSectionText>Miscellaneous</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=3&DPID=MOBILEVIDEO&PID= class=menuTabSectionText>Mobile Video</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=160&parent=3" class="menuTabSectionText">MP3 / Digital Players</a></br></br></td><td valign="top"><a href=http://www.mwave.com/mwave/Departments.asp?parent=3&DPID=NOVELTY&PID= class=menuTabSectionText>Novelty Items</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=3&DPID=SHRED&PID= class=menuTabSectionText>Paper Shredders</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=3&DPID=PDA&PID= class=menuTabSectionText>PDA / Organizers</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=726&parent=3" class="menuTabSectionText">Projectors</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=165&parent=3" class="menuTabSectionText">Security DVR Surveillance</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=754&parent=3" class="menuTabSectionText">Speakers</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=3&DPID=PHONE&PID= class=menuTabSectionText>Telephones</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=3&DPID=LCDTV&PID= class=menuTabSectionText>Televisions - LCD </a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=3&DPID=UNIREMOTE&PID= class=menuTabSectionText>Universal Remotes</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=755&parent=3" class="menuTabSectionText">Video Games</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=3&DPID=ELEC-VOICE&PID= class=menuTabSectionText>Voice Recorders</a></br></br></td></tr></table>';
			break;
		case 2:
			newx+=240;
			newContent='<table style="border: 1px solid black; padding:5px 7px 5px 7px; margin:1px" cellpadding=5 width=400 class="menuTabWindowTable"><tr><td colspan="2" align="right" valign="top"><a href="#" onClick="closeMenuTab(2,false);curMenuHeaderIndex=-1;return false" class="menuTabSectionText">Close [ X ]</a></td></tr><tr><td valign="top"><a href=http://www.mwave.com/mwave/Departments.asp?parent=4&DPID=NTCABLES-TOOL&PID= class=menuTabSectionText>Accessories / Tools</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=297&parent=4" class="menuTabSectionText">Network Cables</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=4&DPID=nt-nic&PID= class=menuTabSectionText>Interface Cards</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=704&parent=4" class="menuTabSectionText">KVM / Sharing Devices</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=4&DPID=NT-MEDIA&PID= class=menuTabSectionText>Media Converters</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=4&DPID=nas2&PID= class=menuTabSectionText>Network Attached Storage - NAS</a></br></br></td><td valign="top"><a href=http://www.mwave.com/mwave/Departments.asp?parent=4&DPID=NET-POWER&PID= class=menuTabSectionText>Network Powerline</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=4&DPID=NTPTRSER&PID= class=menuTabSectionText>Print Servers</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=4&DPID=nt-rt&PID= class=menuTabSectionText>Routers / Remote</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=4&DPID=nt-sw&PID= class=menuTabSectionText>Switches</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=183&parent=4" class="menuTabSectionText">Network Security</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=188&parent=4" class="menuTabSectionText">Wireless Networking</a></br></br></td></tr></table>';
			break;
		case 3:
			newx+=390;
			newContent='<table style="border: 1px solid black; padding:5px 7px 5px 7px; margin:1px" cellpadding=5 width=400 class="menuTabWindowTable"><tr><td colspan="2" align="right" valign="top"><a href="#" onClick="closeMenuTab(3,false);curMenuHeaderIndex=-1;return false" class="menuTabSectionText">Close [ X ]</a></td></tr><tr><td valign="top"><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=202&parent=5" class="menuTabSectionText">Barebone Systems</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=203&parent=5" class="menuTabSectionText">Computers / PCs</a></br></br></td><td valign="top"><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=232&parent=5" class="menuTabSectionText">Notebooks - Netbooks</a></br></br></td></tr></table>'
			break;
		case 4:
			newx+=440;
			newContent='<table style="border: 1px solid black; padding:5px 7px 5px 7px; margin:1px" cellpadding=5 width=400 class="menuTabWindowTable"><tr><td colspan="2" align="right" valign="top"><a href="#" onClick="closeMenuTab(4,false);curMenuHeaderIndex=-1;return false" class="menuTabSectionText">Close [ X ]</a></td></tr><tr><td valign="top"><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=236&parent=6" class="menuTabSectionText">Blank Media</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=249&parent=6" class="menuTabSectionText">Flash Media</a></br></br></td><td valign="top"><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=432&parent=6" class="menuTabSectionText">Tape Cartridges / Media</a></br></br></td></tr></table>'
			break;
		case 5:
			newx+=460;
			newContent='<table style="border: 1px solid black; padding:5px 7px 5px 7px; margin:1px" cellpadding=5 width=400 class="menuTabWindowTable"><tr><td colspan="2" align="right" valign="top"><a href="#" onClick="closeMenuTab(5,false);curMenuHeaderIndex=-1;return false" class="menuTabSectionText">Close [ X ]</a></td></tr><tr><td valign="top"><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=260&parent=7" class="menuTabSectionText">AV Cables</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=7&DPID=CABLE-CCTV&PID= class=menuTabSectionText>CCTV Cables</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=7&DPID=IDECABLES-IDE&PID= class=menuTabSectionText>IDE / SATA Cables</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=651&parent=7" class="menuTabSectionText">Input Device Cables</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=7&DPID=FIBERCABLES-FIBER&PID= class=menuTabSectionText>Fiber Optic Cables</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=278&parent=7" class="menuTabSectionText">Firewire Cables</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=7&DPID=NTKVM-CABLES&PID= class=menuTabSectionText>KVM Cables</a></br></br></td><td valign="top"><a href=http://www.mwave.com/mwave/Departments.asp?parent=7&DPID=MDMCABLES&PID= class=menuTabSectionText>Modem Cables</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=297&parent=7" class="menuTabSectionText">Network Cables</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=757&parent=7" class="menuTabSectionText">Power Supply Cables</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=7&DPID=PTRCABLE-PRINTERCABLES&PID= class=menuTabSectionText>Printer Cables</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=7&DPID=SCSICABLES-SCSI&PID= class=menuTabSectionText>SCSI Data Cables</a></br></br><a href=http://www.mwave.com/mwave/Departments.asp?parent=7&DPID=MTRCABLES-MTR&PID= class=menuTabSectionText>SVGA / DVI Monitor Cables</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=667&parent=7" class="menuTabSectionText">USB Cables</a></br></br></td></tr></table>';
			break;
		case 6:
			newx+=570;
			newContent='<table style="border: 1px solid black; padding:5px 7px 5px 7px; margin:1px" cellpadding=5 width=400 class="menuTabWindowTable"><tr><td colspan="2" align="right" valign="top"><a href="#" onClick="closeMenuTab(6,false);curMenuHeaderIndex=-1;return false" class="menuTabSectionText">Close [ X ]</a></td></tr><tr><td valign="top"><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=327&parent=8" class="menuTabSectionText">Bags & Carrying Cases</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=141&parent=8" class="menuTabSectionText">Batteries & Chargers</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=236&parent=8" class="menuTabSectionText">Blank Media</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=590&parent=8" class="menuTabSectionText">Camcorder Accessories</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=365&parent=8" class="menuTabSectionText">Case Accessories</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=758&parent=8" class="menuTabSectionText">Cell Phone Accessories</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=375&parent=8" class="menuTabSectionText">Cooling Devices</a></br></br></td><td valign="top"><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=353&parent=8" class="menuTabSectionText">Camera Accessories</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=690&parent=8" class="menuTabSectionText">Hard Drive Accessories</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=759&parent=8" class="menuTabSectionText">MP3 Accessories</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=760&parent=8" class="menuTabSectionText">Printer Accessories</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=423&parent=8" class="menuTabSectionText">Projector Accessories</a></br></br><a href="http://www.mwave.com/mwave/subcategory.asp?CatID=432&parent=8" class="menuTabSectionText">Tape Cartridges / Media</a></br></br></td></tr></table>';
			break;
		default:
			newContent='';

  }
  

  hideSelect();
  var tmd=document.getElementById('tabbedMenuDiv');
  tmd.style.visibility='hidden';
  tmd.innerHTML='';
  tmd.style.left=0;
  tmd.style.width=400;
  if (n==3)
	tmd.style.width=200;
  if (n==5)
	tmd.style.width=500;
  tmd.innerHTML=newContent;
  tmd.style.left=newx;
  tmd.style.top=newy;
  tmd.style.display='none';
  tmd.style.visibility='visible';
  tmd.style.display='block';
  return;
}

function changeMenuTab(n)
{
  if (curMenuHeaderIndex>=0)
    closeMenuTab(curMenuHeaderIndex,(curMenuHeaderIndex!=n));
  if (curMenuHeaderIndex==n)
  {
    curMenuHeaderIndex=-1;
    return;
  }
  openMenuTab(n);
  curMenuHeaderIndex=n;
  return;
}

function hideSelect()
{
  selectSetVis('hidden');
}

function showSelect()
{
  selectSetVis('inherit');
}

function selectSetVis(vis_string)
{
  var ind = 0;
  var eol;

  do {
    var hide_select = doGebi("hidesel"+ ind++ );
    eol = hide_select==null;
    if (!eol)
     hide_select.style.visibility=vis_string;
  } while (!eol);
}

var on_off=new Array();
var menu_code=new Array();

number_of_menus=80;