/**
 * the debugManager class provides methods for javascript debugging
 *
 */
function debugManager(){
  //properties
  this.bOn;
  //methods
  this.showVariables = showVariables;
  this.hideVariables = hideVariables;
  this.clearVariables = clearVariables;
  this.switchBacktrace = switchBacktrace;
  this.dv = dv;
  
}

function showVariables(){
  document.getElementById('debug_variables').style.display = 'block';
}
function clearVariables(){
  document.getElementById('debug_variables').innerHTML = '';
}
function hideVariables(){
  document.getElementById('debug_variables').style.display = 'none';
}
function switchBacktrace(){
  var oElement = document.getElementById('debug_backtrace');
  oElement.style.display = (oElement.style.display == 'block') ? 'none' : 'block';
}
function dv(variable){
  var code = '';
  var type = typeof(variable);
  //code += 'type: '+type+'<br/>';
  switch(type){
    case 'object':
      for(i in variable){
        code += this.dv(variable[i]);
      }
    break;
    case 'boolean':
      code += variable ? 'true' : 'false';
    break;
    case 'number':
    case 'string':
      code += variable;
    break;
  }
  code += '<br/>';
  document.getElementById('debug_variables').innerHTML += code;
}
