// window.onerror = null;
var DOM = (document.getElementById)?true:false;
var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4 && !DOM);
var IE4 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4);
var layerType = NS4?'layer':'div';
var menuOn = 0;
var layerOn;
var mainIndex, subIndex;
var windowWidth, smWidth=160, font, sl, IE5=false, pressed=false;
var menuTimer = null;
var layerText, styleText, leftText, topText, wHeight, appVer=navigator.appVersion;
var rtimer;
var activemenucolor = '#B0B0FF', inactivemenucolor = '#D3D1FA', menubordercolor = '#ff6600', borderimage = 'c6/t.gif', headingfont = 't14';

if(colortheme == 'green')
    {
	activemenucolor = color[1];
	inactivemenucolor = color[0];
	menubordercolor = '#000000';
	borderimage = 'c14/black.gif';
	headingfont = 'sc2';
    }
    

if(navigator.appName == "Netscape")
{
  layerText="document.layers";
  styleText="";
  leftText='.left';
  topText='.top';
  wHeight=window.innerHeight;
  windowWidth = window.innerWidth-16;
}
else
{
  layerText="document.all";
  styleText=".style";
  leftText='.pixelLeft';
  topText='.pixelTop';  
  wHeight=document.body.clientHeight;
  windowWidth = document.body.clientWidth;
  if(parseFloat(appVer.substr(appVer.indexOf("MSIE ")+5, 5))>=5)
    {  
      windowWidth = windowWidth-16;
      IE5 = true;
    }
}

function getYPos(layerNumber, subIndex)
{
  var Yoffset, Y;

  if(navigator.appName == "Netscape") 
    Yoffset=window.pageYOffset;
  else 
    Yoffset=document.body.scrollTop; 

  Y = Math.min(parseInt(layerNumber)*22+subIndex*17+188+logoHeight+heightAdj, Yoffset+wHeight-5-(eval('sub'+layerNumber+'.length')-subIndex)*17);
  Y = Math.max(Yoffset+subIndex*17, Y);

  return(Y);
}  

function displayMenu(layerNumber, src){
  var i, myY, toSet;
  
  if(menuTimer != null)
    { 
      clearTimeout(menuTimer);

      if(layerOn!=layerNumber)
        hideMenu(layerOn);
    }
  
  if(!pressed)
    {
      mainIndex=layerNumber;
      subIndex=-1;
    }  
  
  if(DOM)
    document.getElementById('main'+layerNumber).style.backgroundColor=activemenucolor;
  else if(NS4)
    eval(layerText+'["'+'main'+layerNumber+'"]'+'.document.bgColor="'+activemenucolor+'"');  
  else if(IE4)
    eval(layerText+'["'+'main'+layerNumber+'"]'+'.style.backgroundColor="'+activemenucolor+'"'); 
  
  if(eval('main['+layerNumber+'].sub==1'))
    {
      myY = getYPos(layerNumber, 0);
      
      if(DOM)
	{
	  document.getElementById('sub'+layerNumber).style.top=myY;
	  document.getElementById('sub'+layerNumber).style.visibility='visible';
	}	
      else if(IE4)
	{
	  eval(layerText+'["'+'sub'+layerNumber+'"]'+styleText+topText+'='+myY);
	  eval(layerText+'["'+'sub'+layerNumber+'"]'+styleText+'.visibility="visible"');
	}
      else if(NS4)
	for(i=0; i<eval('sub'+layerNumber+'.length'); i++)
	  {
	    eval(layerText+'["'+'sub'+layerNumber+i+'"]'+styleText+topText+'='+myY);	      	    
	    eval(layerText+'["'+'sub'+layerNumber+i+'"]'+styleText+'.visibility="visible"');
	    myY = myY + 17;
	  }
    }
  layerOn = layerNumber;
}

