Refactoring js instuctions of questions graphics in order to use it with other type of question