mcN = "letter";

increments = Math.floor(3600 / speed);

if (increments == 0)
   increments = 1;

alphaInc = (100 - alpha) / increments;
scaleInc = (100 - scale) / increments;
posInc   = top           / increments;

aLetters = new Array();

for (i = 0; i< numChar; i++)
{
  aLetters[i+0] = i;
  var letter =  this[mcN +i];
  letter._visible = false;
  letter.init = letterInit;
  letter.doEffect = effect;
  letter.number = i;
}

function letterInit()
{
  this._visible = true;
  this.step = 0;
  this.increments = this._parent.increments;
  this._alpha     = this._parent.alpha;
  this._xscale    = this._parent.scale;
  this._yscale    = this._parent.scale;
  this.alphaInc   = this._parent.alphaInc;
  this.scaleInc   = this._parent.scaleInc;
  this.posInc     = this._parent.posInc;
  this.finalX     = this._x;
  this.finalY     = this._y;

  dir = Math.floor(3.99 * Math.random());

  this.xInc = 0;
  this.yInc = 0;

  if (dir == 0) // from left
  {
     this._x   = this._x - this._parent.top;
     this.xInc = this.posInc;
  }
  else if (dir == 1) // from top
  {
     this._y   = this._y - this._parent.top;
     this.yInc = this.posInc;
  }
  else if (dir == 2) // from right
  {
     this._x   = this._x + this._parent.top;
     this.xInc = -this.posInc;
  }
  else if (dir == 3) // from bottom
  {
     this._y   = this._y + this._parent.top;
     this.yInc = -this.posInc;
  }
}

function effect()
{
  this._alpha  += this.alphaInc;
  this._xscale += this.scaleInc;
  this._yscale += this.scaleInc;
  this._x      += this.xInc;
  this._y      += this.yInc;

  this.step += 1;

  if (this.step >= this.increments)
  {
    this._xscale = 100;
    this._yscale = 100;
    this._alpha  = 100;
    this._x      = this.finalX;
    this._y      = this.finalY;
    this.gotoAndStop("end");
  }
}

function shuffle()
{
  return Math.floor(Math.random() * 3) -1;
}

if (random == 1)
{
  aLetters.sort(shuffle);
}

if (reverse == 1)
{
  aLetters.reverse();
}