First problem with your script, you are missing a ; on line 24.
Second problem, you haven't created a var called xtra which you try to use on line 31.
Also, why are you mixing DOM standard with innerHTML?
Lastly, this appears to be JavaScript, not PHP. For future reference, there is a JS forum here: Click.