var browser = navigator.userAgent.toLowerCase();
var browserIE = ( browser.indexOf("msie") != -1 );

/*
 * These next functions and variables were used on TheFreeDictionary.com
 * to display inline notes (8-Jun-2004)
 */

function layer(id){
  if(document.getElementById) return document.getElementById(id)
  if(document.all) return document.all[id]
  return null
}
var nsx;
var nsy;
if (!document.all) {
	document.captureEvents(Event.MOUSEMOVE);	
	document.onmousemove=get_mouse;
}
function get_mouse(e) {
	nsx=e.pageX;
	nsy=e.pageY+5;
}
function t_i(id) {
	var hlp=layer('Tp'+id).style
	if (hlp) {
	if (document.all) {
	 nsy=event.y+document.body.scrollTop
	 nsx=event.x+document.body.scrollLeft
	}
	hlp.top=nsy+20
	// hlp.left=(nsx>610?nsx-470:140)
    hlp.left=(nsx>610?nsx-470:300)		
	hlp.visibility='visible'
}}
function t_o(id) {
	var hlp=layer('Tp'+id).style
	if(hlp) hlp.visibility='hidden'
}

/*
 * end TheFreeDictionary.com functions
 */

function get_mfwpnLogo(pTM) {
  var mfwpnLogo = '<span class="MFWPNlogo">' +
  '<span style="color: 000000">My</span>' +
  '<span style="color: ff0000">First</span>' +
  '<span style="color: 00ff00">Web</span>' +
  '<span style="color: 0000ff">Page</span>' +
  '<span style="color: 000000">.net';

  if ( pTM == 'tm' )
    mfwpnLogo = ( mfwpnLogo + '&#153;' );
  mfwpnLogo = ( mfwpnLogo + '</span></span>' );

return mfwpnLogo;
} // end get_mfwpnLogo function

function f_element( p_index, p_deliminator, p_string ) {
  /* 
   * JavaScript version of OpenVMS DCL F$ELEMENT lexical
   */
  var currIndex = p_string.indexOf(p_deliminator);
  var i = 0;
  var outChar = '';
  var outPoint = 0;
  var outString = p_string;
  var trackIndex = 0;

  if ( currIndex >= 0 ) {
      while ( ( trackIndex != p_index ) && ( currIndex != -1 ) ) {
        outPoint = ++currIndex;
        currIndex = p_string.indexOf(p_deliminator,outPoint);
        trackIndex++;
      } // end while ( ( trackIndex != p_index ) && ( currIndex != -1 ) )
      if ( trackIndex != p_index ) {
        outString = p_deliminator;
      } else {
        outString = '';
        for ( i=outPoint; i<p_string.length; i++ ) { 
          outChar = p_string.charAt(i);
          if ( outChar == p_deliminator ) {
            break;
          } else {
            outString = ( outString + outChar );
          } // end if ( outChar == p_deliminator )
        } // for ( i=outPoint; i<p_string.length; i++ )
      } // end if ( trackIndex != p_index )
    } else if ( p_index >= 1 )
      outString = p_deliminator;
    // end if ( currIndex >= 0 )
  
  return outString;
  } // end f_element function

function show_email(p_email) {
  var at_loc = p_email.indexOf('@');
  var email1 = p_email.substring(0,at_loc);
  var email2 = p_email.substring(at_loc + 1,p_email.length);
  var email3 = ( email1 + " @ " + email2 );

  return email3;
} // end show_email function

function get_DOY( p_target ) {
  /* 
   * get_DOY - Get Day of Year
   *           Sometimes called the Julian Day
   * Parameters
   *   p_target: The target date
   *             Only one value is expected - EOY (End of Year)
   *             Otherwise the current date is used
   */
  var Target = new Date();
  var TargetYear = Target.getYear();
  
  if (TargetYear < 2000) 
    TargetYear += 1900;

  var Jan1 = new Date( TargetYear, 0, 1 );
  if ( p_target == 'EOY' ) 
    Target = new Date( TargetYear, 11, 31 );
  var DOY = ( ( Math.floor((Target.getTime()/1000/86400)-(Jan1.getTime()/1000/86400)) ) + 1 );
  if ( ( p_target != 'EOY' ) && ( Target.getHours() == 0 ) )
    DOY = ( DOY + 1 );
  return DOY;
} // end get_DOY function

