/* Menu Script*/

/* 
var posYmenu = 155;
var posXmenu = 5;
*/

var mainXoffset =0;
var mainYoffset =0;
var mainwidth=795;
var mainitems=9;
var subXoffset = 0;
var subYoffset = 26;
var rowheight = 25;
var cellspace = 1;
var cellpad = 2;
var timermilli=2000;

/*
	something: #E0CCAA;
	darkbrown: #A3&b67;
	lightbrown: #B59682;
	darkmauve: #745F97;
	lightmauve: #B1A2BC;
	darkblue: #002E62;
	midblue: #00428C;
	lightblue: #0078FF;
*/
/*
var bgcolor='#002E62';
var bgcolor2='#AAAAAA';
var fontcol='#FFFFFF';
var bordercol='#00428C';
var timerid=0;
*/
var bgcolor='#002E62';
var bgcolor2='#bbbbbb';
var fontcol='#FFFFFF';
var bordercol='#bbbbbb';
var timerid=0;

var imgPosition = imgXY('menuposition');  

document.write('<style type="text/css">');
document.write('.popper { POSITION: absolute; VISIBILITY: hidden; z-index:50; }');
document.write('A:hover.dynamenu {color:'+fontcol+'; text-decoration:none; font-weight: normal;  font-size: 9pt;}');
document.write('A.dynamenu {color:'+fontcol+'; text-decoration:none; font-weight: normal; font-size: 9pt;}');
document.write('</style>');

document.write('<DIV class=popper id=topdeck></DIV>'); 

mainopts = new Array;
mainhref = new Array;
mainopts[0]="Introduction";
mainhref[0]="intro.htm";
mainopts[1]="About Us";
mainhref[1]="aboutus.htm";
mainopts[2]="Products";
mainhref[2]="ramparts.htm";
mainopts[3]="Downloads";
mainhref[3]="downloads.htm";
mainopts[4]="Videos";
mainhref[4]="videos.htm";
mainopts[5]="Contact";
mainhref[5]="contact.htm";
mainopts[6]="Shop";
mainhref[6]="index.htm";
mainopts[7]="Shop (max'd)";
mainhref[7]="http://shop.steerforth.co.uk/catalog";
mainopts[8]="Links";
mainhref[8]="links.htm";

opts = new Array; 
opts[0] = new Array; 
opts[1] = new Array; 
opts[2] = new Array; 
opts[3] = new Array; 
opts[4] = new Array; 
opts[5] = new Array; 
opts[6] = new Array; 
opts[7] = new Array; 
opts[8] = new Array; 

/*
opts[2][0] = '<A HREF="propman.htm" CLASS=dynamenu>Property Management</A>';
*/
opts[2][0] = '<A HREF="ramparts.htm" CLASS=dynamenu>Ramparts</A>';
opts[2][1] = '<A HREF="stdrams.htm" CLASS=dynamenu>Standard/Special Rams</A>';
opts[2][2] = '<A HREF="tierodrams.htm" CLASS=dynamenu>Tie Rod Rams</A>';
opts[2][3] = '<A HREF="hydmotors.htm" CLASS=dynamenu>Hydraulic Motors</A>';
opts[2][4] = '<A HREF="hydtools.htm" CLASS=dynamenu>Hydraulic Tools</A>';
/* opts[2][5] = '<A HREF="plantseals.htm" CLASS=dynamenu>Plant Seals</A>'; */
opts[2][5] = '<A HREF="rodends.htm" CLASS=dynamenu>Rod Ends, Bearings & Bushes</A>';
opts[2][6] = '<A HREF="tankerparts.htm" CLASS=dynamenu>Tanker Parts</A>';
opts[2][7] = '<A HREF="videos.htm" CLASS=dynamenu>Product Videos</A>';

opts[3][0] = '<A HREF="documents/RAMPARTS XIth Edition.pdf" target="_new" CLASS=dynamenu>Ramparts Catalogue</A>';
opts[3][1] = '<A HREF="documents/HIGH_PRESSURE_2009.pdf" target="_new" CLASS=dynamenu>Hydraulic Tools Catalogue</A>';
opts[3][2] = '<A HREF="documents/STEERFORTH Hydraulic Wearing Parts 2007.pdf" target="_new" CLASS=dynamenu>Hydraulic Catalogue</A>';
/* opts[3][3] = '<A HREF="documents/4928 Steerforth Plant Seals.pdf" target="_new" CLASS=dynamenu>Plant Seals Catalogue</A>';  */
opts[3][3] = '<A HREF="documents/Steerforth Tanker Catalogue 2008.pdf" target="_new" CLASS=dynamenu>Tanker Catalogue</A>';
opts[3][4] = '<A HREF="documents/Account Application Form.pdf" target="_new" CLASS=dynamenu>Account Application</A>';


