if(!window.leeg)
leeg=new Object();
leeg.layerNo=0;
leeg.Layer = function(newLayer, x, y)
{if(!newLayer)
return;
if(x==null)x=0;
if(y==null)y=0;
if(document.layers)
{if(typeof newLayer == "string")
{this.layer=new Layer(2000);
this.layer.document.open();
this.layer.document.write(newLayer);
this.layer.document.close();}
else
this.layer=newLayer;
this.layer.moveTo(x,y);
this.images=this.layer.document.images;}
else
if(document.all)
{var xName;
if(typeof newLayer == "string")
{xName="xLayer" + leeg.layerNo++;
var txt = ""
+ newLayer
+ "";
document.body.insertAdjacentHTML("BeforeEnd",txt);}
else
xName=newLayer.id;
this.content = document.all[xName];
this.layer = document.all[xName].style;
this.images = document.images;}
else
if (document.getElementById)
{
var newDiv;
if(typeof newLayer == "string")
{
var xName="xLayer" + leeg.layerNo++;
var txt = ""
+ "position:absolute;"
+ "left:" + x + "px;"
+ "top:" + y + "px;"
+ "visibility:hidden";
var newRange = document.createRange();
newDiv = document.createElement("DIV");
newDiv.setAttribute("style",txt);
newDiv.setAttribute("id", xName);
document.body.appendChild(newDiv);
newRange.setStartBefore(newDiv);
strFrag = newRange.createContextualFragment(newLayer);
newDiv.appendChild(strFrag);}
else
newDiv = newLayer;
this.content = newDiv;
this.layer = newDiv.style;
this.images = document.images;}
return(this);}
leeg.findLayer = function(theDiv)
{
if(document.layers)
return(document.layers[theDiv]);
else
if(document.all)
return(document.all[theDiv]);
else
if(document.getElementById)
return(document.getElementById(theDiv));
else
return("Undefined.....");}
if(navigator.appName.indexOf("Netscape") != -1 && !document.getElementById)
{
var eventmasks = {
onabort:Event.ABORT, onblur:Event.BLUR, onchange:Event.CHANGE,
onclick:Event.CLICK, ondblclick:Event.DBLCLICK,
ondragdrop:Event.DRAGDROP, onerror:Event.ERROR,
onfocus:Event.FOCUS, onkeydown:Event.KEYDOWN,
onkeypress:Event.KEYPRESS, onkeyup:Event.KEYUP, onload:Event.LOAD,
onmousedown:Event.MOUSEDOWN, onmousemove:Event.MOUSEMOVE,
onmouseout:Event.MOUSEOUT, onmouseover:Event.MOUSEOVER,
onmouseup:Event.MOUSEUP, onmove:Event.MOVE, onreset:Event.RESET,
onresize:Event.RESIZE, onselect:Event.SELECT, onsubmit:Event.SUBMIT,
onunload:Event.UNLOAD};
/**** START prototypes for NS ***/
leeg.Layer.prototype.moveTo = function(x,y) { this.layer.moveTo(x,y); }
leeg.Layer.prototype.moveBy = function(x,y) { this.layer.moveBy(x,y); }
leeg.Layer.prototype.show = function() { this.layer.visibility = "show"; }
leeg.Layer.prototype.hide = function() { this.layer.visibility = "hide"; }
leeg.Layer.prototype.setzIndex = function(z) { this.layer.zIndex = z; }
leeg.Layer.prototype.setBgColor = function(color) { this.layer.bgColor = color; if(color==null)this.layer.background.src=null;}
leeg.Layer.prototype.setBgImage = function(image) { this.layer.background.src = image; }
leeg.Layer.prototype.getX = function() { return this.layer.left; }
leeg.Layer.prototype.getY = function() { return this.layer.top; }
leeg.Layer.prototype.getWidth = function() { return this.layer.clip.right; }
//leeg.Layer.prototype.getWidth = function() { return this.layer.width; }
leeg.Layer.prototype.getHeight = function() { return this.layer.clip.bottom; }
//leeg.Layer.prototype.getHeight = function() { return this.layer.height; }
leeg.Layer.prototype.getzIndex = function() { return this.layer.zIndex; }
leeg.Layer.prototype.isVisible = function() { return this.layer.visibility == "show"; }
leeg.Layer.prototype.setContent = function(xHtml)
{
this.layer.document.open();
this.layer.document.write(xHtml);
this.layer.document.close();}
leeg.Layer.prototype.clip = function(x1,y1, x2,y2)
{
this.layer.clip.top =y1;
this.layer.clip.left =x1;
this.layer.clip.bottom =y2;
this.layer.clip.right =x2;}
leeg.Layer.prototype.addEventHandler = function(eventname, handler)
{
this.layer.captureEvents(eventmasks[eventname]);
var xl = this;
this.layer[eventname] = function(event) {
event.clientX = event.pageX;
event.clientY = event.pageY;
event.button = event.which;
event.keyCode = event.which;
event.altKey =((event.modifiers & Event.ALT_MASK) != 0);
event.ctrlKey =((event.modifiers & Event.CONTROL_MASK) != 0);
event.shiftKey =((event.modifiers & Event.SHIFT_MASK) != 0);
return handler(xl, event);}}
leeg.Layer.prototype.removeEventHandler = function(eventName)
{
this.layer.releaseEvents(eventmasks[eventName]);
delete this.layer[eventName];}
}
else if(document.all)
{
leeg.Layer.prototype.moveTo = function(x,y)
{
this.layer.pixelLeft = x;
this.layer.pixelTop = y;
}
leeg.Layer.prototype.moveBy = function(x,y)
{
this.layer.pixelLeft += x;
this.layer.pixelTop += y;
}
leeg.Layer.prototype.show = function() { this.layer.visibility = "visible"; }
leeg.Layer.prototype.hide = function() { this.layer.visibility = "hidden"; }
leeg.Layer.prototype.setzIndex = function(z) { this.layer.zIndex = z; }
leeg.Layer.prototype.setBgColor = function(color) { this.layer.backgroundColor = color==null?'transparent':color; }
leeg.Layer.prototype.setBgImage = function(image) { this.layer.backgroundImage = "url("+image+")"; }
leeg.Layer.prototype.setContent = function(xHtml) { this.content.innerHTML=xHtml; }
leeg.Layer.prototype.getX = function() { return this.layer.pixelLeft; }
leeg.Layer.prototype.getY = function() { return this.layer.pixelTop; }
leeg.Layer.prototype.getWidth = function()
{
if(document.getElementById)
return this.content.offsetWidth;
else
return this.content.scrollWidth;
}
leeg.Layer.prototype.getHeight = function() { return this.content.offsetHeight; }
leeg.Layer.prototype.getzIndex = function() { return this.layer.zIndex; }
leeg.Layer.prototype.isVisible = function() { return this.layer.visibility == "visible"; }
leeg.Layer.prototype.clip = function(x1,y1, x2,y2)
{
this.layer.clip="rect("+y1+" "+x2+" "+y2+" "+x1+")";
this.layer.pixelWidth=x2;
this.layer.pixelHeight=y2;
this.layer.overflow="hidden";
}
leeg.Layer.prototype.addEventHandler = function(eventName, handler)
{
var xl = this;
this.content[eventName] = function()
{
var e = window.event;
e.cancelBubble = true;
if(document.getElementById)
{
e.layerX = e.offsetX;
e.layerY = e.offsetY;
}
else
{
/*** Work around for IE 4 : clone window.event ***/
ev = new Object();
for(i in e)
ev[i] = e[i];
ev.layerX = e.offsetX;
ev.layerY = e.offsetY;
e = ev;
}
return handler(xl, e);
}
}
leeg.Layer.prototype.removeEventHandler = function(eventName)
{
this.content[eventName] = null;
}
}
else if (document.getElementById)
{
leeg.Layer.prototype.moveTo = function(x,y)
{
this.layer.left = x+"px";
this.layer.top = y+"px";
}
leeg.Layer.prototype.moveBy = function(x,y) { this.moveTo(this.getX()+x, this.getY()+y); }
leeg.Layer.prototype.show = function() { this.layer.visibility = "visible"; }
leeg.Layer.prototype.hide = function() { this.layer.visibility = "hidden"; }
leeg.Layer.prototype.setzIndex = function(z) { this.layer.zIndex = z; }
leeg.Layer.prototype.setBgColor = function(color) { this.layer.backgroundColor = color==null?'transparent':color; }
leeg.Layer.prototype.setBgImage = function(image) { this.layer.backgroundImage = "url("+image+")"; }
leeg.Layer.prototype.getX = function() { return parseInt(this.layer.left); }
leeg.Layer.prototype.getY = function() { return parseInt(this.layer.top); }
leeg.Layer.prototype.getWidth = function() { return this.content.offsetWidth; }
leeg.Layer.prototype.getHeight = function() { return this.content.offsetHeight; }
leeg.Layer.prototype.getzIndex = function() { return this.layer.zIndex; }
leeg.Layer.prototype.isVisible = function() { return this.layer.visibility == "visible"; }
leeg.Layer.prototype.clip = function(x1,y1, x2,y2)
{
this.layer.clip="rect("+y1+" "+x2+" "+y2+" "+x1+")";
this.layer.width=x2 + "px";
this.layer.height=y2+ "px";
this.layer.overflow="hidden";
}
leeg.Layer.prototype.addEventHandler = function(eventName, handler)
{
var xl = this;
this.content[eventName] = function(e)
{
e.cancelBubble = true;
return handler(xl, e);
}
}
leeg.Layer.prototype.removeEventHandler = function(eventName)
{
delete this.content[eventName];
}
leeg.Layer.prototype.setContent = function(xHtml)
{
var newRange = document.createRange();
newRange.setStartBefore(this.content);
while (this.content.hasChildNodes())
this.content.removeChild(this.content.lastChild);
var strFrag = newRange.createContextualFragment(xHtml);
this.content.appendChild(strFrag);
}
} else
{
leeg.Layer.prototype.moveTo = function(x,y) { }
leeg.Layer.prototype.moveBy = function(x,y) { }
leeg.Layer.prototype.show = function() { }
leeg.Layer.prototype.hide = function() { }
leeg.Layer.prototype.setzIndex = function(z) { }
leeg.Layer.prototype.setBgColor = function(color) { }
leeg.Layer.prototype.setBgImage = function(image) { }
leeg.Layer.prototype.getX = function() { return 0; }
leeg.Layer.prototype.getY = function() { return 0; }
leeg.Layer.prototype.getWidth = function() { return 0; }
leeg.Layer.prototype.getHeight = function() { return 0; }
leeg.Layer.prototype.getzIndex = function() { return 0; }
leeg.Layer.prototype.isVisible = function() { return false; }
leeg.Layer.prototype.setContent = function(xHtml) { }
}
if(!window.leeg)
leeg=new Object();
if(!leeg.Browser)
leeg.Browser = new Object();
leeg.Browser.mouseX = 0;
leeg.Browser.mouseY = 0;
if(navigator.appName.indexOf("Netscape") != -1)
{
leeg.Browser.captureMouseXY = function (evnt)
{
leeg.Browser.mouseX=evnt.pageX;
leeg.Browser.mouseY=evnt.pageY;
}
window.captureEvents(Event.MOUSEMOVE);
window.onmousemove = leeg.Browser.captureMouseXY;
}
else if(document.all)
{
if(navigator.appVersion.indexOf("MSIE 5.") != -1)
leeg.Browser.captureMouseXY = function ()
{
leeg.Browser.mouseX = event.x + document.body.scrollLeft;
leeg.Browser.mouseY = event.y + document.body.scrollTop;
}
else
leeg.Browser.captureMouseXY = function ()
{
leeg.Browser.mouseX = event.x;
leeg.Browser.mouseY = event.y;
}
document.onmousemove = leeg.Browser.captureMouseXY;
}
var oneDeg=(2*Math.PI)/360;
var Radius = 5;
var NumStars=32;
var NumSteps=16;
var StepAngle=(25)*oneDeg;
var StarObject=new Array();
var hexDigit=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
function dec2hex(dec)
{
return(hexDigit[dec>>4]+hexDigit[dec&15]);
}
function hex2dec(hex)
{
return(parseInt(hex,16))
}
leeg.PinWheelSpark = function()
{
//Call the superclass constructor
this.superC = leeg.Layer;
this.superC("X", 100, 100);
this.currAngle = 0;
this.step = 0;
this.x = 100;
this.y = 100;
}
leeg.PinWheelSpark.prototype = new leeg.Layer;
function restart()
{
var num=Math.floor(Math.random()*4);
for(i=0;i