var c = 0; 
var t; 
var z = 0;
var y = 0; 
var i = 0;
var j = 200;
var b = 1;
var theight = new Array(100);
var thez = new Array(100);

for (rt=0;rt<=100;rt=rt+1)
{
theight[rt] = 0;
}

function dispSize(el){
document.getElementById(el).innerHTML = '';
for (rt=0;rt<=10;rt=rt+1)
  {
    document.getElementById(el).innerHTML = document.getElementById(el).innerHTML+theight[rt]+'px - Current size: '+thez[rt]+'px<br/>';
  }
}

function setHeight(el){
if(theight[el] == 0){
  document.getElementById('foldout'+el).style.display = 'block';
  thez[el] = 0; 
  theight[el] = document.getElementById('foldout'+el).offsetHeight; //Get objects full height 
  //dispSize('error'); 
}else{
 document.getElementById('foldout'+el).style.display = 'block';
 thez[el] = 0; 
}
  
}

function grow(el){
if(thez[el] < theight[el] + 5){
  thez[el]=thez[el]+10;
  document.getElementById('foldout'+el).style.height=thez[el]+'px'; //grow by 1 pixel  
  t=setTimeout(function(){grow(el)},15);
  //dispSize('error');
 }else{
  stopCount('show',el);
 }

}

/////////////
function shrink(els){
 if(thez[els]>10){ //if height hasnt shrunk below 0 width
    thez[els]=thez[els]-10;
    document.getElementById('foldout'+els).style.height=thez[els]+'px'; //shrink by 1 pixel
    t=setTimeout(function(){shrink(els)},15);
    //dispSize('error'); 
 }else{
    stopCount('hide',els);
 }
}
///////////////////////

function stopCount(trigger, elm)
{
clearTimeout(t);
  if(trigger == 'hide'){
    document.getElementById('foldout'+elm).style.height = theight[elm]+'px'; 
    document.getElementById('foldout'+elm).style.display = 'none';
    thez[elm] = 0; 
  }
}
