RoundedInputCorners = {
	roundedCornerClass:"rounded",
	roundedCornerLeftClass:"rounded_left",
	roundedCornerDoneClass:"rounded_Complete",
	initialize : function()
	{
		var arrElms =  $$("." +this.roundedCornerClass);
		for ( var i = 0; i <  arrElms.length; i++)
		{
			var elm = arrElms[i];
			if (! Element.hasClassName(elm, this.roundedCornerDoneClass))
			{
				var tmpElm = document.createElement("span");
				Element.insert(elm,  {
					before: tmpElm
				});	
				Element.addClassName(tmpElm, this.roundedCornerLeftClass);
				Element.update(tmpElm, "&nbsp;")
				tmpElm.appendChild(elm);
				Element.addClassName(elm, this.roundedCornerDoneClass);
				if ( Prototype.Browser.Gecko)
					Element.addClassName(tmpElm, this.roundedCornerLeftClass + "_firefox");	
			}
		}
	}
	
}

Event.observe(window, "load", RoundedInputCorners.initialize.bindAsEventListener(RoundedInputCorners));

CorneredBoxes = {
	toCornerClass : "BoxContent",
	CornerDoneClass: "BoxContentCompleted",
	
	initialize : function()
	{
		var arrElms = $$("." + this.toCornerClass);
		for ( var i = 0; i <  arrElms.length; i++)
		{
			var elm = arrElms[i];
			if (! Element.hasClassName(elm, this.CornerDoneClass))
			{
				var tmpTable = document.createElement("table");
				var tmpElm = document.createElement("tbody");
				var tmpTR = document.createElement("tr");
				var tmpTD = document.createElement("td");
				var tmpContent = {};
				tmpTable.cellPadding = 0;
				tmpTable.cellSpacing = 0;
				
				Element.addClassName(tmpTD, "topLeft");
				tmpTR.appendChild(tmpTD);
				tmpTD = document.createElement("td");
				Element.addClassName(tmpTD, "top");
				tmpTR.appendChild(tmpTD);					
				tmpTD = document.createElement("td");
				Element.addClassName(tmpTD, "topRight");
				tmpTR.appendChild(tmpTD);
				tmpElm.appendChild(tmpTR);
				
				tmpTR = document.createElement("tr");
				tmpTD = document.createElement("td");
				Element.addClassName(tmpTD, "left");
				tmpTR.appendChild(tmpTD);
				tmpTD = document.createElement("td");
				Element.addClassName(tmpTD, "content");
				tmpContent = tmpTD;
				tmpTR.appendChild(tmpTD);					
				tmpTD = document.createElement("td");
				Element.addClassName(tmpTD, "right");
				tmpTR.appendChild(tmpTD);
				tmpElm.appendChild(tmpTR);
				
				tmpTR = document.createElement("tr");
				tmpTD = document.createElement("td");
				Element.addClassName(tmpTD, "bottomLeft");
				tmpTR.appendChild(tmpTD);
				tmpTD = document.createElement("td");
				Element.addClassName(tmpTD, "bottom");
				tmpTR.appendChild(tmpTD);					
				tmpTD = document.createElement("td");
				Element.addClassName(tmpTD, "bottomRight");
				tmpTR.appendChild(tmpTD);
				tmpElm.appendChild(tmpTR);
				
				tmpTable.appendChild(tmpElm);
				Element.insert(elm,  {
					before: tmpTable
				});	
				//Element.addClassName(tmpElm, this.roundedCornerLeftClass);
				
				
				tmpContent.appendChild(elm);
				Element.addClassName(elm, this.CornerDoneClass);
				var type = elm.getAttribute("type");				
				if ( type != "")
					Element.addClassName(tmpTable, type)
			}
		}
	}
	
}

Event.observe(window, "load", CorneredBoxes.initialize.bindAsEventListener(CorneredBoxes));