function hideMenu(layerNumber)
{
  var i;
  
  if(DOM)
    document.getElementById('main'+layerNumber).style.backgroundColor=inactivemenucolor;
  else if(NS4)
    eval(layerText+'["'+'main'+layerNumber+'"]'+'.document.bgColor="'+inactivemenucolor+'"');
  else if(IE4)
    eval(layerText+'["'+'main'+layerNumber+'"]'+'.style.backgroundColor="'+inactivemenucolor+'"');
  
  if(menuOn == 0 && eval('main['+layerNumber+'].sub==1'))
    {
      if(DOM)
	document.getElementById('sub'+layerNumber).style.visibility='hidden';
      else if(NS4)
	for(i=0; i<eval('sub'+layerNumber+'.length'); i++)
	  eval(layerText+'["'+'sub'+layerNumber+i+'"]'+styleText+'.visibility="hidden"');
      else if(IE4)
	eval(layerText+'["'+'sub'+layerNumber+'"]'+styleText+'.visibility="hidden"');
    }
}

function setMenuTimer() 
{
  menuTimer = setTimeout("menuTimerOut()",700);
}

function menuTimerOut()
{    
  if(menuOn == 0)
    hideMenu(layerOn);
}

function subMenuIn(main, sub, src)
{
  clearTimeout(menuTimer);
  menuOn = 1;
  
  if(NS4)
    eval(layerText+'["'+'sub'+main+sub+'"]'+'.document.bgColor="'+activemenucolor+'"');
  else
    src.bgColor=activemenucolor;

  if(!pressed)
    {
      mainIndex=main;
      subIndex=sub;
    } 
}
 
function subMenuOut(main, sub, src) 
{
  menuOn = 0;	

  if(NS4)
    eval(layerText+'["'+'sub'+main+sub+'"]'+'.document.bgColor="'+inactivemenucolor+'"');
  else
    src.bgColor=inactivemenucolor;

  menuTimer = setTimeout("hideMenu(layerOn)", 700);
}

function handleResize()
{
  if(!IE4)
    return;

  clearTimeout(rtimer);
  rtimer=setTimeout('window.location=window.location;',500);
}

function getDestination(e)
{
  setTimeout("G2()", 180);
  pressed=true;
}

function G2()
{
  if(subIndex==-1)
    window.location=(main[i].url.indexOf("http://")==-1?menuBase:"")+main[parseInt(mainIndex)].url;
  else
    window.location=(main[i].url.indexOf("http://")==-1?menuBase:"")+eval('sub'+mainIndex+'['+subIndex+'].url');
}

function getAllCatWidth(fo, obj)
{
  var result = 0.0;
  var c, code;
  var r, i, j;

  smWidth=135;
  for(i=0; i<obj.length; i++)
    {
      r=0.0;
      for(j=0; j<obj[i].title.length; j++)
	{
	  c=obj[i].title.charAt(j);
	  code=obj[i].title.charCodeAt(j);
	  
	  if(fo==10)
	    {  
	      if(c=='f' || c=='i' || c=='j' || c=='l' || c=='t' || c=='I')
		r+=.5;
	      else if(c=='r')
		r+=.62;
	      else if(c=='s')
		r+=.75;
	      else if(c=='c' || c=='k' || c=='v' || c=='y' || c=='z' || c=='J' || c=='Z' || (code>=48 && code<=57))
		r+=.88;
	      else if(c=='A' || c=='B' || c=='C' || c=='D' || c=='H' || c=='K' || c=='N' || c=='P' || c=='R' || c=='S' || c=='U' || c=='V' || c=='X')
		r+=1.125;
	      else if(c=='G' || c=='O' || c=='Q')
		r+=1.25;
	      else if(c=='w' || c=='M')
		r+=1.37;
	      else if(c=='m')
		r+=1.5;
	      else
		r+=1;
	    }
	  else
	    {
	      if(c=='i' || c=='j' || c=='l' || c=='I')
		r+=.43;
	      else if(c=='f' || c=='t')
		r+=.57;
	      else if(c=='r')
		r+=.72;
	      else if(c=='w' || c=='y' || c=='F')
		r+=.86;
	      else if(c=='A' || c=='B' || c=='C' || c=='D' || c=='G' || c=='H' || c=='K' || c=='N' || c=='P' || c=='R' || c=='S' || c=='U' || c=='V' || c=='X')
		r+=1.15;
	      else if(c=='O' || c=='Q')
		r+=1.3;
	      else if(c=='w' || c=='M')
		r+=1.45;
	      else if(c=='m')
		r+=1.58;
	      else
		r+=1;
	    }

	  if(c=='&' && obj[i].title.charAt(j+1)=='q' && obj[i].title.charAt(j+2)=='u' &&  obj[i].title.charAt(j+3)=='o' &&  obj[i].title.charAt(j+4)=='t' &&  obj[i].title.charAt(j+5)==';')
	    j=j+5;
	}
      
      if(fo==10)
	r=r*8.03;
      else
	r=r*6.9;
     
      obj[i].width=Math.round(r)+18;
      result=result+Math.round(r)+18;
      smWidth=Math.max(smWidth, Math.round(r)+6);
    } 

  return result;
}

