/*========================================================================*\
|                                                                          |
|          Common functions for all C F S Nevada, Inc. Web pages           |
|                                                                          |
\*========================================================================*/

/*========================================================================*\
|                                                                          |
|                       Create footer for all pages                        |
|                                                                          |
\*========================================================================*/
function CommonFooter( Netmind )
   {
   /*==================*\
   |  Copyright string  |
   \*==================*/
   current_date = new Date()
   current_year = current_date.getYear() + 0000
   copyright_string = '&copy; ' + current_year + ' by ' + '<A HREF="mailto:webmaster@cfsrexx.com">C F S Nevada, Inc.</a> All rights reserved.'

   /*======================*\
   |  Last modified string  |
   \*======================*/
   DayNameArray   = new CreateArray( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" )
   MonthNameArray = new CreateArray( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" )
   last_modified_date = new Date( document.lastModified )      /* e.g. Tue Nov 28 20:09:50 pst 1996 */
   month_name     = MonthNameArray[ ( last_modified_date.getMonth() + 1 ) ]
   day_name       = DayNameArray[ ( last_modified_date.getDay() + 1 ) ]
   month_number   = last_modified_date.getMonth() + 1
   day_number     = last_modified_date.getDate()
   yyyy           = last_modified_date.getYear() + 0000
   if ( month_number < 10 )
      {
      month_number = '0' + month_number
      }
   if ( day_number < 10 )
      {
      day_number = '0' + day_number
      }
   formatted_date = day_name + '; ' + yyyy + '/' + month_number + '/' + day_number

   /*=================================*\
   |  Create a table with 4 quadrants  |
   \*=================================*/
   document.writeln( '<center>' )
   document.writeln( '<table width=90% border=0>' )
   document.writeln(  '<tr><td colspan=2><hr></td></tr>' )

   /*===========================*\
   |  Netmind notification link  |
   \*===========================*/
   if ( Netmind == '1' )
      {
      object_page         = '../home/notify.htm'
      lowercase_url       = document.URL.toLowerCase()
      notification_url    = document.URL
      notification_title  = document.title
      if ( lowercase_url.indexOf( '/home' ) >= 0 )
         {
         notification_url = 'http://cfsrexx.com/welcome.htm';
         notification_title = 'C F S Nevada, Inc. home page';
         }

      mouse_over_status_data = '\'Netmind notification form when ' + location.pathname + ' changes\''
      mouse_out_status_data  = "\'" + location.pathname + '   Last modified: ' + document.lastModified + "\'"

      document.writeln( '<tr>' )
      document.writeln(  '<td align="center" colspan=2>' )
      document.writeln(   '<font size=-1>' )
      document.writeln(   '<a href="', object_page, '?', notification_url, '&', escape( notification_title ), '"' )
      document.writeln(   ' onMouseOver="window.status=', mouse_over_status_data, '; return true"' )
      document.writeln(   ' onMouseOut ="window.status=', mouse_out_status_data, '; return true">' )
      document.writeln(   'Request e-mail notification</a> from <a href="http://www.netmind.com" target="_top">Netmind</a> when this page changes.</font><br>&#160;<hr>' )
      document.writeln(  '</td>' )
      document.writeln( '</tr>' )
      }

   /*===================*\
   |  Top left quadrant  |
   \*===================*/
   document.writeln(  '<tr valign="top">' )
   document.writeln(   '<td align="left">' )
   document.writeln(    '<table border=0>' )
   document.writeln(     '<tr>' )
   document.writeln(      '<td align="left" valign="top">' )
   document.writeln(       '<font size=-2>This URI: ', document.URL, '</font>' )
   document.writeln(       '<br><font size=-2>', copyright_string , '</font>' )
   document.writeln(       '<br><font size=-2>Last update: ', formatted_date, '</font>' )
   document.writeln(      '</td>' )
   document.writeln(     '</tr>' )
   document.writeln(    '</table>' )
   document.writeln(   '</td>' )

   /*=====================*\
   |  Top right quandrant  |
   \*=====================*/
   document.writeln(   '<td align="right">' )
   document.writeln(    '<table border=0>' )
   document.writeln(     '<tr>' )
   document.writeln(      '<td align="center" valign="top">' )
   document.writeln(       '<font size=-2><strong>C&#160;F&#160;S&#160;Nevada,&#160;Inc.</strong>' )
   document.writeln(       '<br>Las Vegas, Nevada 89104-3012' )
   document.writeln(       '<br>+1-702-732-9616</font>' )
   document.writeln(      '</td>' )
   document.writeln(     '</tr>' )
   document.writeln(    '</table>' )
   document.writeln(   '</td>' )
   document.writeln(  '</tr>' )

   /*======================*\
   |  Bottom left quadrant  |
   \*======================*/
   /* provide link to home page if not currently there */
   lowercase_url = document.URL.toLowerCase()
   optional_home_page_link = '&#160;'
   if ( lowercase_url.indexOf( '/home' ) == -1 )
      {
      cfsrexx_ptr = lowercase_url.indexOf( 'cfsrexx' )
      base_ptr   = lowercase_url.indexOf( '/', cfsrexx_ptr ) + 1
      optional_home_page_link = '<a href="' + document.URL.substring( 0, base_ptr ) + 'welcome.htm' + '" target="_top">C F S Nevada, Inc. home page</a>'
      }
   document.writeln(  '<tr valign="middle">' )
   document.writeln(   '<td align="left">' )
   document.writeln(    '<table border=0>' )
   document.writeln(     '<tr>' )
   document.writeln(      '<td align="left" valign="top">' )
   document.writeln(       '<font size=-1>', optional_home_page_link, '</font>' )
   document.writeln(      '</td>' )
   document.writeln(     '</tr>' )
   document.writeln(    '</table>' )
   document.writeln(   '</td>' )

   /*=======================*\
   |  Bottom right quadrant  |
   \*=======================*/
   document.writeln(   '<td align="right">' )
   document.writeln(    '<table border=0>' )
   document.writeln(     '<tr>' )
   document.writeln(      '<td align="center" valign="bottom">' )
   document.writeln(      '<a href="http://www.eff.org/blueribbon.html" OnMouseOver="window.status=\'The Electronic Freedom Foundation\'; return true"> ' )
   document.writeln(      '<img src="../images/eff01.gif" width=143 height=30 border="0" alt="The Electronic Freedom Foundation"></a>' )
   document.writeln(      '</td>' )
   document.writeln(     '</tr>' )
   document.writeln(    '</table>' )
   document.writeln(   '</td>' )
   document.writeln(  '</tr>' )

   document.writeln( '</table>' )

   /********** Browser compatability testing only **********\
   document.writeln( '<p>' )
   document.writeln( '<table align="left" cellpadding=5 border=0>' )
   document.writeln(  '<tr><td align="left" valign="top"><pre>document.location = ', document.location, '</td></tr>' )
   document.writeln(  '<tr><td align="left" valign="top"><pre>document.title    = ', document.title,    '</td></tr>' )
   document.writeln(  '<tr><td align="left" valign="top"><pre>document.URL      = ', document.URL,      '</td></tr>' )
   document.writeln(  '<tr><td align="left" valign="top"><pre>location.hash     = ', location.hash,     '</td></tr>' )
   document.writeln(  '<tr><td align="left" valign="top"><pre>location.host     = ', location.host,     '</td></tr>' )
   document.writeln(  '<tr><td align="left" valign="top"><pre>location.hostname = ', location.hostname, '</td></tr>' )
   document.writeln(  '<tr><td align="left" valign="top"><pre>location.href     = ', location.href,     '</td></tr>' )
   document.writeln(  '<tr><td align="left" valign="top"><pre>location.pathname = ', location.pathname, '</td></tr>' )
   document.writeln(  '<tr><td align="left" valign="top"><pre>location.port     = ', location.port,     '</td></tr>' )
   document.writeln(  '<tr><td align="left" valign="top"><pre>location.protocol = ', location.protocol, '</td></tr>' )
   document.writeln(  '<tr><td align="left" valign="top"><pre>location.search   = ', location.search,   '</td></tr>' )
   document.writeln(  '</table>' )
   \********** Browser compatability testing only **********/

   document.writeln( '<br>&#160;' )
   }

/*========================================================================*\
|                                                                          |
|                               Create array                               |
|                                                                          |
\*========================================================================*/
function CreateArray()
   {
   this.length = CreateArray.arguments.length
   this[0]     = CreateArray.arguments.length
   for (var i = 0; i < this.length; i++ )
      {
      this[i+1] = CreateArray.arguments[i];
      }
   }

/*====================================================================================*\
|  Create a separated, linked list of all specified pages, excluding the current page  |
\*====================================================================================*/
function TreeContents( subject_url, subject_title )
   {
   bullet_string = ' &#149; '
   last_slash_ptr = subject_url.lastIndexOf( '/' )
   subject_file_name = subject_url.substring( last_slash_ptr, subject_url.length )
   last_slash_ptr = document.URL.lastIndexOf( '/' )
   document_file_name = document.URL.substring( last_slash_ptr, document.URL.length )
   if ( subject_file_name == document_file_name )
      {
      return
      }
   tree_contents = tree_contents + '<a href="' + subject_url + '">' + subject_title + '</a>' + bullet_string
   }

/*==================================*\
|  WebMaven bottom of page contents  |
\*==================================*/
function WebMavenContents( )
   {
   tree_contents = '<p><center>Other WebMaven pages:<br>[ '
   TreeContents( '../WebMaven/faq_01.htm',                        'FAQ' )
   TreeContents( '../WebMaven/SampleReports/ReportSummary.htm',   'Sample&#160;reports' )
   TreeContents( '../WebMaven/ScreenShots.htm',                   'Screen shots' )
   TreeContents( '../WebMaven/techspecs.htm',                     'Technical&#160;Specs.' )
   TreeContents( '../WebMaven/reports.htm',                       'Webmaster&#160;Report&#160;Info' )
   TreeContents( '../WebMaven/welcome.htm',                       'WebMaven&#160;Intro' )
   document.writeln( tree_contents.substring( 0, tree_contents.length - bullet_string.length ), ' ]</center>' )
   }

/*========================================================================*\
|                                                                          |
|                   Create header for all WebMaven pages                   |
|                                                                          |
\*========================================================================*/
function WebMavenHeader( title )
   {
   document.writeln( '<center>' )
   document.writeln( '<table>' )
   document.writeln( ' <tr align="center" valign="top">' )
   document.writeln( '  <td>' )
   document.writeln( '   <a href="../WebMaven/welcome.htm">' )
   document.writeln( '   <img src="../WebMaven/l216x078.gif" width=216 height=078 border=0 alt="WebMaven logo"></a> <font size=-1>&#153;</font>' )
   document.writeln( '  </td>' )
   document.writeln( ' </tr>' )

   document.writeln( ' <tr><td> &#160; </td></tr>' )

   document.writeln( ' <tr>' )
   document.writeln( '  <td align="center">' )
   document.writeln( '      <strong>' )
   document.writeln( '      <font size=+3>', title, '</font>' )
   document.writeln( '      <br><font size=-2>(In process and subject to change)</font>' )
   document.writeln( '      </strong>' )
   document.writeln( '  </td>' )
   document.writeln( ' </tr>' )

   document.writeln( '</table>' )
   document.writeln( '</center>' )
   }

/*========================================================================*\
|                                                                          |
|                 Determine secure connection by location                  |
|                      (archaic but needed by 2.02e)                       |
|                                                                          |
\*========================================================================*/
function secure_connection_determination()
   {
   lowercase_url = document.URL.toLowerCase()
   secure_connection =
      ( lowercase_url.substring( 0, 6 ) == 'https:' ) ||
      ( lowercase_url.substring( 0, 5 ) == 'file:' )
   return secure_connection
   }

/*========================================================================*\
|                                                                          |
|         Footnote - Open a secondary window to display a footnote         |
|                                                                          |
\*========================================================================*/
function Footnote( URL, comment )
   {
   if ( comment == '' )
      {
      comment = 'Tech note'
      }
   document.writeln( '<a href="', URL, '"><font color="red"><i>{', comment, '}</i></font></a>&#160;' )
   }