function show_fullToday() {
  var Today = new Date();
  var TodayWeekDay = Today.getDay( );
  var TodayDay = Today.getDate();
  var TodayMonth = Today.getMonth();
  var TodayYear = Today.getYear();
  var fullDate = '';

  var A_all_weekdays = new Array( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" );
  var A_all_months = new Array( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" );

  if (TodayYear < 2000) TodayYear += 1900;
  fullDate = ( A_all_weekdays[TodayWeekDay] + ",&nbsp;" +
   '<a href="http://en.wikipedia.org/wiki/' + A_all_months[TodayMonth] + '_' + TodayDay + 
   '" title="Wikipedia entry for this day" target="_blank">' +
   A_all_months[TodayMonth] + "&nbsp;" + TodayDay + '</a>' + 
   ",&nbsp;" + TodayYear + "&nbsp;(Day&nbsp;" + get_DOY() + "&nbsp;of&nbsp;" + 
   get_DOY('EOY') + ")" );
  return fullDate;
} // end show_fullToday function

function addToFavorites() {
  var urlAddress = "http://www.myfirstwebpage.net";
  var pageName = "MyFirstWebPage.net Design Services";

  if (window.external) {
    window.external.AddFavorite(urlAddress,pageName);
  }
  else { !(window.external)
    alert("Sorry, your browser does not support this function.");
  } // end if (window.external)

  return
} // end addToFavorites function

function bannerLogo(docType) {
  var typeCorrespondence = ( docType == 'correspondence' );
  var homePage = 'index.html';
  if ( devEnviron() == 'Production' ) 
    homePage = 'http://MyFirstWebPage.net/';

  document.write('<tr>');
  if ( !typeCorrespondence ) {
      /*
      document.write('<td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffbb" background="MyFWPNblocks.jpg">');
      */
      document.write('<td><table class="banner" width="100%" cellpadding="0" cellspacing="0">');
      document.write('<tr><td style="font-family: \'times new roman\'; font-size: 17px; font-weight: bold; color: #777777">&nbsp;</td></tr>');

      document.write('<tr>');
  }

  /*
  document.write('<td style="font-size: 35px;">');
  document.write('<img src="indent.gif" width="181" height="1" alt="">');
  document.write('<a class="MFWPNlogo" href="http://www.myfirstwebpage.net/" title="Return to the MyFirstWebPage.net home page.&#153;">' + get_mfwpnLogo('tm') + '</a></td>');
  document.write('</td>');
  document.write('</tr>');
  */

  document.write('<td style="font-size: 35px;">');
  document.write('<img src="indent.gif" width="178" height="1" alt="">');
  document.write('<a class="MFWPNlogo" href="' + homePage + '" title="Return to the MyFirstWebPage.net&#153; home page.">' + '<img src="MyFWPNlogo.gif" width="420" height="36" border="0">' + '</a>');
  document.write('</td>');
  document.write('</tr>');


  document.write('<tr>');
  document.write('<td style="font-family: \'Verdana\', \'Helvetica\', \'Arial\'; font-size: 17px;">');
  document.write('<img src="indent.gif" width="227" height="1"alt="">');
  /*
  document.write('Affordable&nbsp;design&nbsp;services&nbsp;for&nbsp;your&nbsp;first&nbsp;web&nbsp;page');
  */
  document.write('Affordable&nbsp;services&nbsp;for&nbsp;new&nbsp;and&nbsp;established&nbsp;web&nbsp;sites');
  document.write('</td>');

  if ( !typeCorrespondence ) {
      document.write('</tr>');

      document.write('<tr><td>&nbsp;</td></tr>');
      document.write('</table></td>');
  }

  document.write('</tr>');

  return;
} // end bannerLogo function

function show_subPageBanner() {
  bannerLogo('mfwpnPage');
  return;
} // end show_subPageBanner function

function display_dateToday() {
  document.write('<tr>');
  document.write('<td class="fullToday" align="right">');
  document.write(show_fullToday());
  document.write('</td>');
  document.write('</tr>');
  return;
} // end display_dateToday function

var bMenuOptions = new Array(
  '0',
  '1|home|Home|http://MyFirstWebPage.net/|To the home page.',
  '0|mission|Mission|mission.html|To read our Mission Statement.',
  '1|services|Services|services.html|To find out what we do.',
  '0|game|Game|game.html|To help watch for this site.',
  '1|aboutus|About Us|aboutus.html|To find who we are.',
  '1|contactus|Contact Us|contactus.html|To find out how to reach us.',
  '1|fun|Fun|fun.html|To bring a smile to your face.'
); // End of bMenuOptions

if ( devEnviron() == 'Development' )
  bMenuOptions[1] = "1|home|Home|index.html|To the home page.";

function show_bOption(p_i, p_currentPage, p_bOption) {
  var oTitle = f_element(4,'|',p_bOption);
  var oWidth = '175px';
  if ( f_element(3,'|',p_bOption) == "#" ) {
	document.write('<li><a href="' + f_element(3,'|',p_bOption) + '">' + f_element(2,'|',p_bOption) + '</a>');
  } else {
    if ( p_currentPage ) {
      document.write('<li><a style="background-color: #0000ff; color: #ffffff;" onmouseover="t_i(9'+ p_i + ')" onmouseout="t_o(9'+ p_i + ')">' + f_element(2,'|',p_bOption) + '</a>');
      oTitle = 'You are here';
      oWidth = '100px';
    } else {
      document.write('<li><a href="' + f_element(3,'|',p_bOption) + '" onmouseover="t_i(9'+ p_i + ')" onmouseout="t_o(9'+ p_i + ')">' + f_element(2,'|',p_bOption) + '</a>');
	}
    document.write('<span id="Tp9'+ p_i + '" class="hint" style="text-align: center; width: ' + oWidth + ';">' + oTitle + '</span></li>');
  }
  return;
} // end show_bOption function

function show_bannerMenu(p_thisPage) {

  /*
   * Constants
   */
  var bSeperator = '&nbsp;|';

  /*
   * Variables
   */
  var bLevel = 0;
  var bOption = '';
  var optionCnt = 0;

  document.write('<tr><td>');
  document.write('<table align="center" border="0" cellpadding="0" cellspacing="0">');
  document.write('<tr><td><ul id="nav">');

  for (i=0; i<bMenuOptions.length; i++) {
    bOption = bMenuOptions[i];
	bLevel = parseInt(f_element(0,"|",bOption));
    if ( bLevel >= 1 ) {
      optionCnt = optionCnt + 1;
      show_bOption(i,Boolean(p_thisPage == f_element(1,'|',bOption)), bOption);
    } // end if ( bLevel <= 0 )
  } // end for (i=0; i<bMenuOptions.length; i++)

  document.write('</ul></td></tr>');
  document.write('</table>');
  document.write('</td></tr>');

  return;
} // end show_bannerMenu function

function simple_quote(pSelect) {
  var showQuote = pSelect;
  var allQuotes = Array (
    '<i>"Every contrivance of man, every tool, every instrument, every utensil, every article designed for use, of each and every kind, evolved from very simple beginnings."</i> <span class="nBR">&#045;Robert Collier</span>', 
    '<i>"A complex system that works is invariably found to have evolved from a simple system that works."</i> <span class="nBR">&#045;John Gall</span>',
    '<i>"Only those who have the patience to do simple things perfectly ever acquire the skill to do difficult things easily."</i> <span class="nBR">&#045;Anonymous</span>',
    '<i>"After all, life is really simple; we ourselves create the circumstances that complicate it."</i> <span class="nBR">&#045;Anonymous</span>',
    '<i>"Simplicity is an acquired taste.  Mankind, left free, instinctively complicates life."</i> <span class="nBR">&#045;Katherine F. Gerould</span>',
    '<i>"Our life is frittered away by detail&#8230;  Simplify, simplify."</i> <span class="nBR">&#045;Henry David Thoreau,</span> <u><a href="http://en.wikipedia.org/wiki/Walden" target="_blank">Walden</a></u> (1854)',
    '<i>"Simplicity is the glory of expression."</i> <span class="nBR">&#045;Walt Whitman</span>',
    '<i>"In the beginner\'s mind there are many possibilities; in the expert\'s mind there are few."</i> <span class="nBR">&#045;Shunryu Suzuki, Roshi</SPAN>',
    '<i>"Have you ever observed that we pay much more attention to a wise passage when it is quoted than when we read it in the original author?"</i> <span class="nBR">&#045;Philip G. Hamerton, <u>The Intellectual Life</u></SPAN>',
    '<i>"First we thought the PC was a calculator. Then we found out how to turn numbers into letters with ASCII, and we thought it was a typewriter. Then we discovered graphics, and we thought it was a television. With the World Wide Web, we\'ve realized it\'s a brochure."</i> <span class="nBR">&#045;Douglas Adams</SPAN>',
    '<i>"Gardening is not for wimps!"</i> <span class="nBR">&#045;Chris McIntosh</SPAN>',
    '<i>"‘Tis the gift to be simple"</i> <span class="nBR">&#045;Shaker Hymn</SPAN>',
    '<i>"The problem is that we attempt to solve the simplest questions cleverly, thereby rendering them unusually complex.  One should seek the simple solution."</i> <span class="nBR">&#045;Anton Pavlovich Chekhov (1860–1904)</SPAN>, <span class="nBR">Russian author, playwright</SPAN>',
    '<i>"Regardless of the changes in technology, the market for well-crafted messages will always have an audience."</i> <span class="nBR">&#045;Steve Burnett</SPAN>',
    '<i>"It is always the simple that produces the marvelous."</i> <span class="nBR">&#045;Amelia E. Barr</SPAN>'
    ); 

  if ( pSelect <= -1 ) {
    var TodayDOY = get_DOY();
    var qTotal = allQuotes.length;
    var x1 = Math.floor( ( TodayDOY - 1 ) / qTotal );
    var x2 = ( ( x1 * qTotal ) + 1);
    showQuote = ( TodayDOY - x2 );
  } // end if ( pSelect <= -1 )

  return allQuotes[showQuote];
} // end simple_quote function</script>

function show_pageFooter(p_pageId) {
  var Today = new Date();
  var TodayYear = Today.getYear();

  if (TodayYear < 2000) TodayYear += 1900;

  if ( p_pageId == 'home' ) {
    document.write('<tr><td><a id="fn1"><p style="font-size: 12px;">');
    document.write('1.  The quotes displayed on this page change every day.');
    document.write('</p></a></td></tr>');
  } // end if ( p_pageId == 'home' )
  
  if ( p_pageId == 'contactus' ) {
    document.write('<tr><td>&nbsp;</td></tr>');
  } else {
    for (i=0; i < 2; i++) {
      document.write('<tr><td>&nbsp;</td></tr>');
    }  // end for (i=0; i < 2; i++)
  } // end ( p_pageId == 'contactus' )
  
  document.write('<tr><td id="footer" align="center">');
  if ( p_pageId == 'home' ) {
    document.write('<a href="JavaScript:addToFavorites()">Click here to bookmark this page</a>');
    document.write('<br>');
  } // end if ( p_pageId == 'home' )
  if ( p_pageId == 'contactus' ) {
    document.write('Newsletter service provided by <a href="http://constantcontact.com/" target="_blank">Constant Contact</a><br>');
  } // end ( p_pageId == 'contactus' )
  if ( p_pageId != 'home' )
    document.write('<a class="MFWPNlogo" href="http://www.myfirstwebpage.net/">');
  document.write(get_mfwpnLogo());
  if ( p_pageId != 'home' )
    document.write('</a>');
  document.write('&nbsp;hosted by <a href="http://www.dls.net/" target="_blank">DLS Internet</a>');
  document.write('<br>Copyright &#169;&nbsp;' + TodayYear + '&nbsp;by ');
  document.write('<A class="MFWPNlogo" HREF="javascript:msgForm(\'2\',\'Comments About A MyFirstWebPage.net Page\')"');
  document.write('title="We will reply ASAP">');
  document.write(get_mfwpnLogo('tm'));
/*
  emailE=('we' + 'bmas' + 'ter' + '@' + 'MyFirstWebPage' + '.' + 'net')
  document.write('<a class="MFWPNlogo" href="mailto:' + emailE 
  + '?subject=Comments About A MyFirstWebPage.net Page"'
  + '>');
  document.write(get_mfwpnLogo('tm'));
*/
  document.write('</a></span>');
  document.write('</td></tr>'); 

  return;
} // end show_pageFooter function

function getPassedValue(p_id) {
  /* 
   * +++
   *
   * Function Name: getPassedValue
   *        Author: Alvin Orzechowski MyFirstWebPage.net
   * Creation Date: 15-Aug-2004
   *      Abstract: To return the passed value or the specified portion of it
   *   Description: 
   *    Parameters: p_id - Value found to the left of an equal sign.  If this is
   *                    found, this function will return the value found to the
   *                    right of the equal sign.  If this parameter is not 
   *                    provided, this function will return the whole value 
   *                    passed.
   *       History: 
   * 
   * ---
   */

  // [ getPassedValue Constants ]
  var passedValue = unescape(location.search.substring(1));

  // [ getPassedValue Variables ]
  var allSubValues = location.search.substring(1,location.search.length).split('&');
  var i;
  var idValue = passedValue;
  var subValue;

  // [ getPassedValue Main Line ]
  for (i=0; i<allSubValues.length; i++) {
    subValue = allSubValues[i].split('=');
    if ( subValue[0] == p_id ) {
      idValue = unescape(subValue[1]);
      i = allSubValues.length;
    } // end if ( subValue[0] == p_id )  
  } // end for (i=0; i<allSubValues.length; i++)

  // [ getPassedValue End of Job ]
  return idValue;

} // end getPassedValue function

function msgForm(p_to,p_subject) {
  /* 
   * +++
   *
   * Function Name: msgForm
   *        Author: Alvin Orzechowski MyFirstWebPage.net
   * Creation Date: 16-Aug-2004
   *      Abstract: To bring up the msgform.html file in its own window
   *   Description: 
   *    Parameters: p_to - Value of username getting the e-mail address
   *                p_subject - Value of Subject to be put in the form
   *       History: 
   * 
   * ---
   */

  // [ msgForm Constants ]

  var day = new Date();

  // [ msgForm Variables ]

  var id = day.getTime();
  var params = '';
  var URL = 'msgform.html';

  // [ msgForm Main Line ]

  if ( p_to != '' )
    params = ( '?to=' + p_to );
  if ( p_subject != '' ) {
    if ( params == '' )
      params = '?'
    else
      params = ( params + '&' );
    params = ( params + 'subject=' + p_subject );
  }
  URL = ( URL + params );
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=725,height=565');");

  // [ msgForm End of Job ]
  return;

} // end msgForm function

function replace(p_string,p_text,p_by) {
// Replaces p_text with p_by in p_string
// From:  http://tech.irt.org/articles/js037/
    var strLength = p_string.length, txtLength = p_text.length;
    if ((strLength == 0) || (txtLength == 0)) return p_string;

    var i = p_string.indexOf(p_text);
    if ((!i) && (p_text != p_string.substring(0,txtLength))) return p_string;
    if (i == -1) return p_string;

    var newstr = p_string.substring(0,i) + p_by;

    if (i+txtLength < strLength)
        newstr += replace(p_string.substring(i+txtLength,strLength),p_text,p_by);

    return newstr;
}  // end replace function

// end script