Php Function Within Function Javascript Syntax Error