// -------------------------------------------------------
// 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
// -------------------------------------------------------

    var hom = new Array() ;
     var homHref = new Array() ;
    var com = new Array() ;
     var comHref = new Array() ;
    var macSa = new Array() ;
    var macSaHref = new Array() ;
    var turPr = new Array() ;
    var turPrHref = new Array() ;
    var disNe = new Array() ;
      disNeHref = new Array() ;    
    var news = new Array() ;
    var newsHref = new Array() ;
    var lin = new Array() ;
    var linHref = new Array() ;
    var con = new Array() ;
    var conHref = new Array() ;
    var conTarget = new Array() ;
    var sea = new Array() ;
    var seaHref = new Array() ;
    var sitMa = new Array() ;
    var sitMaHref = new Array() ;
    var copIn = new Array() ;
    var copInHref = new Array() ;
	  
// -------------------------------------------------------
// Set up menus
// Arrays must start from 0.
// -------------------------------------------------------
	hom[0] = '&nbsp;' 
	  homHref[0] = '&nbsp;' 

	com[0] = 'Company Introduction'
	  comHref[0] = 'six01.html'
	com[1] = 'Structure'
	  comHref[1] = 'six01-3.html'
	com[2] = 'History'
	  comHref[2] = 'six01-1.html'
	com[3] = 'Quality'
	  comHref[3] = 'six01-2.html'

	macSa[0] = 'Introduction' 
	  macSaHref[0] = 'six02.html'
	macSa[1] = 'Machinery Distribution' 
	  macSaHref[1] = 'six02-3.html'
	macSa[2] = 'Local Distributors' 
	  macSaHref[2] = 'operating_areas.asp'
	macSa[3] = 'Products' 
	  macSaHref[3] = 'six02-1.html'
	macSa[4] = 'Spares &amp; Service' 
	  macSaHref[4] = 'six02-2.html'
	macSa[5] = 'Enquiry Form' 
	  macSaHref[5] = 'six02-5.html'
	  
	turPr[0] = 'Introduction'
	  turPrHref[0] = 'six04.html'
	turPr[1] = 'Industrial'
	  turPrHref[1] = 'six04-1.html'
	turPr[2] = 'Educational'
	  turPrHref[2] = 'six04-2.html'
	turPr[3] = 'Mobile Workshops &amp; Generators'
	  turPrHref[3] = 'six04-3.html'

	disNe[0] = 'Local Distributors'
	  disNeHref[0] = 'operating_areas.asp'
	disNe[1] = 'Africa'
	  disNeHref[1] = 'countries_by_area.asp?CompanyID=5&AreaID=1'
	disNe[2] = 'Asia & Middle East'
	  disNeHref[2] = 'countries_by_area.asp?CompanyID=5&AreaID=2'
	disNe[3] = 'Central & South America'
	  disNeHref[3] = 'countries_by_area.asp?CompanyID=5&AreaID=6'

	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] = '&nbsp;'
	  linHref[0] = '&nbsp;' 

      con[0] = 'Registered Office'
        conHref[0] = 'six06.html'
        conTarget[0] = 'submain'
      con[1] = 'Key Contacts' 
        conHref[1] = 'six06-1.html'
        conTarget[1] = 'submain'
      con[2] = 'Local Map'
	    conHref[2] = 'http://uk.multimap.com/p/browse.cgi?pc=CO28HF&title=600+Machinery+International&scale=5000'
	  conTarget[2] = '_new'
	  con[3] = 'Regional Map'
	    conHref[3] = 'http://uk.multimap.com/p/browse.cgi?pc=CO28HF&title=600+Machinery+International&scale=50000'
 	conTarget[3] = '_new'
 	
	sea[0] = '&nbsp;' 
	  seaHref[0] = '&nbsp;' 

	sitMa[0] = '&nbsp;' 
	  sitMaHref[0] = '&nbsp;' 

	copIn[0] = 'Copyright Notice'
	  copInHref[0] = 'six09.html'
	copIn[1] = 'Legal Information'
	  copInHref[1] = 'six09-1.html'

