// rainborick.inpacifica.com version updated 09/09/04 //  time zone globals

   var fileScript = true;  //  show script read
   var now = new Date();
   var time1 = "";
   var time2 = "";

var storeOffset = 5;     // GMTOffset for store (fixed)
var localOffset = now.getTimezoneOffset()/60;    // local user GMT offset (calculated)
var openBase = 9;        // store open hour military time
var closeBase = 17;      // store close hour military time

function local2GMT(localHour) {
   var GMTHour = localHour + storeOffset;
     if (GMTHour >= 24) { GMTHour -= 24; }
     if (GMTHour < 0) { GMTHour += 24; }
   return GMTHour;
 }

function GMT2Local(GMTHour) {
   var localHour = GMTHour - localOffset;
     if (localHour >= 24) { localHour -= 24; }
     if (localHour < 0) { localHour += 24; }
   return localHour;
 }

function timeString(hourNum) {
   var meridien = ":00 AM";
    if (hourNum > 12) {
      meridien = ":00 PM";
      hourNum -= 12;
     }
   var hourString = String(hourNum);
   var hLength = hourString.length;
   hourString = hourString.substr(hLength-2,2)
   return hourString.concat(meridien);
 } // end timeString

function showLocal() {
  if (document.images) {  // test for really old browsers
    time1 = timeString(GMT2Local(local2GMT(openBase)));
    time2 = timeString(GMT2Local(local2GMT(closeBase)));
 if (localOffset != storeOffset) { // if user's offset not local time
   document.writeln(", which is from " + time1 + " to " + time2 + " your local time,");
       } // endif (localOffset != storeOffset)
     else {
   document.writeln(", which is also your local time, ");
       } // end else
  } // endif document.images
} // end showLocal()



var rainboPink = "#ff0084";


// dynamic HTML code
//  dynamic HTML globals
//  test for advanced browsers
    var canShine = false;
    var canDynamic = false;

    var ns4 = false;
    var ns6 = false;
    var ie4 = false;
    var ie5 = false;

    var agt=navigator.userAgent.toLowerCase();
    var ieIndex = agt.indexOf("msie ");
     if (ieIndex != -1) {  // we have new IE!
       ieVersion = parseInt(agt.substr(ieIndex + 5));
        }

// we don't use is_nav yet

    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var nsIndex = agt.indexOf("netscape/");
     if ((is_nav) && (nsIndex != -1)) {  // we have new NS!
       nsVersion = parseInt(agt.substr(nsIndex + 9));
        }

   if (document.layers) { nsVersion = parseFloat(navigator.appVersion); }

      if (document.layers) { ns4 = true; }
      if (document.all) { ie4 = true; }
      if (document.getElementById && !document.all) { ns6 = true; }
      if (document.getElementById && document.all) { ie5 = true; }

// Test for modern browsers
   if (document.images) { canShine = true; }

// Test for Dynamic HTML browsers
   if ((ns4) || (ns6) || (ie5)) { canDynamic = true; }


 function shine(fname, iname)  {
     if (canShine == true)  { document.images[iname].src=fname; } 
        }

 function unshine(fname, iname)  {
     if (canShine == true)  { document.images[iname].src=fname; }
        }


//  EMail address link support code

reason = "";
myAddress = "rick@rainbo.net";
myName = "Richard L. Trethewey";

function nameLink() {
    document.writeln("<a href=\"mailto:" + myAddress + "\">" + myAddress + "</a>");
   }  // end nameLinke

function mailLink() {
    document.writeln("<a href=\"mailto:" + myAddress + "\">\n");
    document.writeln("<img src=\"/pics/mailicon.jpg\" width=\"36\" height=\"36\" " +
                     "alt=\"mailbox icon\" title=\"mailbox icon\" align=\"left\" border=\"0\" />\n");
    document.writeln("&nbsp;Comments or Questions?<br />\n&nbsp;" +
                     myAddress + "  " + myName + "</a>\n");
  } // end mailLink

