// 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 temp, windowWidth, allCatWidth, leftWidth, midWidth=11, rightWidth=143, edgeWidth=9, smWidth=160, totalWidth, center, loc, font, pressed=false;
var menuTimer = null;
var layerText, styleText, leftText, topText, appVer=navigator.appVersion;
var rtimer;

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



function displayMenu(layerNumber, src)
{
  var i;
  
  if(menuTimer != null) 
    {
      clearTimeout(menuTimer);
      if(layerOn!=layerNumber)
        hideMenu(layerOn);
    }

  if(!pressed)
    {    
      mainIndex=layerNumber;
      subIndex=-1;  
    }

  if(DOM)
    document.getElementById('main'+layerNumber).style.backgroundColor='#ff99ff';
  else if(NS4)
    eval(layerText+'["'+'main'+layerNumber+'"]'+'.document.bgColor="#ff99ff"');
  else if(IE4)
    eval(layerText+'["'+'main'+layerNumber+'"]'+'.style.backgroundColor="#ff99ff"');
  
  if(eval('main['+layerNumber+'].sub==1'))
    {
      if(DOM)
	document.getElementById('sub'+layerNumber).style.visibility='visible'; 
      else if(NS4)
	{
	  for(i=0; i<eval('sub'+layerNumber+'.length'); i++)
	    eval(layerText+'["'+'sub'+layerNumber+i+'"]'+styleText+'.visibility="visible"');
	}
      else
	eval(layerText+'["'+'sub'+layerNumber+'"]'+styleText+'.visibility="visible"');
    }
  
  layerOn = layerNumber;
}

function hideMenu(layerNumber)
{
  var i;
  
  if (menuOn == 0)
    { 
      if(DOM)
	document.getElementById('main'+layerNumber).style.backgroundColor='#3399cc';
      else if(NS4)
	eval(layerText+'["'+'main'+layerNumber+'"]'+'.document.bgColor="#3399cc"');
      else if(IE4)
	eval(layerText+'["'+'main'+layerNumber+'"]'+'.style.backgroundColor="#3399cc"');
      
      if(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="#ff99ff"');
  else 
    src.bgColor='#ff99ff';

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

  if(NS4)
    eval(layerText+'["'+'sub'+main+sub+'"]'+'.document.bgColor="#3399cc"');
  else
    src.bgColor='#3399cc';
  
  menuTimer = setTimeout("hideMenu(layerOn)", 700);
}


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

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)+16;
      result=result+Math.round(r)+16;
      smWidth=Math.max(smWidth, Math.round(r)+6);
    } 

  return result;
}

function getCatLocation()
{
  var i;
  var cur = Math.round((leftWidth-allCatWidth)/2);

  for(i=0; i<main.length; i++)
    {
      main[i].location=cur;
      cur=cur+main[i].width;
    }
}

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);
    }
}



windowWidth = Math.max(610, windowWidth);

font=10;
allCatWidth = getAllCatWidth(10, main);

if(allCatWidth>(windowWidth-midWidth-rightWidth-edgeWidth)) 
{ 
  font=9;
  allCatWidth = getAllCatWidth(9, main);
}

leftWidth = Math.max(windowWidth-midWidth-rightWidth-edgeWidth, allCatWidth); 
totalWidth = leftWidth + midWidth + rightWidth + edgeWidth;

getCatLocation();

if(priceMode=='2' || priceMode=='3')
  {
    scString='<td width=22% align=center valign=bottom><a href='+myTop[2].url+' class=BB10><img src='+idomain+'/c4/sitemap.gif width=18 height=18 border=0><br>'+myTop[2].title+'</a></td>';
    coString='<td width=17% align=center valign=bottom><a href='+myTop[3].url+' class=BB10><img src='+idomain+'/c4/help.gif width=17 height=17 border=0><br>'+myTop[3].title+'</a></td>';
    otString='<td width=23% align=center valign=bottom><a href='+myTop[4].url+' class=BB10><img src='+idomain+'/c4/bookmark.gif width=17 height=17 border=0><br>'+myTop[4].title+'</a></td>';
  }
