if(window.attachEvent){window.attachEvent("onload",RenderRoundCorner);}
else if(window.addEventListener){window.addEventListener("load",RenderRoundCorner,false);}

function RenderRoundCorner()
{
 var DS = document.getElementsByTagName("div");
 for(var i=0;i<DS.length;i++)
 {
  if(DS[i].getAttribute("roundcorner")=="true" ){ doRenderRoundCorner(DS[i]);};
 }
 
 function doRenderRoundCorner(obj)
 {
  
  
  var borderColor = "#808080";
  var borderWidth = 4;
  var fillColor = "#cccccc";
  var cornerWidth = 24;

	if(obj.getAttribute("borderColor") !=null){borderColor=obj.getAttribute("bordercolor")};
	if(obj.getAttribute("borderWidth") !=null){borderWidth= parseInt( obj.getAttribute("borderWidth"))};
	if(obj.getAttribute("fillColor") !=null){fillColor=obj.getAttribute("fillColor")};
	if(obj.getAttribute("cornerWidth") !=null){cornerWidth=parseInt( obj.getAttribute("cornerWidth"));};


  if(obj.style.position =="" || obj.style.position ==null)
  {
   obj.style.position = "relative";
  }
	
	
     obj.style.padding= cornerWidth/2;
	if(obj.parentElement && document.all)
	{   //for IE only
		for(var c=0;c<1;c++)
		{
		 window.cornerIndex++;
		 var PS = new Object();
      
		 window.vIndex = (window.vIndex==null)?0:window.vIndex;
		 window.vIndex++;
		 var chtml = '<v:roundrect id="v_'+window.vIndex+'" fillcolor="'+fillColor+'"  strokecolor="'+ borderColor +'"   strokeweight='+borderWidth+'px  style="position:absolute ;left:-'+cornerWidth/2+'px;top:-'+cornerWidth/2+'px;z-index:-1; width:'+ ( obj.offsetWidth + cornerWidth)  +';height:'+( obj.offsetHeight + cornerWidth) +'px"  arcsize="25%"></v:roundrect></div>';
         obj.insertAdjacentHTML("AfterBegin", chtml );
		 obj.style.marginBottom = cornerWidth + borderWidth;
		 obj.style.marginTop = cornerWidth + borderWidth;
		 var V = document.getElementById("v_" + window.vIndex);
		 V.parentElement.V =  V;
		 V.parentElement.onresize = function(){
		 V.style.posWidth = obj.offsetWidth +  cornerWidth;
		 V.style.posHeight= obj.offsetHeight +  cornerWidth;
		 }

		 window.onresize = function(){
		 V.style.posWidth = obj.offsetWidth +  cornerWidth;
		 V.style.posHeight= obj.offsetHeight +  cornerWidth;
		 }
		}
	}else if(obj.parentNode)
	{//for Mozilla
	  
	  obj.style.borderColor =  borderColor;
	  obj.style.borderWidth = borderWidth ;	
	 
	  obj.style.backgroundColor = fillColor ;
	  obj.style.borderStyle="solid";
	  obj.style.MozBorderRadius= cornerWidth;
	}
 


 }

}