// -------------------------------------------------------
//  Create the titles
// -------------------------------------------------------

	var writeSection
	var whichSubPage
	var writeSubPage
	
	if (section=='hom'){writeSection='600 Machinery International'}
	if (section=='com'){writeSection='Company'}
	if (section=='macSa'){writeSection='Machinery Sales'}
	if (section=='turPr'){writeSection='Turnkey Projects'}
	if (section=='disNe'){writeSection='Distribution Network'}	
	if (section=='news'){writeSection='News'}
	if (section=='lin'){writeSection='Links'}
	if (section=='con'){writeSection='Contact'}
	if (section=='sea'){writeSection='Search'}
	if (section=='sitMa'){writeSection='Site Map'}
	if (section=='copIn'){writeSection='600 Machinery International'}
	if (whichSubPage==''){writeSubPage='&nbsp;'}
	else {writeSubPage = whichSubPage}
	
// -------------------------------------------------------
// Write the menus
// -------------------------------------------------------

	var max
	
	if (section=='hom'){max = eval(hom.length-1);}
	if (section=='com'){max = eval(com.length-1);}
	if (section=='macSa'){max = eval(macSa.length-1);}
	if (section=='turPr'){max = eval(turPr.length-1);}
	if (section=='disNe'){max = eval(disNe.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=='sea'){max = eval(sea.length-1);}
	if (section=='sitMa'){max = eval(sitMa.length-1);}
	if (section=='copIn'){max = eval(copIn.length-1);}

// -------------------------------------------------------
// Write html
// Every section must be reflected in this section.  See below
// -------------------------------------------------------

	location.reload()

	document.write('<html>');
	document.write('<head>');

	stylo = navigator.appName;
	if (stylo == "Netscape") { 
                sCSS = '<LINK REL=StyleSheet HREF="css/netscape.css" TITLE="Main" TYPE="text/css">';
	}
	else {
                sCSS = '<LINK REL=StyleSheet HREF="css/explorer.css" TITLE="Main" TYPE="text/css">';
	}
	document.write(sCSS)

	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>');

	if (section=='hom') {
	  document.write('<p class=\"title\">'+writeSection+'</p>');
	  }
	else{	
	  document.write('<p class=\"title\">');
	  if (whichSubPage==''){colon=''}
	  else {colon=': '}
	  document.write(writeSection + colon + writeSubPage);
	  document.write('</p>');
	  }
	document.write('<p class=\"submenu\">');


// -------------------------------------------------------
// Every three letter code must be reflected in an if 
// statement below.  The best way to do this is to cut
// and paste a statement (such as hom below) and find/replace 
// the code
// -------------------------------------------------------


	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=='com'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (com[ticker].value == "" && com[0].value =="0" ){com[ticker].value = "Error"}
  	      document.write('<a href=' + comHref[ticker] + ' target=submain>' + com[ticker] + '</a>');
	      if (ticker != eval(max)){document.write('&nbsp;| ');}
	      }
	  }

	if (section=='macSa'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (macSa[ticker].value == "" && macSa[0].value =="0" ){macSa[ticker].value = "Error"}
  	      document.write('<a href=' + macSaHref[ticker] + ' target=submain>' + macSa[ticker] + '</a>');
	      if (ticker != eval(max)){document.write('&nbsp;| ');}
	      }
	  }

	if (section=='turPr'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (turPr[ticker].value == "" && turPr[0].value =="0" ){turPr[ticker].value = "Error"}
  	      document.write('<a href=' + turPrHref[ticker] + ' target=submain>' + turPr[ticker] + '</a>');
	      if (ticker != eval(max)){document.write('&nbsp;| ');}
	      }
	  }

	if (section=='disNe'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (disNe[ticker].value == "" && disNe[0].value =="0" ){disNe[ticker].value = "Error"}
  	      document.write('<a href=' + disNeHref[ticker] + ' target=submain>' + disNe[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="' + conTarget[ticker] +'">' + con[ticker] + '</a>');
	      if (ticker != eval(max)){document.write('&nbsp;| ');}
	      }
	  }
	  
	if (section=='sea'){
	    for (ticker = 0; ticker <= max; ticker++){
	      if (sea[ticker].value == "" && sea[0].value =="0" ){sea[ticker].value = "Error"}
  	      document.write('<a href=' + seaHref[ticker] + ' target=submain>' + sea[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('</span>');

	document.write('</script>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('</body>');
	document.write('</html>');
  }
