//Copyright 2007, Howling Dynamo, Inc. or its suppliers. All Rights Reserved. http://www.hdyn.com/wr/common/contact.php?addr=pr
function startStars(bg){
var _2;
if(bg<20){
_2=20;
}else{
if(bg>205){
_2=205;
}else{
_2=bg-20;
}
}
var _3=initStars(_2,document.getElementById("holder"));
_3.setDensity(300);
_3.start();
}
var g_stars=null;
var g_shapes=["*","'","\xb0","."];
var g_nShapes=g_shapes.length;
var g_prodMillis=null;
function initStars(_4,_5){
g_stars=new Stars("g_stars",_4,_5);
window.onresize=doResize;
g_prodMillis=new Date().getTime()+7000;
return g_stars;
}
function Stars(_6,_7,_8){
this.clock=new GPTimer();
this.nodeSet=null;
this.name=_6;
this.baseColor=_7;
this.holder=_8;
this.density=100;
this.nStars=100;
this.waitMillis=20;
this.jsTester=new JSTester(30);
this.jstMillis=-1;
this.setDensity=function(_9){
this.density=_9;
};
this.twinkle=function(){
if(this.jstMillis<0){
this.jstMillis=this.jsTester.test();
}else{
if(this.jstMillis>50){
goRoot();
return;
}
}
var _a=this.holder;
if(this.nodeSet==null||_a==null){
return;
}
var _b=0;
var _c=this.nodeSet.length;
var _d=null;
if(_c>0){
_d=this.nodeSet.item(rand(_c));
if(_c>this.nStars){
_a.removeChild(_d);
}else{
_b=rand(16);
}
}
this.changeNode(_d,_b);
this.clock.doAfter(this.name+".twinkle()",this.waitMillis);
};
this.start=function(){
this.setHolder();
this.twinkle();
};
this.setHolder=function(){
var _e=this.holder;
_e.style.width="100%";
_e.style.height="100%";
this.nStars=Math.floor(_e.offsetWidth*_e.offsetHeight/1000000*this.density);
if(this.nStars<1){
this.nStars=1;
}
this.waitMillis=Math.floor(4000/this.nStars);
if(this.waitMillis<8){
this.waitMillis=8;
}
this.prebuild();
};
this.clear=function(_f){
this.nodeSet=null;
if(_f){
this.holder.innerHTML="";
}
this.holder.style.width="0px";
this.holder.style.height="0px";
};
this.prebuild=function(){
var _10=document.createElement("div");
_10.className=this.holder.className;
_10.style.backgroundColor=this.holder.style.backgroundColor;
_10.style.width=this.holder.style.width;
_10.style.height=this.holder.style.width;
_10.onmousedown=goRoot;
for(var i=0;i<this.nStars;++i){
this.changeNode(buildNode(_10),15);
}
this.holder.parentNode.replaceChild(_10,this.holder);
this.holder=_10;
this.nodeSet=this.holder.getElementsByTagName("div");
};
this.changeNode=function(_12,_13){
if(_13==0){
return;
}
var s=_12.style;
if((_13&4)!=0){
s.left=(rand(this.holder.offsetWidth))+"px";
s.top=(rand(this.holder.offsetHeight))+"px";
}
if((_13&1)!=0){
s.color=randColor(this.baseColor);
}
if((_13&8)!=0){
var z=rand(18);
s.fontSize=(z+10)+"px";
s.zIndex=z;
}
if((_13&2)!=0){
if(g_prodMillis!=null&&new Date().getTime()>=g_prodMillis){
appendProd();
}
_12.firstChild.nodeValue=g_shapes[rand(g_shapes.length)];
}
if(_12.offsetLeft+_12.offsetWidth>this.holder.offsetWidth){
s.left=(_12.offsetLeft-this.holder.offsetWidth/2)+"px";
}
};
}
function JSTester(_16){
this.testMillis=-1;
this.testIdx=0;
this.nLoops=_16;
this.test=function(){
if(this.testMillis==-1){
this.testMillis=new Date().getTime();
}
if(this.testIdx<this.nLoops){
++this.testIdx;
}else{
if(this.testIdx==this.nLoops){
++this.testIdx;
return (new Date().getTime()-this.testMillis)/this.nLoops;
}
}
return -1;
};
}
var g_prods=["it's OK to touch the wall","do it!","no?","maybe the mouse is broken...","walls endure","a fear of museum guards?","it's not easy being grey"];
function appendProd(){
if(g_prods==null){
goRoot();
return;
}
if(g_shapes.length<g_nShapes+g_prods.length){
g_shapes.push(g_prods[g_shapes.length-g_nShapes]);
g_prodMillis=new Date().getTime()+1000;
}else{
g_shapes.length=g_nShapes;
g_prods=null;
g_prodMillis=new Date().getTime()+1000;
}
}
function buildNode(_17){
var _18=document.createElement("div");
_18.className="star";
_18.appendChild(document.createTextNode(""));
_17.appendChild(_18);
return _18;
}
function randColor(_19){
var gun=_19+rand(50);
if(gun>255){
gun=255;
}
var c=[gun,gun,gun];
return "rgb("+c.join(",")+")";
}
function rand(lt){
return Math.floor(Math.random()*0.99999*lt);
}
function doStars(){
if(g_stars!=null){
g_stars.start();
}
}
function doResize(){
if(g_stars!=null){
g_stars.setHolder();
}
}
function clrStars(){
if(g_stars!=null){
g_stars.clear(true);
}
}

