// 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 IE5=false, windowWidth, smWidth=160, font, sl, cHeight, otstring, pressed=false;
var menuTimer = null;
var layerText, styleText, leftText, topText, wHeight, appVer=navigator.appVersion;
var rtimer;

if(navigator.appName == "Netscape")
{
  layerText="document.layers";
  styleText="";
  leftText='.left';
  topText='.top';
  heightText='.clip.height';
  wHeight=window.innerHeight;
  windowWidth = window.innerWidth-16;

  if(navigator.userAgent.indexOf("Firefox") != -1)
      heightAdj=heightAdj+8;
}
else
{
  layerText="document.all";
  styleText=".style";
  leftText='.pixelLeft';
  topText='.pixelTop';
  heightText='.height';
  wHeight=document.body.clientHeight;
  windowWidth = document.body.clientWidth;
  if(parseFloat(appVer.substr(appVer.indexOf("MSIE ")+5, 5))>=5)  
    { 
      IE5=true;   
      windowWidth = windowWidth-16;
    }
}

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+128+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='pink';
  else if(NS4)
    eval(layerText+'["'+'main'+layerNumber+'"]'+'.document.bgColor="pink"');  
  else if(IE4)
    eval(layerText+'["'+'main'+layerNumber+'"]'+'.style.backgroundColor="pink"'); 
  
  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='#ffffcc';
  else if(NS4)
    eval(layerText+'["'+'main'+layerNumber+'"]'+'.document.bgColor="#ffffcc"');
  else if(IE4)
    eval(layerText+'["'+'main'+layerNumber+'"]'+'.style.backgroundColor="#ffffcc"');
  
  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="pink"');
  else
    src.bgColor='pink';

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

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

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


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

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


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=='t')
  otstring='<td align=center width=25%><a class=head9 href='+myTop[4].url+'>'+myTop[4].title+'</td>'
else
  otstring='';

if(IE4)
  sl=17;
else if(DOM)
  sl=10;
else
  sl=12;

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

document.writeln('<table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td colspan=3 bgcolor='+color[0]+'><img src='+idomain+'/ac/b.gif width=620 height=1></td></tr><tr><td width=1% bgcolor='+color[0]+'><img src='+idomain+'/ac/b.gif width=1 height=1></td><td width=98%><table cellpadding=0 cellspacing=0 border=0 width=100%>');

if(topHTML=="")
  document.writeln('<tr><td align=center width=20%><a class=head9 href='+myTop[0].url+'>'+myTop[0].title+'</td><td align=center width=15%><a class=head9 href='+myTop[1].url+'>'+myTop[1].title+'</td><td align=center width=20%><a class=head9 href='+myTop[2].url+'>'+myTop[2].title+'</td><td align=center width=20%><a class=head9 href='+myTop[3].url+'>'+myTop[3].title+'</td>'+otstring+'</tr>');
else
  document.writeln('<tr><td width=100%>'+topHTML+'</td></tr>');

document.writeln('</table></td><td width=1% bgcolor='+color[0]+'><img src='+idomain+'/ac/b.gif width=1 height=1></td></tr></table>    <table cellpadding=0 cellspacing=0 border=0 width=100% bgcolor='+color[0]+'><tr><td colspan=5><img src='+idomain+'/ac/b.gif width=620 height=1></td></tr><tr><td valign=bottom bgcolor='+color[0]+' width=20%><img src='+idomain+'/c11/browse.gif width=155 height=18></td>'+itemString+'<td align=center width=35% class=search8 nowrap><form method=get action='+sch+'>Search:<input type=text name=search class=searchbox size='+sl+' maxlength=50>'+(menuBase.indexOf('www.acmemovie.com')!=-1?' <select name=searchby><option value="">General Search<option value=name>Search by Title<option value=performer>Search by Actor<option value=sdescription>Search by Description</select>':'')+'<input type=image src='+idomain+'/c11/'+color[0].substr(1, 6)+'go.gif width=46 height=22 value=go name=go border=0 align=absmiddle></td></form><td align=center width=25%>'+loginlink+'</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+128+logoHeight+heightAdj)+' left=1 bgcolor=#ffffcc 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+'/c6/t.gif width=1 height=21></td><td width=160><img src='+idomain+'/c6/t.gif width=160 height=1></td><td width=1 rowspan=3><img src='+idomain+'/c6/t.gif width=1 height=21></td></tr><tr><td align=center height=19 nowrap><a class=maincat6 href="'+menuBase+main[i].url+'">'+main[i].title+'</a></td></tr><tr><td height=1><img src='+idomain+'/c6/t.gif width=160 height=1></td></tr></table></'+layerType+'>');
  else
    {
      document.writeln('<div id=main'+i+' style="position: absolute; background-color: #ffffcc; Z-INDEX: 5; width=162; top: '+eval(i*22+128+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+'/c6/t.gif width=1 height=21></td><td width=160><img src='+idomain+'/c6/t.gif width=160 height=1></td><td width=1 rowspan=3><img src='+idomain+'/c6/t.gif width=1 height=21></td></tr><tr><td align=center height=19 nowrap><a class=maincat6 href="'+menuBase+main[i].url+'">'+main[i].title+'</a></td></tr><tr><td height=1><img src='+idomain+'/c6/t.gif 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=#ffffcc width='+smWidth+' TOP='+eval(i*22+j*17+128+logoHeight+heightAdj)+' 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+'/c6/t.gif width=1 height=18></td><td><img src='+idomain+'/c6/t.gif width='+(smWidth-2)+' height=1></td><td width=1 rowspan=3><img src='+idomain+'/c6/t.gif width=1 height=18></td></tr><tr><td align=center height=16 nowrap><a class=subcat6 href="'+menuBase+eval('sub'+i+'['+j+'].url')+'">'+eval('sub'+i+'['+j+'].title')+'</a></td></tr><tr><td height=1><img src='+idomain+'/c6/t.gif 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+128+logoHeight+heightAdj); LEFT: 164; VISIBILITY: hidden;"><table cellspacing=0 cellpadding=0 border=0 bgcolor=#ffffcc><tr><td width=1 bgcolor=#ff6600><img src='+idomain+'/ac/b.gif width=1 height=1></td><td><table cellpadding=0 cellspacing=0 border=0><tr><td bgcolor=#ff6600 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=subcat6 href="'+menuBase+eval('sub'+i+'['+j+'].url')+'">'+eval('sub'+i+'['+j+'].title')+'</a></td></tr>');
	  
	  document.writeln('<tr><td bgcolor=#ff6600 height=1><img src='+idomain+'/ac/b.gif width=1 height=1></td></tr></table></td><td width=1 bgcolor=#ff6600><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');
    }
}