function secureMailLink() {
    document.writeln("<a href=\"mailto:" + myAddress + "\">\n");
    document.writeln("<img src=\"/pics/mailicon.jpg\" width=\"36\" height=\"36\" " +
                     "alt=\"mailbox icon\" title=\"mailbox icon\" align=\"left\" border=\"0\" />\n");
    document.writeln("&nbsp;Comments or Questions?<br />&nbsp;\n" +
                     myAddress + "  " + myName + "</a>\n");
  } // end mailLink


 function zoomLink(thumb, tWidth, tHeight, bigPict, bigWidth, bigHeight) {
  zRef = "<a href=\"javascript:popZoom('" + bigPict + "', " +
    bigWidth + ", " + bigHeight + ")\">";
   document.write(zRef + "<img src=\"" + thumb + "\" " +
        "width=\"" + tWidth + "\" height=\"" + tHeight + "\" " +
        "alt=\"Click Here to see a larger image\" title=\"Click Here to see a larger image\" /><br />\n");
    document.write("&nbsp;<br /><center><img src=\"/pics/zoom1.gif\" width=\"80\" height=\"19\" border=\"0\" alt=\"Pop-Up Zoom\" title=\"Pop-Up Zoom\" />&nbsp;</a></center>\n");
   }

 function popZoom(pictURL, pWidth, pHeight) {
  var sWidth = 640;
   if ((ns4) || (ie4) || (ns6)) { sWidth = screen.availWidth; }
  var x1 = pWidth+30;
  var y1 = pHeight+30;
  var pZoomStr = "height=" + y1 + ",width=" + x1 + ",left=" + ((sWidth-x1)/2) +
      ",top=60,scrollbars=0,menubar=0";
    pZoom = window.open("","", pZoomStr);
    pZoom.document.open();
    pZoom.document.writeln("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
    pZoom.document.writeln("<html>\n<head>\n<title>Rainbo: Zoom View of " + pictURL + "</title>");
    pZoom.document.writeln("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
    pZoom.document.writeln("</head>\n<body bgcolor=\"skyblue\" onblur='self.close();'>");
    pZoom.document.writeln("<center><img src=\"" + pictURL + "\" width=\"" + pWidth + "\" height=\"" + pHeight + "\" />");
    pZoom.document.writeln("</center></body>\n</html>\n");
    pZoom.document.close();

 } // end popZoom

 function popHelp() {
  var sHeight = 400;
   if ((ns4) || (ie4) || (ns6)) { sHeight = screen.availHeight; }
  var pHZoomStr = "height=" + (sHeight-50) + ",width=450,left=40,top=20,scrollbars=1,menubar=1";
    pHZoom = window.open("http://www.rainbo.net/help.htm","", pHZoomStr);

 } // end popHelp

// cookies library

var db = (ie4) ? 1 : 0;                  // test for MSIE (was document.body)
var hasCookies = false;                  // global cookies flag

function canCookie(temp) {
    setCookie("test", "1");
    temp = getCookie("test");
    if (temp != null) {
        hasCookies = true;
        deleteCookie("test");
       }  else { 
    hasCookies = false; } // endIf
   return hasCookies;
 } // end canCookie


function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else {
    begin += 2;
  }
  var end = document.cookie.indexOf(";", begin);
  if (end == -1) end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name) {
  var exp = new Date();
  exp.setTime(exp.getTime() - 1);  // this cookie is history!
  var cval = getCookie(name);
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
 } // end deleteCookie

 function getDomain() {
  var dName = unescape(document.location);
  var len = dName.length;
  var start = dName.indexOf("/");  // find the first forward slash
   for (i = start; i <= len; i++) {
      if (dName.substring(i, i+1) != "/") { break; }
     }
  if (i == len) { return null }
  dName = dName.substring(i, dName.lastIndexOf("/"));
  dot = dName.lastIndexOf(".");
  if (dot == -1) { return null; }
  dType = dName.substring(dot, dName.length);
  if ((dType != ".com") && (dType != ".net")) { return null }
 return dName;
 } // end getDomain


 function getDocName() { 
  var loc = unescape(document.location); // our current location
  var lloc = loc.length;                 // string length
  var slashIndex = 0;                    // index of slash

  for (i=lloc; i>0; i--) {
    c = loc.substring(i-1,i);
     if ((c == "/") || (c == "\\")) { 
            slashIndex = i; 
            break;
          } // endIf
     }  // end for
     return loc.substring(slashIndex, lloc);
 }  // end getDocName

// scroll position save support
var canScrollTo = (window.scrollTo) ? 1 : 0;  // window scrolling available flag

function saveScroll(thePage) {
  if (!canScrollTo) return;
  var db = false;
  if (ie4) { db = true; } 
  var now = new Date();
  pageName = "";
  if (thePage == null) 
  {  pageName = getDocName(); }
    else
  {  pageName = thePage; 
     i = pageName.indexOf("/", 0);
     k = pageName.length;
     pageName = pageName.substring(i, k); }
  var i = pageName.indexOf(".", 0);
  pageName = pageName.substring(0, i);
  now.setTime(now.getTime() + 1 * 24 * 60 * 60 * 1000);  // expires in 1 day
  var x = (db) ? document.body.scrollLeft : window.pageXOffset;
  var y = (db) ? document.body.scrollTop : window.pageYOffset;
  setCookie(pageName + "xy", x + "_" + y, now);
} // end saveScroll

function loadScroll(thePage) {
  var pageName = "";
  if (!canScrollTo) return;
  if (thePage == null) 
  {  pageName = getDocName(); }
    else
  {  pageName = thePage; 
     i = pageName.indexOf("/", 0);
     k = pageName.length;
     pageName = pageName.substring(i, k);  }
  i = pageName.indexOf(".", 0);
  pageName = pageName.substring(0, i);
  var xy = getCookie(pageName + "xy");
  if (!xy) { return; }
  var ar = xy.split("_");
  if (ar.length == 2) scrollTo(parseInt(ar[0]), parseInt(ar[1]));
} // end loadScroll

 function checkEMail(userEMail)  {
   var sendMail = false;
   var EMail_reg_exp = /^[a-z][\w\.]*@[\w\.]+\.[a-z]{2,3}/i;
   reason = "Invalid EMail address";
   return EMail_reg_exp.test(userEMail.toLowerCase());
   } // end checkEMail


// link constants - replaces "rightnum" and "leftnum" parameters in original code
rLinkCount = 0;
lLinkCount = 0;

function rightLink(link, message, rightnum) {
 rLinkCount = rLinkCount + 1;
document.writeln("<a href=" + link + 
   " onmouseover=\"shine('../pics/rboxb2.gif', 'right" + rLinkCount + "')\"" +
   " onmouseout=\"unshine('../pics/rboxb1.gif', 'right" + rLinkCount + "')\">" +
   " <img src=\"/pics/rboxb1.gif\" width=\"40\" height=\"40\" alt=\"forward icon\"" +
   " align=\"middle\" name=\"right" + rLinkCount + "\" border=\"0\" />  " + message + "</a>");

}  // end rightLink

function leftLink(link, message, leftnum) {
 lLinkCount = lLinkCount + 1;
document.writeln("<a href=" + link + 
   " onmouseover=\"shine('../pics/lboxb2.gif', 'left" + lLinkCount + "')\"" +
   " onmouseout=\"unshine('../pics/lboxb1.gif', 'left" + lLinkCount + "')\">" +
   " <img src=\"/pics/lboxb1.gif\" width=\"40\" height=\"40\" alt=\"back icon\"" +
   " align=\"middle\" name=\"left" + lLinkCount +"\" border=\"0\" />  " + message + "</a>");

}  // end leftLink


//
// anti image leeching code
//


//
//  common links generators
//

 function thumbLink (bigPict, smallPict, theWidth, theHeight) {
   document.write("<a href=\"" + bigPict + "\" target=\"_blank\">");
   document.writeln("<img src=\"" + smallPict + "\" width=\"" + theWidth +
    "\" height=\"" + theHeight + "\" alt=\"Click here to see a Larger View\" title=\"Click here to see a Larger View\" align=\"left\" /></a>");
 } // end thumbLink

function getTZWindowWidth() {
  var myWidth = 640;
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
      }
    }
  return myWidth;
} // end getTZWindowWidth

