function TBehSound()
{
  this.IsPlay = true;
  this.ObjIn;
  this.ObjA;
  
  this.ChoosePlay = function()
  {
    this.ObjIn = document.getElementById('IDPlayInact');
    this.ObjA = document.getElementById('IDPlayAct');
  }
  this.ChoosePause = function()
  {
    this.ObjIn = document.getElementById('IDPauseInact');
    this.ObjA = document.getElementById('IDPauseAct');
  }
  
  this.Choose = function()
  {
    if(this.IsPlay)
      this.ChoosePlay();
    else
      this.ChoosePause();
  }
  
  this.MouseOut = function()
  {
    this.Choose();
    
    this.ObjA.style.visibility = "hidden";
    this.ObjIn.style.visibility = "visible";
  }
  
  this.MouseOver = function()
  {
    this.Choose();
    
    this.ObjA.style.visibility = "visible";
    this.ObjIn.style.visibility = "hidden";  
  }
  
  this.FileNum = 1;
  
  this.Click = function(fNum)
  {
    this.FileNum = fNum;
    this.TogglePlay();
  }
  
  this.HideInact = function()
  {
    
    if(this.IsPlay)
    {
      this.Obj1 = document.getElementById('IDPauseInact');
      this.Obj2 = document.getElementById('IDPauseAct');
    }
    else
    {
      this.Obj1 = document.getElementById('IDPlayInact');
      this.Obj2 = document.getElementById('IDPlayAct');
    }
    
    this.Obj1.style.visibility = "hidden";
    this.Obj2.style.visibility = "hidden";       
  }
  
  this.ToggleBtn = function()
  {
    this.IsPlay = !this.IsPlay;
    this.HideInact();
    this.MouseOver();
  }
  
  this.TogglePlay = function()
  {
    this.ToggleBtn();
    
    if(this.IsPlay)
      this.Pause();
    else
      this.Play();
  }
  
  this.Call = function(p, arg)
  {
    try
    {
      if(window.document["flashSound"]) 
      {
        window.document["flashSound"].SetVariable(p, arg);
      }
      else
      {
        document.flashSound.SetVariable(p, arg);
      }
    }
    catch(e)
    {
// warn about problem to access to FlashInput   
    }
  }
  
  this.Play = function()
  {
      this.Call("listener.play", "true");
      
      if(this.FileNum != undefined)
	      RequestAJAX("/profile/listen_sound.html?file="+this.FileNum);
  }
  this.Pause = function()
  {
      this.Call("listener.play", "false");
  }
  
}

var BehSnd = new TBehSound();
