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('
'); layers[name] = document.all[name]; } else { document.writeln('