var CurrFrame = 0;
var CurrFrameChck = 0;
var filmInterval = 0;

window.setTimeout("filmInterval = window.setInterval('frameWatch()', 500)", 4000);



function myDynamicContent_DoFSCommand(command, args) { 
//  alert(command);
//  alert(args);
} 



function thisMovie(movieName) {
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName];
  } else {
    return document[movieName];
  }
}

function frameWatch() {
  try {
     theMovie = thisMovie("myDynamicContent");     
     if (movieIsLoaded(theMovie)) {
       if (theMovie.IsPlaying()) {
          CurrFrameChck = thisMovie("myDynamicContent").TCurrentFrame("_root");
          if (CurrFrameChck <= CurrFrame) {
            start_stopmovie();
            clearTheInterval("3");
          } else {
            CurrFrame = CurrFrameChck;
          }
       } else {
         clearTheInterval("2");
       }
     }
  } catch(e) {
//    alert(e);
    clearTheInterval("1");
  }
}

function clearTheInterval(wann) {
//  alert(wann);
//  alert("check: "+CurrFrameChck);
//  alert("curr: "+CurrFrame);
  window.clearInterval(filmInterval);
}

function movieIsLoaded (theMovie) {
  if (typeof(theMovie) != "undefined") {
    return theMovie.PercentLoaded() == 100;
  } else {
    return false;
  }
}


function playmovie() {
  thisMovie("myDynamicContent").Play();
}


function start_stopmovie() {
   if (thisMovie("myDynamicContent").IsPlaying()) {
     thisMovie("myDynamicContent").GotoFrame (0);
     thisMovie("myDynamicContent").StopPlay();
  } else {
    if (movieIsLoaded(thisMovie("myDynamicContent"))) {
       thisMovie("myDynamicContent").Play();
    }
  }
}
