﻿var zxcHideLast=true;  
var zxcOOPCnt=0;
var zxcLst;

function zxcShowHide(zxcid,zxcmax,zxcmin,zxcinc,zxcdis,obj){

 var zxcobj=zxcid;
 if (typeof(zxcid)=='string')
    { 
        var thistop=obj.style.top;
        var thisleft=obj.style.left;
        thistop = Number(thistop) + Number(190) ;        
        zxcobj=document.getElementById(zxcid);
        zxcobj.style.top=thistop; 
        zxcobj.style.left=thisleft+80;
    }
 if (!zxcobj){ return; }
 if (!zxcobj.oopsh)
    { 
        zxcobj.oopsh=new zxcOOPSH(zxcobj,zxcmax,zxcmin,zxcinc,zxcdis); 
    }
 clearTimeout(zxcobj.oopsh.to);
 zxcobj.oopsh.dir=-zxcobj.oopsh.dir;
 if (zxcobj.oopsh.h<zxcobj.oopsh.minmax[1]){ zxcobj.style.display=''; }
 if (zxcLst&&zxcLst!=zxcobj&&zxcHideLast){ clearTimeout(zxcLst.oopsh.to); zxcLst.oopsh.dir=-1; zxcLst.oopsh.showhide(); }
 zxcLst=zxcobj;
 zxcobj.oopsh.showhide();
}

function zxcOOPSH(zxcobj,zxcmax,zxcmin,zxcinc,zxcdis){
 this.obj=zxcobj;
 this.ref='zxcoopsh'+zxcOOPCnt++;
 zxcmin=zxcmin>zxcinc?zxcmin:zxcinc+1;
 zxcmax=zxcmax>zxcmin+zxcinc?zxcmax:zxcmin+zxcinc+1;
 this.minmax=[zxcinc,zxcmax,zxcmin,zxcdis||false];
 window[this.ref]=this;
 this.to=null;
 this.spd=10;
 this.dir=(parseInt(zxcobj.style.height)<this.minmax[1])?-1:1;
 this.h=parseInt(this.obj.style.height);
}

zxcOOPSH.prototype.showhide=function(){
 this.h=parseInt(this.obj.style.height);
 if ((this.dir>0&&this.h<this.minmax[1])||(this.dir<0&&this.h>this.minmax[2])){
  this.obj.style.height=(this.h+=(this.minmax[0]*this.dir))+'px';
  this.setTimeOut('showhide();',this.spd);
 }
 else {
  if (this.dir>0){ this.obj.style.height=(this.minmax[1])+'px'; }
  else { this.obj.style.height=(this.minmax[2])+'px'; if (this.minmax[3]){ this.obj.style.display='none'; } }
 }
}

zxcOOPSH.prototype.setTimeOut=function(zxcf,zxcd){
 this.to=setTimeout('window.'+this.ref+'.'+zxcf,zxcd);
}

/*]]>*/
