/****************************************************************************\
  Project     : AL-QURSU for WWW
  Language    : JavaScript Pur
  Autor       : (c) 1997, imam mujib
  Last Update : 12-08-1997
\****************************************************************************/

function LBClass(LBitem)
{ //------------- Properties -------------------------------------------------
  this.LBitem     = LBitem;
  this.iCurSel    = 0;
  this.iCount     = 1;
  //------------- Methods ----------------------------------------------------
  this.GetCurSel  = GetCurSel;  // .GetCurSel()
  this.SetCurSel  = SetCurSel;  // .SetCurSel(3,true|false)
  this.GetCount   = GetCount;   // .GetCount()
  this.SetCount   = SetCount;   // .SetCount(3)
  this.SetText    = SetText;    // .SetText(1,'First Index')
  this.SetNewList = SetNewList; // .SetNewList('First Index','Second Index',..)
  this.GetText    = GetText;    // .GetText(3)
}

function SetCurSel(index,onoff)
{ if(this.iCurSel<this.iCount)
     this.LBitem.options[this.iCurSel].selected = false;
  if(index<this.iCount)
  { this.LBitem.options[index].selected = onoff;
    this.iCurSel = index;
  }
}

function GetText(index)
{ return this.LBitem.options[index].text; }

function GetCurSel()
{ return this.LBitem.selectedIndex; }

function GetCount()
{ return this.LBitem.length; }

function SetCount(newCount)
{ this.LBitem.length = newCount;
  this.iCount = newCount;
}

function SetText(index,text)
{ if(index > this.GetCount()-1)
  {  this.LBitem.length=index+1;
     this.iCount = index + 1;
  }
  this.LBitem.options[index].text=text;
}

function SetNewList()
{ this.iCount = SetNewList.arguments.length;
  this.LBitem.length = this.iCount;
  for(i=0;i<this.iCount;i++)
    this.LBitem.options[i].text=SetNewList.arguments[i];
}
