--- /dev/null
+var Debug = {window: undefined, pploaded: false};
+
+Debug.openwindow = function() {
+ if (navigator.userAgent.toLowerCase().indexOf('msie 6') == -1) {
+ title = 'Debug Window';
+ height = '250'
+ } else {
+ title = 'DebugWindow';
+ height = '500'
+ }
+
+ var output = window.open('', title, "toolbar=no,scrollbars,resizable=yes,width=400,height="+height);
+
+ if (output) {
+ output.document.open("text/html");
+ output.document.write("<html><head><title>" + title + "</title></head>\n");
+ output.document.write("<body>\n");
+
+ output.document.write('<p><input type="button" value="Close window" onClick="self.debug.closewindow()">');
+ output.document.write('<input type="button" value="Clear window" onClick="self.debug.clear()"><br>');
+ // output.document.write('Inspect: <input type="text" value="" onClick="self.debug.clear()"></p>');
+
+ output.document.write('<div style="font-size: 10px;" id="debug_output"></div>');
+
+ output.document.write("</body></html>\n");
+ output.document.close();
+ output.debug = Debug;
+ }
+
+ return output;
+}
+
+Debug.closewindow = function()
+{
+ if (Debug.window) {
+ var win = Debug.window;
+ win.close();
+ }
+ Debug.window = undefined;
+}
+
+Debug.clear = function()
+{
+ if (Debug.window) {
+ var div = Debug.window.document.getElementById('debug_output');
+ if (div)
+ div.innerHTML = '';
+ } else
+ Debug.window = Debug.openwindow();
+}
+
+Debug.output = function(text)
+{
+ if (!Debug.window)
+ Debug.window = Debug.openwindow();
+
+ var div = Debug.window.document.getElementById('debug_output');
+ if (div)
+ div.innerHTML = text;
+}
+
+Debug.write = function(text)
+{
+ if (!Debug.window)
+ Debug.window = Debug.openwindow();
+
+ var div = Debug.window.document.getElementById('debug_output');
+ if (div)
+ div.innerHTML += '<br>' + text;
+}
+
+Debug.ObjInfoRaw = function(obj)
+{
+ var text = 'Elements:';
+ for (var e in obj)
+ text += ' ' + e;
+
+ Debug.write(text);
+}
+
+// boolean (Ja/Nein-Variable),
+// string (Zeichenkettenvariable),
+// number (numerische Variable),
+// function (Funktion),
+// object (Objekt),
+// undefined (unbestimmter Typ).
+
+Debug.ObjInfo = function(obj)
+{
+ var text = '<p><b>Elements:</b><br><ul>';
+ for (var e in obj) {
+ text += '<li> ' + e;
+
+ switch (typeof obj[e]) {
+ case 'object':
+ case 'undefined':
+ case 'function': text += ' ('+typeof obj[e]+')'; break;
+ default: text += ' = '+obj[e]; break;
+ }
+ }
+
+ text += '</ul></p>';
+
+ Debug.write(text);
+}
+
+Debug.ObjDump = function(obj)
+{
+ var text = 'Object dump:<br><ul>';
+ for (var e in obj)
+ text += '<li><strong>Element ' + e + '</strong>: '+obj[e]+'</li>';
+ text += '</ul>';
+
+ Debug.write(text);
+}
+
+Debug.ObjDumpRaw = function(obj)
+{
+ var text = "Object dump:\n<pre>\n";
+ for (var e in obj) {
+ text += e + ': ';
+ text += obj[e];
+ text += "\n";
+ }
+ text += "</pre>\n";
+
+ Debug.write(text);
+}
+
+function eleminfo(e)
+{
+ var t = '';
+ if (!e) return;
+ t = '<' + e.tagName + ' size="'+e.clientWidth+'"';
+ t += '>';
+ return t;
+}
+
+// Requires: git clone git://github.com/jamespadolsey/prettyPrint.js.git
+Debug.PrettyPrint = function(obj)
+{
+ if (!Debug.window)
+ Debug.window = Debug.openwindow();
+
+ var div = Debug.window.document.getElementById('debug_output');
+ if (div) {
+ if (!Debug.pploaded) {
+ pp = document.createElement("script");
+ pp.type = 'text/javascript';
+ pp.src = 'lib/prettyprint.js';
+ document.body.appendChild(pp);
+ Debug.pploaded = true;
+ }
+
+ var ppTable = prettyPrint(obj);
+ div.appendChild(ppTable);
+ }
+}
+
+// var temp = "";
+// obj = grid_tab_2.buffer;
+// for (x in obj)
+// temp += x + ": " + obj*[x] + "\n";
+// var Fenster = window.open('','Fenstername','scrollbars');
+// Fenster.document.open("text/html");
+// Fenster.document.write("<pre>\n" + temp + "\n</pre>");
+// // Fenster.document.close();