/* common js functions */

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

function addClass(element, value) {
	if(!element.className) {
		element.className = value;
	} else {
		var newClassName = element.className;
		newClassName += " ";
		newClassName += value;
		element.className = newClassName;
	}
}
/*
function insertAfter(newElement, targetElement) {
	var myParent = targetElement.parentNode;
	if (myParent.lastChild == targetElement) {
		myParent.appendChild(newElement);
	} else {
		myParent.insertBefore(newElement, targetElement.nextSibling);
	}
}
*/
function insertAfter(node, referenceNode) {
	var myParent = referenceNode.parentNode;
	myParent.insertBefore(node, referenceNode.nextSibling);
}
