// -------------------------------------------------------
// Menu System
// -------------------------------------------------------

function writeSubMenu(section,whichSubPage){
// -------------------------------------------------------
// Naming Conventions
// Single word: First three letters of first word in lower case
// Exception new is NEWS 
// Two plus words: First three letters of first word in lower case, Cap of second word, second in lower 
// Add new menus to Array statements below and Menu items to set up
// -------------------------------------------------------

    hom = new Array() ;
      homHref = new Array() ;
    busOv = new Array() ;
      busOvHref = new Array() ;
    ser = new Array() ;
      serHref = new Array() ;
    spa = new Array() ;
      spaHref = new Array() ;
    news = new Array() ;
      newsHref = new Array() ;
    lin = new Array() ;
      linHref = new Array() ;
    con = new Array() ;
      conHref = new Array() ;
    sitMa = new Array() ;
      sitMaHref = new Array() ;
    copIn = new Array() ;
      copInHref = new Array() ;
	  
// -------------------------------------------------------
// Set up menus
// -------------------------------------------------------
	hom[0] = '' 
	  homHref[0] = '' 

	sitMa[0] = '' 
	  sitMaHref[0] = '' 

	busOv[0] = 'Business Overview'
	  busOvHref[0] = 'six01.html'
	busOv[1] = 'Quality'
	  busOvHref[1] = 'six01-3.html'

	ser[0] = 'Service'
	  serHref[0] = 'six02.html' 
	ser[1] = 'Service Query Form'
	  serHref[1] = 'six02-query.html' 

	spa[0] = 'Spares'
	  spaHref[0] = 'six04.html' 
	spa[1] = 'Spares Query Form'
	  spaHref[1] = 'six04-query.html' 

	news[0] = 'Introduction'
	  newsHref[0] = 'six03-0.html'
	news[1] = 'Press Releases'
	  newsHref[1] = 'six03-1.asp'
	news[2] = 'Exhibitions'
	  newsHref[2] = 'six03-2.asp'
	news[3] = 'News Archive'
	  newsHref[3] = 'six03-3.asp'

	lin[0] = 'Company Links' 
	  linHref[0] = 'six05.html' 
	lin[1] = 'Group Links' 
	  linHref[1] = 'six05-2.html' 

    con[0] = 'Key Contacts'
      conHref[0] = 'six06.asp?companyid=4'
	con[1] = 'Find Us' 
	  conHref[1] = 'six07-1.html' 
    con[2] = 'Local Map'
	  conHref[2] = 'six07-2loc2a.html'
	con[3] = 'Regional Map'
	  conHref[3] = 'six07-2loc2b.html'

        
	copIn[0] = 'Copyright Notice'
	  copInHref[0] = 'six09.html'
	copIn[1] = 'Legal Information'
	  copInHref[1] = 'six09-1.html'


// -------------------------------------------------------
//  Create the titles
// -------------------------------------------------------

	if (section=='hom'){writeSection='600 Lathes'}
	if (section=='busOv'){writeSection='Business Overview'}
	if (section=='ser'){writeSection='Service'}
	if (section=='spa'){writeSection='Spares'}
	if (section=='news'){writeSection='News'}
	if (section=='lin'){writeSection='Links'}
	if (section=='con'){writeSection='Contact'}
	if (section=='sitMa'){writeSection='Site Map'}
	if (section=='copIn'){writeSection='600 Lathes'}

	if (whichSubPage==''){writeSubPage=' '}
//	else if (whichSubPage==undefined){writeSubPage=' '}
	else {writeSubPage = whichSubPage}
	
// -------------------------------------------------------
// Write the menus
// -------------------------------------------------------

	if (section=='hom'){max = eval(hom.length-1);}
	if (section=='busOv'){max = eval(busOv.length-1);}
	if (section=='ser'){max = eval(ser.length-1);}
	if (section=='spa'){max = eval(spa.length-1);}
	if (section=='news'){max = eval(news.length-1);}
	if (section=='lin'){max = eval(lin.length-1);}
	if (section=='con'){max = eval(con.length-1);}
	if (section=='sitMa'){max = eval(sitMa.length-1);}
	if (section=='copIn'){max = eval(copIn.length-1);}

// -------------------------------------------------------
// Write html
// -------------------------------------------------------

	location.reload()

	document.write('<html>')
	document.write('<head>')
	document.write('<link rel=stylesheet href=css/main.css type=text/css></link>')
	document.write('<script src=java/submenu.js type=text/javascript></script>')
	document.write('</head>')
	document.write('<body bgcolor=#ffffff>')

	document.write('<table width=604 cellpadding=0 cellspacing=0 border=0 align=center style=\"margin-right: 18px;\">')
	document.write('<tr>')
	document.write('<td valign=top align=left class=col1>')

	if (section=='hom') {
	  document.write('<h1 class=\"title\">'+writeSection+'</h1>')
	  }
	else{	
	  document.write('<h3 class=\"title\">') ;
	  if (whichSubPage==''){colon=''}
	  else {colon=': '}
	  document.write(writeSection + colon + writeSubPage) ;
	  document.write('</h3>') ;
	  }
	document.write('<p class=\"submenu\">') ;


	if (section=='hom'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (hom[ticker].value == "" && hom[0].value =="0" ){hom[ticker].value = "Error"}
  	      document.write('<a href=' + homHref[ticker] + ' target=submain>' + hom[ticker] + '</a>')
	      if (ticker != eval(max)){document.write('&nbsp;| ')}
	      }
	  }
	if (section=='busOv'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (busOv[ticker].value == "" && busOv[0].value =="0" ){busOv[ticker].value = "Error"}
  	      document.write('<a href=' + busOvHref[ticker] + ' target=submain>' + busOv[ticker] + '</a>')
	      if (ticker != eval(max)){document.write('&nbsp;| ')}
	      }
	  }
	if (section=='ser'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (ser[ticker].value == "" && ser[0].value =="0" ){ser[ticker].value = "Error"}
  	      document.write('<a href=' + serHref[ticker] + ' target=submain>' + ser[ticker] + '</a>')
	      if (ticker != eval(max)){document.write('&nbsp;| ')}
	      }
	  }
	if (section=='spa'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (spa[ticker].value == "" && spa[0].value =="0" ){spa[ticker].value = "Error"}
  	      document.write('<a href=' + spaHref[ticker] + ' target=submain>' + spa[ticker] + '</a>')
	      if (ticker != eval(max)){document.write('&nbsp;| ')}
	      }
	  }
	if (section=='news'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (news[ticker].value == "" && news[0].value =="0" ){news[ticker].value = "Error"}
  	      document.write('<a href=' + newsHref[ticker] + ' target=submain>' + news[ticker] + '</a>')
	      if (ticker != eval(max)){document.write('&nbsp;| ')}
	      }
	  }
	if (section=='lin'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (lin[ticker].value == "" && lin[0].value =="0" ){lin[ticker].value = "Error"}
  	      document.write('<a href=' + linHref[ticker] + ' target=submain>' + lin[ticker] + '</a>')
	      if (ticker != eval(max)){document.write('&nbsp;| ')}
	      }
	  }
	if (section=='con'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (con[ticker].value == "" && con[0].value =="0" ){con[ticker].value = "Error"}
  	      document.write('<a href=' + conHref[ticker] + ' target=submain>' + con[ticker] + '</a>')
	      if (ticker != eval(max)){document.write('&nbsp;| ')}
	      }
	  }
	if (section=='sitMa'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (sitMa[ticker].value == "" && sitMa[0].value =="0" ){sitMa[ticker].value = "Error"}
  	      document.write('<a href=' + sitMaHref[ticker] + ' target=submain>' + sitMa[ticker] + '</a>')
	      if (ticker != eval(max)){document.write('&nbsp;| ')}
	      }
	  }
	if (section=='copIn'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (copIn[ticker].value == "" && copIn[0].value =="0" ){copIn[ticker].value = "Parent Element not selected"}
	      document.write('<a href=' + copInHref[ticker] + ' target=submain>' + copIn[ticker] + '</a>')
	      if (ticker != eval(max)){document.write('&nbsp;| ')}
	      }
	  }

	document.write('</p>')

	document.write('</script>')
	document.write('</td>')
	document.write('</tr>')
	document.write('</table>')
	document.write('</body>')
	document.write('</html>')
  }
