function roundedCorners() { var divs = document.getElementsByTagName('div'); var rounded_divs = []; /* First locate all divs with 'rounded' in their class attribute */ for (var i = 0; i < divs.length; i++) {   if (/\bbox\b/.exec(divs[i].className)) {     rounded_divs[rounded_divs.length] = divs[i];   } } /* Now add additional divs to each of the divs we have found */ for (var i = 0; i < rounded_divs.length; i++) {   var original = rounded_divs[i];   /* Now create the outer-most div */   var newbox = document.createElement('div');   newbox.className = original.className;	newbox.className = newbox.className.replace('box', 'box2');   newbox.id = original.id;   original.className = 'bl';   original.id = '';   /* Swap out the original (we'll put it back later) */   original.parentNode.replaceChild(newbox, original);   /* Create the two other inner nodes */   var tl = document.createElement('div');   tl.className = 'tl';   var tr = document.createElement('div');   tr.className = 'tr';   var br = document.createElement('div');   br.className = 'br';   /* Now glue the nodes back in to the document */   newbox.appendChild(tl);   tl.appendChild(tr);   tr.appendChild(br);   br.appendChild(original); }}/* Run the function once the page has loaded: */window.onload = roundedCorners;