window.onload=textLength;

function toplinks_show() {
	document.getElementById("toplinks_collapsed").style.display="none";
	document.getElementById("toplinks_expanded").style.display="block";
}
function toplinks_hide() {
	document.getElementById("toplinks_collapsed").style.display="block";
	document.getElementById("toplinks_expanded").style.display="none";
}
function textLength() {
	if(document.getElementById('submenu')) {

		var li=document.getElementById('submenu').getElementsByTagName('li'),lis=li.length;
		for(i=0;i<lis;i++){
		   li[i].onmouseover=function() {
			if(this.nextSibling){
			 	var nextLi=this.nextSibling;
				if(nextLi.className.indexOf("active")!=-1) nextLi.className+=" special"
			}	
		   }
			
		    li[i].onmouseout=function() {
			if(this.nextSibling) { 
				var nextLi=this.nextSibling;
				if(nextLi.className.indexOf("active")!=-1) nextLi.className=nextLi.className.replace(' special','')
			}	
		    }
		   var text=li[i].getElementsByTagName('a').length ? li[i].getElementsByTagName('a')[0].innerHTML : li[i].getElementsByTagName('strong')[0].innerHTML 
		   if(text.length>21) li[i].className+=" line2"
		}
	}	
	
}

