The purpose of the code is to build a series of nested HTML using information in objects:

Here are the informational objects I created:

```
function branch(level,sciname,comname,parent,children){
    this.level = level;
    this.sciname = sciname;
    this.comname = comname;
    this.parent = parent;
    this.children = children;}

var animalia = new branch(1,'Animalia','Animals',"",['chordata']);
var chordata = new branch(2,'Chordata','Chordates',animalia,['petromyzontida','actinopterygii']);
var actinopterygii = new branch(3,'Actinopterygii','Ray-finned Fishes',chordata,['siluriformes','scorpaeniformes','salmoniformes','percopsiformes','perciformes','osteoglossiformes','osmeriformes','lepisosteiformes','gasterosteiformes','gadiformes','esociformes','cyprinodontiformes','cypriniformes','clupeiformes','atheriniformes','anguilliformes','amiiformes','acipenseriformes']);
var petromyzontida = new branch(3,'Petromyzontida','Lampreys',chordata,['petromyzontiformes']);

```

And here is the script:

```
    function CreateDiv(parent,child,z,width,height,top,left,bgcolor){
        var parent_ = document.getElementById(parent);
        var newdiv = document.createElement("div"); 
        newdiv.setAttribute("id",child);
        newdiv.style.zIndex = z;
        newdiv.style.position = "absolute";
        newdiv.style.width = width + "%";
        newdiv.style.height = height + "%";
        newdiv.style.top = top + "%";
        newdiv.style.left = left + "%";
        newdiv.style.backgroundColor = bgcolor;
        parent_.appendChild(newdiv);}

function CreateTree(){
    var firstdiv = document.createElement("div");
    firstdiv.setAttribute("id","animalia");
    document.getElementById("container1").appendChild(firstdiv);
    var parent1 = "animalia";
    var children1 = window[parent1].children;
    var numbchildren1 = children1.length;
    var rowcounter1 = 1;
    var columncounter1 = 0;
    for (i=0;i<numbchildren1;i++){
        var child1 = children1[i];
        var z1 = 2;
        var columns1 = Math.ceil(Math.sqrt(numbchildren1));
        var width1 = (100/columns1) - 2;
        var rows1 = Math.ceil(numbchildren1/columns1);
        var height1 = (100/rows1) - 2;
        var top1 = rowcounter1*height1 - height1 + 1;
        var left1 = columncounter1*width1 + 1;                          
        var bgcolor1 = "#B43333";   
        CreateDiv(parent1,child1,z1,width1,height1,top1,left1,bgcolor1);
        var numbchildren2 = window[child1].length;
        if ((i/rowcounter1) == columns1){
            rowcounter1 = rowcounter1 + 1;}
            else {rowcounter1 = rowcounter1;}
        if (columncounter1 == columns1){
            columncounter1 = 1;}
            else {columncounter1 = columncounter1 + 1;}
        var rowcounter2 = 1;
        var columncounter2 = 0;
        console.log("before:" + columncounter2);
        for (j=0;j<numbchildren2;j++){          
            console.log("after:" + columncounter2);
            var child2 = children2[j];
            var z2 = 3;
            var columns2 = Math.ceil(Math.sqrt(numbchildren2));
            var width2 = (100/columns2) - 1;
            var rows2 = Math.ceil(numbchildren2/columns2);
            var height2 = (100/rows2) - 1;
            var top2 = rowcounter2*height2 - height2 + 1;
            var left2 = columncounter2*width2 - width2 + 1;                         
            var bgcolor2 = "#B48233";   
            CreateDiv(parent2,child2,z2,width2,height2,top2,left2,bgcolor2);}}}

```

I've run the code through a debugger dozens of times and I get no errors. Yet the script does not fully execute. I suspected an infinite loop but I fail to see why that would occur and after going over the code in great detail, I can find no real problems. I can tell where the code seems to break. There are two console.log() statements in the above code. The first console statement gets properly logged, but the second one does not. The debugger shows no errors (Firebug), but the code still fails to fully execute. Please help! And suggestions or criticism will be very welcome as I'm still learning some of the basics.

As a note: Eventually, I will add to this process to create several layers of nested elements, but wanted to get just the first couple layers right before I begin nesting things further as once I do that additional nesting should be relatively easy.