<!--

	// DynMenu.js
	// Dynamic menu - this is based on an array of
	// "Link" objects that contain the URL of the page and a 
	// description that can be used as the anchor text.
	//
	// Written - 24,26 & 28.12.1999, & 30.01.2000 Paul Phillips. 	

	var aPageList = new Array(); //Array to hold page info...
	var i = 0;	  				 //Loop counter...
	var sLevel = "../";			 //Level prefix...
	
	// ========================================
	// The pages themselves go something like this...
	// 0 = index.htm
	// 1 = wtnews.htm 
	// 2 = wtbiog.htm
	// 3 = wtdiscog.htm
	// 4 = wtsolo.htm
	// 5 = wtmusic.htm
	// 6 = wtaudio.htm
	// 7 = archiveidx.htm
	// 8 = Gallery.htm
    // 9 = wtVaults.htm
	// 10 = wtabout.htm
	// 11 = Guest Book - sign
	// 12 = Guest Book - view
	// 13 = Email
	// ========================================

	// This function defines an object called 'Link'.
	function Link(href,text,status,level) 
			 {     
			 	   this.href = href;   		  // URL
				   this.text = text;   	  	  // Visible description
				   this.status = status;  	  // Window.status property
				   this.level = level;		  // 0 or above. 0=root level.
			 }

    // This function creates a new instance of a 'Link' object
	// and places it in the aPageList array. 
	function setLink(href,text,status) 
			 {     
			 	   aPageList[i] = new Link(href,text,status);
     			   i++;
		     }

    // Construct and return an onMouseOver string...
	function showStatus(nId)
			 {
			  	   var sStatus;
			       sStatus = "window.status = '"+aPageList[nId].status+"';return true";
				   return sStatus;
			 }

    // Construct and return an onMouseOut string...
	function clearStatus()
			 {
			  	   var sStatus;
				   sStatus = "window.status = '';return true"
				   return sStatus;
			 }			 

	// Test which page we are in using the objPage object.
	// Uses the search method of the string object, which returns
	// -1 if a string value is not found in the string object. 
	function thisPage(href)
			 {
			  	   var shref;
				   var sPage = document.location.href;
				   var sUpperPage;
				   var iPos;
				   var iLastPos;
				   				   
				   // Note - enforce to uppercase.
				   sUpperPage = sPage.toUpperCase();
				   shref = href.toUpperCase();
				   
				   // Create string objects for the page file name ("*.htm")
				   // and the reference passed in.
				   var objPage = new String(sUpperPage);
				   var objHref = new String(shref);
				   
				   // Strip out any "/" characters...
				   iPos=0; iLastPos=1;
				   iPos= objHref.indexOf("/");
				   while (iPos != -1)
				   		 {
						  	   iLastPos = iPos;
							   iPos= objHref.indexOf("/",(iPos+1));
					     }
				   shref = shref.substring(iLastPos,shref.length);						 
						 
				   // can we find one within the other ?
			  	   return (objPage.indexOf(shref) == -1);

		     }			 			 

    // Are we in a "root" page, or a lower level page ?
    function inRootLevelPage()
			 {
             var sPage = document.location.href;
			 var sUpperPage;
			 var sReference1 = "GALLERY";
			 var sReference2 = "MUSIC";
			 var sReference3 = "MAGAZINES";
			 
			 sUpperPage = sPage.toUpperCase();
			 var objPage = new String(sUpperPage);			 

			 // Is this a low level page ?
			 return ((objPage.indexOf(sReference1) == -1) && (objPage.indexOf(sReference2) == -1) && (objPage.indexOf(sReference3) == -1));
			 }

    function jumpToPage(sUrl)
	   {
	   window.location.href=sUrl;
	   }			 
	   
	
    // Main body of script... 
    // Now populate the array 'aPageList' with 'Link' objects
	setLink("index.htm","Home","Back to The Last Perfect Thing Homepage");
	setLink("wtnews.htm","News","Up to date site and band news");
	setLink("wtbiog.htm","Biography","Full band biography");
	setLink("wtdiscog.htm","Worldwide Discography","All the hits !");
	setLink("wtsolo.htm","Solo Page","Life after Wire Train");
	setLink("music/wtmusic.htm","Music Page","Song transcriptions");
	setLink("wtaudio.htm","Audio &amp; Video","Audio and video links");
	setLink("magazines/archiveidx.htm","Archive","The ultimate Wire Train resource");
	setLink("gallery/Gallery.htm","Gallery","Photo gallery - great shots of the band");
	setLink("wtVaults.htm","In the Vaults","Un-released Wire Train");
	setLink("wtabout.htm","Links & Credits","Links to other Wire Train areas");
	setLink("http://htmlgear.tripod.com/guest/control.guest?u=paul-phillips&i=1001&a=sign","Guest Book - Sign","Say something nice !");
	setLink("http://htmlgear.tripod.com/guest/control.guest?u=paul-phillips&i=1001&a=view","Guest Book - View","View the Guest Book");

	// Do we need to prefix locations with direcory info ?
    if (inRootLevelPage())
		 {
		 sLevel = ""; 
		 sAnchorPrefix = "";
		 }  
	else
	  	 {
		 sLevel = "../";
		 }
		 
	// Output the menu details...
	for (i=0; i< (aPageList.length); i++)				
		{
		 	  if (thisPage(aPageList[i].href))
			  	 {
				 document.writeln('<img src="'+sLevel+'graphics/smaller_arrow.gif">')
	   			 if (aPageList[i].href.indexOf("http") != -1)
				     {
					     document.writeln('<A HREF="'+aPageList[i].href+'" TARGET="_top" onMouseOver="'+showStatus(i)+'" onMouseOut="'+clearStatus(i)+'">'+aPageList[i].text+'</A>');
					 }
				 else
				     {
				         document.writeln('<A HREF="'+sLevel+aPageList[i].href+'" TARGET="_top" onMouseOver="'+showStatus(i)+'" onMouseOut="'+clearStatus(i)+'">'+aPageList[i].text+'</A>');
                     }
				 document.writeln('<br>');		

				 }
			  else
      		  	  {
				  document.writeln('<div class="CurrMenuItem">');
				  document.writeln('<img src="'+sLevel+'graphics/smaller_arrow_bl.gif">')
				  document.writeln(''+aPageList[i].text+'');
				  document.writeln('<br>');		
				  document.writeln('</div>');
				  }
				  		 
		}

// -->


