Code:
<html>
<head>
<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico">
<title>Bunny Cage-Chat Room</title>
<script type="text/javascript">
/*<![CDATA[*/
/*******************************************************************
*
* File : JSFX_Halloween.js © JavaScript-FX.com
*
* Created : 2001/10/16
*
* Author : Roy Whittle www.Roy.Whittle.com
*
* Purpose : To create animated Ghosts on the page using any user
* supplied image.
*
* History
* Date Version Description
*
* 2001-10-16 1.0 Created for javascript-fx
***********************************************************************/
/*** START OF CODE FROM JSFX_Layer.js ***/
if(!window.JSFX)
JSFX=new Object();
JSFX.layerNo=0;
/**********************************************************************************/
JSFX.createElem = function(htmlStr){
var elem = null;
if(document.all){
var xName = "xLayer" + JSFX.layerNo++;
var txt = "<DIV ID='" + xName
+ "' STYLE=\"position:absolute;"
+ "visibility:hidden\">"
+ htmlStr
+ "</DIV>";
document.body.insertAdjacentHTML("BeforeEnd",txt);
elem = document.all[xName];
}
else if (document.getElementById){
var xName="xLayer" + JSFX.layerNo++;
var txt = ""
+ "position:absolute;"
+ "visibility:hidden";
var newRange = document.createRange();
elem = document.createElement("DIV");
elem.setAttribute("style",txt);
elem.setAttribute("id", xName);
document.body.appendChild(elem);
newRange.setStartBefore(elem);
strFrag = newRange.createContextualFragment(htmlStr);
elem.appendChild(strFrag);
}
return elem;
}
/**********************************************************************************/
JSFX.Layer = function(newLayer){
if(!newLayer)
return;
if(typeof newLayer == "string")
this.elem = JSFX.createElem(newLayer);
else
this.elem=newLayer;
this.images = document.body.getElementsByTagName('IMG');
this.style = this.elem.style;
}
/**********************************************************************************/
var ns4 = (navigator.appName.indexOf("Netscape") != -1 && !document.getElementById);
/**********************************************************************************/
/*** moveTo (x,y) ***/
JSFX.Layer.prototype.moveTo = function(x,y){
this.style.left = x+"px";
this.style.top = y+"px";
}
if(ns4)
JSFX.Layer.prototype.moveTo = function(x,y) { this.elem.moveTo(x,y); }
/**********************************************************************************/
/*** show()/hide() Visibility ***/
JSFX.Layer.prototype.show= function(){
this.style.visibility = "visible";
}
JSFX.Layer.prototype.hide=function(){
this.style.visibility = "hidden";
}
/**********************************************************************************/
/*** Opacity ***/
JSFX.Layer.prototype.setOpacity = function(pc){
zxcOpacity(this.elem,pc);
}
/******* END OF CODE FROM JSFX.Layer.js ***/
/*** START OF CODE FROM JSFX.Browser.js ***/
/*** END OF CODE FROM JSFX.Browser.js ***/
/*** START OF CODE FROM JSFX.Ghosts.js ***/
JSFX.Halloween = new Object();
JSFX.Halloween.Ghosts = new Array();
JSFX.Halloween.start = function(){
if(JSFX.Halloween.theTimer == null){
JSFX.Halloween.theTimer = setTimeout("JSFX.Halloween.animateAll()", 40);
}
}
JSFX.Halloween.animateAll = function(){
JSFX.Halloween.theTimer = setTimeout("JSFX.Halloween.animateAll()", 40);
var sp = JSFX.Halloween.Ghosts;
var i;
for(i=0 ; i<sp.length ; i++){
sp[i].animate();
}
}
JSFX.AddGhost = function(img){
var myGhost = null;
var htmlStr = "<IMG SRC='"+img+"'>";
myGhost = new JSFX.Layer(htmlStr);
myGhost.op = 0;
myGhost.x = Math.random()*(zxcWWHS()[2]+zxcWWHS()[0]);
myGhost.y = Math.random()*(zxcWWHS()[2]+zxcWWHS()[0]);
myGhost.dx = 0;
myGhost.dy = 0;
myGhost.w = 30;
myGhost.h = 30;
myGhost.targetX = Math.random()*(zxcWWHS()[2]+zxcWWHS()[0]);
myGhost.targetY = Math.random()*(zxcWWHS()[2]+zxcWWHS()[0]);
myGhost.state = "off"
myGhost.animate = JSFX.animateGhosts;
myGhost.hide();
myGhost.setOpacity(this.op);
myGhost.moveTo(myGhost.x,myGhost.y);
JSFX.Halloween.Ghosts[JSFX.Halloween.Ghosts.length] = myGhost;
JSFX.Halloween.start();
}
JSFX.animateGhosts = function(){
if(this.state == "off"){
if(Math.random() > .99){
this.state="up";
this.show();
}
}
else if(this.state == "on"){
if(Math.random() > .98){
this.state="down";
}
}
else if(this.state == "up"){
this.op += 2;
this.setOpacity(this.op);
if(this.op==100)
this.state = "on";
}
else if(this.state == "down"){
this.op -= 2;
if(this.op==0){
this.hide();
this.state = "off";
}
else {
this.setOpacity(this.op);
}
}
m = this;
var X = (this.targetX - m.x);
var Y = (this.targetY - m.y);
var len = Math.sqrt(X*X+Y*Y);
if(len < 1){
len = 1;
}
var dx = 20 * (X/len);
var dy = 20 * (Y/len);
var ddx = (dx - this.dx)/10;
var ddy = (dy - this.dy)/10;
this.dx += ddx;
this.dy += ddy;
m.x += this.dx;
m.y += this.dy;
m.moveTo(m.x, m.y);
if(Math.random() >.95 )
{
this.targetX = Math.random()*(zxcWWHS()[0]-150);
this.targetY = Math.random()*(zxcWWHS()[1]+zxcWWHS()[3]-150);
}
}
function zxcWWHS(){
if (window.innerHeight) return [window.innerWidth-10,window.innerHeight-10,window.pageXOffset,window.pageYOffset];
else if (document.documentElement.clientHeight) return [document.documentElement.clientWidth-10,document.documentElement.clientHeight-10,document.documentElement.scrollLeft,document.documentElement.scrollTop];
return [document.body.clientWidth,document.body.clientHeight,document.body.scrollLeft,document.body.scrollTop];
}
function zxcOpacity(obj,opc){
if (opc<0||opc>100) return;
obj.style.filter='alpha(opacity='+opc+')';
obj.style.opacity=obj.style.MozOpacity=obj.style.WebkitOpacity=obj.style.KhtmlOpacity=opc/100-.001;
}
/*]]>*/
</script>
<SCRIPT type="text/javascript">
function JSFX_StartEffects(){
JSFX.AddGhost("http://www.bunnycagechat.com/images/ghost0.gif");
JSFX.AddGhost("http://www.bunnycagechat.com/images/ghost1.gif");
JSFX.AddGhost("http://www.bunnycagechat.com/images/ghost2.gif");
JSFX.AddGhost("http://www.bunnycagechat.com/images/ghost0.gif");
JSFX.AddGhost("http://www.bunnycagechat.com/images/ghost1.gif");
JSFX.AddGhost("http://www.bunnycagechat.com/images/ghost2.gif");
}
</SCRIPT>
<style type="text/css">
html,body {
background-color: #000000;
color: #000000;
text-align: center;
}
div.center {
width: 700px;
margin-left: auto; margin-right: auto;
}
</style>
</head>
<body>
<BODY onLoad="JSFX_StartEffects()">
</body>
Bookmarks