Simple image slider written in javascript