separated the js code into jquery plugins