// rainbo.net version 05/12/08
// modified for static.rainbo.net images 12/03/09

var rainboPink = "#ff0084";
var rootURL = "http://www.rainbo.net/";
var secureRootURL = "https://www.rainbo.net/";
var picsPath = "pics/";

//  time zone globals

   var fileScript = true;  //  show script read
   var now = new Date();
   var time1 = "";
   var time2 = "";

var storeOffset =6;     // 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);
   hourString = hourString.substr(hourString.length-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 pacific 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()

// 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 reasonably modern browser
   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; }
        }

// preload image files
     if ( canShine )    {
//   myImage10 = new Image();
//   myImage10.src = "http://static.rainbo.net/cartbar1.gif";
//   myImage11 = new Image();
//   myImage11.src = "http://static.rainbo.net/cartbar2.gif";
//   myImage12 = new Image();
//   myImage12.src = "http://static.rainbo.net/qmbar1.gif";
//   myImage13 = new Image();
//   myImage13.src = "http://static.rainbo.net/qmbar2.gif";
   }

//////////////////////////////////////
//  EMail address link support code
//////////////////////////////////////

reason = "";
myAddress = "webmaster@rainbo.net";

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=\"http://static.rainbo.net/mailicon.jpg\" width=\"36\" height=\"36\" " +
                     "alt=\"\" align=\"left\" border=\"0\" />\n");
    document.writeln("Comments or Questions?<br />\n" +
                     myAddress + "  Richard L. Trethewey</a>");
  } // end mailLink

function secureMailLink() {
    document.writeln("<a href=\"mailto:" + myAddress + "\">\n");
    document.writeln("<img src=\"" + secureRootURL + picsPath + "mailicon.jpg\" width=\"36\" height=\"36\" " +
                     "alt=\"\" align=\"left\" border=\"0\" />\n");
    document.writeln("Comments or Questions?<br />\n" +
                     myAddress + "  Richard L. Trethewey</a>");
  } // end mailLink

//////////////////////////////////////
// Zoom Functions
//////////////////////////////////////

zoomButImg = 'zoom_mag.gif';
zoomButWidth = 30;
zoomButHeight = 30;

 function autoZoomLink(tWidth, bigPict, bigWidth, bigHeight) {
  var bigPURL = bigPict;
   if (bigPict.substr(0,3) == "../") { bigPURL = bigPict.substr(3,bigPict.length-3); }
  zRef = "<a href=\"javascript:popZoom('" + bigPict + "', " +
    bigWidth + ", " + bigHeight + ")\">";
   document.write(zRef + "<img src=\"/cgi-bin/makeThumb.cgi?command=resize&file=" + bigPURL +
                         "&width=" + tWidth + "\" width=\"" + tWidth + "\" height=\"" +
                         Math.round((tWidth/bigWidth)*bigHeight) + "\" " +
        "alt=\"Click Here to see a larger image\" title=\"Click Here to see a larger image\" /><br />\n");
    document.write("&nbsp;<br /><p style=\"text-align:center;\"><img src=\"http://static.rainbo.net/zoom1.gif\" width=\"80\" height=\"19\" border=\"0\" alt=\"Pop-Up Zoom\" title=\"Pop-Up Zoom\" />&nbsp;</a></p>\n");
   }

 function nszoomLink(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\" border=\"0\" /><br />\n");
    document.write("&nbsp;<br /><p style=\"text-align:center;\"><img src=\"http://static.rainbo.net/zoom1.gif\" width=\"80\" height=\"19\" border=\"0\" alt=\"Pop-Up Zoom\" title=\"Pop-Up Zoom\" />&nbsp;</a></p>\n");
   }


 function zoomLink(thumb, tWidth, tHeight, bigPict, bigWidth, bigHeight) {
  bMargin = 6;
  zRef = "<a href=\"javascript:popZoom('" + bigPict + "', " + bigWidth + ", " + bigHeight + ")\">";

    // make outer div
   document.write("<div class=\"js_outer\" style=\"width:" + (tWidth + bMargin + bMargin) + "px; height:" +
    (tHeight + bMargin + bMargin) + 
    "px; background-color:white; border:solid 1px #c0c0c0; margin:1px auto; padding:0; position:relative; top:0; left:0;\">");

    // make image div
//   document.write("<div style=\"position:absolute; top:0; left:0; margin:0; padding:0; z-index:3; width:" + tWidth + "px; height:" + tHeight + "px;\">\n");
   document.write("<div style=\"position:absolute; top:0; left:0; margin:" + bMargin + "px; padding:0; z-index:3; width:" + tWidth + "px; height:" + tHeight + "px;\">\n");
   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\" border=\"0\" /><br />\n");
    document.write("</div>\n"); // close image div

