var wspCollapse = function(ObjId, SetId, Cfg)
{
 this.step = 15;
 this.height = 237;

 this.setid = 0; this.timer = null; this.name = ObjId;
 this.obj = document.getElementById(ObjId);

 if(typeof Cfg == 'undefined') Cfg = new Array();
 if(Cfg['Height'] > 0) this.height = Cfg['Height'];
 if(Cfg['Step'] > 0) this.step = Cfg['Step'];

 this.fSet = function(id)
 {
  this.setid = id;
  this.fDoHide();
 };
 this.fDoHide = function()
 {
  this.fClrTimer(); var re = /\D/g;
  var height = this.obj.style.height.replace(re, '')*1;
  if(height < 2) return this.fDoSet();
 
  if(height > this.step) this.obj.style.height = (height-this.step) + 'px';
   else this.obj.style.height = '1px';
  this.timer = setTimeout(this.name+".fDoHide()", 25);
 };
 this.fDoSet = function()
 {
  this.fClrTimer();
  if(this.setid < 1) return;
  this.obj.style.display = 'none';
  this.obj.innerHTML = document.getElementById(this.name+this.setid).innerHTML;
  this.obj.style.height = '1px'; this.obj.style.display = 'block';
  this.fDoShow();
 };
 this.fDoShow = function()
 {
  this.fClrTimer(); var re = /\D/g; 
  var height = this.obj.style.height.replace(re, '')*1;
  if(height >= this.height) return;
 
  if(height+this.step < this.height) this.obj.style.height = (height+this.step) + 'px';
   else this.obj.style.height = this.height + 'px';
  this.timer = setTimeout(this.name+".fDoShow()", 25);
 };
 this.fClrTimer = function()
 {
  clearTimeout(this.timer); this.timer = null;
 };
 
 if(typeof SetId == 'undefined') SetId = 0;
 if(SetId > 0) this.fSet(SetId);
};

