You have multiple places calling the same function. Do not put JavaScript code in the HTML!