// Browser compatibility shortcut for referring to flash movies in javascript
function thisMovie(movieName) {
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(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;
  }
}


//custom script- checks if flash is loaded, stops playing if it's playing, rewinds movie and then plays
function PlayMovie(movieName,varShowDiv,varShowClass)
{
   var flashMovie=thisMovie(movieName);
   if (movieIsLoaded)
	{
     flashMovie.StopPlay();
	 flashMovie.SetVariable('varShowDiv',varShowDiv);
	 flashMovie.SetVariable('varShowClass',varShowClass);
     flashMovie.Rewind();
     flashMovie.Play();
	}
	else
	{
	 return false;
	}
}
