// ============================================================================
//    PURPOSE:             Класс CC_textButtonDis представляет кнопку с тремя
//                            состояниями (enabled-mouseOut, enabled-mouseOver, disabled)
//
//    FUNCTIONAL AREA:     GUI
//    NAME:                CC_textButtonDis.js
//    VERSION:             1.0
//    AUTHORS:             Sasha
//    DESIGN REFERENCE:    
//    MODIFICATION:        26.09.2005 - (version 1.0) 
// ============================================================================
// =================================================================== INCLUDES
// =================================================================== SYNOPSIS
// ================================================================== CONSTANTS
var GUIH_3SB_ENABLED  = true;
var GUIH_3SB_DISABLED = false;
// ================================================================== VARIABLES
// ================================================================== FUNCTIONS

// ============================================================================
function CC_textButtonDis(imgId, classBase, enabled)
// ============================================================================
   //PURPOSE:
      //конструктор

   //INPUT:
      //(imgId)            - html-идентификатор изображения, которое соответствует кнопке
      //(imgPath)          - базовая часть пути к файлу(ам) с изображением кнопки
      //                      ".../butX"
      //(enabled)          - true, если кнопка активна, false в прот. случае
      //(urlArr)           - массив url, по которым передавать управление в случае 
      //                      нажатия на кнопку

   //OUTPUT:
{
   this.onOver             = CC_textButtonDis_onOver;
   this.onOut              = CC_textButtonDis_onOut;
   this.onClick            = CC_textButtonDis_onClick;
   this.setEnabled         = CC_textButtonDis_setEnabled;
   

   this.draw               = CC_textButtonDis_draw;
   //this.setSelectedRadio   = CGUIH_3stButton_setSelectedRadio;
   //this.setEnabled         = 
   
   this.m_imgId            = imgId;
   //this.m_imgPath          = imgPath;
   this.m_enabled          = enabled;
   this.m_classBase        = classBase;
   //this.m_radioValue       = -1;
   //this.m_urlArr           = urlArr;
   //this.m_radioGroupId     = radioGroupId;
   //alert(222);
}


// ============================================================================
function CC_textButtonDis_setEnabled(newState)
// ============================================================================
{
   this.m_enabled          = newState;
   this.draw();
}

/*
// ============================================================================
function CGUIH_3stButton_setSelectedRadio(radioButNumber)
// ============================================================================
   //PURPOSE:
      //обработчик события MOUSE_OVER кнопки

   //INPUT:
      //(radioButNumber)       - номер нажатой радиокнопки

   //OUTPUT:
{
   this.m_enabled          = GUIH_3SB_ENABLED;


   //меняем видимое состояние кнопки
   var imgObj = document.getElementById(this.m_imgId);
   imgObj.src = this.m_imgPath + ".gif";
   //alert(this.m_imgPath + ".gif");

   this.m_radioValue = radioButNumber;
}
*/

// ============================================================================
function CC_textButtonDis_onOver()
// ============================================================================
   //PURPOSE:
      //обработчик события MOUSE_OVER кнопки

   //INPUT:

   //OUTPUT:
{

   if (!this.m_enabled)
   {
      //при наведении мыши на кнопку ничего не делаем
      return;
   }

   //alert("CC_textButtonDis_onOver");
   //UI_echo("this.m_enabled", this.m_enabled);
   //alert("CGUIH_3stButton_onOver");

   //при наведении мыши на кнопку подсвечиваем ее
   //var imgObj = document.getElementById(this.m_imgId);
   //this.className=this.m_classBase + 'O';

   //imgObj.src = this.m_imgPath + "O.gif";



   var imgObj = document.getElementById(this.m_imgId);
   var aObj  = document.getElementById(this.m_imgId + "_A");

   aObj.className   = "CC_textButtonDis_A_OVER";
   imgObj.className = this.m_classBase + "O";
}


// ============================================================================
function CC_textButtonDis_onOut()
// ============================================================================
   //PURPOSE:
      //обработчик события MOUSE_OUT кнопки

   //INPUT:

   //OUTPUT:
{
   if (!this.m_enabled)
   {
      //при наведении мыши на кнопку ничего не делаем
      return;
   }

   //при наведении мыши на кнопку подсвечиваем ее
   //var imgObj = document.getElementById(this.m_imgId);
   //imgObj.src = this.m_imgPath + ".gif";
   //this.className=this.m_classBase;



   var imgObj = document.getElementById(this.m_imgId);
   var aObj  = document.getElementById(this.m_imgId + "_A");

   aObj.className   = "CC_textButtonDis_A_OUT";
   imgObj.className = this.m_classBase;

}


// ============================================================================
function CC_textButtonDis_onClick(cmd)
// ============================================================================
   //PURPOSE:
      //обработчик события MOUSE_CLICK кнопки

   //INPUT:

   //OUTPUT:
{
   if (!this.m_enabled)
   {
      //при наведении мыши на кнопку ничего не делаем
      return;
   }

   eval(cmd);

   //передача управления странице по нажатию на кнопку
   //var obj = this.m_radioGroupId;
   //var a = obj.m_selected;
   //var url = this.m_urlArr[this.m_radioValue];

   //alert(this.m_urlArr[this.m_radioValue]);
   //window.location = url;
}

// ============================================================================
function CC_textButtonDis_draw()
// ============================================================================
{
   var imgObj = document.getElementById(this.m_imgId);
   var aObj  = document.getElementById(this.m_imgId + "_A");

   if (!this.m_enabled)
   {
      //при наведении мыши на кнопку ничего не делаем
      //return;
      aObj.className   = "CC_textButtonDis_A_DISABLED";
      imgObj.className = this.m_classBase+"D";
   }
   else
   {
      aObj.className   = "CC_textButtonDis_A_OUT";
      imgObj.className = this.m_classBase;
   };

   //alert(this.m_classBase);
}

