function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.

  if (navigator.appName.indexOf("Microsoft") != -1) {    
    return document.getElementById(movieName)
  }
  else {
    return document[movieName]
  }
}

function elementExists(a){

var allEls = document.getElementsByTagName("*");
var l = allEls.length, i;
for(i = 0; i < l; i++) {
if(allEls[i].getAttribute("name") == a)
return true
}
return false
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
  if (typeof(theMovie) != "undefined") {
    return theMovie.PercentLoaded() == 100;
  } else {
    return false;
  }
}

var movieName = "";
var toggle = "Off";

function togglemovie(MovieId) {
	
	stopmovie('team1');
	stopmovie('team2');
	stopmovie('team3');

	if (toggle == "Off" || movieName != MovieId)
	{
	    playmovie(MovieId);
        toggle = "On";
    }
	else
    {
        toggle = "Off";
    }
    movieName = MovieId;
}

function playmovie(movieName) {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).GotoFrame(1);
    thisMovie(movieName).Play();
  }
}

function stopmovie(movieName) {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).StopPlay();
  }
}

function go(theFrame) {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).GotoFrame(theFrame);
	playmovie();
  }
}

function golabel() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).TGotoLabel("_level0/","redframe");
  }
}