// JavaScript Document
function Player()
{
   this.isPlaying = 0 ;
   this.PlayerOn  = '';
   this.PlayerOff = '';
   this.PlaySrc = null;

   this.SetPlayerImages=function(imgOn,imgOff)
   {
      this.PlayerOn=imgOn;
      this.PlayerOff=imgOff;
   }

   this.stopMP3=function()
   {
      frames['playerFrame'].location.href = 'about:blank'; // пустой файл

      if(this.PlayIMG)
      {
         this.PlayIMG.src=this.PlayerOn;
      }
      this.PlayIMG=null;
      this.isPlaying = 0;
   }

   this.playMP3=function (_this, fileName)
   {
      this.isPlaying = 1;

      if(_this)
      {
         var tag=_this.tagName;
         if(tag=='A')
         {
            if(_this.getElementsByTagName('img'))
            {  
               this.PlayIMG=_this.getElementsByTagName('img')[0];
            }
         }
         else
         {
            if(tag=='IMG')
            {
               this.PlayIMG = _this;
            }
         }
      }
      if(this.PlayIMG)
      {
         this.PlayIMG.src=this.PlayerOff;
      }
      frames['playerFrame'].location.href = 'http://song4you.ru/player.php?mp3='+fileName;
   }
   
   this.stopAll=function()
   {
       this.stopMP3();
   }
}
   
/*
function play(fileName)
{
//  stopAll();  
    
 if (isPlaying == 1) // если кликнули на плеер, который играет, выключаем его
 {
        stopMP3();
    }
    else // иначе включаем другой плеер
    {
        playMP3(fileName);
    }
}

//*/
function getVariant() 
{
 theGroup = document.getElementsByName("variant");

 for (i=0; i< theGroup.length; i++)
 {
     if (theGroup[i].checked) 
     {
        return theGroup[i].value;
        break;
     }
  }
  return 0;
}

