<!-- hide script ---
// Global - so there is only one MIDI window
var newWindow = null

// MIDIfileURL is the complete address of the MIDI file
// it is passed in from the individual link on the page.
function newMIDIWindow(MIDIfileURL) {
  newWindow = window.open("","","status,height=50,width=170")
  if(newWindow != null)
  {
    var newContent = "<html><head><title>MIDI</title></head>"
    newContent += "<body><EMBED SRC='" + MIDIfileURL + "'"
    newContent += " WIDTH=150 HEIGHT=40 PANEL=0 AUTOSTART=TRUE REPEAT=FALSE>"
    newContent += "</body></html>"
    newWindow.document.write(newContent)
    newWindow.document.close()
  }
}

function closeMIDIWindow() {
  if(newWindow != null)
    newWindow.close()
}

function focusMIDIWindow() {
  if(newWindow != null)
    newWindow.focus()
}
  
function play_sound() {
  newWindow.document.embeds[0].play(false)
}

function stop_sound() {
  newWindow.document.embeds[0].stop()
}

function pause_sound() {
  newWindow.document.embeds[0].pause()
}

// ---- end script -->

