var popUpWindow = null;
var popUpWindowCount = 0;
var popUpWindowName = "popUpWindow";
var cookieString = "";
var preloadFlag = 0;


// ***************************
function toi_doItWithStyle()
// ***************************
{
  document.write( '<STYLE TYPE="text/css">');
  document.write( '	BODY');
  document.write( '	{ ');
  document.write( ' font-family: verdana, arial, helvetica; font-size: 10pt;');
  document.write( '	scrollbar-base-color: 0076A3; ');
  document.write( '	scrollbar-arrow-color: 63AFCC;');
  document.write( '	scrollbar-DarkShadow-Color: 025778;');
  document.write( '	scrollbar-Highlight-Color: 9FCCDD; ');
  document.write( '	}');
  document.write( '.f8blue {text-decoration: none; color:#2C60BE; font-size: 8pt; line-height: 9pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.f8blue:hover {text-decoration: underline; color:#000000}');
  document.write( '.f9blue {text-decoration: none; color:#2C60BE; font-size: 9pt; line-height: 10pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.f9blue:hover {text-decoration: underline; color:#000000}');
  document.write( '.f9black {text-decoration: none; color:#000000; font-size: 9pt; line-height: 10pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.f9black:hover {text-decoration: underline; color:#000000}');

  document.write( '.f10blue {text-decoration: none; color:#2C60BE; font-size: 10pt; line-height: 12pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.f10blue:hover {text-decoration: underline; color:#000000}');
  document.write( '.f10red {text-decoration: none; color:#FF0000; font-size: 10pt; line-height: 12pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.f10red:hover {text-decoration: underline; color:#FF0000}');
  document.write( '.f10black {text-decoration: none; color:#2C60BE; font-size: 10pt; line-height: 12pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.f10black:hover {text-decoration: underline; color:#000000}');

  document.write( '.largebluetext {text-decoration: none; color:#2C60BE; font-size: 14pt; line-height: 15pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.largebluetext:hover {text-decoration: underline; color:#2C60BE}');
  document.write( '.bigbluetext {text-decoration: none; color:#2C60BE; font-size: 12pt; line-height: 13pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.bigbluetext:hover {text-decoration: underline; color:#2C60BE}');
  document.write( '.lilblueitalic {text-decoration: none; color:#2C60BE; font-size: 7pt; line-height: 8pt; font-style: italic; font-family: verdana,arial,helvetica}');
  document.write( 'a.lilblueitalic:hover {text-decoration: underline; color:#000000}');
  document.write( '.hugeblacktext {text-decoration: none; color:#000000; font-size: 15pt; line-height: 16pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.hugeblacktext:hover {text-decoration: underline; color:#000000}');
  document.write( '.bigblacktext {text-decoration: none; color:#000000; font-size: 10pt; line-height: 12pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.bigblacktext:hover {text-decoration: underline; color:#000000}');
  document.write( '.medblacktext {text-decoration: none; color:#000000; font-size: 8pt; line-height: 9pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.medblacktext:hover {text-decoration: underline; color:#000000}');
  document.write( '.medredtext {text-decoration: none; color:#FF0000; font-size: 8pt; line-height: 9pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.medredtext:hover {text-decoration: underline; color:#000000}');
  document.write( '.medwhitetext {text-decoration: none; color:#FFFFFF; font-size: 8pt; line-height: 9pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.medwhitetext:hover {text-decoration: underline; color:#000000}');
  document.write( '.lilblacktext {text-decoration: none; color:#000000; font-size: 7pt; line-height: 8pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.lilblacktext:hover {text-decoration: underline; color:#000000}');
  document.write( '.lilbluetext {text-decoration: none; color:#2C60BE; font-size: 7pt; line-height: 8pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.lilbluetext:hover {text-decoration: underline; color:#2C60BE}');
  document.write( '.lilredtext {text-decoration: none; color:#FF0000; font-size: 7pt; line-height: 8pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.lilredtext:hover {text-decoration: underline; color:#2C60BE}');
  document.write( '.tinyblacktext {text-decoration: none; color:#000000; font-size: 7pt; line-height: 8pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.tinyblacktext:hover {text-decoration: underline; color:#000000}');
  document.write( '.tinybluetext {text-decoration: none; color:#2C60BE; font-size: 7pt; line-height: 8pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.tinybluetext:hover {text-decoration: underline; color:#2C60BE}');
  document.write( '.links {text-decoration: none; color:#000000; font-size: 7pt; line-height: 11pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.links:hover {text-decoration: bold; color:#0076A3}');
  document.write( '.tinygreytext {text-decoration: none; color:#9a9a9a; font-size: 7pt; line-height: 8pt; font-family: verdana,arial,helvetica}');
  document.write( 'a.tinygreytext:hover {text-decoration: underline; color:#9a9a9a}');
  document.write( '</STYLE>');
  toi_preloadImages();
}
// ****************************
function toi_textLinkTable()
// ****************************
{
  document.write(' <table width=733 border="0" cellpadding="0" cellspacing="0">');
  document.write('   <tr>');
  document.write('     <td valign="top" align="center" class="tinyblacktext" bgcolor=#EDEFF4>');
  document.write('       &nbsp;&nbsp;<a href="index.html" class="tinyblacktext">Home</a>&nbsp;&nbsp;<B>|</B>&nbsp;&nbsp;');
  document.write('       <a href="bjs-about.htm" class="tinyblacktext">About</a>&nbsp;&nbsp;<B>|</B>&nbsp;&nbsp;');
  document.write('       <a href="bjs-services.htm" class="tinyblacktext">Services</a>&nbsp;&nbsp;<B>|</B>&nbsp;&nbsp;');
  document.write('       <a href="bjs-contacts.htm" class="tinyblacktext">Contacts</a>&nbsp;&nbsp;<B>|</B>&nbsp;&nbsp;');
  document.write('       <a href="bjs-directions.htm" class="tinyblacktext">Directions</a>&nbsp;&nbsp;<B>|</B>&nbsp;&nbsp;');
  document.write('       <a href="bjs-links.htm" class="tinyblacktext">Links</a>&nbsp;&nbsp;');
  document.write('     </TD>');
  document.write('   </tr>');
  document.write(' </TABLE> ');
}

