function setBotButtonStyle(bot, style){ var htmlID = 0; if(bot == 1){ if(style == 'active'){ document.getElementById('bot1Button').className = "botButtonActiveStyle"; document.getElementById('bot1Button').onclick = function onclick(event){ botStop(1);}; } else if(style == 'inactive'){ document.getElementById('bot1Button').className = "botButtonInactiveStyle"; document.getElementById('bot1Button').onclick = function onclick(event){ botStart(1);}; } else if(style == 'buyAction'){ document.getElementById('bot1Button').className = "botButtonBuyActionStyle"; setTimeout(function(){ botButtonStyleCheck() }, 500); } else{ alert("Fehler beim Stylen von Botbutton"); } } else if(bot == 2){ if(style == 'active'){ document.getElementById('bot2Button').className = "botButtonActiveStyle"; document.getElementById('bot2Button').onclick = function onclick(event){ botStop(2);}; } else if(style == 'inactive'){ document.getElementById('bot2Button').className = "botButtonInactiveStyle"; document.getElementById('bot2Button').onclick = function onclick(event){ botStart(2);}; } else if(style == 'buyAction'){ document.getElementById('bot2Button').className = "botButtonBuyActionStyle"; setTimeout(function(){ botButtonStyleCheck() }, 500); } else{ alert("Fehler beim Stylen von Botbutton"); } } else{ alert("Fehler Auswahl eines Botbuttons für Styling"); } }; function botButtonStyleCheck(){ if(bot1ID != 0){ setBotButtonStyle(1, 'active'); } else{ setBotButtonStyle(1, 'inactive'); } if(bot2ID !=0){ setBotButtonStyle(2, 'active'); } else{ setBotButtonStyle(2, 'inactive'); } };