function getTZWindowHeight() {
  var myHeight = 480;
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myHeight = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myHeight = document.body.clientHeight;
      }
    }
  return myHeight;
} // end getTZWindowHeight

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else {
    if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
      //DOM compliant
      scrOfY = document.body.scrollTop;
      scrOfX = document.body.scrollLeft;
    } else {
      if( document.documentElement &&
          ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
      	//IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
      }
    }
  }
  return [ scrOfX, scrOfY ];
}

function getTZScrollTop() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else {
    if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
      //DOM compliant
      scrOfY = document.body.scrollTop;
    } else {
      if( document.documentElement &&
          ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
      	//IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
      }
    }
  }
  return scrOfY;
} // end getTZScrollTop

function getTZScrollLeft() {
  var scrOfX = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfX = window.pageXOffset;
  } else {
    if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
      //DOM compliant
      scrOfX = document.body.scrollLeft;
    } else {
      if( document.documentElement &&
          ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
      	//IE6 standards compliant mode
        scrOfX = document.documentElement.scrollLeft;
      }
    }
  }
  return scrOfX;
} // end getTZScrollLeft

//
// navBox support code
navBTop = 0;
navBLeft = 0;
navBWidth = 0;
navBHeight = 0;
interval_id = 0;
sBarWidth = 18;

 function initNavBox() {
     sLeft = getTZScrollLeft();
     sTop = getTZScrollTop();
     wWidth = getTZWindowWidth();
     wHeight = getTZWindowHeight();

// alert ("sLeft = " + sLeft + "\n" +
// "sTop = " + sTop + "\n" +
// "wWidth = " + wWidth + "\n" +
// "wHeight = " + wHeight + "\n");

 if (document.getElementById) {
     theElement = document.getElementById("navBox");
     navBWidth = parseInt(theElement.style.width);
     navBHeight = parseInt(theElement.style.height);
    navBLeft = wWidth - navBWidth;
    navBTop = wHeight - navBWidth;
     theElement.style.top = navBTop;
     theElement.style.left = navBLeft;
     interval_id = window.setInterval("updateNavBox()", 500);
    } // endif document.getElementById

  } // end initNavBox


 function updateNavBox() {
     sLeft = getTZScrollLeft();
     sTop = getTZScrollTop();
     wWidth = getTZWindowWidth();
     wHeight = getTZWindowHeight();

  if (document.getElementById) {
     theElement = document.getElementById("navBox");
    newBLeft = wWidth + sLeft - navBWidth;
    newBTop = wHeight + sTop - navBHeight;
      if ((newBLeft != navBLeft) || (newBTop != navBTop)) {
     navBLeft = newBLeft;
     navBTop = newBTop;
     theElement.style.top = navBTop;
     theElement.style.left = navBLeft;
    } // endif newBLeft || newBTop
   } // endif document.getElementById

 } // end updateNavBox

 function killNavBox() {
 if (document.getElementByID) {
    window.clearInterval(interval_id);
    }
  } // end killNavBox

