setting main photo for items in item list, correcting javascript error not allowing second click event