I don't see this.stage being defined anywhere, yet it's in two of your conditional checks. So, I took it out, and the effect is a small up-and-down movement.
PHP Code:
function onTimeout() {
if (player.z == 2)
this.air = 2;
if (player.z == 1)
this.air = 1;
if (this.air == 1)
player.z += 0.05;
else if (this.air == 2)
player.z -= 0.05;
else if (this.air == 0 && player.z > 0)
player.z -= 0.05;
setTimer(0.05);
}