//     // make shadow div
//    document.write("<div style=\"position:absolute; top:" + bMargin + "px; left:" + bMargin + "px; z-index:1; width:" + tWidth + "px; height:" + tHeight + "px; background-color:black;\">\n");
//    document.write("&nbsp;</div>\n"); // close shadow div

//    document.write("</div>\n"); // close outer div
    document.write("</div>\n"); // close outer div
    document.write("&nbsp;<br />");
    document.write("<p style=\"text-align:center;\"><img src=\"http://static.rainbo.net/zoom1.gif\" width=\"80\" height=\"19\" border=\"0\" alt=\"Click here to see larger image\" title=\"Click here to see larger image\" />&nbsp;</a></p>\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";

  picIndex = pictURL.indexOf('pics/', 0);
  pictURL = 'http://www.rainbo.net/wm.php?src=' + pictURL.slice(picIndex, pictURL.length);
// alert(pictURL);
    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=\"white\"");
    pZoom.document.writeln(" onblur='self.close();'");
    pZoom.document.writeln(">");
    pZoom.document.writeln("<p style=\"text-align:center;\"><img src=\"" + pictURL + "\" width=\"" + pWidth + "\" height=\"" + pHeight + "\" />\n");
    pZoom.document.writeln("<img src=\"/cgi-bin/imgCount.cgi?file=pics/spacer.gif&amp;page=zoom/" + pictURL + "\" />\n");
    pZoom.document.writeln("</p></body>\n</html>\n");
    pZoom.document.close();

 } // end popZoom


 function autoZoomLink(thumb, bigPict) {
  tGraphic = new Image();
  tGraphic.src = thumb;
  tWidth = tGraphic.width;
  tHeight = tGraphic.height;
  document.write("<br>Width: " + tWidth + "<br>");
  zRef = "<a href=\"javascript:autoPopZoom('" + bigPict + "')\">";
   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 /><p style='margin:0px; text-align:center;'><img src=\"" + rootURL + picsPath + "zoom1.gif\" width=\"80\" height=\"19\" border=\"0\" alt=\"Pop-Up Zoom\" title=\"Pop-Up Zoom\" />&nbsp;</a></p>\n");
   }


 function autoPopZoom(pictURL) {
  graphic = new Image();
  graphic.src = pictURL;
  pWidth = graphic.width;
  pHeight = graphic.height;
  var sWidth = 770;
   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("<p style='margin:0px; text-align:center;'><img src=\"" + pictURL + "\" width=\"" + pWidth + "\" height=\"" + pHeight + "\" />");
    pZoom.document.writeln("</p></body>\n</html>\n");
    pZoom.document.close();

 } // end autoPopZoom



 function popHelp() {
  var sHeight = 400;
   if ((ns4) || (ie4) || (ns6)) { sHeight = screen.availHeight; }
  var pHZoomStr = "height=" + (sHeight-50) + ",width=550,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

  var reason = "Invalid or Misspelled EMail Address";

 function checkEMail(form, userEMail)  {
   var sendMail = false;
   var reg_exp = /^[a-z][\w-\.]*@[\w-\.]+\.[a-z]{2,3}/i;
   form.email.value = userEMail.toLowerCase();
   form.browser.value = navigator.appName + " v" + navigator.appVersion;
   sendMail = reg_exp.test(userEMail.toLowerCase());
   reason = "Invalid EMail address";
 return sendMail;
   } // 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('http://static.rainbo.net/rboxb2.gif', 'right" + rLinkCount + "')\"" +
   " onmouseout=\"unshine('http://static.rainbo.net/rboxb1.gif', 'right" + rLinkCount + "')\">" +
   " <img src=\"http://static.rainbo.net/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('http://static.rainbo.net/lboxb2.gif', 'left" + lLinkCount + "')\"" +
   " onmouseout=\"unshine('http://static.rainbo.net/lboxb1.gif', 'left" + lLinkCount + "')\">" +
   " <img src=\"http://static.rainbo.net/lboxb1.gif\" width=\"40\" height=\"40\" alt=\"back icon\"" +
   " align=\"middle\" name=\"left" + lLinkCount +"\" border=\"0\" />  " + message + "</a>");

}  // end leftLink


/////////////////////////////
// anti image leeching code
////////////////////////////

var cMessage="The images and information on these pages are the copyright\n\n" +
 "property Of Rainbo Animation Art and other Copyright holders"; 

// document.onmousedown=grabClick; 

function grabClick(e) { 
   if (ie4) { 
     if (event.button == 2) { 
        alert(cMessage); 
    return false; 
      } 
  } 
    if (ns4 || ns6) {
      if (e.which == 3) { 
     alert(cMessage); 
   return false; 
    } 
   } 
 } 
    if (ns4 || ns6) { 
//   document.captureEvents(Event.MOUSEDOWN); 
  } 


