id's are case-sensitive
var newdiv = document.getElementById('StatusBar');
<div id="statusbar" style="display:none;">
You're trying to get the element 'StatusBar', but it doesn't exist. However there is an element named 'statusbar'. Pick one or the other and stick with it.
To fix the error when your status bar doesn't exist, change your function to this:
Code:
function addElement() {
var ni = document.getElementById('StatusBarHolder');
var newdiv = document.getElementById('StatusBar');
if (newdiv != null) {
ni.appendChild(newdiv);
newdiv.style.display = 'block';
}
}