Adding advanced option js code + fixing page. see BT#7060
Minor - refactor code.