/*************************** Multiple onload's function *****************************************************************/

	function addLoadEvent(func) {
		var oldonload = window.onload;				
		if (typeof window.onload != 'function') {	
			window.onload = func;
			} else {
			window.onload = function() {
				oldonload();
				func();
			}
		}
	}

/*************************** Insert After function ************************************/
	
	function insertAfter (newElement, targetElement) {
		var parent = targetElement.parentNode;
		if (parent.lastChild == targetElement) {
			parent.appendChild(newElement);
		} else {
			parent.insertBefore(newElement, targetElement.nextSibling);
		}
	}	
	
/*************************** Get Next Element ************************************/

	function getNextElement(node) {
		if ( node.nodeType == 1 ) {
			return node;
		}
		if ( node.nextSibling ) { 
			return getNextElement(node.nextSibling);
		}
		return null;
	}

/*************************** Add Class ************************************/
	
	/*
		* The addClass function is passed to argument values, elemetn and value.  These contain the element
		  that is to have a class value attached and the value of that class.
		* If the element has no class then it is assigned the newly created class value.
		* Else the existing class value is detected and assigned to the variable newClassName.  The existing 
		  variable is then given a space and then the new class value is placed after the existing value.
		* The element is then assigned this new double class value stored in newClassName, through the className property.
	*/
	
	function addClass(element, value) {
		if ( !element.className) {
			element.className = value;
		} else {
			newClassName = element.className;
			newClassName+= " ";
			newClassName+= value;
			element.className = newClassName;
		}
	}


