  /**
  * Function : __debug()
  * Arguments: The data - array,hash(associative array),object
  *    The level - OPTIONAL
  * Returns  : The textual representation of the array.
  * This function was inspired by the print_r function of PHP.
  * This will accept some data as the argument and return a
  * text that will be a more readable version of the
  * array/hash/object that is given.
  */
  function __debug(arr,showalert) {
    var ret = '';
    var level = 0;
    showalert = (showalert!='undefined')?showalert:true;
    if(!name) name = '';

    //The padding given at the beginning of the line.
    var level_padding = "";
    
    if(!showalert){
      ret+= '<div style="margin:0px 0px 5px 0px;background:#ffcccc;overflow:hidden;border:1px solid #000000;color:#444444;">'+"\n";
      ret+= '<div style="font-style:italic">DEBUG-Output(JS)</div>'+"\n";
      ret+= '<div style="font-weight:bold">'+name+'</div>'+"\n";
      ret+= '<pre>'+"\n";
    }
    for(var j=0;j<=level;j++) level_padding += "  ";
    if(typeof(arr) == 'object') { //Array/Hashes/Objects
     for(var item in arr) {
      var value = arr[item];
      if(typeof(value) == 'object') { //If it is an array,
       ret += level_padding + "" + item + " ... ";
       ret += dump(value,level+1);
       ret += "\n";
      } else {
       ret += level_padding + "" + item + " => " + value + "\n";
      }
     }
    } else { //Strings/Chars/Numbers etc.
     ret+= "===>"+arr+"<===("+typeof(arr)+")"+"\n";
    }
    if(!showalert){
      ret+= '</pre>'+"\n";
      ret+= '</div>'+"\n";
    }
    
    if(!showalert){
      document.write(ret);
    }else{
      alert(ret);
    }
    
    return true;
  }

function _dbg(dbgObj){
  if(typeof dbgObj == 'undefined'){
    alert('_dbg: no object given');
    return false;
  }
  
  var x = new Array();
//alert(tickeritemmap[0].all['clientHeight']); 
  var ipp = 18;
  var tmp = new Array();
  var cnt = 0;
  for(var i in dbgObj){    
    
    if(typeof dbgObj[i] == 'undefined') continue;
    tmp.push(i.toString()+': '+dbgObj[i]);
    cnt++;
    if(cnt==ipp){
      x.push(tmp.join("\n"));
      var tmp = new Array();
      cnt = 0;
    }
  
  }
  for(var id in x){
    alert(x[id]);
  }
}

function errorMessage(meldung, url, zeile){
   var txt = "Es ist ein Fehler aufgetreten!\n\n"
   txt += "Meldung: " + meldung + "\n"
   txt += "URL: " + url + "\n"
   txt += "Zeile: " + zeile
   alert(txt)
   return true
}


function alvineDebugExpandDebugAll(id,mode){

    if(mode == 'inline'){
    alvineDebugExpandDebug(id);
    }
    var elements = document.getElementById(id).getElementsByTagName('DIV');
    var anzahl = elements.length;
    for (i=0;i<anzahl;i++) {

    if(elements[i].style.display=='')continue;

    if(mode == 'inline'){

        if(elements[i].style.display == "block"){
            elements[i].style.display = "none";
        }else{
            elements[i].style.display = "block";
        }

    }

    if(mode == 'open'){
    elements[i].style.display = "block";
    }
    if(mode == 'close'){
    elements[i].style.display = "none";
    }


}
}


function alvineDebugExpandDebug(id){
    if(document.getElementById(id).style.display == "none"){
      document.getElementById(id).style.display = "block";
    }else{
      document.getElementById(id).style.display = "none";
    }
}

function alvineDebugIsEnabled(){
  return (typeof ALVINE_DEBUG_ENABLED != 'undefined' && ALVINE_DEBUG_ENABLED === true);
}

//window.onerror = errorMessage;
