// $Revision: 3886 $

function CloseRedoCloseMouseOver(objName)
{
  eval(objName).HighlightClose();
}

function CloseRedoRedoMouseOver(objName)
{
  eval(objName).HighlightRedo();
}

function CloseRedoMouseOut(objName)
{
  eval(objName).HighlightNone();
}

function TCloseRedoObj(objName, closeFunc, redoFunc, closeAlt, redoAlt)
{
  this.ObjName = objName;
  this.Place = Place;
  this.CloseAlt = closeAlt;
  this.RedoAlt = redoAlt;
  this.CloseFunc = closeFunc;
  this.RedoFunc = redoFunc;
  
  this.MapName = "mapCloseRedo" + this.ObjName;
  this.ID = this.ObjName;
  this.IDImg = this.ObjName + "Img";
  this.IDImg1 = "IDCloseRedoImg1" + this.ObjName;
  this.IDImg2 = "IDCloseRedoImg2" + this.ObjName;
  this.IDImg3 = "IDCloseRedoImg3" + this.ObjName;
  
  this.SrcImg = new Array(Environment.getResourceDirectory() + 'img/Features/CloseRedo.PNG',
                          Environment.getResourceDirectory() + 'img/Features/CloseRedoCloseHigh.PNG',
                          Environment.getResourceDirectory() + 'img/Features/CloseRedoRedoHigh.PNG');
  
  this.ExportAreas = function()
  {
    var res = "";
    
    res += "<MAP name=\'" + this.MapName + "\'>";
    res += "<AREA shape=\'circle\' coords=\'74, 16, 15\' title=\'" + this.CloseAlt + "\' onmouseover='CloseRedoCloseMouseOver(\"" + this.ObjName + "\")' onmouseout='CloseRedoMouseOut(\"" + this.ObjName + "\")' onclick=\'" + this.CloseFunc + "();\'>";
    res += "<AREA shape=\'circle\' coords=\'28, 41, 30\' title=\'" + this.RedoAlt + "\' onmouseover='CloseRedoRedoMouseOver(\"" + this.ObjName + "\")' onmouseout='CloseRedoMouseOut(\"" + this.ObjName + "\")' onclick=\'" + this.RedoFunc + "();\'>";
    res += "</MAP>";
    
    return res;
  }
  
  this.Generate = function()
  {
    var res = "";
    
    res += this.ExportAreas();
    if(isOpera())
    {
        res += "<div style='display: none' id='" + this.ID + "'><div id='" + this.IDImg1 + "' style='position: relative; visibility: visible; z-index: 0; width: 150px;'><img align='right' style='cursor: pointer' usemap='#" + this.MapName + "' src='" + this.SrcImg[0] + "'></div>" +
                  "<div id='" + this.IDImg2 + "' style='position: relative; top: -71px; visibility: hidden; z-index: 1; width: 150px;'><img align='right' style='cursor: pointer' usemap='#" + this.MapName + "' src='" + this.SrcImg[1] + "'></div>" +
                  "<div id='" + this.IDImg3 + "' style='position: relative; top: -142px; visibility: hidden; z-index: 2; width: 150px;'><img align='right' style='cursor: pointer' usemap='#" + this.MapName + "' src='" + this.SrcImg[2] + "'></div></div>";
   }
   else
   {
      res += "<span style='cursor: pointer'>" + Img(this.SrcImg[0], this.MapName, this.IDImg) + "</span>"; 
   }
    
    return res;
  }
  
  this.Get = function()
  {
    return document.getElementById(this.ID);
  }  
  
  this.Show = function(bVal)
  {
    if(!isOpera()) return;
    if(bVal)
    {
      this.Get().style.display = "";
    }
    else
    {
      this.Get().style.display = "none";
    }
  }   
  
  this.ShowEl = function(ind)
  {    
    document.getElementById(this.IDImg).src = this.SrcImg[ind];            
  }
  
  this.ShowElOpera = function(ind)
  {
    var obj = new Array(document.getElementById(this.IDImg1),
                        document.getElementById(this.IDImg2),
                        document.getElementById(this.IDImg3));                                        
                        
    for(var i = 0; i < 3; i++)
      if(i == ind)
        obj[i].style.visibility = "visible";
      else
        obj[i].style.visibility = "hidden";
  }
  
  this.HighlightClose = function()
  {
    if(isOpera())
      this.ShowElOpera(1);
    else
      this.ShowEl(1);
  }
  
  this.HighlightRedo = function()
  {
    if(isOpera())
      this.ShowElOpera(2);
    else
      this.ShowEl(2);
  }
  
  this.HighlightNone = function()
  {
    if(isOpera())
      this.ShowElOpera(0);
    else
      this.ShowEl(0);
  }
}
