
    Debug = {

        OBJECTS : "OBJECTS",
        METHODS : "METHODS",
        PROPERTIES : "PROPERTIES",
        
        String : function(s) {
            var info = "";
            
            alert("Debug.String");
            
            if (typeof(s) != "string") {
                return this.Object(s);
            }
            
            info += "STRING:\n";
            info += s;

            alert(info);
        },

        Object : function(obj, which) {
            var info = "";
            var objects = new Array();
            var methods = new Array();
            var properties = new Array();
                        
            if (typeof(obj) == "string") {
                return this.String(obj);
            }
            
            info += obj + "\n\n";
            
            for (var i in obj) {
                var type = typeof(obj[i]);
                switch (type) {
                    case "object" : objects.push(i); break;
                    case "function" : methods.push(i); break;
                    case "string" : 
                    case "number" : 
                    case "boolean" : properties.push(i); break;
                    default : alert("Unknown type: " + type);
                }
            }

            if (!which || which == this.PROPERTIES) {
                info += "PROPERTIES:\n";
                for (var i = 0; i < properties.length; i++) {
                    var name = properties[i];
                    var type = typeof(obj[name]);
                    var value = type == "string" ? '"' + obj[name].substring(0, 100) + '"' : obj[name];
                    info += " - " + name + " = " + value + "\n";
                }
            }
            
            if (!which || which == this.OBJECTS) {            
                info += "OBJECTS:\n";
                for (var i = 0; i < objects.length; i++) {
                    var name = objects[i];
                    var type = typeof(obj[name]);
                    var value = type == "string" ? '"' + obj[name] + '"' : obj[name];
                    info += " - " + name + " = " + value + "\n";
                }
            }
            
//                info += " " + type;
  //              if (!groups[type]) {groups[type] = Array();}
    //            groups[type][groups[type].length] = i;
  //              groups[type].push(i);
//            alert(info);
            alert(info);
        }
        
    }


