// Modifed: mchampan for GrayDot
// Date: 2006-11-09 12:35pm

function RenderRoundCorner(div_id) {
	doRenderRoundCorner(document.getElementById(div_id));

	function doRenderRoundCorner(obj) {
	
		//alert(obj.id);
		var borderColor = "#cccccc";
		var borderWidth = 2;
		var fillColor = "white";
		var cornerWidth = 1;

		if (obj) {		
			if(obj.getAttribute("borderColor") !=null){borderColor=obj.getAttribute("bordercolor")};
			if(obj.getAttribute("boxwidth") !=null){boxwidth=obj.getAttribute("boxwidth")};
			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"));};
				
			cornerWidth = (Math.max(borderWidth*2),4);
			obj.style.width = boxwidth+'px';

			if(obj.parentElement && document.all && window.createPopup ) {   //for IE only

				if(obj.style.position =="" || obj.style.position ==null){
					obj.style.position = "relative";	
				}

				obj.style.width = (boxwidth-2)+'px';
				window.cornerIndex++;
				var PS = new Object();

				window.vIndex = (window.vIndex==null)?0:window.vIndex;
				window.vIndex++;
				var chtml ="";
				if(document.all.tags("v").length==0){
					chtml +='<?xml:namespace Prefix="v" />';
				}
				chtml += '<v:roundrect id="v_'+window.vIndex+'" fillcolor="'+fillColor+'"  strokecolor="'+ borderColor +'"   strokeweight='+borderWidth+'px  style="position:absolute ;behavior: url(#default#VML); antialias: true; left:-'+borderWidth+'px;top:'+borderWidth +'px;z-index:-1; width:'+ ( obj.offsetWidth + cornerWidth)  +';height:'+( obj.offsetHeight + cornerWidth) +'px"  arcsize="001001f"></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;

				function ReDraw(){
					V.style.posWidth = obj.offsetWidth
					V.style.posHeight= obj.offsetHeight
				}
				V.ReDraw=ReDraw;
				V.parentElement.onresize = ReDraw;

				window.onresize =  ReDraw;
				V.ReDraw();
			
			} else if(obj.parentNode) {//for Mozilla and others
				obj.style.borderColor =  borderColor;
				obj.style.borderWidth = '1px' ;
				obj.style.backgroundColor = fillColor ;
				obj.style.borderStyle = "solid";
				obj.style.MozBorderRadius = '8px';
			} //else
		}
	} // doRenderRoundCornder
}