// **************************************
function toi_copyAndDesign()
// copy right notice and design credit.
// **************************************
{
		document.write('<table width=550 border="0" cellpadding="0" cellspacing="0">');
			document.write('<tr>');
				document.write('<td valign="top" align="center" class="tinyblacktext"><br /><a href="bjs-disclaimer.html">Read Disclaimer</a><br />Copyright &copy; 2008&nbsp;Barbara J. Sarvis - ');
						document.write(' All Rights Reserved. <br />Design: 3rd Origin');
						
						
				document.write('</td>');
			document.write('</tr>');
		document.write('</table>');
}

// *********************************************************
function toi_getCookieVar( forString )
// This function gets the value associated with "forString"
// from the cookie. Return value is numeric
// *********************************************************
{
  var testString = "";
  testString = toi_getCookieStr(forString);
  if( testString == "" )
    return 0;
  else
    return testString.valueOf();
}

// ************************************************************************
function toi_getCookieStr( forString )
// This function gets the value associated with "forString"
// from the cookie. Return value is alpa string.
// Example: to retrieve the value of a cookie named
// NUMBEROFHOUSES: var numberOfHouses = toi_getCookieStr("NUMBEROFHOUSES");
// Note that numberOfHouses will be "24" (string) not 24.0 number.
// To get a numeric value, see function toi_getCookieVar.
// ************************************************************************
{
  var index;
  var namestart;
  var nameend;
  // if this function fails to get a valid string retString
  // will be returned with NULL value.
  var retString = "";
  if(document.cookie)  // is there a cookie?
  {
    // if the cookie exists, get the character position of
    // the first occurance of "forString" in the cookie and
    // assign it to the index variable. -1 is the result
    // when the string is not found within the cookie.
    index = document.cookie.indexOf(forString);
    if (index != -1)
    {
      namestart = (document.cookie.indexOf("=", index) + 1);
      if( namestart == -1 )
        retString = "";
      else
      {
        nameend = document.cookie.indexOf(";", index);
        if (nameend == -1)
        {
          nameend = document.cookie.length;
          retString = document.cookie.substring(namestart, nameend);
        }
        else if ( nameend > namestart )
        {
          retString = document.cookie.substring(namestart, nameend);
        }
      }
    }
  }
  return unescape(retString);
}

// ******************************************
function toi_putCookieVar( forString, sVal, perma )
//
// Save a temporary cookie.
// Example: to save the value of 24 as numberOfHouses
// var numberOfHouses = 12;
// toi_putCookieVar( "NUMBEROFHOUSES", numberOfHouses );
// ******************************************
{
  if( perma > 0)
  {
    //create a cookie expiration date variable
    var expdate = new Date ();
    expdate.setTime (expdate.getTime() + (365 * 24 * 60 * 60 * 1000));
    document.cookie = forString+ "=" +sVal+ "; expires=" + expdate.toGMTString();
  }
  else if( perma < 0 )
    {document.cookie = forString+ "=" +sVal+ "; expires=Thu, 01-Jan-70 00:00:01 GMT";}
  else
    {document.cookie = forString+ "=" +sVal}
}

