var borders = new Class({
	initialize: function(elems) {
		var sides = ["top","right","bottom","left","topleft","topright","bottomright","bottomleft"];
		this.elems = $$(elems);
		for (var j=0; j<this.elems.length; j++) {
			$id = this.elems[j];
			
			$idWidth = $id.style.width;
			if ($idWidth!=""&&parseInt($idWidth) > 0) {
				$idWidth = $id.getSize().size.x;
				$id.style.width = "auto";
			} else {
				$idWidth = "";
			}

			$idHeight = $id.style.height;
			if ($idHeight!=""&&parseInt($idHeight) > 0) {
				$idHeight = $id.getSize().size.y;
				$id.setStyle("height",$idHeight-14);
			}				

			for (var i=0; i<8; i++) {
				var $div = new Element("div", {"class":"cborder_"+sides[i]});
				$div.injectAfter($id);
				$div.adopt($id);
				if (i==0) {
					$div.setStyle("width",$idWidth);
				} else if(i==7) {			
					$div.setStyle("padding", "7px");
				}
			}
		
		}								
	}
});