var nava = (document.layers); 
var dom = (document.getElementById); 
var iex = (document.all); 
if (nava) { skn = document.topdeck } 
else if (dom) { skn = document.getElementById("topdeck").style } 
else if (iex) { skn = topdeck.style } 
/*
skn.top = posYmenu+subYoffset; 
*/
skn.top = imgPosition.y+subYoffset; 

document.onclick = kill;
window.onresize= reposition;

document.write('<DIV ID=topleft style="POSITION: absolute; top:'+(imgPosition.y+mainYoffset)+'px; left:'+(imgPosition.x+mainXoffset)+'px; z-index:2;">');

document.write('<TABLE WIDTH=' + mainwidth + ' BORDER=0 CELLPADDING='+cellpad+' CELLSPACING='+cellspace+' BGCOLOR='+bordercol+'>\r')
document.write('<TR>');
for (i=0;i<mainopts.length;i++) 
{
	document.write('<TD CLASS="dynamenu" HEIGHT='+rowheight+' WIDTH=' + mainwidth/mainitems + ' ALIGN=left BGCOLOR='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(opts['+i+'],'+i+')" onMouseOut="this.style.background=\''+bgcolor+'\'">&nbsp;<A CLASS="dynamenu" onMouseOver="pop(opts['+i+'],0)" href="'+mainhref[i]+'">'+mainopts[i]+'</a>&nbsp;</TD>\r')
}
document.write('</TR></TABLE></DIV>\r')

function pop(msg,pos) { 
if (timerid) clearTimeout(timerid);
skn.visibility = "hidden"; 
a=true;

skn.left = imgPosition.x+((mainwidth/mainitems)*pos);
skn.top = imgPosition.y+subYoffset;

/* - replaced for horizontal menu by

skn.left = imgPosition.x+subXoffset;
skn.top=imgPosition.y+(pos*(rowheight+cellspace))+subYoffset;

/* end replace */

var content ="<TABLE BORDER=0 CELLPADDING="+cellpad+" CELLSPACING="+cellspace+" BGCOLOR="+bordercol+" >";
for (pass=0;pass<msg.length;pass++)
	{
	content += "<TR><TD CLASS='dynamenu' HEIGHT="+rowheight+" ALIGN=left BGCOLOR="+bgcolor+" onMouseOver=\"resettimer(); this.style.background='"+bgcolor2+"'\" onMouseOut=\"this.style.background='"+bgcolor+"'\" nowrap>&nbsp;"+msg[pass]+"&nbsp;</TD></TR>";
	}
content += "</TABLE>";
if (nava)
  {
    skn.document.write(content);
	  skn.document.close();
  }
    else if (dom)
  {
	  document.getElementById("topdeck").innerHTML = content;
  }
    else if (iex)
  {
	  document.all("topdeck").innerHTML = content;
  }
/*alert("Top: "+skn.top+ "left: "+skn.left);*/
skn.visibility = "visible";
timerid=setTimeout('kill();',timermilli);
}

function resettimer()
{
if (timerid) clearTimeout(timerid);
timerid=setTimeout('kill();',timermilli);
}

function kill()
{
	skn.visibility = "hidden";
}

function imgXY(imgID) {
  /* This function returns the upperleft x,y coordinates of the specified image */
  var XY = new Object();
  var imgObj = document.images[imgID];
  if (document.layers) {
	XY.x = eval(imgObj).x;
	XY.y = eval(imgObj).y;
  } else {
	var x,y, tempEl;
	x = eval(imgObj).offsetLeft;
	y = eval(imgObj).offsetTop;
	tempEl = eval(imgObj).offsetParent;
  	while (tempEl != null) {
  		x += tempEl.offsetLeft;
		y += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
  	}
	XY.x = x;
	XY.y = y;
  }
  return XY;
}

function reposition()
{
var mainstyle;
if (nava) { mainstyle= document.topleft} 
else if (dom) { mainstyle= document.getElementById("topleft").style } 
else if (iex) { mainstyle= topleft.style } 
/*mainstyle.visibility='hidden';*/
imgPosition = imgXY('menuposition');
mainstyle.left=imgPosition.x + mainXoffset;
mainstyle.top=imgPosition.y + mainYoffset;
/*mainstyle.visibility='visible';*/
}