function isIE4() { return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') ); }
function openMail(host) { var mailwindow = window.open("http://" + host +"/.sc/ms/em", "EmailFriend", "width=500,height=400,resizable,scrollbars,status"); if(!isIE4()) mailwindow.focus(); }

for(i=0; i<main.length; i++)
{
  if(main[i].sub==1)
    {
      getAllCatWidth(9, eval('sub'+i));
      eval('sub'+i+'.smWidth='+smWidth);
    }
}

if(ot=='f')
  {
    myTop[4].url=myTop[3].url+'/co3';
    myTop[4].title='My Account';
  }

if(IE4)
  sl=16;
else if(DOM)
  sl=10;
else
  sl=11;

if(priceMode=='2' || priceMode=='3')
    itemString='<td align=center height=20><font class=num2><b>Orders: '+phone+'</b></font></td>';
else
    itemString='<td align=right><a href='+myTop[2].url+'><img src='+idomain+'/ac/cart.gif width=23 height=20 border=0 align=absmiddle></a></td><td><a href='+myTop[2].url+' class=t14>Items: '+items+'</a></td>';



document.writeln('</td><td width=1 bgcolor=#000000><img src='+idomain+'/ac/b.gif width=1 height=1 border=0></td></tr><tr><td colspan=3 bgcolor=#000000><img src='+idomain+'/ac/b.gif width=600 height=1 border=0></td></tr>');

if(topHTML=="")
  document.writeln('<tr><td colspan=2 bgcolor='+color[1]+' height=18><table border=0 cellspacing=0 cellpadding=0 align=center width=100% height=21><tr><td class=search width=8%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td align=center width=12%><a class='+headingfont+' href='+myTop[0].url+'>&nbsp;'+myTop[0].title+'&nbsp;</a></td><td align=center width=2%><img src='+idomain+'/c14/bar.gif width=1 height=10 border=0></td><td align=center width=14%><a href='+myTop[1].url+' class='+headingfont+'>&nbsp;'+myTop[1].title+'&nbsp;</a></td><td align=center width=2%><img src='+idomain+'/c14/bar.gif width=1 height=10 border=0></td><td align=center width=18%><a href='+myTop[2].url+' class='+headingfont+'>'+myTop[2].title+'</a></td><td align=center width=2%><img src='+idomain+'/c14/bar.gif width=1 height=10 border=0></td><td align=center width=14%><a href='+myTop[3].url+' class='+headingfont+'>'+myTop[3].title+'</a></td><td align=center width=2%><img src='+idomain+'/c14/bar.gif width=1 height=10 border=0></td><td align=center width=18%><a href='+myTop[4].url+' class='+headingfont+'>'+myTop[4].title+'</a></td><td class=search width=8%>&nbsp;</td></tr></table></td><td width=1 bgcolor=#000000><img src='+idomain+'/ac/b.gif width=1 height=1 border=0></td></tr></table>');
else
  document.writeln('<tr><td colspan=2 bgcolor='+color[1]+' height=18>'+topHTML+'</td><td width=1 bgcolor=#000000><img src='+idomain+'/ac/b.gif width=1 height=1 border=0></td></tr></table>');

for(i=0; i<main.length; i++)
{
  if(NS4)
    document.writeln('<layer id=main'+i+' Z-INDEX=5 width=162 top='+eval(i*22+188+logoHeight+heightAdj)+' left=1 bgcolor='+inactivemenucolor+' onmouseover="displayMenu('+"'"+i+"'"+', this);" onmouseout=setMenuTimer();><table cellspacing=0 cellpadding=0 border=0 width=162 height=21><tr><td width=1 rowspan=3><img src='+idomain+'/'+borderimage+' width=1 height=21></td><td width=160><img src='+idomain+'/'+borderimage+' width=160 height=1></td><td width=1 rowspan=3><img src='+idomain+'/'+borderimage+' width=1 height=21></td></tr><tr><td align=center height=19 nowrap><a class=navy9 href="'+(main[i].url.indexOf("http://")==-1?menuBase:"")+main[i].url+'">'+main[i].title+'</a></td></tr><tr><td height=1><img src='+idomain+'/'+borderimage+' width=160 height=1></td></tr></table></'+layerType+'>');
  else
    {
      document.writeln('<div id=main'+i+' style="position: absolute; background-color: '+inactivemenucolor+'; Z-INDEX: 5; width=162; top: '+eval(i*22+188+logoHeight+heightAdj)+'; left: 1;"><table cellspacing=0 cellpadding=0 border=0 width=162 height=21 onmouseover="displayMenu('+"'"+i+"'"+', this);" onmouseout=setMenuTimer(); onclick=getDestination(null);><tr><td width=1 rowspan=3><img src='+idomain+'/'+borderimage+' width=1 height=21></td><td width=160><img src='+idomain+'/'+borderimage+' width=160 height=1></td><td width=1 rowspan=3><img src='+idomain+'/'+borderimage+' width=1 height=21></td></tr><tr><td align=center height=19 nowrap><a class=navy9 href="'+(main[i].url.indexOf("http://")==-1?menuBase:"")+main[i].url+'">'+main[i].title+'</a></td></tr><tr><td height=1><img src='+idomain+'/'+borderimage+' width=160 height=1></td></tr></table></'+layerType+'>');
	
      if(IE5) eval(layerText+'["'+'main'+i+'"]'+styleText+'.filter="alpha(opacity=75)"');
      if(IE4) eval(layerText+'["'+'main'+i+'"]'+styleText+'.cursor="hand"');
    }	
}

for(i=0; i<main.length; i++)
{
  if(NS4)
    {
      if(main[i].sub==1)		
	{
	  smWidth=eval('sub'+i+'.smWidth');	  
	  for(j=0; j<eval('sub'+i+'.length'); j++)
	    {   
	      document.writeln('<layer id=sub'+i+j+' Z-INDEX=5 bgcolor='+inactivemenucolor+' TOP='+eval(i*22+j*17+188+logoHeight+heightAdj)+' width='+smWidth+' LEFT=164 VISIBILITY=hidden onmouseover="subMenuIn('+"'"+i+"', '"+j+"', this)"+'" onmouseout="subMenuOut('+"'"+i+"'"+", '"+j+"', this)"+'"><table cellspacing=0 cellpadding=0 border=0 width='+smWidth+' height=18><tr><td width=1 rowspan=3><img src='+idomain+'/'+borderimage+' width=1 height=18></td><td><img src='+idomain+'/'+borderimage+' width='+(smWidth-2)+' height=1></td><td width=1 rowspan=3><img src='+idomain+'/'+borderimage+' width=1 height=18></td></tr><tr><td align=center height=16 nowrap><a class=navy9 href="'+menuBase+eval('sub'+i+'['+j+'].url')+'">'+eval('sub'+i+'['+j+'].title')+'</a></td></tr><tr><td height=1><img src='+idomain+'/'+borderimage+' width='+(smWidth-2)+' height=1></td></tr></table></layer>');
	    }	
	}	
    }
  else
    {
      if(main[i].sub==1)
	{
	  smWidth=eval('sub'+i+'.smWidth');
	  
	  document.writeln('<div id=sub'+i+' style="position: absolute; Z-INDEX: 5; width='+smWidth+'; TOP: eval(i*22+188+logoHeight+heightAdj); LEFT: 164; VISIBILITY: hidden;"><table cellspacing=0 cellpadding=0 border=0 bgcolor='+inactivemenucolor+'><tr><td width=1 bgcolor='+menubordercolor+'><img src='+idomain+'/ac/b.gif width=1 height=1></td><td><table cellpadding=0 cellspacing=0 border=0><tr><td bgcolor='+menubordercolor+' height=1><img src='+idomain+'/ac/b.gif width='+smWidth+' height=1></td></tr>');
	  
	  for(j=0; j<eval('sub'+i+'.length'); j++) 
	    document.writeln('<tr><td height=17 align=center valign=top nowrap onmouseover="subMenuIn('+"'"+i+"', '"+j+"', this)"+'" onmouseout="subMenuOut('+"'"+i+"'"+", '"+j+"', this)"+'" onclick=getDestination(null)><a class=navy9 href="'+menuBase+eval('sub'+i+'['+j+'].url')+'">'+eval('sub'+i+'['+j+'].title')+'</a></td></tr>');
	  
	  document.writeln('<tr><td bgcolor='+menubordercolor+' height=1><img src='+idomain+'/ac/b.gif width=1 height=1></td></tr></table></td><td width=1 bgcolor='+menubordercolor+'><img src='+idomain+'/ac/b.gif width=1 height=1></td></tr></table></div>');
	  
	  if(IE5) eval(layerText+'["'+'sub'+i+'"]'+styleText+'.filter="alpha(opacity=92)"');
	  if(IE4) eval(layerText+'["'+'sub'+i+'"]'+styleText+'.cursor="hand"');
	}
    }
}

if(NS4)
{
  for(i=0; i<eval(layerText+'.length'); i++)
    {
      eval(layerText+'['+i+'].captureEvents(Event.MOUSEUP)');
      eval(layerText+'['+i+'].onmouseup=getDestination');
    }
}



document.writeln('<table width=100% cellspacing=0 cellpadding=0 border=0><tr><td colspan=5 bgcolor=#000000><img src='+idomain+'/ac/b.gif width=600 height=1 border=0></td></tr><tr><td align=center valign=top bgcolor='+color[2]+'><img src='+idomain+'/ac/b.gif width=163 height=3 border=0><TABLE cellpadding=0 cellspacing=0 border=0 width=100%><tr>'+itemString+'</tr></table>'+loginlink+'</td><td width=1 bgcolor=#000000><img src='+idomain+'/ac/b.gif width=1 height=1 border=0></td><td colspan=2 valign=top><form method=get action='+sch+'><TABLE cellpadding=0 cellspacing=0 border=0 align=right width=100%><tr><td align=right bgcolor=#ffffff><img src='+idomain+'/c14/'+colortheme+'product.gif width=280 height=23 border=0></td><td bgcolor='+color[5]+'><input class=searchbox type=text name=search size='+sl+' maxlength=50><input type=image src='+idomain+'/c14/'+colortheme+'search.gif width=52 height=21 value=go name=go border=0 align=absmiddle></td></tr><tr><td colspan=2 bgcolor=#000000><img src='+idomain+'/ac/b.gif width=435 height=1 border=0></td></tr><tr><td colspan=2>'+direction+'</td></tr></table></form></td><td width=1 bgcolor=#000000><img src='+idomain+'/ac/b.gif width=1 height=1 border=0></td></tr>');









