msie = navigator.appVersion.indexOf("MSIE") != -1; 
function layerSupport() {return (document.all || document.layers);} 
layers = new Array();
layerX = new Array();
layerY = new Array();
cursorX = 0;
cursorY = 0; 
function getViewWidth() {if (msie) return document.body.clientWidth; 
else return window.innerWidth;} 
function getViewHeight() {if (msie) return document.body.clientHeight; 
else return window.innerHeight;} 
function getViewXOffset() {if (msie) return document.body.scrollLeft; 
else return window.pageXOffset;} 
function getViewYOffset() {if (msie) return document.body.scrollTop; 
else return window.pageYOffset;} 
function getLayerX(i) {return layerX[i];} 
function getLayerY(i) {return layerY[i];} 
function moveLayer(i, x, y) {layerX[i] = x; layerY[i] = y; 
if (msie) {layers[i].style.pixelLeft = x; layers[i].style.pixelTop = y;} 
else {layers[i].left = x; layers[i].top = y;}}
function setVisible(i, show) {if (msie) layers[i].style.visible = show ? "show" : "hidden"; 
else layers[i].visibility = show;}
function outOfBounds(config, x, y, w, h) {var result = 0;
  // note that fudge factor isn't used for bottom
  if (x < getViewXOffset() - config.xFudge)
    result |= 1; // Left
  else if (x + w >= getViewXOffset() + getViewWidth() + config.xFudge)
    result |= 2; // Right
  
  if (y + h >= getViewYOffset() + getViewHeight())
    result |= 4; // Bottom
  else if (y < getViewYOffset() - config.yFudge)
    result |= 8; // Top
    
  return result;} 
function random(bound) {return Math.floor(Math.random() * bound);} 
function randomX(config) {return getViewXOffset() + random(getViewWidth() - config.imageWidth);} 
function randomY(config) {return getViewYOffset() - config.yFudge + random(getViewHeight() + config.yFudge - config.imageHeight);} 
function setVisible(i, show) {if (msie) layers[i].style.visibility = show ? "" : "hidden"; 
else layers[i].visibility = show ? "show" : "hide";}
function writeImage(image, name, x, y) {layerX[name] = x; layerY[name] = y; 
if (msie) {document.writeln('<div id="' + name + '" style="position:absolute;left:' + x + ';top:' + y + ';"><img src="' + image + '"></div>'); 
layers[name] = document.all[name];} 
else {document.writeln('<layer id="' + name + '" left=' + x + ' top=' + y + '><img src="' + image + '"></layer>'); 
layers[name] = document.layers[name];}}
function writeImages(config) {for (var i = 0; i < config.imageCount; i++)
{var startX = randomX(config); 
var startY = config.startOnScreen ? randomY(config) : -config.imageHeight; 
var name = config.prefix + i; 
writeImage(config.image, name, startX, startY);}}
function cursorXY(e) 
{cursorX = msie ? (getViewXOffset() + event.clientX) : e.pageX; 
cursorY = msie ? (getViewYOffset() + event.clientY) : e.pageY;}
function captureXY() {if (!msie) { document.captureEvents(Event.MOUSEMOVE); } 
document.onmousemove = cursorXY;}
function config() {this.xFudge = 0; this.yFudge = 0; this.updateInterval = 50; 
this.startOnScreen = true; this.imageCount = 1;}

c32          = new config();
c32.prefix   = "y_tails32";
c32.image0       = "flyindogalltailsA.gif";
c32.image0width  ="40";
c32.image0height ="40";
c32.image1       = "flyindogalltailsA.gif";
c32.image1width  ="40";
c32.image1height ="40";
c32.imageCount = 6;
c32.positionX  = 3;
c32.positionY  = 4;
c32.posbump    = 5;
c32.oldx       = new Array();
c32.oldy       = new Array();
c32.updateDelay = 5;
c32.updateDelay = 15 * c32.updateDelay;
c32.uid        = 32;
for (i=c32.imageCount - 1;i>=0; i--) {
 writeImage(c32.image0, c32.prefix + i, 0, -c32.image0height);
 setVisible(c32.prefix + i, 0);
}
writeImage(c32.image1, c32.prefix + "top", 0, -c32.image1height);
setVisible(c32.prefix + "top", 0);
for (i=0;i<c32.imageCount;i++) {
 c32.oldx[i] = -c32.image0height;
 c32.oldy[i] = 0;
}
// get destination around cursor for both images
c32.offset0x = -c32.image0width + c32.image0width * ((c32.positionX - 1)/2) + (c32.positionX - 2) * c32.posbump;
c32.offset1x = -c32.image1width + c32.image1width * ((c32.positionX - 1)/2) + (c32.positionX - 2) * c32.posbump;
c32.offset0y = -c32.image0height + c32.image0height * ((c32.positionY - 1)/2) + (c32.positionY - 2) * c32.posbump;
c32.offset1y = -c32.image1height + c32.image1height * ((c32.positionY - 1)/2) + (c32.positionY - 2) * c32.posbump;
function updateTail(c) {
 if (cursorX + c.offset0x == getLayerX(c.prefix + (c.imageCount - 1)) && cursorY + c.offset0y == getLayerY(c.prefix + (c.imageCount - 1))) {
  for (i=c.imageCount-1;i>=0;i--) {  setVisible(c.prefix + i, 0); }
  if (c.image1 != "") {
   moveLayer(c.prefix + "top", cursorX + c.offset1x, cursorY + c.offset1y);
   setVisible(c.prefix + "top", 1);
  }
 } else {
  setVisible(c.prefix + "top", 0);
  for (i=c.imageCount-1;i>0;i--) {
   c.oldx[i] = c.oldx[i-1];
   c.oldy[i] = c.oldy[i-1];
  }
  c.oldx[0] = cursorX + c.offset0x;
  c.oldy[0] = cursorY + c.offset0y;
  for (i=0;i<c.imageCount;i++) {
   setVisible(c.prefix + i, 1);
   moveLayer(c.prefix + i, c.oldx[i], c.oldy[i]);
  }
 }
 setTimeout("updateTail(c" + c.uid + ")", c.updateDelay);
}
captureXY();
if (c32.image0) { updateTail(c32); }