var dropdowncontent={

	slideit: function(el_id, direction, params) {
		var el = document.getElementById(el_id);		
		el.style.display = 'block';
		el.style.overflow = "hidden";
		el.contentheight=parseInt(el.offsetHeight);
		el.startTime=new Date().getTime();
		el.style.height = (direction == "down") ? "0px" : "auto";
		el.glidetime=params.speed || 700;
		this.slideengine(el, direction, params);
		
	},

	curveincrement:function(percent){
		return (1-Math.cos(percent*Math.PI)) / 2 //return cos curve based value from a percentage input
	},

	slideengine:function(obj, direction, params){
		var elapsed=new Date().getTime()-obj.startTime //get time animation has run
		if (elapsed<obj.glidetime){ //if time run is less than specified length
			var distancepercent=(direction=="down")? this.curveincrement(elapsed/obj.glidetime) : 1-this.curveincrement(elapsed/obj.glidetime)
			var currentclip=(distancepercent*obj.contentheight)+"px"
			obj.style.height=currentclip;
			window["glidetimer_"+obj.id]=setTimeout(function(){dropdowncontent.slideengine(obj, direction, params)}, 10)
		}
		else{ //if animation finished
			obj.style.overflow = "visible";
			obj.style.height="auto";
			obj.style.display = direction == "down" ? "block" : "none";
			if (params.user_function)
			{
				params.user_function();
			}
		}
	}
}
