// JavaScript Document

var battery = new Array();
battery[0]=['Box Type','battery1.html'];
battery[1]=['Panel Mounted','battery2.html'];

var elect = new Array();
elect[0]=['GCRP Panels','elect1.html'];
elect[1]=['Digital AVR Panels','elect2.html'];
elect[2]=['Analog AVR Panels','elect3.html'];
elect[3]=['Battery Charger Panels','elect4.html'];
elect[4]=['AMF Panels','elect5.html'];

var avr = new Array();
avr[0]=['NEC 277','avr1.html'];
avr[1]=['NEC 277 N','avr2.html'];
avr[2]=['NEC 547','avr3.html'];
avr[3]=['NEC 727','avr4.html'];
avr[4]=['NEC 07','avr5.html'];
avr[5]=['NEC 25','avr6.html'];
avr[6]=['NEC 1177','avr7.html'];
avr[7]=['NEC 367','avr8.html'];


var protection = new Array();
protection[0]=['Applications','protection1.html'];
protection[1]=['Specifications','protection2.html'];



document.write('<div id="div0" class="menu">');
for(i=0; i<battery.length; i++)
{document.write('<a href="'+battery[i][1]+'">'+battery[i][0]+'</a>')}
document.write('</div>');
checkit(document.getElementById('div0'))

document.write('<div id="div1" class="menu">');
for(i=0; i<elect.length; i++)
{document.write('<a href="'+elect[i][1]+'">'+elect[i][0]+'</a>')}
document.write('</div>');
checkit(document.getElementById('div1'))

document.write('<div id="div2" class="menu">');
for(i=0; i<avr.length; i++)
{document.write('<a href="'+avr[i][1]+'">'+avr[i][0]+'</a>')}
document.write('</div>');
checkit(document.getElementById('div2'))

document.write('<div id="div3" class="menu">');
for(i=0; i<protection.length; i++)
{document.write('<a href="'+protection[i][1]+'">'+protection[i][0]+'</a>')}
document.write('</div>');
checkit(document.getElementById('div3'))



// optional function

function checkit(divobj)
{  if(divobj.hasChildNodes())
	{	for(i=0; i<divobj.childNodes.length; i++)
		{ 	if(divobj.childNodes[i].href.indexOf("#")==-1)
			{ }
			else{divobj.childNodes[i].className="current";}
		}
	}
}

var ie4=document.all;
var dom=document.getElementById &&! ie4;
var ns4 = document.layers;
var opera = navigator.userAgent.indexOf('opera') != -1

var menuobj = null;

function iecompat()
{ return (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body; }

function gety(what)
{ var objtop = what.offsetTop;
  var objp = what.offsetParent;
  
  while(objp)
  { objtop = objtop+objp.offsetTop;
    objp = objp.offsetParent;
  }
  return objtop;

}

function gettoppos(what, offsettype)
{ var topy = gety(what);
  var winheight = (!opera)? iecompat().scrollTop+iecompat().clientHeight : window.pageYOffset+window.innerHeight;
  var maxheight = topy+menuobj.offsetHeight;
  
  if(winheight < maxheight)
  { var objy = topy-(menuobj.offsetHeight);
 }
  else{objy = topy+what.offsetHeight;}
  return objy;
}

function getx(what)
{ var objleft = what.offsetLeft;
  var objp = what.offsetParent;
  while(objp)
  { objleft = objleft+objp.offsetLeft;
    objp = objp.offsetParent;
  }
	return objleft;	
}

function getleftpos(what, offsettype)
{ var leftx = getx(what);
  var winwidth = (!opera)? iecompat().scrollLeft+iecompat().clientWidth : window.pageXOffset+window.innerWidth;
  var maxwidth = leftx+menuobj.offsetWidth;
  
  if(winwidth < maxwidth)
  { var objx = winwidth - menuobj.offsetWidth}
  else
  {objx = leftx;}
  return objx;
  }


function dropmenu(obj,e)
{  if(window.event) window.event.cancelBubble=true;
   else if(e.stopPropagation) e.stopPropagation();
   
   if(menuobj != null)
   {hidemenu();}
   
   menuobj = document.getElementById(obj.rel)
   cleardelay()
   
   if(ie4 || dom)
   {menuobj.style.visibility="visible";
    menuobj.style.top = gettoppos(obj,"top")+"px"; 
	menuobj.style.left = getleftpos(obj,"left")+"px"; 
	}
	
	if(ns4)
   {menuobj.visibility="visible";
    menuobj.clip.top = gettoppos(obj,"top")+"px"; 
	menuobj.clip.left = getleftpos(obj,"left")+"px"; 
	}
	
	if(opera)
   {menuobj.style.visibility="visible";
    menuobj.pixelTop = gettoppos(obj,"top")+"px"; 
	menuobj.pixelLeft = getleftpos(obj,"left")+"px"; 
	}
   
   menuobj.onmouseover=function()
   {cleardelay();
    prev = obj.className;
   	obj.className = "current"; 
	}
	
   menuobj.onmouseout=function()
   {delayhide();
   obj.className = prev ;}


}

function delayhide()
{stopit = setTimeout('hidemenu()',200);}

function hidemenu()
{menuobj.style.visibility="hidden";}

function cleardelay()
{ if(typeof stopit != "undefined")
	clearTimeout(stopit);
}