/***********************************************
* Floating image script- By Virtual_Max (http://www.geocities.com/siliconvalley/lakes/8620)
* Modified by Dynamic Drive for various improvements
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/


var vmin=2;
var vmax=8;
var vr=7;
var timer1;

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function Chip(chipname,width,height){
 this.named=chipname;
 this.vx=vmin+vmax*Math.random();
 this.vy=vmin+vmax*Math.random();
 this.w=width+20;
 this.h=height;
 this.xx=-200;
 this.yy=0;
 this.timer1=null;
}

function movechip(chipname){
if (document.getElementById){
eval("chip="+chipname);
   if (window.innerWidth || window.opera){
	 pageX=window.innerWidth/2.4;
     pageW=window.innerWidth;
     //pageY=window.pageYOffset;
     pageH=window.innerHeight;
	 pageY=410;
	 }
   else if (document.body){
	 pageX=iecompattest().offsetWidth/2.4;
     pageW=iecompattest().offsetWidth;
     //pageY=iecompattest().scrollTop;
     pageH=iecompattest().offsetHeight;
	 pageY=410;
    } 

/*     if(chip.xx==0){
			chip.xx=pageX;
     }*/
   if(chip.xx<-100){
			chip.xx=pageX;
     }
   chip.yy=pageY;
   chip.xx=chip.xx-vr;
   chip.vy=0;

  
/*   if(chip.xx>=pageX+pageW-chip.w){
			chip.xx=pageX+pageW-chip.w;
     }
  if(chip.yy<>pageY)
     {chip.yy=pageY;
     }
     if(chip.yy>=pageY+pageH-chip.h)
     {chip.yy=pageY+pageH-chip.h;
     }*/

document.getElementById(chip.named).style.left=chip.xx+"px";
document.getElementById(chip.named).style.top=chip.yy+"px";


   chip.timer1=setTimeout("movechip('"+chip.named+"')",100);
  }
}

/***********************************************
* Floating image script- By Virtual_Max (http://www.geocities.com/siliconvalley/lakes/8620)
* Modified by Dynamic Drive for various improvements
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
* Using CSB or Trellix:  use an INSERT HTML box to hold your script and put your js and images into web components (webgem in Trellix).  Then you MUST change each gEMDIR to GEMDIR before using code!
***********************************************/

//Step 1: Define unique variable names depending on number of flying images (ie:3):
var flyimage1

function pagestart(){
//Step 2: Using the same variable names as 1), add or delete more of the below lines (47=width, height=68 of image):
 flyimage1=new Chip("flyimage1",100,92);


//Step 3: Using the same variable names as 1), add or delete more of the below lines:
movechip("flyimage1");

}

if (window.addEventListener)
window.addEventListener("load", pagestart, false)
else if (window.attachEvent)
window.attachEvent("onload", pagestart)
else if (document.getElementById)
window.onload=pagestart
