

var sliderIntervalId = 0;
var sliderHeight;
var maxHeight;
var sliding = false;
var slideSpeed = 10;
var boxID;
var boxMinMax;
var slider;

function setupBoxes()
{
	loadBoxes();

}

function Slide(number,theBoxID)
{
	boxID = theBoxID;
	maxHeight = number;
	
	slider = document.getElementById(boxID);
    sliderHeight = parseFloat(slider.style.height.replace("px",""));  
	boxMinMax  = document.getElementById( boxID+'MinMax');	

		
   if(sliding)
   {
      return;
   }
   sliding = true;
   if(sliderHeight == maxHeight)
   {
      sliderIntervalId = setInterval('SlideUpRun()', 30);
	  boxMinMax.src = "/img/max.jpg";
	}
   else
   {
 
      sliderIntervalId = setInterval('SlideDownRun()', 30);
	  boxMinMax.src = "/img/min.jpg";
	}
	
	

}

function SlideUpRun()
{
   slider = document.getElementById(boxID);
    
    
   if(sliderHeight <= 0)
   {
      sliding = false;
      sliderHeight = 0;
	  slider.className = 'boxContentHidden'
	  saveBoxes();
      clearInterval(sliderIntervalId);
	  
   }
   else
   {
      sliderHeight -= slideSpeed;
      if(sliderHeight <0)
	  {
         sliderHeight = 0;
	  }
      if(sliderHeight <10)
	  {
		 slider.className = 'boxContentHidden'
	  }
      slider.style.height = sliderHeight + 'px';
  
   }
}

function SlideDownRun()
{
   slider = document.getElementById(boxID);
 
    if(sliderHeight >10)
	{
		 slider.className = 'boxContent'
	}    
   
   if(sliderHeight>= maxHeight)
   {
      sliding = false;
      sliderHeight = maxHeight;
      slider.style.height = maxHeight  + 'px';
	  saveBoxes();
      clearInterval(sliderIntervalId);
   }
   else
   {
      sliderHeight += slideSpeed;
	  
      if(sliderHeight> maxHeight)
	  {
         sliderHeight = maxHeight;
	  }
      slider.style.height = sliderHeight + 'px';
   }
   
 	

}