else
  {
    scString='<td width=22% align=center valign=bottom><a href='+myTop[2].url+' class=BB10><img src='+idomain+'/c4/cart.gif width=21 height=17 border=0><br>'+myTop[2].title+'</a></td>';
    coString='<td width=17% align=center valign=bottom><a href='+myTop[3].url+' class=BB10><img src='+idomain+'/c4/check.gif width=17 height=17 border=0><br>'+myTop[3].title+'</a></td>';
    otString='<td width=23% align=center valign=bottom><a href='+myTop[4].url+' class=BB10><img src='+idomain+'/c4/track.gif width=31 height=17 border=0><br>'+myTop[4].title+'</a></td>';
  }

if(ot=='f')
  {
    otString='';
  }

if(topHTML=="")
  document.writeln('<table cellpadding=0 cellspacing=0 border=0 valign=top width='+totalWidth+'><tr><td rowspan=2 width='+leftWidth+'><table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td width=5%><img src='+idomain+'/ac/b.gif width=1 height=1></td><td width=13% align=center valign=bottom><a href='+myTop[0].url+' class=BB10><img src='+idomain+'/c4/home.gif width=17 height=17 border=0><br>Home</a></td><td width=16% align=center valign=bottom><a href='+myTop[1].url+' class=BB10><img src='+idomain+'/c4/contact.gif width=21 height=17 border=0><br>Contact</a></td>'+scString+coString+otString+'<td width=4%><img src='+idomain+'/ac/b.gif width=1 height=1></td></tr></table></td><td colspan=3 width='+midWidth+' height=9 valign=bottom><img src='+idomain+'/c4/arrowpurple.gif width=11 height=9></td><td rowspan=2 align=center width='+rightWidth+'>'+loginlink+'</td><td rowspan=2 width='+edgeWidth+'><img src='+idomain+'/ac/b.gif width=1 height=1></td></tr>');
else
  document.writeln('<table cellpadding=0 cellspacing=0 border=0 valign=top width='+totalWidth+'><tr><td rowspan=2 width='+leftWidth+'>'+topHTML+'</td><td colspan=3 width='+midWidth+' height=9 valign=bottom><img src='+idomain+'/c4/arrowpurple.gif width=11 height=9></td><td rowspan=2 align=center width='+rightWidth+'>'+loginlink+'</td><td rowspan=2 width='+edgeWidth+'><img src='+idomain+'/ac/b.gif width=1 height=1></td></tr>');

document.writeln('<tr><td><img src='+idomain+'/ac/b.gif width=4 height=26></td><td bgcolor=#666699><img src='+idomain+'/ac/b.gif width=3 height=1></td><td><img src='+idomain+'/ac/b.gif width=4 height=1></td></tr><tr><td><img src='+idomain+'/ac/b.gif width=1 height=4></td><td><img src='+idomain+'/ac/b.gif width=4 height=1></td><td bgcolor=#666699><img src='+idomain+'/ac/b.gif width=3 height=1></td><td><img src='+idomain+'/ac/b.gif width=4 height=1></td><td><img src='+idomain+'/ac/b.gif width=1 height=4></td><td rowspan=3><img src='+idomain+'/c4/arrowred.gif width=9 height=11></td></tr>');

document.writeln('<tr><td colspan=5 bgcolor=red><img src='+idomain+'/ac/b.gif width=1 height=3></td></tr><tr bgcolor=#3399cc><td><img src='+idomain+'/ac/b.gif width=1 height=4></td><td><img src='+idomain+'/ac/b.gif width=4 height=1></td><td bgcolor=#666699><img src='+idomain+'/ac/b.gif width=3 height=1></td><td><img src='+idomain+'/ac/b.gif width=4 height=1></td><td><img src='+idomain+'/ac/b.gif width=1 height=4></td></tr><tr><td bgcolor=#3399cc><form method=get action='+sch+'><img src='+idomain+'/ac/b.gif width=1 height=22></td><td bgcolor=#3399cc><img src='+idomain+'/ac/b.gif width=4 height=1></td><td bgcolor=#666699><img src='+idomain+'/ac/b.gif width=3 height=1></td><td bgcolor=#3399cc><img src='+idomain+'/ac/b.gif width=4 height=1></td><td bgcolor=#3399cc align=center class=searchbox><input type=text name=search size=14 maxlength=50></td><td><img src='+idomain+'/ac/b.gif width=1 height=1></td></tr>');

