// JavaScript Document
var g_Browser = navigator.appName;
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var state;
var rstate
var pos;   
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 = InternetExplorer ? document.getElementById("movie") : document.movie;
 
    mpos = document.Player.controls.currentPosition;
    pos = TimeString (mpos);
    state = document.Player.playState;
    rstate = document.Player.playState;
    movieObj.SetVariable("_root.rstate", rstate);
    movieObj.SetVariable("_root.ptime", pos);
    movieObj.SetVariable("_root.state", state);
// document.display.timedisp.value = pos;

  {if (command == "Launch"){
    window.document.movie.SetVariable("Snoop", "PageLoad");   
      }
  }
   
  {if (command == "PopUp1"){
      popup ('../popup/please.html', '480', '600', true);
        }
  }
  
  {if (command == "PopUp2"){
      popup ('../popup/bloodon.html', '480', '600', true);
        }
  }

  {if (command == "PopUp3"){
      popup ('../popup/ladylies.html', '480', '600', true);
        }
  }

  
  {if (command == "PopUp4"){
      popup ('../popup/visions.html', '480', '600', true);
        }
  }


  {if (command == "PopUp5"){
      popup ('../popup/anyway.html', '480', '600', true);
        }
  }

  {if (command == "PopUp6"){
      popup ('../popup/thevine_e.html', '470', '600', true);
        }
  }

  {if (command == "PopUp7"){
      popup ('../popup/evidence.html', '470', '600', true);
        }
  }
    
  {if (command == "Open"){
      popup ('seven.htm', '550', '450', true);
      }
  }

  {if (command == "Open1"){
       popup ('../popup/helpdesk.html', '400', '550', true);
      }   
  }

  {if (command == "Open2"){
      popup ('../popup/wintertale.htm', '460', '450', true);
      }
  }  

  {if (command == "Open3"){
      popup ('200fragen.htm', '550', '600', false);
      }
  }  

  {if (command == "Load"){
      document.Player.URL = "midifiles/seven_stones.mid";
      }
  }

  {if (command == "Sound"){
      document.Player.URL = args;
      }
  }


// Mediensteurung  
  {if (command == "Forward"){
        document.Player.controls.currentPosition = document.Player.controls.currentPosition + 20;
      }
  }
  
    {if (command == "Rewind"){
        document.Player.controls.currentPosition = document.Player.controls.currentPosition - 20;
      }
  }

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

  {if (command == "Ende"){
      window.location.href = "../index.html"
      }
  }   

}

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

