Php Function Within Function Javascript Mozilla