document.writeln('<tr><td rowspan=2>'+direction+'</td><td><img src='+idomain+'/ac/b.gif width=4 height=1></td><td bgcolor=#666699><img src='+idomain+'/ac/b.gif width=3 height=1></td><td bgcolor=#3399cc><img src='+idomain+'/ac/b.gif width=4 height=1></td><td align=center valign=top bgcolor=#3399cc><input type=image src='+idomain+'/c4/search.gif width=65 height=21 value=go name=go border=0></td><td><img src='+idomain+'/ac/b.gif width=1 height=1></td></tr><tr><td><img src='+idomain+'/ac/b.gif width=4 height=10></td><td bgcolor=#666699><img src='+idomain+'/ac/b.gif width=3 height=1></td><td><img src='+idomain+'/ac/b.gif width=4 height=1></td><td><img src='+idomain+'/ac/b.gif width=1 height=1></td><td><img src='+idomain+'/ac/b.gif width=1 height=1></form></td></tr></table>');

for(i=0; i<main.length; i++)
{
  if(NS4)
    document.writeln('<layer id=main'+i+' Z-INDEX=5 top='+(111+logoHeight+heightAdj)+' bgcolor=#3399cc left='+main[i].location+' width='+main[i].width+' onmouseover="displayMenu('+"'"+i+"'"+', this);" onmouseout=setMenuTimer();><table cellspacing=0 cellpadding=0 border=0 width='+main[i].width+' height=24>');
  else
    document.writeln('<div id=main'+i+' style="position: absolute; Z-INDEX: 5; background-color: #3399cc; top: '+(111+logoHeight+heightAdj)+'; left: '+main[i].location+'; width='+main[i].width+'"><table cellspacing=0 cellpadding=0 border=0 width='+main[i].width+' height=25 onmouseover="displayMenu('+"'"+i+"'"+', this);" onmouseout=setMenuTimer(); onclick=getDestination(null);>'); 
  
  document.writeln('<tr><td width=1 rowspan=3><img src='+idomain+'/c4/t1.gif width=1 height=24></td><td width='+(main[i].width-2)+' height=1><img src='+idomain+'/c4/t1.gif width='+(main[i].width-2)+' height=1></td><td width=1 rowspan=3><img src='+idomain+'/c4/t1.gif width=1 height=24></td></tr><tr><td align=center height=22><table cellspacing=0 cellpadding=0 border=0 width='+(main[i].width-2)+' height=22><tr><td width=1 rowspan=3><img src='+idomain+'/c4/t2.gif width=1 height=22></td><td width='+(main[i].width-4)+' height=1><img src='+idomain+'/c4/t2.gif width='+(main[i].width-4)+' height=1></td><td width=1 rowspan=3><img src='+idomain+'/c4/t2.gif width=1 height=22></td></tr><tr><td nowrap align=center height=20><a class=WB10N href="'+menuBase+main[i].url+'">'+main[i].title+'</a></td></tr><tr><td height=1><img src='+idomain+'/c4/t2.gif width='+(main[i].width-4)+' height=1></td></tr></table></td></tr><tr><td height=1><img src='+idomain+'/c4/t1.gif width='+(main[i].width-2)+' height=1></td></tr>');

  if(NS4)
    document.writeln('</table></layer>');
  else
    {
      document.writeln('<tr><td colspan=3 bgcolor=#3399cc><img src='+idomain+'/ac/b.gif width=1 height=1></td></tr></table></div>');

      if(IE4)
        eval(layerText+'["'+'main'+i+'"]'+styleText+'.cursor="hand"');
    }
}