// end navBox support code


//
// DHTML support code - including animation
//

function display(id, str) {
  if (canDynamic) { // if browser supports style sheets
    if (document.layers) { // if Navigator 4.x
      with (document[id].document) {
        open(); // open document
        write(str); // write to document
        close(); // close document
      } // end with
    } else if (document.getElementById) { // Internet Explorer 5.x or ns6+
      document.getElementById(id).innerHTML = str; // "assign" to element
    } // end else
  } // end if(ns4 || ie4)
} // end display

function swapClass(text, spName, urlName, oldName, clName, over) {
  if (bVer < 4) { // old browser
    return; // terminate the function
  }  

  // create a new string for the link
  // change the link's class to clName (it was oldName before)
  var str = "<a class='" + clName + "' href='" + urlName + "'";
  if (over) {
    // replace onMouseOver with onMouseOut
    // replace true with false
    str += " onmouseout=\"swapClass(\'" + text + "\', \'" + spName +
           "\', \'" + urlName + "\', \'" + clName +
           "\', \'" + oldName + "\', false)\">";
  } else {
    // replace onMouseOut with onMouseOver
    // replace false with true
    str += " onmouseover=\"swapClass(\'" + text + "\', \'" + spName +
           "\', \'" + urlName + "\', \'" + clName +
           "\', \'" + oldName + "\', true)\">";
  }
  str += text + "</a>";
  display(spName, str); // update the code
}