///////////////////////////////
//  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 = 800;
    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();

 if (document.getElementById) {
     theElement = document.getElementById("navBox");
     navBWidth = parseInt(theElement.style.width);
     navBHeight = parseInt(theElement.style.height);
     navBLeft = wWidth - navBWidth + "px";
     navBTop = wHeight - navBHeight + "px";
     theElement.style.top = navBTop;
     theElement.style.left = navBLeft;

     interval_id = window.setInterval("updateNavBox()", 500);

   } // endif document.getElementById

// alert ("navBLeft = " + navBLeft + "\n" + "navBTop = " + navBTop + "\n");

 } // end initNavBox


//
//  navBLeft = 200;
//   navBTop = 30;
//   alert(navBLeft + "\n" + navBTop);
//

 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 + "px";
     navBTop = newBTop + "px";
     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 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;
        } //  endif .compatMode
    } // endif typeof

    return {scrollX:X,scrollY:Y};
}

// -------------------------------------------------------------------
// Courtesy: http://www.softcomplex.com/docs/get_window_size_and_scrollbar_position.html
// -------------------------------------------------------------------
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

//--------------------------------------------------------------------------------

   function setTrans(elementName,opacity) {
        if (document.getElementById) {
          theElement = document.getElementById(elementName);
            if(document.all) { // msie 5.5+
              theElement.filters.alpha.opacity=opacity;
            } else { // ns6+
              theElement.style.MozOpacity=opacity/100;
            } // endif document.all
         } // endif (document.getElementById)
    } // end setTrans


///////////////////////////////////////////
////
////   Amazon.com support
////
////     DO NOT REMOVE!
////
///////////////////////////////////////////

function popUp(URL,NAME) {
amznwin=window.open(URL,NAME,'location=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes,width=380,height=450,screenX=10,screenY=10,top=10,left=10');
amznwin.focus();}

function doAZLink(theASIN) {
document.open();
document.write("<a href=\"javascript:popUp('http://buybox.amazon.com/exec/obidos/redirect?tag=rainboelectronic&link_code=qcb&creative=23424&camp=2025&path=/dt/assoc/tg/aa/xml/assoc/-/" + theASIN + "/rainboelectronic/ref=ac_bb5_,_amazon');\"><img src=\"http://rcm-images.amazon.com/images/G/01/associates/remote-buy-box/buy5.gif\" border=\"0\" alt=\"Buy from Amazon.com\"></a>\n");
document.close();
 } // end doAZLink


function doPopAZLink(theASIN) {
document.open();
document.write("<p class=\"itemdes\"><b>NOTE:</b> This item is available through Amazon.com<br />\n");
document.write("<a href=\"javascript:popUp('http://buybox.amazon.com/exec/obidos/redirect?tag=rainboelectronic&link_code=qcb&creative=23424&camp=2025&path=/dt/assoc/tg/aa/xml/assoc/-/" + theASIN + "/rainboelectronic/ref=ac_bb5_,_amazon');\" rel=\"nofollow\"><img src=\"http://static.rainbo.net/more-info-yellow.gif\" border=\"0\" alt=\"Click here for more info from Amazon.com\"></a><br /></p>\n");
document.close();
 } // end doAZLink

function doDirectAZLink(theASIN) {
document.write("<div style=\"width:75%; margin:3px auto; padding:4px; border:solid 2px blue;\">\n");
document.write("<p class=\"itemdes\"><b>NOTE:</b> This toy is currently available through Amazon.com<br />\n");
document.write("<br />\n");
document.write("<b><a class=\"reg\" href=\"http://www.amazon.com/gp/search?ie=UTF8&keywords=" + theASIN + "&tag=rainboelectronic&index=blended&linkCode=ur2&camp=1789&creative=9325\" rel=\"nofollow\">Click here for <img src=\"http://static.rainbo.net/more-info-yellow.gif\" border=\"0\" alt=\"Click here for more info from Amazon.com\"></a><img src=\"http://www.assoc-amazon.com/e/ir?t=rainboelectronic&amp;l=ur2&amp;o=1\" width=\"1\" height=\"1\" border=\"0\" alt=\"\" style=\"border:none !important; margin:0px !important;\" /><br /></b>\n");
document.write("</p>\n");
document.write("</div>\n");
 } // end doAZLink

 function amazonAd() { // used on /index.html!
 document.write("<p class=\"smalltext\">We are proud to be an Amazon.com affiliate.  You can click on the picture of most of the items we review and immediately order it from Amazon.com at a great price!  We'd appreciate it if, whenever you want to shop at Amazon.com that you come here first and click on the Amazon.com icon shown above here.  The commissions help keep us online and serving our readers.  Thanks!<br /></p>");
  }



