$(document).ready(function() {
  if ($('#Test1').length > 0) {
    setTimeout(function () {zxcCngHeight('Test1',-5,10,200,50,true)},5000);
  }
});


var zxcOOPCnt=0;
 
function zxcCngHeight(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,zxcrmv,zxcl){
 if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj);}
 if (!zxcobj.oopch){ zxcobj.level=zxcl||1; zxcobj.oopch=new zxcOOPCngHeight(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,zxcrmv); }
 clearTimeout(zxcobj.oopch.to);
 zxcobj.oopch.dir=zxcdir;
 zxcobj.oopch.delay=zxcdly||zxcobj.oopch.delay;
 if (zxcdir>0){ zxcobj.style.display=''; }
 zxcobj.oopch.cngheight();
}
function zxcCngHeightToggle(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,zxcrmv){
 if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj);}
 if (!zxcobj.cnghd){ zxcobj.cnghd=zxcdir; }
 else { zxcobj.cnghd*=-1; }
 zxcCngHeight(zxcobj,zxcobj.cnghd,zxcminh,zxcmaxh,zxcdly,zxcrmv);
}
function zxcFndHidden(zxcobj,zxcary){
 var zxcels=zxcobj.getElementsByTagName('*');
 for (var zxc0=0;zxc0<zxcels.length;zxc0++){
  if (zxcels[zxc0].style.overflow=='hidden'){
   zxcary.push(zxcels[zxc0]);
  }
 }
}
function zxcOOPCngHeight(zxcm,zxcdir,zxcminh,zxcmaxh,zxcdly,zxcrmv){
 this.ary=[];
 zxcFndHidden(zxcm,this.ary);
 this.objS=zxcm.style;
 if (!this.objS.position){ this.objS.position='relative'; }
 this.obj=zxcm;
 this.ext=['none']; // (T = top decrease with height, [1]- obj top)
 this.objS.overflow='hidden';
 this.ref='zxchs'+zxcOOPCnt;
 window[this.ref]=this;
 this.hlp=0;
 this.minh=zxcminh;
 this.maxh=zxcmaxh;
 if (this.minh<Math.abs(zxcdir)){ this.minh=Math.abs(zxcdir); }
 this.rmv=zxcrmv;
 this.dir=zxcdir;
 if (zxcdir<0){ this.cnt=this.maxh; }
 else { this.cnt=this.minh; }
 this.delay=zxcdly||100;
 this.to=null;
 zxcOOPCnt++;
}
zxcOOPCngHeight.prototype.cngheight=function(){
 if ((this.dir<0&&this.cnt+this.dir>this.minh)||(this.dir>0&&this.cnt+this.dir<this.maxh)){
  this.objS.height=(this.cnt+=this.dir)+'px';
  if (this.ext[0]=='T'){ this.objS.top=(this.ext[1]-parseInt(this.objS.height))+'px'; }
  this.chloop();
  this.setTimeOut("cngheight();",this.delay);
 }
 else if (this.dir<0){ this.objS.height=this.minh+'px'; if (this.rmv){ this.objS.display='none'; }; if (this.ext[0]=='T'){ this.objS.top=(this.ext[1])+'px'; }; }
 else if (this.dir>0){ this.objS.height=this.maxh+'px'; this.chloop(); }
}
zxcOOPCngHeight.prototype.chloop=function(){
 for (this.hlp=0;this.hlp<this.ary.length;this.hlp++){
  this.ary[this.hlp].style.height=this.objS.height;
 }
}
zxcOOPCngHeight.prototype.setTimeOut=function(zxcf,zxcd){
 this.to=setTimeout("window."+this.ref+"."+zxcf,zxcd);
}
 
function zxcCngWidth(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,zxcrmv,zxcl){
 if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj);}
 if (!zxcobj.oopcw){  zxcobj.level=zxcl||1; zxcobj.oopcw=new zxcOOPCngWidth(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,zxcrmv); }
 clearTimeout(zxcobj.oopcw.to);
 zxcobj.oopcw.dir=zxcdir;
 zxcobj.oopcw.delay=zxcdly||zxcobj.oopcw.delay;
 if (zxcdir>0){ zxcobj.style.display=''; }
 zxcobj.oopcw.cngwidth();
}
function zxcCngWidthToggle(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,zxcrmv){
 if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj);}
 if (!zxcobj.cngwd){ zxcobj.cngwd=zxcdir; }
 else { zxcobj.cngwd*=-1; }
 zxcCngWidth(zxcobj,zxcobj.cngwd,zxcminw,zxcmaxw,zxcdly,zxcrmv);
}
function zxcOOPCngWidth(zxcm,zxcdir,zxcminw,zxcmaxw,zxcdly,zxcrmv){
 this.ary=[];
 zxcFndHidden(zxcm,this.ary);
 this.objS=zxcm.style;
 if (!this.objS.position){ this.objS.position='relative'; }
 this.obj=zxcm;
 this.ext=['none'];  // (L = left decrease with height, [1]- obj left)
 this.objS.overflow='hidden';
 this.ref='zxcws'+zxcOOPCnt;
 window[this.ref]=this;
 this.wlp=0;
 this.minw=zxcminw;
 this.maxw=zxcmaxw;
 if (this.minw<Math.abs(zxcdir)){ this.minw=Math.abs(zxcdir); }
 this.rmv=zxcrmv;
 this.dir=zxcdir;
 if (zxcdir<0){ this.cnt=this.maxw; }
 else { this.cnt=this.minw; }
 this.delay=zxcdly||100;
 this.to=null;
 zxcOOPCnt++;
}
zxcOOPCngWidth.prototype.cngwidth=function(){
 if ((this.dir<0&&this.cnt+this.dir>this.minw)||(this.dir>0&&this.cnt+this.dir<this.maxw)){
  this.objS.width=(this.cnt+=this.dir)+'px';
  if (this.ext[0]=='L'){ this.objS.left=(this.ext[1]-parseInt(this.objS.width))+'px'; }
  this.setTimeOut("cngwidth();",this.delay);
 }
 else if (this.dir<0){ this.objS.width=this.minw+'px'; if (this.rmv){ this.objS.display='none'; }; if (this.ext[0]=='L'){ this.objS.left=(this.ext[1])+'px'; }; }
 else if (this.dir>0){ this.objS.width=this.maxw+'px'; }
}
zxcOOPCngHeight.prototype.cwloop=function(){
 for (this.wlp=0;this.wlp<this.ary.length;this.wlp++){
  this.ary[this.wlp].style.width=this.objS.width;
 }
}
zxcOOPCngWidth.prototype.setTimeOut=function(zxcf,zxcd){
 this.to=setTimeout("window."+this.ref+"."+zxcf,zxcd);
}

