Cleaned up javascript for add post javascript functionalityj