function image(id, action) { var div = document.getElementById(id).style.backgroundPosition; if (action == 'next') { div = 'center center'; } }