javascript multiple function definitions