/*
cbb2 function by Roger Johansson, http://www.456bereastreet.com/
*/
var cbb2 = {
	init : function() {
	// Check that the browser supports the DOM methods used
		if (!document.getElementById || !document.createElement || !document.appendChild) return false;
		var oElement2, oOuter2, oI12, oI22, tempId2;
	// Find all elements with a class name of cbb2
		var arrElements = document.getElementsByTagName('*');
		var oRegExp2 = new RegExp("(^|\\s)cbb2(\\s|$)");
		for (var i=0; i<arrElements.length; i++) {
	// Save the original outer element for later
			oElement2 = arrElements[i];
			if (oRegExp2.test(oElement2.className)) {
	// 	Create a new element and give it the original element's class name(s) while replacing 'cbb2' with 'cb'
				oOuter2 = document.createElement('div');
				oOuter2.className = oElement2.className.replace(oRegExp2, '$1cb2$2');
	// Give the new div the original element's id if it has one
				if (oElement2.getAttribute("id")) {
					tempId2 = oElement2.id;
					oElement2.removeAttribute('id');
					oOuter2.setAttribute('id', '');
					oOuter2.id = tempId2;
				}
	// Change the original element's class name and replace it with the new div
				oElement2.className = 'i32';
				oElement2.parentNode.replaceChild(oOuter2, oElement2);
	// Create two new div elements and insert them into the outermost div
				oI12 = document.createElement('div');
				oI12.className = 'i12';
				oOuter2.appendChild(oI12);
				oI22 = document.createElement('div');
				oI22.className = 'i22';
				oI12.appendChild(oI22);
	// Insert the original element
				oI22.appendChild(oElement2);
	// Insert the top and bottom divs
				cbb2.insertTop(oOuter2);
				cbb2.insertBottom(oOuter2);
			}
		}
	},
	insertTop : function(obj) {
		var oOuter2, oInner2;
	// Create the two div elements needed for the top of the box
		oOuter2=document.createElement("div");
		oOuter2.className="bt2"; // The outer div needs a class name
	    oInner2=document.createElement("div");
	    oOuter2.appendChild(oInner2);
		obj.insertBefore(oOuter2,obj.firstChild);
	},
	insertBottom : function(obj) {
		var oOuter2, oInner2;
	// Create the two div elements needed for the bottom of the box
		oOuter2=document.createElement("div");
		oOuter2.className="bb2"; // The outer div needs a class name
	    oInner2=document.createElement("div");
	    oOuter2.appendChild(oInner2);
		obj.appendChild(oOuter2);
	},
	// 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]);
		}
	}
};

cbb2.addEvent(window, 'load', cbb2.init);