// Round image corners function
function roundedImages() {
 var roundedCornerDetails = document.getElementById('roundedCornerDetails');
 var imgs = roundedCornerDetails.getElementsByTagName('img');
 
 for (var i = 0; i < imgs.length; i++) {         // start loop 

   var wrapping = document.createElement('div');  // Create the outer-most div (wrapping)
   wrapping.className = 'wrapping';                // Give it a classname - wrapping
   wrapping.style.width = imgs[i].width+'px';     // give wrapping the same width as the current img
   var original = imgs[i];                       // take the next image  
   /* Swap out the original img with our wrapping div (we'll put it back later) */
   if(original.parentNode.tagName.toUpperCase()=='A') original = original.parentNode; // if you link the image this will help the script find the right parent wrapping
   original.parentNode.replaceChild(wrapping, original);
   // IE crash fix - c/o Joshua Paine - http://fairsky.us/home


   /* Create the four other inner nodes and give them classnames */
   var tl = document.createElement('div');
   tl.className = 'tl';
   var br = document.createElement('div');
   br.className = 'br';
   var tr = document.createElement('div');
   tr.className = 'tr';
   var bl = document.createElement('div');
   bl.className = 'bl';
   /* Glue the nodes back inside the wrapping */
   wrapping.appendChild(tl);
   wrapping.appendChild(tr);
   wrapping.appendChild(bl);
   wrapping.appendChild(br);
   /* And glue the img back in after the DIVs */
   
   wrapping.appendChild(original);
 }
}
/* Run the function once the page has loaded: */

window.onload = roundedImages;