﻿function getFlashMovieObject(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);
  }
}
function PlayMovie(movieName)
{
     var flashMovie=getFlashMovieObject(movieName);
     flashMovie.Play();
}
function StopMovie(movieName)
{
     var flashMovie=getFlashMovieObject(movieName);
     flashMovie.StopPlay();
}
function RewindMovie(movieName)
{
	var flashMovie=getFlashMovieObject(movieName);
	flashMovie.Rewind();
}

function changeMovie(movieName, movieSrc) {
	var flashMovie=getFlashMovieObject(movieName);
	if(flashMovie.IsPlaying()) {flashMovie.StopPlay()};
	flashMovie.LoadMovie(0,movieSrc);
}

function NextFrameMovie(movieName)
{
	var flashMovie=getFlashMovieObject(movieName);
	// 4 is the index of the property for _currentFrame
	var currentFrame=flashMovie.TGetProperty("/", 4);
	var totalFrames=flashMovie.TGetProperty("/", 5);
	var nextFrame=parseInt(currentFrame);
	var lastFrame=parseInt(totalFrames);
	if (nextFrame>=lastFrame)
		nextFrame=0;
	flashMovie.GotoFrame(nextFrame);		
}

function PrevFrameMovie(movieName)
{
	var flashMovie=getFlashMovieObject(movieName);
	// 4 is the index of the property for _currentFrame
	var currentFrame=flashMovie.TGetProperty("/", 4);
	var totalFrames=flashMovie.TGetProperty("/", 5);
	var nextFrame=parseInt(currentFrame);
	var lastFrame=parseInt(totalFrames);
	nextFrame = nextFrame - 2;
	if (nextFrame<=0)
		nextFrame=lastFrame;
	flashMovie.GotoFrame(nextFrame);		
}

function ZoominMovie(movieName)
{
	var flashMovie=getFlashMovieObject(movieName);
	flashMovie.Zoom(90);
}

function ZoomoutMovie(movieName)
{
	var flashMovie=getFlashMovieObject(movieName);
	flashMovie.Zoom(110);
}
