function insertAfter(newElement, targetElement) {
	var parent = targetElement.parentNode;
	if (parent.lastChild == targetElement) {
		parent.appendChild(newElement);
	}
	else{
		parent.insertBefore(newElement, targetElement.nextSibling);
	}
}

function addClass (element, value) {
	if (!element.className) {
		element.className = value;
	}
	else {
		newClassName = element.className + " " + value;
		element.className = newClassName;
	}
}
// Add Load Events for onloads
function addLoadEvent(func) {
	var oldonload = window.onload;
	if(typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
// For browsers without native getElementsByClassName
if(!document.getElementsByClassName){
	document.getElementsByClassName=function(cn){
		var allT=document.getElementsByTagName('*'), allCN=[], i=0, a;
		while(a=allT[i++]){
			a.className==cn?allCN[allCN.length]=a:null;
		}
	return allCN
	}
}

