/** $Id: debug.js 13 2010-04-13 16:27:00Z jfabregat $
 *
 * PHPLab Libs
 *
 * Copyright 2008 PHPLab, www.phplab.fr
 * Author : Joan Fabrégat <joan@joan.pro>
 * Version : 1.2
 */

function debug(object, onlyReturn) {
               output = "<style type=\"text/css\">body { background: #FFF;\nfont-family: sans-serif; font-size: 10px;\n}\n</style>\n<table style=\"width: 100%\">";
               j = 0;
               for (i in object) {
                       color = (j%2 ? "F7F7F7" : "FFF");
                       output += "<tr style=\"background: #"+color+";\"><td>"+i+"</td><td>"+object[i]+"</td></tr>\n";
                       j++;
               }
               output += "</table>";

               if (j === 0) {
                       alert('L\'objet est vide');
               }
               else {
                       if (!onlyReturn) {
                               outputWin = open('about:blank', 'debugOutputWin', 'width=700,height=600,resizable=yes,scrollbars=yes');
                               outputWin.document.write(output);
                               outputWin.focus();
                       }
                       return output;
               }
}
