// Back-Next link writing script copyright (c) Jon Evans 2003.

var strPaths = new Array() ;
var nPaths = 0  ;

strPaths[nPaths++] = "restoring-valve-radios-book.html" ;
strPaths[nPaths++] = "electronic-classics-book.html" ;
strPaths[nPaths++] = "valve-radio-handbook.html" ;
strPaths[nPaths++] = "vintage-radios-book.html" ;
strPaths[nPaths++] = "books.html" ;
strPaths[nPaths++] = "transmitters.html" ;
strPaths[nPaths++] = "am03.html" ;
strPaths[nPaths++] = "gizmo.html" ;
strPaths[nPaths++] = "gizmo-modifications.html" ;
strPaths[nPaths++] = "vec1290k.html" ;
strPaths[nPaths++] = "amt3000.html" ;
strPaths[nPaths++] = "australian-cd.html" ;
strPaths[nPaths++] = "radio-italiane-cd.html" ;
strPaths[nPaths++] = "tr82-97-radio.html" ;


function findEntry( )
{

// For some reason, if you access window.location any other way then none of the string methods work

var completePath = new String("") ;
   completePath += window.location ;

var hashpos ;
var i = 0 ;

    hashpos = completePath.indexOf('#') ;

    if( hashpos > -1 )
    {
        path = completePath.substring(0,hashpos) ;
    }
    else
    {
        path = completePath ;
    }

   while( (strPaths[i] != path.substr(path.lastIndexOf('/')+1))&&(i<nPaths) )
   {
      i++ ;
   }
   if( i >= nPaths )
   {
      alert(path+" not found in strPaths[] table") ;
      i = 0 ;
   }
   return i ;
}


function writePrevious()
{
var i ;

   i = findEntry() - 1 ;

   if( i < 0 ) // Handle wrap-around
   {
      i = nPaths - 1 ;
   }

   document.write( '<A HREF="' + strPaths[i] + '">&lt;- Previous</A>' ) ;
}


function writeNext()
{
var i ;

   i = findEntry() + 1 ;

   if( i >= nPaths ) // Handle wrap-around
   {
      i = 0 ;
   }

   document.write( '<A HREF="' + strPaths[i] + '">Next -&gt;</A>' ) ;
}
