// Feel free to hack around with this code for personal use, all I ask is
// that this code comment remain in tact.  If you're are thinking of using
// this code for profit, you MUST get my permission before doing so.
// Thank you.
//
// Don't know what parallax scrolling is?  Check out the back ground of 
// Sonic the Hedgehog.  Or better yet, Mega Man 2.
//
// -Brent
// assembler.org || vitaflo.com

var letter = new Array(4);
letter[0] = "star3";
letter[1] = "star2";
letter[2] = "star1";

var yplace = new Array(4);
yplace[0] = -513;
yplace[1] = -513;
yplace[2] = -513;

var ymax = new Array(4);
ymax[0] = 0;
ymax[1] = 0;
ymax[2] = 0;

var xplace = new Array(4);
xplace[0] = 0;
xplace[1] = 0;
xplace[2] = 0;

var restart = new Array(3);
restart[0] = -513;
restart[1] = -513;
restart[2] = -513;

var speed = new Array(4);
speed[0] = 2;
speed[1] = 7;
speed[2] = 12;

var velocity = new Array(4);
velocity[0] = 4;
velocity[1] = 2;
velocity[2] = 1;

function paralax(num) {
  var theObj = getObject(letter[num]);
  if (yplace[num] <= ymax[num]) {
      if (yplace[num] == ymax[num]) yplace[num]=restart[num];
       yplace[num] = yplace[num]+velocity[num];
      if (yplace[num] > ymax[num]) yplace[num] = ymax[num];
      shiftTo(theObj, yplace[num], xplace[num]);
    setTimeout("paralax(" + num + ")",speed[num]);
  }
}

function init() {
  redrawInit();
  for (i = 0; i <= 2; i++) {
		paralax(i);
  }
}
