var movieName = "gwTutorialMovie";

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 window[movieName]
  }	else {
    return document[movieName]
  }
}

// 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;
  }
}


function playmovie() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).Play();
  }
}

function stopmovie() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).StopPlay();
  }
}


function go(theFrame) {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).GotoFrame(theFrame);
  }
}

function golabel() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).TGotoLabel("_level0/","redframe");
  }
}


/*var movieName = "gwTutorialMovie";
var frameJump = 80;

//alert(movieObj(movieName));

/*function movieObj(movieName)
{
    // IE and Mozilla refer to the movie object differently.
    if (navigator.appName.indexOf ("Microsoft") != -1)
    {
        return window[movieName];
    }
    else
    {
        return document[movieName];
    }
}function movieObj(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]
  }
}


function movieIsLoaded (theMovie)
{
    if (typeof(theMovie) != "undefined")
    {
        return theMovie.PercentLoaded() == 100;
    }
    else
    {
        return false;
    }
}

function playMovie()
{
    if (movieIsLoaded(movieObj(movieName)))
    {
        if (document.getElementById('playStatus').value == 0)
        {
            document.getElementById('playStatus').value = 1;
            document.getElementById('playButton').value = "Pause";
            movieObj(movieName).Play();
        }
        else
        {
            document.getElementById('playStatus').value = 0;
            document.getElementById('playButton').value = "Play";
            alert(movieObj(movieName));
            movieObj(movieName).StopPlay();
        }

    }
}

function stopMovie()
{
    if (movieIsLoaded(movieObj(movieName)))
    {
        movieObj(movieName).StopPlay();
        movieObj(movieName).GotoFrame(0);
        document.getElementById('playStatus').value = 0;
        document.getElementById('playButton').value = "Play";
    }
}

function rewindMovie()
{
    if (movieIsLoaded(movieObj(movieName)))
    {
        movieObj(movieName).Rewind();
    }
}

function gotoFrame(frameNo)
{
    if (movieIsLoaded(movieObj(movieName)))
    {
        movieObj(movieName).GotoFrame(frameNo);
    }
}

function forwardMovie()
{
    if (movieIsLoaded(movieObj(movieName)))
    {
        // Get Total Frames
        if (navigator.appName.indexOf ("Microsoft") != -1)
        {
            totalFrames = movieObj(movieName).TotalFrames;
        }
        else
        {
            totalFrames = movieObj(movieName).TotalFrames();
        }
        // Get Current Frame
        currentFrame = movieObj(movieName).TCurrentFrame('_level0/');

        if (currentFrame < totalFrames - frameJump)
        {
            movieObj(movieName).StopPlay();
            gotoFrame(currentFrame + frameJump);
            movieObj(movieName).Play();
        }

    }
}

function backwardMovie()
{
    if (movieIsLoaded(movieObj(movieName)))
    {
        // Get Current Frame
        currentFrame = movieObj(movieName).TCurrentFrame('_level0/');

        if (currentFrame > frameJump)
        {
            movieObj(movieName).StopPlay();
            gotoFrame(currentFrame - frameJump);
            movieObj(movieName).Play();
        }

    }
}

function checkProgress()
{
    // Get Total Frames
    if (navigator.appName.indexOf ("Microsoft") != -1)
    {
        totalFrames = movieObj(movieName).TotalFrames;
    }
    else
    {
        totalFrames = movieObj(movieName).TotalFrames();
    }

    /*if (document.getElementById('f_total').value == 0)
    {
        document.getElementById('f_total').value = totalFrames;
    }

    if (movieIsLoaded(movieObj(movieName)))
    {
        // Get Current Frame
        currentFrame = movieObj(movieName).TCurrentFrame('_level0/');
        //document.getElementById('f_current').value = currentFrame;
        currentPercent = Math.round((currentFrame / totalFrames) * 100);
        document.getElementById('f_percent').value = currentPercent;
        document.getElementById('progressBar').style.width = currentPercent + '%';

        if (currentFrame < parseInt(totalFrames) - 2)
        {
            setTimeout("checkProgress()", 100);
        }
        else
        {
            //document.getElementById('f_current').value = 0;
            document.getElementById('f_percent').value = 0;
            document.getElementById('progressBar').style.width = '0%';
            document.getElementById('playStatus').value = 0;
            document.getElementById('playButton').value = "Play";
            movieObj(movieName).StopPlay();
            return;
        }

    }
    else
    {
        setTimeout("checkProgress()", 100);
    }
}*/