$(document).ready(function() {
	// this is for the DIVS
	var div = $('.div_rounded');
	var div_width = div.width();
	var div_height = div.height();
	
	
	// build wrapper
	var wrapper = $('<div class="rounded_wrapper"></div>');
	wrapper.width(div_width);
	wrapper.height(div_height);
	
	
	// move CSS properties from img to wrapper
	wrapper.css('float', div.css('float'));
	div.css('float', 'none')
	
	wrapper.css('margin-right', div.css('margin-right'));
	div.css('margin-right', '0')

	wrapper.css('margin-left', div.css('margin-left'));
	div.css('margin-left', '0')

	wrapper.css('margin-bottom', div.css('margin-bottom'));
	div.css('margin-bottom', '0')

	wrapper.css('margin-top', div.css('margin-top'));
	div.css('margin-top', '0')

	wrapper.css('display', 'block');
	div.css('display', 'block')

	// IE6 fix (when image height or width is odd)
	if ($.browser.msie && $.browser.version == '6.0')
	{
		if(div_width % 2 != 0)
		{
			wrapper.addClass('ie6_width')
		}
		if(div_height % 2 != 0)
		{
			wrapper.addClass('ie6_height')			
		}
	}
	// IE7 fix (when image height or width is odd)
	if ($.browser.msie && $.browser.version == '7.0')
	{
		
			wrapper.addClass('ie7_width')
		
		
			wrapper.addClass('ie7_height')			
		
	}

	// wrap image
	div.wrap(wrapper);
	
	// add rounded corners
	div.after('<div class="tl"></div>');
	div.after('<div class="tr"></div>');
	div.after('<div class="bl"></div>');
	div.after('<div class="br"></div>');

	
});

