function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } 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; newClassName+= " "; newClassName+= value; element.className = newClassName; } } function explodeArray(item,delimiter) { // this function to explode any path tempArray=new Array(1); var Count=0; var tempString=new String(item); while (tempString.indexOf(delimiter)>0) { tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter)); tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1); Count=Count+1 } tempArray[Count]=tempString; return tempArray; } function highlightPage() { if (!document.getElementsByTagName) return false; if (!document.getElementById) return false; if (!document.getElementById("navigation_categories")) return false; var nav = document.getElementById("navigation_categories"); var links = nav.getElementsByTagName("a"); current_path = explodeArray(document.location,"cn"); // second parameter needs to be set to the point if explosion exploded_path = explodeArray(current_path[1],'/'); // second paramter defines charcter in string to explode var current_path = exploded_path[exploded_path.length-1]; // returns last index of array, i.e. index.php for (var i=0; i