var status = 0; function status_icon(el) { switch (el) { case "status": if(status==0){ status=1; break; } if(status==1){ status=0; break; } } if (status == 1) { document.getElementById('ansprech_header').style.background="url(/js/open.gif) no-repeat scroll 0px 1px"; } else { document.getElementById('ansprech_header').style.background="url(/js/closed.gif) no-repeat scroll 0px 1px"; } }