function doSlide(id, fromheight, toheight, runfunction){
	timeToSlide = 20; 						// in milliseconds
	obj = document.getElementById(id);
	direction = eval(id + "_state")
	if(direction==0){ 						// direction - down
		height = obj.offsetHeight;
		eval(id + "_state=1")
		slideDown(obj,fromheight,toheight,Math.ceil(height/timeToSlide));
	} 
	else {
		eval(id + "_state=0")
		slideUp(obj,Math.ceil(obj.offsetHeight/timeToSlide), obj.offsetHeight, fromheight);
	}
	if (runfunction!="") {
		eval(runfunction + "('" + id + "'," + direction + ")")
	}
}

function slideDown(obj,offset,full,px){
	if(offset < full){
		obj.style.height = offset+"px";
		offset=offset+px;
		setTimeout((function(){slideDown(obj,offset,full,px);}),1);
	} 
	else {
		obj.style.height = full+"px"; 		
	}
}

function slideUp(obj,px,full, offset){
	if((obj.offsetHeight-px) > offset){
		obj.style.height = obj.offsetHeight-px+"px";
		setTimeout((function(){slideUp(obj,px,full, offset);}),1);
	} 
	else {
		obj.style.height=offset+"px"; 	// we reset the height if we were to slide it back down
	}
}

function test(teststr) {
	alert(teststr);
}

