function getElementsByClassName(classname, node) {
			 if(!node) node = document.getElementsByTagName("body")[0];
			 var a = [];
			 var re = new RegExp('\\b' + classname + '\\b');
			 var els = node.getElementsByTagName("*");
			 for(var i = 0,j = els.length; j > i; i++)
			 if(re.test(els[i].className))a.push(els[i]);
			 return a;
		}
		
		//create onDomReady Event
onReady = (function(ie){
 var d = document;
 return ie ? function(c){
   var n = d.firstChild,
    f = function(){
     try{
      c(n.doScroll('left'))
     }catch(e){
      setTimeout(f, 10)
     }
    }; f()
  } : 
  /webkit|safari|khtml/i.test(navigator.userAgent) ? function(c){
   var f = function(){
     /loaded|complete/.test(d.readyState) ? c() : setTimeout(f, 10)
    }; f()
  } : 
  function(c){
   d.addEventListener("DOMContentLoaded", c, false);
  }
})(/*@cc_on 1@*/);

		
		onReady(function(){
			uls = document.getElementById('navmenu').childNodes;
			for (ul in uls) {
				if (!uls[ul]) continue;
				if (uls[ul].tagName=='UL') break;
			}
			ul = uls[ul];
			lis = ul.childNodes;

			var reallis = new Array();
			var nli = document.createElement('li');
			nli.innerHTML = '<a href="#"><span>More Pages</span></a>';
			var ne = document.createElement('ul');
			nli.appendChild(ne);
			
			var clearlis = [];
			for (lkey in lis)
			{
				var li = lis[lkey];
				if (!li) continue;
				if (li.tagName != 'LI') continue;
				clearlis.push(li);
			}
			var lastlis = clearlis.slice(8);
			
			
			if (lastlis.length){
				for (lkey in lastlis)
				{
					var li = lastlis[lkey];
					for (childkey in li.childNodes)
					{
						lichild = li.childNodes[childkey];

						if (!lichild) continue;
						
						// alert(lichild.tagName);
						if (lichild.tagName == 'UL')
						{
							li.removeChild(lichild);
						}
					}

					ne.appendChild(li);
					
				}
				ul.appendChild(nli);
			}
		});