for(i=0; i<main.length; i++)
{
  if(main[i].sub==1)
    {
      smWidth=eval('sub'+i+'.smWidth');
      if(NS4)
	{	  
	  for(j=0; j<eval('sub'+i+'.length'); j++)
	    {   
	      document.writeln('<layer id=sub'+i+j+' Z-INDEX=5 bgcolor=#3399cc width='+(smWidth-2)+' TOP='+eval(j*16+135+logoHeight+heightAdj)+' LEFT='+(main[i].location+1)+' VISIBILITY=hidden onmouseover="subMenuIn('+"'"+i+"', '"+j+"', this)"+'" onmouseout="subMenuOut('+"'"+i+"'"+", '"+j+"', this)"+'"><table cellspacing=0 cellpadding=0 border=0 width='+(smWidth-2)+' height=17><tr><td width=1 rowspan=3><img src='+idomain+'/c4/t2.gif width=1 height=17></td><td width='+(smWidth-4)+' height=1><img src='+idomain+'/c4/t2.gif width='+(smWidth-4)+' height=1></td><td width=1 rowspan=3><img src='+idomain+'/c4/t2.gif width=1 height=17></td></tr><tr><td align=center nowrap height=15><a class=WB9N href="'+menuBase+eval('sub'+i+'['+j+'].url')+'">'+eval('sub'+i+'['+j+'].title')+'</a></td></tr><tr><td height=1><img src='+idomain+'/c4/t2.gif width='+(smWidth-4)+' height=1></td></tr></table></layer>');
	    }
	}
      else
	{
	  document.writeln('<div id=sub'+i+' style="position: absolute; Z-INDEX: 5; background-color: #3399cc; width='+(smWidth-2)+'; TOP: '+(135+logoHeight+heightAdj)+'; LEFT: '+(main[i].location+1)+'; VISIBILITY: hidden;"><table cellspacing=0 cellpadding=0 border=0><tr><td width=1 bgcolor=#66ccff><img src='+idomain+'/ac/b.gif width=1 height=1></td><td><table cellpadding=0 cellspacing=0 border=0><tr><td bgcolor=#66ccff height=1><img src='+idomain+'/ac/b.gif width='+(smWidth-2)+' height=1></td></tr>');
	  
	  for(j=0; j<eval('sub'+i+'.length'); j++)
	    document.writeln('<tr><td height=15 align=center valign=top nowrap onmouseover="subMenuIn('+"'"+i+"', '"+j+"', this)"+'" onmouseout="subMenuOut('+"'"+i+"'"+", '"+j+"', this)"+'" onclick=getDestination(null)><a class=WB9N href="'+menuBase+eval('sub'+i+'['+j+'].url')+'">'+eval('sub'+i+'['+j+'].title')+'</a></td></tr><tr><td bgcolor=#66ccff height=1 onmouseover="clearTimeout(menuTimer); menuOn = 1;" onmouseout="menuOn=0; menuTimer=setTimeout('+"'"+'hideMenu(layerOn)'+"'"+', 700);" onclick=getDestination(null)><img src='+idomain+'/ac/b.gif width=1 height=1></td></tr>');
	  
	  document.writeln('</table></td><td width=1 bgcolor=#66ccff><img src='+idomain+'/ac/b.gif width=1 height=1></td></tr></table></div>');
	  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');
    }
}

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

function G2()
{
  if(subIndex==-1)
    window.location=menuBase+main[parseInt(mainIndex)].url;
  else
    window.location=menuBase+eval('sub'+mainIndex+'['+subIndex+'].url');
}

document.writeln('<table cellpadding=0 cellspacing=0 border=0 width='+totalWidth+'><tr><td width='+leftWidth+'><img src='+idomain+'/ac/b.gif width='+leftWidth+' height=1></td><td width=4><img src='+idomain+'/ac/b.gif width=4 height=1></td><td bgcolor=#666699 width=3><img src='+idomain+'/ac/b.gif width=3 height=1></td><td width=4><img src='+idomain+'/ac/b.gif width=4 height=1></td><td width='+rightWidth+'><img src='+idomain+'/ac/b.gif width='+rightWidth+' height=1></td><td width='+edgeWidth+'><img src='+idomain+'/ac/b.gif width='+edgeWidth+' height=1></td></tr>');

