// animation globals

  xIncrement = -5;
  yIncrement = -5;
  startLeft = 800;
  maxLeft = 750;
  startTop = 520;
  maxTop = 470;
  loops = 0;
  maxLoops = 1000;
  loopTimer = 50;


 function initAnimation() {

   if ((ns6) || (ie4)) {
      if (document.body.clientWidth) {
     wWidth = document.body.clientWidth;
     wHeight = document.body.clientHeight;
        } else { // if (ns4)
     wWidth = window.innerWidth;
     wHeight = window.innerHeight;
        } // endif document.body.clientWidth

   if (agt.indexOf("msie 6.") != -1) {
     wWidth = document.documentElement.clientWidth;
     wHeight = document.documentElement.clientHeight;
     }

       if (document.getElementById) {
   theElement = document.getElementById("zoomer");
     maxLeft = wWidth - parseInt(theElement.style.width);
     maxTop = wHeight - parseInt(theElement.style.height);
        } // endif (document.getElementById)

    } // endif (new browser)

   if (document.layers) {
     wWidth = window.innerWidth;
     wHeight = window.innerHeight;
    maxLeft = wWidth - document.zoomer.left;
    maxTop = wHeight - document.zoomer.height;
 } // endif ns4/document.layers

    moveIt();  // first call to moveIt(); initializes animation with setTimeout

  } // end animation code init


function moveIt() {

  if(document.layers) {
       newLeft = document.zoomer.left + xIncrement;
   if (newLeft < 0) { newLeft = 0; xIncrement = (xIncrement * (-1)); }
   if (newLeft > maxLeft) { newLeft = maxLeft; xIncrement = (xIncrement * (-1)); }
       document.zoomer.left = newLeft;
       newTop = document.zoomer.top + yIncrement;
   if (newTop < 0) { newTop = 0; yIncrement = (yIncrement * (-1)); }
   if (newTop > maxTop) { newTop = maxTop; yIncrement = (yIncrement * (-1)); }
       document.zoomer.top = newTop;
   }  // end if ns4/document.layers

  if (document.getElementById) {  // ns6+ || ie5+
   theElement = document.getElementById("zoomer");
     newLeft = parseInt(theElement.style.left) + xIncrement;
   if (newLeft < 0) { newLeft = 0; xIncrement = (xIncrement * (-1)); }
   if (newLeft > maxLeft) { newLeft = maxLeft; xIncrement = (xIncrement * (-1)); }
     theElement.style.left = newLeft + "px";
     newTop = parseInt(theElement.style.top) + yIncrement;
   if (newTop < 0) { newTop = 0; yIncrement = (yIncrement * (-1)); }
   if (newTop > maxTop) { newTop = maxTop; yIncrement = (yIncrement * (-1)); }
     theElement.style.top = newTop + "px";
     }

        if ((document.all) && (!document.getElementById)) {  // ie4 only!
      zoomer.style.left = parseInt(zoomer.style.left) + xIncrement; //
      zoomer.style.top = parseInt(zoomer.style.top) + yIncrement; //
      if (parseInt(zoomer.style.left) < 0) { zoomer.style.left = 0; xIncrement = (xIncrement * (-1)); } //
      if (parseInt(zoomer.style.left) > maxLeft) { newLeft = maxLeft; xIncrement = (xIncrement * (-1)); } //
      if (parseInt(zoomer.style.top) < 0) { zoomer.style.top = 0; yIncrement = (yIncrement * (-1)); } //
      if (parseInt(zoomer.style.top) > maxTop ) { newTop = maxTop; yIncrement = (yIncrement * (-1)); } //
         } // endif (ie4)

    loops++;
     if (loops < maxLoops) {
      setTimeout('moveIt()', loopTimer); 
        } else {

        if (document.getElementById) {
          theElement = document.getElementById("zoomer");
          theElement.style.visibility = "hidden";
           }

        if ((document.all) && (!document.getElementById)) {  // ie4 only!
          zoomer.style.visibility = "hidden";
           }

    } // endif (loops < maxLoops

} // end moveIt

function testfunction() { 
  if ( (typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function") )
 { window.sidebar.addPanel ("Developer's Guide","/docs/manuals/browser/sidebar/sbtoc1.html",""); } 

} 

function getPageScroll(){
    var X, Y;
    if(typeof window.pageXOffset == 'number'){
        X = window.pageXOffset;
        Y = window.pageYOffset;
    }else{
        if((window.document.compatMode)&&
                  (window.document.compatMode == 'CSS1Compat')){
            X = window.document.documentElement.scrollLeft;
            Y = window.document.documentElement.scrollTop;
        }else{
            X = window.document.body.scrollLeft;
            Y = window.document.body.scrollTop;
        }
    }
    return {scrollX:X,scrollY:Y};
}


