function slider_button($ID_1,$slider_ID)
{
		if($ID_1.value==0){
		$ID_1.nextSibling.style.display='none';
		var element = document.getElementById($slider_ID);
		animate($slider_ID,  0, null);
		element.up = true;
		element.down = false;
		element.style.overflow='hidden';	 
		}
		else{$ID_1.nextSibling.style.display='inline';}
}

function slider(elementId, newHeight, headerElement,overflow)
{
   var element = document.getElementById(elementId);
	 if(element.down)
   {
		  animate(elementId,  0, null);
      element.up = true;
      element.down = false;
			element.style.overflow='hidden';	 
	 }
   else
   {
      animate(elementId, newHeight, null);
      element.down = true;
      element.up = false;
			if(overflow){element.style.overflow=overflow;}
			else{element.style.overflow='auto';}
			}
}
function animate(elementID, newHeight, callback)
{
		var time = 40;
		var el = document.getElementById(elementID);
		if(el == null)
			return;
	 
		var cHeight = parseInt(el.style.height);
	 
		var totalFrames = 1;
		if(time> 0)
			totalFrames = time/5;
	
		var fHeight = newHeight - cHeight;
		if(fHeight != 0)
			fHeight /= totalFrames;
		 
		doFrame(elementID,cHeight, newHeight, fHeight, callback);
}

function doFrame(eID, 
      cHeight, nHeight, fHeight, callback)
{
   var el = document.getElementById(eID);
   if(el == null)
     return;

  cHeight = moveSingleVal(cHeight, nHeight, fHeight);
  el.style.height = Math.round(cHeight) + 'px';
  if(cHeight == nHeight)
  {
    if(callback != null)
      callback();
    return;
  }
  setTimeout( 'doFrame("'+eID+'",'+cHeight+','+nHeight+','+fHeight+','+callback+')', 40);
}

function moveSingleVal(currentVal, finalVal, frameAmt)
{
  if(frameAmt == 0 || currentVal == finalVal)
    return finalVal;
 
  currentVal += frameAmt;
  if((frameAmt> 0 && currentVal>= finalVal)
    || (frameAmt <0 && currentVal <= finalVal))
  {
    return finalVal;
  }
  return currentVal;
}