// JavaScript Markt Movie

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 = pos;   //Zeit in Sekunden ausgeben
    
	 
// ab hier Filmpositionen aufrufen  
  if (pos == 0) {
      movieObj.TGotoFrame("_root",0);
  }
  if (pos >= 2 & pos <= 19) {
    if (currentFrame != "1") {
       movieObj.GotoFrame(1);
    }
  }
  if (pos >= 20 & pos <= 48) {
      if (currentFrame != "2") {
        movieObj.GotoFrame(2);
    }
  }
  if (pos >= 49 & pos <= 73) {
      if (currentFrame != "3") {
        movieObj.GotoFrame(3);
    }
  }
  if (pos >= 74 & pos <= 106) {
      if (currentFrame != "4") {
        movieObj.GotoFrame(4);
    }
  }
  if (pos >= 108 & pos <= 111) {
      if (currentFrame != "5") {
        movieObj.GotoFrame(5);
    }
  }
  if (pos >= 112 & pos <= 117) {
      if (currentFrame != "6") {
        movieObj.GotoFrame(6);
    }
  }
  if (pos >= 118 & pos <= 122) {
      if (currentFrame != "7") {
        movieObj.GotoFrame(7);
    }
  }
  if (pos >= 123 & pos <= 129) {
      if (currentFrame != "8") {
        movieObj.GotoFrame(8);
    }
  }
  if (pos >= 130 & pos <= 135) {
      if (currentFrame != "9") {
        movieObj.GotoFrame(9);
    }
  }
  if (pos >= 136 & pos <= 163) {
      if (currentFrame != "10") {
        movieObj.GotoFrame(10);
    }
  }
  if (pos >= 164 & pos <= 169) {
      if (currentFrame != "11") {
        movieObj.GotoFrame(11);
    }
  }
  if (pos >= 170 & pos <= 323) {
      if (currentFrame != "12") {
        movieObj.GotoFrame(12);
    }
  }
  if (pos >= 324 & pos <= 374) {
      if (currentFrame != "13") {
        movieObj.GotoFrame(13);
    }
  }
  if (pos >= 375 & pos <= 418) {
      if (currentFrame != "14") {
        movieObj.GotoFrame(14);
    }
  }
  if (pos >= 419 & pos <= 426) {
      if (currentFrame != "15") {
        movieObj.GotoFrame(15);
    }
  }
  if (pos >= 427 & pos <= 500) {
      if (currentFrame != "16") {
        movieObj.GotoFrame(16);
    }
  }


// Mediensteurung    
    {if (command == "Launch"){
        window.document.movie.SetVariable("Snoop", "PageLoad");    
        }
    }
    
    {if (command == "Open"){
        fenster = open("", "newwin", " scrollbars=1,width=460,height=450");
        fenster.document.open();
        with (fenster.document) {
            fenster.location.href = "../popup/burnrope.html";
            }
        fenster.document.close();
        }
    }

    {if (command == "Low"){
        document.Player.settings.volume = 30;
        }
    }

    {if (command == "High"){
        document.Player.settings.volume = 60;
        }
    }

    {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');
}
