// based on: http://simplythebest.net/sounds/sound_guide.html

var ver=parseInt(navigator.appVersion)
var ie4=(ver>3  && navigator.appName!="Netscape")?1:0
var ns4=(ver>3  && navigator.appName=="Netscape")?1:0
var ns3=(ver==3 && navigator.appName=="Netscape")?1:0

function playSound(file_name, extension) {
 if (ie4) { 
   document.all['BGSOUND_ID'].src="sound/"+file_name+"."+extension;
 } else if ((ns4||ns3)
  && navigator.javaEnabled()
  && navigator.mimeTypes['audio/x-midi']
  && self.document[file_name].IsReady()
 )
 {
   document[file_name].play();
 }
}

function stopSound(file_name) {
 if (ie4) document.all['BGSOUND_ID'].src='jsilence.mid';
 if ((ns4||ns3)
  && navigator.javaEnabled()
  && navigator.mimeTypes['audio/x-midi']
 )
 {
  self.document[file_name].stop();
 }
}

// Script Source:  www.CodeBrain.com
var audioOn = true;
function audioDo(doWhat,toWhat){
   if(audioOn){
      var A = eval('document.'+toWhat);
      if (A != null){
         if (doWhat=='stop') A.stop();
         else{
            if (navigator.appName == 'Netscape') A.play();
            else{
               if (document.M == null){
                  document.M = false; var m;
                  for(m in A) if (m == "ActiveMovie"){
                     document.M = true; break;
                     }
                  }
               if (document.M) A.SelectionStart = 0;
               if (document.M) A.play();
            }
         }
      }
   }
}
