/*original cbb function by Roger Johansson, http://www.456bereastreet.com/modified by Sean McAuliffe (http://www.seanmcauliffe.com)to include multiple border styles and more descriptive class names*/var cbb = {	init : function() {	// Check that the browser supports the DOM methods used		if (!document.getElementById || !document.createElement || !document.appendChild) return false;		var oElement, oOuter, oI1, oI2, tempId;	// Find all elements with a class name of cbb		var arrElements = document.getElementsByTagName('*');	// Put custom class names into array (must match class names in parent xhtml)		var classArray = new Array(			"border_primary_outer",			"border_secondary_outer",			"border_primary_inner",			"basic_border",			"blue_rounded_box",			"border_comments",			"portfolio_border"			);		for (var i=0; i<arrElements.length; i++) {	// Save the original outer element for later			oElement = arrElements[i];	// Run through all custom class names (classArray above)			for (var j=1; j<classArray.length+1; j++) {			if (oElement.className == classArray[j-1]) {	// 	Create a new element and give it the original element's class name(s) while replacing 'cbb' with 'cb'				oOuter = document.createElement('div');				oOuter.className = oElement.className.replace(classArray[j-1], 'border'+j);	// Give the new div the original element's id if it has one				if (oElement.getAttribute("id")) {					tempId = oElement.id;					oElement.removeAttribute('id');					oOuter.setAttribute('id', '');					oOuter.id = tempId;				}	// Change the original element's class name and replace it with the new div				oElement.className = 'i3_'+j;				oElement.parentNode.replaceChild(oOuter, oElement);	// Create two new div elements and insert them into the outermost div				oI1 = document.createElement('div');				oI1.className = 'i1_'+j;				oOuter.appendChild(oI1);				oI2 = document.createElement('div');				oI2.className = 'i2_'+j;				oI1.appendChild(oI2);	// Insert the original element				oI2.appendChild(oElement);	// Insert the top and bottom divs				cbb.insertTop(oOuter,j);				cbb.insertBottom(oOuter,j);			}			}		}	},	insertTop : function(obj,id) {		var oOuter, oInner;	// Create the two div elements needed for the top of the box		oOuter=document.createElement("div");		oOuter.className="bt"+id; // The outer div needs a class name (incremented index added)	    oInner=document.createElement("div");	    oOuter.appendChild(oInner);		obj.insertBefore(oOuter,obj.firstChild);	},	insertBottom : function(obj,id) {		var oOuter, oInner;	// Create the two div elements needed for the bottom of the box		oOuter=document.createElement("div");		oOuter.className="bb"+id; // The outer div needs a class name	    oInner=document.createElement("div");	    oOuter.appendChild(oInner);		obj.appendChild(oOuter);	},	// addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html	addEvent : function(obj, type, fn) {		if (obj.addEventListener)			obj.addEventListener(type, fn, false);		else if (obj.attachEvent) {			obj["e"+type+fn] = fn;			obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }			obj.attachEvent("on"+type, obj[type+fn]);		}	}};cbb.addEvent(window, 'load', cbb.init);