var movieInfo = {};

function getMovie(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 window[movieName];
  } else {
    return document[movieName];
  }
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
  // First make sure the movie's defined.
  if (typeof(theMovie) != "undefined") {
    // If it is, check how much of it is loaded.
    return theMovie.PercentLoaded() == 100;
  } else {
    // If the movie isn't defined, it's not loaded.
    return false;
  }
}

function playmovie(movieName, type, size) {
  if (movieIsLoaded(getMovie(movieName))) {
    if (size=='small') {
      if (type=='over') {
        getMovie(movieName).over();
      } else if (type='out') {
        getMovie(movieName).out();
      }
    } else {
      if(getMovie(movieName).IsPlaying()) {
        if (type=='out') {
          clearTimeout(movieInfo[movieName]);
        }
      } else {
        if (type=='over') {
          getMovie(movieName).Play();
          movieInfo[movieName] = setTimeout("getMovie('"+movieName+"').StopPlay();",1607);
        } else {
          getMovie(movieName).Play();
        }
      }
    }
  }
}

function addFrame(movieName) {
  var frame = movieInfo[movieName]['frame'];
  frame++;
  movieInfo[movieName]['frame'] = frame;
  getMovie(movieName).GotoFrame(frame);
}

