The problem is line 23:
var addair = air - 10;
You're using 10 instead of maxair (which is 10, but that will cause problems if you ever decide to change maxair) but you also have them in the wrong order.
Replace that line with:
var addair = maxair - air;
↧