Yeaaaah those nonsense ones I totally missed. I'm not sure I understand why your version works, but I'm pretty new to Javascript.
At any rate, I rewrote it based on your comments but something is still breaking it.
EDIT: Okay, it's definitely these two equations:
Code:
var xpup = (xneeded * Math.ceiling(Math.pow(1.15, plevel)))
var showxp= (xpup - (xneeded * Math.ceiling(Math.pow(1.15, plevel-1)))