javascript refactor, product page image optimisation, javascrtipt smart resizing