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 (/\brounded\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]; 
   /* Make it the inner div of the four */ 
   original.className = original.className.replace('rounded', 'rounded2'); 
   /* Now create the outer-most div*/ 
   var tr = document.createElement('div'); 
   /* Change the class names */ 
   tr.className = original.className;
   original.className = '';
   /* Swap out the original (we'll put it back later) */ 
   original.parentNode.replaceChild(tr, original); 
   /* Create the two other inner nodes */ 
   var tl = document.createElement('div'); 
   var br = document.createElement('div'); 
   /* Now glue the nodes back in to the document */ 
   tr.appendChild(tl); 
   tl.appendChild(br); 
   br.appendChild(original); 
 } 
} 
/* Run the function once the page has loaded: */ 

window.onload = roundedCorners;