function Simulation(uID, location, simObject, simType) {
   this.uniqueID = uID;
   this.location = location;
   this.sim = simObject;
   this.simType = simType;
}

Simulation.prototype.play = function()
{
   if (this.simType.indexOf("flash") != -1) {
      this.sim.TGotoLabel("/JSControls","play");
      this.sim.TPlay("/JSControls");
   }
   if (this.simType.indexOf("java") != -1) {
      this.sim.onPlay();
   }
}

Simulation.prototype.pause = function()
{
   if (this.simType.indexOf("flash") != -1) {
      this.sim.TGotoLabel("/JSControls","pause");
      this.sim.TPlay("/JSControls");
   }
   if (this.simType.indexOf("java") != -1) {
      this.sim.onPause();
   }
}

Simulation.prototype.quit = function()
{
   if (this.simType.indexOf("flash") != -1) 
      this.sim.TGotoLabel("/JSControls","quit");
   if (this.simType.indexOf("java") != -1) {
      this.sim.onClose();
   }
}

Simulation.prototype.forward = function()
{
   if (this.simType.indexOf("flash") != -1) {
      this.sim.TGotoLabel("/JSControls","forward");
      this.sim.TPlay("/JSControls");
   }
   if (this.simType.indexOf("java") != -1) {
      this.sim.onNext();
   }
}

Simulation.prototype.back = function()
{
   if (this.simType.indexOf("flash") != -1) {
      this.sim.TGotoLabel("/JSControls","back");
      this.sim.TPlay("/JSControls");
   }
   if (this.simType.indexOf("java") != -1) {
      this.sim.onPrev();
   }
}

Simulation.prototype.volIncrease = function()
{
   if (this.simType.indexOf("flash") != -1) {
      if (usesWMP) {
         playvolume = SPWIN.document.MediaPlayerIE.settings.volume;
         alert(playvolume);
      }
      else
      {
         this.sim.TGotoLabel("/JSControls","volIncrease");
         this.sim.TPlay("/JSControls");
      }
   }
}

Simulation.prototype.volDecrease = function()
{
   if (this.simType.indexOf("flash") != -1)  {
      this.sim.TGotoLabel("/JSControls","volDecrease");
      this.sim.TPlay("/JSControls");
   }
}

Simulation.prototype.getScore = function()
{
   if (this.simType.indexOf("flash") != -1)  {
	resultstring = SPWIN.document.myFlash.GetVariable("resultstring");

        for (var i = 0; i < resultstring.length; i++) {
		if(resultstring[i]=='c') {
			correct++;
		} else {
			incorrect++;
      		}
   	}

   	var score = (correct / (correct+incorrect)) * 100;
   	score = Math.round(score);
   	if (isNaN(score)) score = 0;
      	return score;
   }
   else
   {
        return getScore();
   }
}

Simulation.prototype.getInteractions = function()
{
   if (this.simType.indexOf("flash") != -1)  {
      resultstring = SPWIN.document.myFlash.GetVariable("resultstring");
   }
   return resultstring();
}

Simulation.prototype.muteSound = function()
{
   if (this.simType.indexOf("flash") != -1) {
      this.sim.TGotoLabel("/JSControls","mutesound");
      this.sim.TPlay("/JSControls");
   }  
}