// Moving Objects Script

// By Virtual_Max

// 

// Permission to use, copy, modify, and distribute this software and its documentation 

// for NON-COMMERCIAL purposes and  without fee is hereby granted provided that this 

// notice appears in all copies. 

//

// VIRTUAL MAX MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE 

// SOFTWARE, EITHER EXPRESS OR IMPLIED





var brOK=false;

var mie=false;

var aver=parseInt(navigator.appVersion.substring(0,1));

var aname=navigator.appName;



function checkbrOK()

{if(aname.indexOf("Internet Explorer")!=-1)

   {if(aver>=4) brOK=navigator.javaEnabled();

    mie=true;

   }

 if(aname.indexOf("Netscape")!=-1)  

   {if(aver>=4) brOK=navigator.javaEnabled();}

}



var vmin=2;

var vmax=5;

var vr=2;

var timer1;



function Chip(chipname,width,height)

{this.named=chipname;

 this.vx=vmin+vmax*Math.random();

 this.vy=vmin+vmax*Math.random();

 this.w=width;

 this.h=height;

 this.xx=0;

 this.yy=0;

 this.timer1=null;

}



function movechip(chipname)

{

 if(brOK)

  {eval("chip="+chipname);

   if(!mie)

    {pageX=window.pageXOffset;

     pageW=window.innerWidth-20;

     pageY=window.pageYOffset;

     pageH=window.innerHeight-20;

    }

   else

    {pageX=window.document.body.scrollLeft;

     pageW=window.document.body.offsetWidth-20;

     pageY=window.document.body.scrollTop;

     pageH=window.document.body.offsetHeight-20;

    } 



   chip.xx=chip.xx+chip.vx;

   chip.yy=chip.yy+chip.vy;

   

   chip.vx+=vr*(Math.random()-0.5);

   chip.vy+=vr*(Math.random()-0.5);

   if(chip.vx>(vmax+vmin))  chip.vx=(vmax+vmin)*2-chip.vx;

   if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx;

   if(chip.vy>(vmax+vmin))  chip.vy=(vmax+vmin)*2-chip.vy;

   if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy;





   if(chip.xx<=pageX)

     {chip.xx=pageX;

      chip.vx=vmin+vmax*Math.random();

     }

   if(chip.xx>=pageX+pageW-chip.w)

     {chip.xx=pageX+pageW-chip.w;

      chip.vx=-vmin-vmax*Math.random();

     }

   if(chip.yy<=pageY)

     {chip.yy=pageY;

      chip.vy=vmin+vmax*Math.random();

     }

   if(chip.yy>=pageY+pageH-chip.h)

     {chip.yy=pageY+pageH-chip.h;

      chip.vy=-vmin-vmax*Math.random();

     }



   if(document.layers)

      {eval('document.'+chip.named+'.top ='+chip.yy);

       eval('document.'+chip.named+'.left='+chip.xx);

      } 

   else if (document.all)

      {eval('document.all.'+chip.named+'.style.pixelLeft='+chip.xx);

       eval('document.all.'+chip.named+'.style.pixelTop ='+chip.yy); 

      }

   else if (document.getElementById)

      {document.getElementById(chip.named).style.left=chip.xx;

       document.getElementById(chip.named).style.top =chip.yy; 

      }

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

  }

}





function stopme(chipname)

{if(brOK)

  {//alert(chipname)

   eval("chip="+chipname);

   if(chip.timer1!=null)

    {clearTimeout(chip.timer1)}

  }

}



<!--
function MM_timelinePlay(tmLnName, myID) { //v1.2
  //Copyright 1997 Macromedia, Inc. All rights reserved.
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
  tmLn = document.MM_Time[tmLnName];
  if (myID == null) { myID = ++tmLn.ID; firstTime=true;}//if new call, incr ID
  if (myID == tmLn.ID) { //if Im newest
    setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);
    fNew = ++tmLn.curFrame;
    for (i=0; i<tmLn.length; i++) {
      sprite = tmLn[i];
      if (sprite.charAt(0) == 's') {
        if (sprite.obj) {
          numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
          if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range
            keyFrm=1;
            for (j=0; j<sprite.values.length; j++) {
              props = sprite.values[j]; 
              if (numKeyFr != props.length) {
                if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];
                else        sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];
              } else {
                while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;
                if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {
                  if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];
                  else        sprite.obj[props.prop2][props.prop] = props[keyFrm-1];
        } } } } }
      } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
      if (fNew > tmLn.lastFrame) tmLn.ID = 0;
  } }
}

