/*

  (c) 2006 TUFaT.com. All Rights Reserved

*/

//var mysound = new FlashSound();
//mysound.embedSWF("../sound/sound.swf");
//mysound.gotoAndPlay('/_default.mp3','start');

function muteResore (node) {
	if( node == "All" )
	{
		config["sound"]["muteAll"] = TempArraySound[node];
		return;
	}
	if( node == "volume" )
	{
		config["sound"]["volume"] = TempArraySound[node];
		return;
	}
  if ( TempArraySound[node] == true )
    config["sound"]["ev"][node]["muted"] = true;
  else
    config["sound"]["ev"][node]["muted"] = false;
}
function muteUnmute (node) {
  if (node["mutes"] == "all") {
    if (node.checked == true)
      config["sound"]["muteAll"] = true;
    else
      config["sound"]["muteAll"] = false;

    return;
  }

  if (node.checked == true)
  {
	config["sound"]["ev"][node["mutes"]]["muted"] = false;
}
  else
    config["sound"]["ev"][node["mutes"]]["muted"] = true;
}

function changeVolume (selNode) {
  var newValue = selNode.value;

  config["sound"]["volume"] = newValue;
}

function testSound (node) {
  var play = node["tests"];
  playSound (play, true);  
}

function playSound (whatToPlay,testsound) {	
  /* TODO: implement this. For now, just show in the status */
  if ((config["sound"]["muteAll"] != "1" && config["sound"]["ev"][whatToPlay]["muted"] != true) || (testsound==true)){
	mysound.gotoAndStop("/",config["sound"]["volume"]);
	//alert(config["sound"]["ev"][whatToPlay]["file"]);
   mysound.gotoAndPlay("/PLAY" + config["sound"]["ev"][whatToPlay]["file"].replace("sounds/","").replace(".mp3",""),'start');
  }
}

