function slideMachine(divid){
	this.slideSpeedUp       = 700;
	this.slideSpeedDown 	= 400;
	this.maxHeight          = 110; 
	this.minHeight          = 80;

	this.slideSpeed         = null;
	this.fixedMaxHeight 	= this.maxHeight;
	this.fixedMinHeight 	= this.minHeight;
	this.currHeight 		= this.fixedMinHeight;
	this.divid 				= divid;
	this.sObj 				= document.getElementById(divid); 
	this.thisobj 			= this; 
	this.direction 			= null; 
	this.runtimer 			= null;
	this.name 				= "so_"+divid;
}

slideMachine.prototype.slideUp = function(targetPos){
	this.direction = "up";
	this.startTime=new Date().getTime(); 
	this._slideEngine(this.currHeight, true);
}

slideMachine.prototype.slideDown = function(targetPos){
	this.direction = "down";
	this.startTime=new Date().getTime();
	this._slideEngine(this.currHeight, true);
}

slideMachine.prototype._slideEngine = function(startHeight, startedFromAction){
	var elapsed = new Date().getTime()-this.startTime; //get time animation has run 
	var thisobj = this;

	if(startedFromAction == true && this.direction == "up"){ 
		this.minHeight = this.fixedMinHeight;
		this.maxHeight = startHeight*1;
		this.slideSpeed = this.slideSpeedUp;
	}

	if(startedFromAction == true && this.direction == "down"){ 
		this.minHeight = startHeight*1;
		this.maxHeight = this.fixedMaxHeight;
		this.slideSpeed = this.slideSpeedDown;
	} 

	var distancepercent = (this.direction == "down" ? slideMachine.curveincrement(elapsed/this.slideSpeed) : 1-slideMachine.curveincrement(elapsed/this.slideSpeed));
	this.currHeight     = parseInt(distancepercent * this.maxHeight + ( this.direction == "down" ? this.minHeight : 0 )); 

	if((this.direction == "down" && this.currHeight <= this.maxHeight) || (this.direction == "up" && this.currHeight >= this.minHeight)){
		this.sObj.style.height =  this.currHeight +"px"; 
		this.runtimer = setTimeout(function(){thisobj._slideEngine(startHeight, false)}, 10); 
	}else{ 
		this.runtimer = null; 
	}
}

slideMachine.curveincrement=function(percent){
	return (1-Math.cos(percent*Math.PI)) / 2; //return cos curve based value from a percentage input
} 

//objectspooler
function smObjectSpooler(divid, direction){ 
	var sObj = "so_"+divid;  
	eval("(!window."+sObj+" ? window."+sObj+" = new slideMachine(\""+divid+"\") : true )"); 

	if(direction == "up"){
		eval(sObj).slideUp();
	}else{
		eval(sObj).slideDown();
	}
}