function MM_timelineGoto(tmLnName, fNew, numGotos) { //v2.0
  //Copyright 1997 Macromedia, Inc. All rights reserved.
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,lastKeyFr,propNum,theObj;
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
  tmLn = document.MM_Time[tmLnName];
  if (numGotos != null)
    if (tmLn.gotoCount == null) tmLn.gotoCount = 1;
    else if (tmLn.gotoCount++ >= numGotos) {tmLn.gotoCount=0; return}
  jmpFwd = (fNew > tmLn.curFrame);
  for (i = 0; i < tmLn.length; i++) {
    sprite = (jmpFwd)? tmLn[i] : tmLn[(tmLn.length-1)-i]; //count bkwds if jumping back
    if (sprite.charAt(0) == "s") {
      numKeyFr = sprite.keyFrames.length;
      firstKeyFr = sprite.keyFrames[0];
      lastKeyFr = sprite.keyFrames[numKeyFr - 1];
      if ((jmpFwd && fNew<firstKeyFr) || (!jmpFwd && lastKeyFr<fNew)) continue; //skip if untouchd
      for (keyFrm=1; keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]; keyFrm++);
      for (j=0; j<sprite.values.length; j++) {
        props = sprite.values[j];
        if (numKeyFr == props.length) propNum = keyFrm-1 //keyframes only
        else propNum = Math.min(Math.max(0,fNew-firstKeyFr),props.length-1); //or keep in legal range
        if (sprite.obj != null) {
          if (props.prop2 == null) sprite.obj[props.prop] = props[propNum];
          else        sprite.obj[props.prop2][props.prop] = props[propNum];
      } }
    } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
  }
  tmLn.curFrame = fNew;
  if (tmLn.ID == 0) eval('MM_timelinePlay(tmLnName)');
}

