Some refactoring for reuse

Package JS in lightSwitch jquery plugin