function ampel(stat, t1, t2) { this.stat = stat; this.t1 = t1; this.t2 = t2; } var myampel = new ampel(4, 2000, 500); // Place Yout HTML code here ... ... function changecolor(c1, c2, c3) { document.getElementById('1').style.backgroundColor = c1; document.getElementById('2').style.backgroundColor = c2; document.getElementById('3').style.backgroundColor = c3; } function nextstat(st) { if (st == 1) {changecolor('black', 'black', 'green'); window.setTimeout('myampel.stat = nextstat(myampel.stat);', myampel.t1);} if (st == 2) {changecolor('black', 'yellow', 'black'); window.setTimeout('myampel.stat = nextstat(myampel.stat);', myampel.t2);} if (st == 3) {changecolor('red', 'black', 'black'); document.getElementById('button').src='../old/i/butn.gif'; /* window.setTimeout('myampel.stat = nextstat(myampel.stat);', myampel.t1); */} if (st == 4) {changecolor('red', 'yellow', 'black'); window.setTimeout('myampel.stat = nextstat(myampel.stat);', myampel.t2);} st++; if (st == 5) st = 1; return st; }