improve javascript code

now the button will display the option you chose
reduse the repeated part of javascript code
Merge branch 'temporary_work_around'

Conflicts:
	option.html
	option.js
Conflicts due to structure changes.