document.write("<style>\n");
for(i=0; i<20; i++) {
  document.write("#divDrag"+i+"{position:absolute; left:50%; top:50%; height:2; width:2; clip:rect(0,2,2,0); background-color:#000000; layer-background-color:#000000} \n");
}
document.write("</style>\n");

var n = (document.layers) ? 1:0;
var ie = (document.all) ? 1:0;
var pageWidth,pageHeight;
var rand=new randomNumberGenerator();

function nextRandomNumber ()  {        
	var Hi = this.seed / this.Q;        
	var Lo = this.seed % this.Q;        
	var Test = this.A * Lo - this.R * Hi;        
	if (Test > 0)                
		this.seed = Test        
	else                
		this.seed = Test + this.M;        
		return (this.seed * this.oneOverM);
}

function randomNumberGenerator() { 
// by Gordon McComb       
	var D = new Date();        
	this.seed = 2345678901 + (D.getSeconds() * 0xFFFFFF) + (D.getMinutes() * 0xFFFF);        
	this.A = 48271;        
	this.M = 2147483647;        
	this.Q = this.M / this.A;        
	this.R = this.M % this.A;        
	this.oneOverM = 1.0 / this.M;        
	this.next = nextRandomNumber;
}

function dragObj(obj,nest){
	nest=(!nest) ? '':'document.'+nest+'.'										
    this.css=(n) ? eval(nest+'document.'+obj):eval('document.all.'+obj+'.style')
	this.getLeft=b_getLeft;
	this.getTop=b_getTop;
	this.moveIt=b_moveIt;
	this.name=obj;
	this.moveX=rand.next()-0.5;
	this.moveY=rand.next()-0.5;
	this.count=0;
	return this;
}

function b_moveIt(){
    this.count++;
	if (this.count>63) this.count=63;
    this.moveX*=1.1; this.moveY*=1.1;
	this.css.left=this.getLeft()+this.moveX;
	this.css.top=this.getTop()+this.moveY;
	this.css.backgroundColor=(this.count)*4+(this.count)*4*256+(this.count)*4*256*256;
	this.css.bgcolor=(this.count)*4+(this.count)*4*256+(this.count)*4*256*256;
	if ((this.getLeft()<10 || this.getLeft()>pageWidth-this.moveX-10)
	    || (this.getTop()<10 || this.getTop()>pageHeight-this.moveY-10)) {
	  this.css.backgroundColor=0;
	  this.css.bgcolor=0;
	  this.css.left=pageWidth/2;
	  this.css.top=pageHeight/2;
	  this.moveX=rand.next()-0.5; this.moveY=rand.next()-0.5;
	  this.count=0;
	}
}

function b_getLeft(){
  	x=(n)? this.css.left:this.css.pixelLeft;
	return x;
}

function b_getTop(){
  	y=(n)? this.css.top:this.css.pixelTop;
	return y;
}

var loaded; 
function init(){
	oDrag=new Array();
	for (i=0; i<20; i++) {
	  oDrag[i]=new dragObj('divDrag'+i);
	}
	loaded=true;
	
	pageWidth=(ie)?document.body.offsetWidth-4:innerWidth;
	pageHeight=(ie)?document.body.offsetHeight-2:innerHeight;
	onresize=resized
	update();
}

function update() {
  for (i=0; i<20; i++) {
    oDrag[i].moveIt();
  }
  setTimeout('update()',20);
}

function resized(){
	pageWidth=(ie)?document.body.offsetWidth-4:innerWidth;
	pageHeight=(ie)?document.body.offsetHeight-2:innerHeight;
}

cZIndex=10

if(n || ie) onload=init;