// Discussed in Chapter 7 of 
//  Robert Penner's Programming Macromedia Flash MX
//  (including graphs of the easing equations)
//
//  http://www.amazon.com/exec/obidos/ASIN/0072223561/robertpennerc-20
//
// t: current time, b: beginning value, c: change in value, d: duration, s: overshoot amount (optional)
// s has a default value of 1.70158, which produces an overshoot of 10 percent
// s==0 produces cubic easing with no overshoot

Math.easeInBack = function (t, b, c, d, s) {
	if (s == undefined) s = 1.70158;
	return c*(t/=d)*t*((s+1)*t - s) + b;
};

Math.easeOutBack = function (t, b, c, d, s) {
	if (s == undefined) s = 1.70158;
	return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
};

Math.easeInOutBack = function (t, b, c, d, s) {
	if (s == undefined) s = 1.70158;
	if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
	return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
};