/****************************************************************************** Copyright (C) Matteo Lucarelli - matteolucarelli@altervista.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ count=0 maxcount=5 dotimer=1; im0 = new Image(); var timerID=0; function updateimage(){ if (dotimer==1){ // reset previous button if (count>0){ im0.src="img/butt"+count+".png"; document.images['butt'+String(count)].src = im0.src; } // increase counter count++; if (count>maxcount) count=1; // highlight button im0.src="img/butt"+count+"h.png"; document.images['butt'+count].src = im0.src; // update image im0.src="img/"+count+".jpg"; document.images['animage'].src = im0.src; timerID=setTimeout("updateimage()",1000); } } function stoptimer(imnum){ dotimer=0; // reset previous button if (count>0){ im0.src="img/butt"+count+".png"; document.images['butt'+count].src = im0.src; } // highlight button im0.src="img/butt"+imnum+"h.png"; document.images['butt'+imnum].src = im0.src; // update image im0.src="img/"+imnum+".jpg"; document.images['animage'].src = im0.src; } function starttimer(imnum){ count=imnum; dotimer=1; if (timerID!=0) clearTimeout(timerID); updateimage(); }