// JavaScript Document
var g_Browser = navigator.appName;
var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var state;
var pos;  
var npos;
var mpos;

// "TimeString(x)" - Converts the supplied time value (in seconds) into
// a decently formated text string in the format of "HH:MM:SS"
// Where "HH" won't be displayed unless the number goes that high,
// and MM and SS will be padded with zeros where/if appropriate.

function TimeString (x) {
  var hours, minutes, seconds, timeString;
  hours = Math.floor(x/60/60);
  x -= hours*60*60;
  minutes = Math.floor(x/60);
  x -= minutes*60;
  seconds = Math.floor(x);
  timeString = "";
  if (hours>0) {
    timeString += hours + ":";
    if (minutes<10) timeString += "0";
  }
  if (minutes==0) {
    timeString += "0:";
  } else {
    timeString += minutes + ":";
  }
  if (seconds==0) {
    timeString += "00";
  } else if (seconds<10) {
    timeString += "0" + seconds;
  } else {
    timeString += seconds;
  }
  return (timeString);
}

function movie_DoFSCommand(command, args) {
    var movieObj = isInternetExplorer ? document.getElementById("movie") : document.movie;
    var currentFrame = movieObj.TCurrentFrame("/");
    mpos = document.Player.controls.currentPosition;
    pos = parseInt(mpos);
    //document.display2.timedisp2.value = TimeString (pos);   //Zeit ausgeben
    
	 
 // ab hier Filmpositionen aufrufen  
  if (pos == 0) {
      movieObj.TGotoFrame("_root",0);
  }
  if (pos >= 2 & pos <= 39) {
      if (currentFrame != "1") {
        movieObj.GotoFrame(1);
    }
  }
  if (pos >= 40 & pos <= 56) {
      if (currentFrame != "2") {
        movieObj.GotoFrame(2);
    }
  }
  if (pos >= 57 & pos <= 68) {
      if (currentFrame != "3") {
        movieObj.GotoFrame(3);
    }
  }
  if (pos >= 69 & pos <= 87) {
      if (currentFrame != "4") {
        movieObj.GotoFrame(4);
    }
  }
  if (pos >= 88 & pos <= 97) {
      if (currentFrame != "5") {
        movieObj.GotoFrame(5);
    }
  }
  if (pos >= 98 & pos <= 107) {
      if (currentFrame != "6") {
        movieObj.GotoFrame(6);
    }
  }
  if (pos >= 108 & pos <= 121) {
      if (currentFrame != "7") {
        movieObj.GotoFrame(7);
    }
  }
  if (pos >= 122 & pos <= 131) {
      if (currentFrame != "8") {
        movieObj.GotoFrame(8);
    }
  }
  if (pos >= 132 & pos <= 152) {
    if (currentFrame != "9") {
        movieObj.GotoFrame(9);
    }
  }
  if (pos >= 153 & pos <= 191) {
    if (currentFrame != "10") {
      movieObj.GotoFrame(10);
    }
  }
  if (pos >= 192 & pos <= 201 ) {
      if (currentFrame != "11") {
      movieObj.GotoFrame(11);
    }
  }
  if (pos >= 202 & pos <= 215 ) {
      if (currentFrame != "12") {
      movieObj.GotoFrame(12);
    }
  }
  if (pos >= 216 & pos <= 220 ) {
      if (currentFrame != "13") {
      movieObj.GotoFrame(13);
    }
  }
  if (pos >= 221 & pos <= 234 ) {
      if (currentFrame != "14") {
      movieObj.GotoFrame(14);
    }
  }
  if (pos >= 235 & pos <= 250 ) {
      if (currentFrame != "15") {
      movieObj.GotoFrame(15);
    }
  }
  if (pos >= 251 & pos <= 260 ) {
      if (currentFrame != "16") {
      movieObj.GotoFrame(16);
    }
  }
  if (pos >= 261 & pos <= 265 ) {
      if (currentFrame != "17") {
      movieObj.GotoFrame(17);
    }
  }
  if (pos >= 266 & pos <= 273 ) {
      if (currentFrame != "18") {
      movieObj.GotoFrame(18);
    }
  }
  if (pos >= 274 & pos <= 282 ) {
      if (currentFrame != "19") {
      movieObj.GotoFrame(19);
    }
  }
  if (pos >= 283 & pos <= 292 ) {
      if (currentFrame != "20") {
      movieObj.GotoFrame(20);
    }
  }
  if (pos >= 293 & pos <= 299 ) {
      if (currentFrame != "21") {
      movieObj.GotoFrame(21);
    }
  }
  if (pos >= 300 & pos <= 308 ) {
      if (currentFrame != "22") {
      movieObj.GotoFrame(22);
    }
  }
  if (pos >= 309 & pos <= 316 ) {
      if (currentFrame != "23") {
      movieObj.GotoFrame(23);
    }
  }
  if (pos >= 317 & pos <= 324 ) {
      if (currentFrame != "24") {
      movieObj.GotoFrame(24);
    }
  }
  if (pos >= 325 & pos <= 330 ) {
      if (currentFrame != "25") {
      movieObj.GotoFrame(25);
    }
  }
  if (pos >= 331 & pos <= 334 ) {
      if (currentFrame != "26") {
      movieObj.GotoFrame(26);
    }
  }
  if (pos >= 335 & pos <= 344 ) {
      if (currentFrame != "27") {
      movieObj.GotoFrame(27);
    }
  }
  if (pos >= 345 & pos <= 350) {
      if (currentFrame != "28") {
      movieObj.GotoFrame(28);
    }
  }
  if (pos >= 351 & pos <= 356 ) {
      if (currentFrame != "29") {
      movieObj.GotoFrame(29);
    }
  }
  if (pos >= 357 & pos <= 361 ) {
      if (currentFrame != "30") {
      movieObj.GotoFrame(30);
    }
  }
  if (pos >= 362 & pos <= 372 ) {
      if (currentFrame != "31") {
      movieObj.GotoFrame(31);
    }
  }
  if (pos >= 373 & pos <= 377 ) {
      if (currentFrame != "32") {
      movieObj.GotoFrame(32);
    }
  }
  if (pos >= 378 & pos <= 383 ) {
      if (currentFrame != "33") {
      movieObj.GotoFrame(33);
    }
  }
  if (pos >= 384 & pos <= 388 ) {
      if (currentFrame != "34") {
      movieObj.GotoFrame(34);
    }
  }
  if (pos >= 389 & pos <= 397 ) {
      if (currentFrame != "35") {
      movieObj.GotoFrame(35);
    }
  }
  if (pos >= 398 & pos <= 401 ) {
      if (currentFrame != "36") {
      movieObj.GotoFrame(36);
    }
  }
  if (pos >= 402 & pos <= 409 ) {
      if (currentFrame != "37") {
      movieObj.GotoFrame(37);
    }
  }
  if (pos >= 410 & pos <= 414 ) {
      if (currentFrame != "38") {
      movieObj.GotoFrame(38);
    }
  }
  if (pos >= 415 & pos <= 454 ) {
      if (currentFrame != "39") {
      movieObj.GotoFrame(39);
    }
  }
  if (pos >= 455 & pos <= 475 ) {
      if (currentFrame != "40") {
      movieObj.GotoFrame(40);
    }
  }
  if (pos >= 476 & pos <= 490 ) {
      if (currentFrame != "41") {
      movieObj.GotoFrame(41);
    }
  }


  // Mediensteurung  
  {if (command == "Launch"){
    window.document.movie.SetVariable("Snoop", "PageLoad");  
    }
  }

  {if (command == "Forward"){
    document.Player.controls.currentPosition = document.Player.controls.currentPosition + 50;
    }
  }

    {if (command == "Rewind"){
    document.Player.controls.currentPosition = document.Player.controls.currentPosition - 50;
    }
  }

   {if (command == "Level"){
    document.Player.settings.volume = parseInt(args);
    }
  }

  {if (command == "Pan"){
    document.Player.settings.balance = parseInt(args);
    }
  }

  {if (command == "Stop"){
    document.Player.controls.stop();
    document.Player.controls.currentPosition = 0;
    }
  }

{if (command == "Pause"){
    document.Player.controls.pause();
    }
  }

{if (command == "Play"){
    document.Player.controls.play();
    }
  }
}

// Hook for Internet Explorer 
  if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
    navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
    document.write('<SCRIPT LANGUAGE=VBScript\> \n');
    document.write('on error resume next \n');
    document.write('Sub movie_FSCommand(ByVal command, ByVal args)\n');
    document.write('  call movie_DoFSCommand(command, args)\n');
    document.write('end sub\n');
    document.write('</SCRIPT\> \n');
}
