function animatedObject(elementName,loop,speed,steps,endRoutines,route){
  this.elementName = elementName;
  this.loop = loop;
  this.speed = speed;
  this.steps = steps;
  this.frameIndex = 0;
  this.endRoutines = endRoutines;
  this.route = route.split(',');
  this.animate = animateObject;
  this.move = moveObject;
  this.show = showObject;
  this.hide = hideObject;
  animatedObjects[elementName] = this;
}

// stopTimeline()
// This function stops a timeline, just pass it the timeline's 
// number.

function stopTimeline(timelineNumber){
   animationTime[timelineNumber] = animationTimeline[timelineNumber].length;
}

// startTimeline()
// This function starts a timeline, just pass it the timeline's 
// number.

function startTimeline(timelineNumber) {
  animationTime[timelineNumber] = 0;
  timelineController(timelineNumber);
}

// timelineController()
// This function controls the timeline, it recurisively runs 
// itself every 100 milliseconds.


function timelineController(timelineNumber) {
    if (animationTime[timelineNumber] <= animationTimeline[timelineNumber].length - 1) {
      animationTime[timelineNumber]++;
        if (animationTimeline[timelineNumber][animationTime[timelineNumber]] != null){
        eval(animationTimeline[timelineNumber][animationTime[timelineNumber]]);
        }
        setTimeout('timelineController(' + timelineNumber + ')', 100);
    }
}


// showObject()

// This function makes an HTML element visible.

function showObject(){
  eval(layerObj + '["' + this.elementName + '"]' + styleObj + '.visibility = "visible"');
}
       

// showObject()
// This function makes an HTML element hidden.

function hideObject(){
  eval(layerObj + '["' + this.elementName + '"]' + styleObj + '.visibility = "hidden"');
}

  

// moveObject()
// This function moves an HTML element to a given position.
// Pass it the and x and y coordinates.


function moveObject(left, top){
  eval(layerObj + '["' + this.elementName + '"]' + styleObj + '.top = top');
  eval(layerObj + '["' + this.elementName + '"]' + styleObj + '.left = left');
}

// doAnimation()
// This function actually interprets the animated object's 
// properties and then animates the animated object. Just
// pass it the number of the animated object.

function animateObject(){
    if (this.route.length > 4 && this.frameIndex < this.route.length)  {
      this.move(this.route[this.frameIndex], this.route[this.frameIndex + 1]);
      this.frameIndex += 2;
      setTimeout('animatedObjects["' + this.elementName + '"].animate()', this.speed);
    }
    else if (this.route.length == 4 && this.frameIndex <= this.steps) {
      this.move(parseInt(this.route[0]) + (this.frameIndex * ((parseInt(this.route[2]) - parseInt(this.route[0])) / this.steps)), parseInt(this.route[1]) + (this.frameIndex * ((parseInt(this.route[3]) - parseInt(this.route[1])) / this.steps)));

      this.frameIndex++;
      setTimeout('animatedObjects["' + this.elementName + '"].animate()', this.speed);         
    }
    else {
      eval(this.endRoutines + "");
      this.frameIndex = 0;
        if (this.loop == "yes"){
          this.animate();
        }
    }
}

//END DON'T CHANGE


function cbgRed() {
		document.bgColor = "red"
		}


function cbgYellow() {
		document.bgColor = "yellow"
		}


function cbgWhite() {
		document.bgColor = "white"
		}


function cbgCyan() {
		document.bgColor = "cyan"
		}


function cbgBlack() {
		document.bgColor = "black"
		}


function cbgOrange() {
		document.bgColor = "#CCGG33"
		}

function cbg0() {
		document.bgColor = "BAC5A0"
		
	}

function cbg1() {
		document.bgColor = "004A00"
		}

function cbg2() {
		document.bgColor = "003399f"
		}

function cbg3() {
		document.bgColor = "006699"
		}

function cbg4() {
		document.bgColor = "666699"
 	             }

function cbg5() {
		document.bgColor = "black"
		}







