function getElementsByClass(searchClass,node,tag) { var classElements = new Array(); if ( node == null ) node = document; if ( tag == null ) tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); for (i = 0, j = 0; i < elsLen; i++) { if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; } } return classElements; } function menu_highlight(mhid,mhclass,mhtag,mrelpage){ // Find menu by one of fourth ways function noe(){return true;} window.onerror = noe; if(mhid != null){ // by id if(mhtag != null){ // parent var menuobj1 = document.getElementById(mhid); var menuobj3 = menuobj1.getElementsByTagName("ul"); var menuobj4 = menuobj3[0]; mhid = mhid+"ah"; menuobj4.id = mhid; }else{ // ul } }else if (mhclass != null){ // by class if(mhtag != null){ // parent var menuobj1 = getElementsByClass(mhclass,null,mhtag); var menuobj2 = menuobj1[0]; var menuobj3 = menuobj2.getElementsByTagName("ul"); var menuobj4 = menuobj3[0]; }else{ // ul var menuobj1 = getElementsByClass(mhclass,null,"ul"); var menuobj4 = menuobj1[0]; } mhid = "highlmenu"; menuobj4.id = mhid; } // Run highlight script preparemenu(mhid,mrelpage); //alert("aaa" + menuobj.innerHTML); } function firstlvlstyling(obj){ // To add class for item with sub levels obj.firstChild.className = "hasDropdown"; } function secondlvlstyling(obj){ } function thirdlvlstyling(obj){ } // Array indexOf function for IE if(!Array.indexOf){ Array.prototype.indexOf = function(obj){ for(var i=0; i 3){ pageurl = pageurl3 + mrelpage[pageurl2]; } } // search for active menu node var activenodeid = arr1.indexOf(pageurl); if (activenodeid >= 0){ // active node found var activenodeobj = document.getElementById(activenodeid); // set active if(arr2[activenodeid] == "s"){ // active node in first level activenodeobj.firstChild.className = "firstlvlactive"; // show sub list var actlist = activenodeobj.getElementsByTagName("UL"); if(actlist.length > 0){ actlist[0].className = "openlist"; } }else if(arr2[arr2[activenodeid]] == "s"){ // active node in second level activenodeobj.firstChild.className = "sublvlactive"; // activate parent node document.getElementById(arr2[activenodeid]).firstChild.className = "firstlvlactive"; // show parent sub list var actlist = activenodeobj.getElementsByTagName("UL"); if(actlist.length > 0){ actlist[0].className = "openlist"; } // show sub list var actlist2 = document.getElementById(arr2[activenodeid]).getElementsByTagName("UL"); if(actlist2.length > 0){ actlist2[0].className = "openlist"; } }else{ // active node in third level activenodeobj.firstChild.className = "sublvlactive"; // activate(open) parent node document.getElementById(arr2[activenodeid]).firstChild.className = "sublvlopen"; // activate parent parent node document.getElementById(arr2[arr2[activenodeid]]).firstChild.className = "firstlvlactive"; // show sub list var actlist = activenodeobj.getElementsByTagName("UL"); if(actlist.length > 0){ actlist[0].className = "openlist"; } // show parent sub list var actlist2 = document.getElementById(arr2[activenodeid]).getElementsByTagName("UL"); if(actlist2.length > 0){ actlist2[0].className = "openlist"; } // show parent parent sub list var actlist3 = document.getElementById(arr2[arr2[activenodeid]]).getElementsByTagName("UL"); if(actlist3.length > 0){ actlist3[0].className = "openlist"; } } } }