function MM_initTimelines() { //v4.0
    //MM_initTimelines() Copyright 1997 Macromedia, Inc. All rights reserved.
    var ns = navigator.appName == "Netscape";
    var ns4 = (ns && parseInt(navigator.appVersion) == 4);
    var ns5 = (ns && parseInt(navigator.appVersion) > 4);
    document.MM_Time = new Array(2);
    document.MM_Time[0] = new Array(4);
    document.MM_Time["Timeline1"] = document.MM_Time[0];
    document.MM_Time[0].MM_Name = "Timeline1";
    document.MM_Time[0].fps = 15;
    document.MM_Time[0][0] = new String("sprite");
    document.MM_Time[0][0].slot = 1;
    if (ns4)
        document.MM_Time[0][0].obj = document["Lsplash1"];
    else if (ns5)
        document.MM_Time[0][0].obj = document.getElementById("Lsplash1");
    else
        document.MM_Time[0][0].obj = document.all ? document.all["Lsplash1"] : null;
    document.MM_Time[0][0].keyFrames = new Array(1, 5);
    document.MM_Time[0][0].values = new Array(1);
    document.MM_Time[0][0].values[0] = new Array("visible","hidden");
    document.MM_Time[0][0].values[0].prop = "visibility";
    if (!ns4)
        document.MM_Time[0][0].values[0].prop2 = "style";
    document.MM_Time[0][1] = new String("sprite");
    document.MM_Time[0][1].slot = 2;
    if (ns4)
        document.MM_Time[0][1].obj = document["Lsplash2"];
    else if (ns5)
        document.MM_Time[0][1].obj = document.getElementById("Lsplash2");
    else
        document.MM_Time[0][1].obj = document.all ? document.all["Lsplash2"] : null;
    document.MM_Time[0][1].keyFrames = new Array(5, 10);
    document.MM_Time[0][1].values = new Array(1);
    document.MM_Time[0][1].values[0] = new Array("visible","hidden");
    document.MM_Time[0][1].values[0].prop = "visibility";
    if (!ns4)
        document.MM_Time[0][1].values[0].prop2 = "style";
    document.MM_Time[0][2] = new String("sprite");
    document.MM_Time[0][2].slot = 1;
    if (ns4)
        document.MM_Time[0][2].obj = document["Lsplash3"];
    else if (ns5)
        document.MM_Time[0][2].obj = document.getElementById("Lsplash3");
    else
        document.MM_Time[0][2].obj = document.all ? document.all["Lsplash3"] : null;
    document.MM_Time[0][2].keyFrames = new Array(10, 15);
    document.MM_Time[0][2].values = new Array(1);
    document.MM_Time[0][2].values[0] = new Array("visible","hidden");
    document.MM_Time[0][2].values[0].prop = "visibility";
    if (!ns4)
        document.MM_Time[0][2].values[0].prop2 = "style";
    document.MM_Time[0][3] = new String("sprite");
    document.MM_Time[0][3].slot = 2;
    if (ns4)
        document.MM_Time[0][3].obj = document["Lsplash4"];
    else if (ns5)
        document.MM_Time[0][3].obj = document.getElementById("Lsplash4");
    else
        document.MM_Time[0][3].obj = document.all ? document.all["Lsplash4"] : null;
    document.MM_Time[0][3].keyFrames = new Array(15, 20);
    document.MM_Time[0][3].values = new Array(1);
    document.MM_Time[0][3].values[0] = new Array("visible","visible");
    document.MM_Time[0][3].values[0].prop = "visibility";
    if (!ns4)
        document.MM_Time[0][3].values[0].prop2 = "style";
    document.MM_Time[0].lastFrame = 20;
    document.MM_Time[1] = new Array(4);
    document.MM_Time["Timeline2"] = document.MM_Time[1];
    document.MM_Time[1].MM_Name = "Timeline2";
    document.MM_Time[1].fps = 15;
    document.MM_Time[1][0] = new String("sprite");
    document.MM_Time[1][0].slot = 1;
    if (ns4)
        document.MM_Time[1][0].obj = document["Lsplash12"];
    else if (ns5)
        document.MM_Time[1][0].obj = document.getElementById("Lsplash12");
    else
        document.MM_Time[1][0].obj = document.all ? document.all["Lsplash12"] : null;
    document.MM_Time[1][0].keyFrames = new Array(1, 5);
    document.MM_Time[1][0].values = new Array(1);
    document.MM_Time[1][0].values[0] = new Array("visible","hidden");
    document.MM_Time[1][0].values[0].prop = "visibility";
    if (!ns4)
        document.MM_Time[1][0].values[0].prop2 = "style";
    document.MM_Time[1][1] = new String("sprite");
    document.MM_Time[1][1].slot = 2;
    if (ns4)
        document.MM_Time[1][1].obj = document["Lsplash22"];
    else if (ns5)
        document.MM_Time[1][1].obj = document.getElementById("Lsplash22");
    else
        document.MM_Time[1][1].obj = document.all ? document.all["Lsplash22"] : null;
    document.MM_Time[1][1].keyFrames = new Array(5, 10);
    document.MM_Time[1][1].values = new Array(1);
    document.MM_Time[1][1].values[0] = new Array("visible","hidden");
    document.MM_Time[1][1].values[0].prop = "visibility";
    if (!ns4)
        document.MM_Time[1][1].values[0].prop2 = "style";
    document.MM_Time[1][2] = new String("sprite");
    document.MM_Time[1][2].slot = 1;
    if (ns4)
        document.MM_Time[1][2].obj = document["Lsplash23"];
    else if (ns5)
        document.MM_Time[1][2].obj = document.getElementById("Lsplash23");
    else
        document.MM_Time[1][2].obj = document.all ? document.all["Lsplash23"] : null;
    document.MM_Time[1][2].keyFrames = new Array(10, 15);
    document.MM_Time[1][2].values = new Array(1);
    document.MM_Time[1][2].values[0] = new Array("visible","hidden");
    document.MM_Time[1][2].values[0].prop = "visibility";
    if (!ns4)
        document.MM_Time[1][2].values[0].prop2 = "style";
    document.MM_Time[1][3] = new String("sprite");
    document.MM_Time[1][3].slot = 2;
    if (ns4)
        document.MM_Time[1][3].obj = document["Lsplash24"];
    else if (ns5)
        document.MM_Time[1][3].obj = document.getElementById("Lsplash24");
    else
        document.MM_Time[1][3].obj = document.all ? document.all["Lsplash24"] : null;
    document.MM_Time[1][3].keyFrames = new Array(15, 20);
    document.MM_Time[1][3].values = new Array(1);
    document.MM_Time[1][3].values[0] = new Array("visible","visible");
    document.MM_Time[1][3].values[0].prop = "visibility";
    if (!ns4)
        document.MM_Time[1][3].values[0].prop2 = "style";
    document.MM_Time[1].lastFrame = 20;
    for (i=0; i<document.MM_Time.length; i++) {
        document.MM_Time[i].ID = null;
        document.MM_Time[i].curFrame = 0;
        document.MM_Time[i].delay = 1000/document.MM_Time[i].fps;
    }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
