move js code from template to lib. fix minor issue in jq place
initial implementation of pm system. remove deprecated messages framework. some minor corrections