<!-- Extract Navigation Bar Generation  10/03/2001-10/24/2001 -->
<!-- --------------------------------------------- 10/17/2001 -->
<!-- www.davar.net/NAVIGATE.JS                                -->
<!-- Copyright (C) 2001 by Vladimir Veytsel                   -->
<!--

// Generates extract navigation bar being adjusted to the context
// of bilingual extract presentation (English-Russian) that provides
// switching between languages as well as switching to split screen
// double text browse.  Its purpose is not a navigation bar shorthand
// (this can provide only a minuscule gain), but the ability to make
// navigation bar dynamic, which makes it possible to use the same
// text both for full and split screen presentations.  This permits
// to avoid otherwise necessary support of two almost identical text
// copies (one for full and another for split screen) that differ only
// in their navigation bars.

// Function arguments:
// 1. Navigation bar position
//    T  - Top    of the text (default)
//    B  - Bottom of the text
// 2. Additional navigation data that shows, if specified, on Full screen only.
//    Precede with " <FONT COLOR=Green>|</FONT> " to continue on the second
//    line (enclosing spaces are necessary), or precede with "<BR>" to start
//    the new navigation bar line.

// Other control data (obtained from current "location" value):
// Type - Text presentation type (first character of the URL parameter value)
//   F  - Full  screen text presentation (default)
//   S  - Split screen text presentation
// Name - Text file name
// Name of split screen control text is derived from file name by appending
// "&" at its end, or substituting 8-th character for "&".

// The returned value is the HTML code for the appropriate navigation bar.

   function NAVIGATE()
            {Pos="T"
             if (arguments.length>0)
                Pos=arguments[0]

             Type=location.search.substr(1,1)

             Path=location.pathname.split("/")
             File=Path[Path.length-1].split(".")
             Name=File[0]

             if (Name.length<8)
                Name_S=Name+"&"
             else
                Name_S=Name.substr(0,7)+"&"

             if (Type=="S")
                if (Pos=="T")
                   {Bar=    "Use [<FONT COLOR=Red>Back</FONT>] button to return to the original text<BR>"
                    Bar=Bar+"<FONT COLOR=Green>Go to</FONT> <A HREF='#Bottom'>Text bottom</A>"
                   }
                else
                   {Bar=    "<FONT COLOR=Green>Go to</FONT> <A HREF='#Top'>Text top</A><BR>"
                    Bar=Bar+"Use [<FONT COLOR=Red>Back</FONT>] button to return to the original text"
                   }
             else
                {Bar=    "<FONT COLOR=Green>Go to:</FONT>&nbsp; <A HREF='../../index.htm'>Davar site entry</A> "
                 Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='../../CNT.HTM'>Site contents</A> "
                 Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='../../IND.HTM'>Site index</A> "
                 if (location.pathname.indexOf("EXTRACTS")>=0)
                    {Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='../EXTRACTS.HTM'>Extracts</A> "
                     if (location.pathname.indexOf("FICTION")>=0)
                        Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='FICTION.HTM'>Fiction extracts</A> "
                     else
                        Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='MISCL.HTM'>Miscl extracts</A> "
                    }
                 else
                    {Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='../RUSSIAN.HTM'>Russian</A> "
                     if (location.pathname.indexOf("FICTION")>=0)
                        Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='FICTION.HTM'>Russian fiction</A> "
                     else
                        Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='MISCL.HTM'>Miscl Russian</A> "
                    }
                 if (Pos=="T")
                    Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='#Bottom'>Text bottom</A>"
                 else
                    Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='#Top'>Text top</A>"
                 if (location.pathname.indexOf("EXTRACTS")>=0)
                    {Bar=Bar+"<BR></FONT> <A HREF='"+Name_S+".HTM'>English and Russian texts</A> "
                     if (location.pathname.indexOf("FICTION")>=0)
                        Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='../../RUSSIAN/FICTION/"+Name+".HTM'>Russian text</A>"
                     else
                        Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='../../RUSSIAN/MISCL/"+Name+".HTM'>Russian text</A>"
                    }
                 else
                    {Bar=Bar+"<BR></FONT> <A HREF='"+Name_S+".HTM'>Russian and English texts</A> "
                     if (location.pathname.indexOf("FICTION")>=0)
                        Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='../../EXTRACTS/FICTION/"+Name+".HTM'>English text</A>"
                     else
                        Bar=Bar+"<FONT COLOR=Green>|</FONT> <A HREF='../../EXTRACTS/MISCL/"+Name+".HTM'>English text</A>"
                    }
                 if (arguments.length>1)
                    Bar=Bar+arguments[1]
                }
             return Bar
            }
//-->

