function updateStockPrice(price, currency, label) { var divStockPrice = document.getElementById('body-tools-stockchart-currentprice'); if (divStockPrice != null) { divStockPrice.innerHTML = label + ' ' + currency + ' ' + price ; } } function updateStockChart(obj) { /* button colors */ var buttonColorActive = 'rgb(0,138,196)'; var buttonColorInactive = 'rgb(194,201,207)'; /* get all involved elements */ var divButtonMonth = document.getElementById('body-tools-stockchart-buttons-month'); var divButtonIntraday = document.getElementById('body-tools-stockchart-buttons-intraday'); var divChartMonth = document.getElementById('body-tools-stockchart-graph-monthchart'); var divChartIntraday = document.getElementById('body-tools-stockchart-graph-intradaychart'); /* abort if one of the elements is missing */ if (divButtonMonth == null || divButtonIntraday == null || divChartMonth == null || divChartIntraday == null) { return; }; /* update elements */ if (obj == divButtonMonth) { divButtonMonth.style.backgroundColor = buttonColorActive; divButtonIntraday.style.backgroundColor = buttonColorInactive; divChartMonth.style.visibility = 'visible'; divChartMonth.style.position = 'static'; divChartIntraday .style.visibility = 'hidden'; divChartIntraday .style.position = 'absolute'; } else { if (obj == divButtonIntraday) { divButtonMonth.style.backgroundColor = buttonColorInactive; divButtonIntraday.style.backgroundColor = buttonColorActive; divChartIntraday.style.visibility = 'visible'; divChartIntraday.style.position = 'static'; divChartMonth .style.visibility = 'hidden'; divChartMonth .style.position = 'absolute'; } } }