Fixed javascript duplicate function issue.