// ****************************
function toi_deleteCookie( forString )
// ****************************
{
  toi_putCookieVar( forString, "expired", -1 );
  //document.cookie = forString+ "=''; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
// **************************
function toi_changeImages()
// **************************
{
	if (document.images && (preloadFlag > 0))
	{
		for (var i=0; i<toi_changeImages.arguments.length; i+=2)
		{
			document[toi_changeImages.arguments[i]].src = toi_changeImages.arguments[i+1];
		}
	}
}

// ******************************************************************
function toi_openPopUpWindow(daURL, daWidth, daHeight, daFeatures)
// ******************************************************************
{
  popUpWindowName = "popUpWindow" + popUpWindowCount++;
  toi_closePopUpWindow();
  if (toi_openPopUpWindow.arguments.length >= 4)
     daFeatures = "," + daFeatures;
   else
     daFeatures = "";
   popUpWindow = window.open(daURL, popUpWindowName, "width=" + daWidth + ",height=" + daHeight + daFeatures);
}

// ******************************************************************
function toi_closePopUpWindow()
// ******************************************************************
{
  if( navigator.appName != "Microsoft Internet Explorer" || parseInt(navigator.appVersion) >=4)
    if(popUpWindow != null)
      if(!popUpWindow.closed)
        popUpWindow.close()
}

// ******************************************************************
function toi_imageMapLinks()
// ******************************************************************
{
  /*
  document.write(' <Map Name="mtom">');
  document.write('   <area shape="rect" coords="5,9,80,75" href="javascript:toi_openPopUpWindow( \'tipofthemonth.htm\', 480, 200 );" onMouseOver="toi_changeImages(\'itom\', \'images/bjs-sub02mo.gif\');" onMouseOut="toi_changeImages(\'itom\', \'images/bjs-sub02.gif\');" onClick="if(this.blur)this.blur();">');
  document.write(' </map>');
  */
  document.write(' <Map Name="mhome">');
  document.write('   <area shape="rect" coords="17,2,63,17" href="index.html" onMouseOver="toi_changeImages(\'iHome\', \'images/bjs-sub04mo.gif\');" onMouseOut="toi_changeImages(\'iHome\', \'images/bjs-sub04.gif\');" onClick="if(this.blur)this.blur();">');
  document.write(' </map>');
  document.write(' <Map Name="mlinks">');
  document.write('   <area shape="rect" coords="23,1,67,17" href="bjs-links.htm" onMouseOver="toi_changeImages(\'iLinks\', \'images/bjs-sub08mo.gif\');" onMouseOut="toi_changeImages(\'iLinks\', \'images/bjs-sub08.gif\');" onClick="if(this.blur)this.blur();">');
  document.write(' </map>');
  document.write(' <Map Name="mcontacts">');
  document.write('   <area shape="rect" coords="4,2,80,17" href="bjs-contacts.htm" onMouseOver="toi_changeImages(\'iContacts\', \'images/bjs-sub07mo.gif\');" onMouseOut="toi_changeImages(\'iContacts\', \'images/bjs-sub07.gif\');" onClick="if(this.blur)this.blur();">');
  document.write(' </map>');
  document.write(' <Map Name="mservices">');
  document.write('   <area shape="rect" coords="7,2,78,17" href="bjs-services.htm" onMouseOver="toi_changeImages(\'iServices\', \'images/bjs-sub06mo.gif\');" onMouseOut="toi_changeImages(\'iServices\', \'images/bjs-sub06.gif\');" onClick="if(this.blur)this.blur();">');
  document.write(' </map>');
  document.write(' <Map Name="mAbout">');
  document.write('   <area shape="rect" coords="17,2,69,16" href="bjs-about.htm" onMouseOver="toi_changeImages(\'iAbout\', \'images/bjs-sub05mo.gif\');" onMouseOut="toi_changeImages(\'iAbout\', \'images/bjs-sub05.gif\');" onClick="if(this.blur)this.blur();">');
  document.write(' </map>');
}

// ************************
function toi_preloadImages()
// ************************
{
	if (document.images)
	{
		p1 = toi_newImage("images/bjs-main_02mo.gif");
		p2 = toi_newImage("images/bjs-main_04mo.gif");
		p3 = toi_newImage("images/bjs-main_08mo.gif");
		p4 = toi_newImage("images/bjs-main_11mo.gif");
		p5 = toi_newImage("images/bjs-main_14mo.gif");
		p6 = toi_newImage("images/bjs-sub02mo.gif");
		p7 = toi_newImage("images/bjs-sub04mo.gif");
		p8 = toi_newImage("images/bjs-sub05mo.gif");
		p9 = toi_newImage("images/bjs-sub06mo.gif");
		p10 = toi_newImage("images/bjs-sub07mo.gif");
		p11 = toi_newImage("images/bjs-sub08mo.gif");

		preloadFlag = 1;
	}
}
// **********************
function toi_newImage(arg)
// ***********************
{
	if (document.images)
	{
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

