window.onload = mladdevents;
			function mladdevents(){
			
				if(window.mlrunShim == true){
					var Iframe = document.createElement("iframe");
					Iframe.setAttribute("src","about:blank");
					Iframe.setAttribute("scrolling","no");
					Iframe.setAttribute("frameBorder","0");
					Iframe.style.zIndex = "2";
					Iframe.style.filter = 'alpha(opacity=0)';
				}
				var effects_a = new Array();
				var divs = document.getElementsByTagName('div');
				for(var j=0;j<divs.length;j++){
					if(divs[j].className.indexOf('mlmenu') != -1){
						var lis = divs[j].getElementsByTagName('li');
						for(var i =0;i<lis.length;i++){
							lis[i].onmouseover = mlover;
							lis[i].onmouseout = mloutSetTimeout;
							if(window.mlrunShim == true){
								lis[i].appendChild(Iframe.cloneNode(false));
							}
							if(lis[i].getElementsByTagName('ul').length > 0){
								lis[i].className += 'haschild';
								if(divs[j].className.indexOf('arrow') != -1){
									if(divs[j].className.indexOf('vertical') != -1 || lis[i].parentNode.parentNode.nodeName != 'DIV'){
										lis[i].getElementsByTagName('a')[0].innerHTML += '<span class="vert">&rarr;</span>';
									}
									else{
										lis[i].getElementsByTagName('a')[0].innerHTML += '<span class="horiz">&darr;</span>';
									}
								}
								else if(divs[j].className.indexOf('plus') != -1){
									lis[i].getElementsByTagName('a')[0].innerHTML += '<span class="plus">+</span>';
								}
							}
							else{
								if(divs[j].className.indexOf('arrow') != -1){
									//This accounts for a wierd IE-specific bug in horizontal menus. CSS will set visibility: hidden;. This keeps the menu level(in IE)
									lis[i].getElementsByTagName('a')[0].innerHTML += '<span class="noshow">&darr;</span>';
								}
							}
							var uls = lis[i].getElementsByTagName('ul');
							for(var k=0;k<uls.length;k++){
								var found = 'no';
								for(var z=0;z<effects_a.length;z++){
									if(effects_a[z] == uls[k]){
										found = 'yes';
									}
								}
								if(found == 'no'){
									effects_a[effects_a.length] = uls[k];
									uls[k].style.zIndex = '100';
									mlEffectLoad(uls[k]);
								}
							}
						}
					}
				}
			}
			function mloutSetTimeout(e){
				if(!e){
					var the_e = window.event;
				}
				else{
					var the_e = e;
				}
				var reltg = (the_e.relatedTarget) ? the_e.relatedTarget : the_e.toElement;
				if(reltg){
					var under = ancestor(reltg,this);
					if(under === false && reltg != this){
						window.mlLast = this;
						var parent = this.parentNode;
						while(parent.parentNode && parent.className.indexOf('mlmenu') == -1){
							parent = parent.parentNode;
						}
						if(parent.className.indexOf('delay') != -1){
							window.mlTimeout = setTimeout(function(){mlout()},500);
						}
						else{
							mlout();
						}
					}
				}
			}
			function mlout(){
			if(window.mlLast==null)return false;
				var uls = window.mlLast.getElementsByTagName('ul');
				var sib;
				for(var i=0;i<uls.length;i++){
					mlEffectOut(uls[i]);
					window.mlLast.className = 'haschild hide';
					if(window.mlrunShim == true){
						sib = uls[i];							
						while(sib.nextSibling && sib.nodeName != 'IFRAME'){
								sib = sib.nextSibling
						}
						sib.style.display = 'none';
					}
				}
				window.lastover = null;
			}
			function mlover(e){
				if(!e){
					var the_e = window.event;
				}
				else{
					var the_e = e;
				}
				the_e.cancelBubble = true;
				if(the_e.stopPropagation){
					the_e.stopPropagation();
				}
				clearTimeout(window.mlTimeout);
				if(window.mlLast && window.mlLast != this && ancestor(this,window.mlLast) == false){
					mlout();
				}
				else{
					window.mlLast = null;
				}
				var reltg = (the_e.relatedTarget) ? the_e.relatedTarget : the_e.fromElement;
				var ob = this.getElementsByTagName('ul');
				var under = ancestor(reltg,this);
				if(ob[0] && under == false){
					if(window.lastover != ob[0]){
						if((window.mlrunShim == true) && (typeof document.body.style.maxHeight == "undefined")){
							var sib = ob[0];
							while(sib.nextSibling && sib.nodeName != 'IFRAME'){
								sib = sib.nextSibling
							}
							ob[0].style.display = 'block';
							sib.style.top = ob[0].offsetTop+'px';
							sib.style.left = ob[0].offsetLeft-2+'px';
							sib.style.width = ob[0].offsetWidth+'px';
							sib.style.height = ob[0].offsetHeight-2+'px';
							sib.style.border = '1px solid red';
							sib.style.display = 'block';
						}
						this.className = 'haschild';
						mlEffectOver(ob[0],this);
						window.lastover = ob[0];
					}
				}
			}
						
			function mldelay(ob,lvl){
		       /* var opnow = ob.style.opacity;		        
		        opnow = opnow * 10;
		        var newop = opnow +1;
		        var std = newop/10;
		        var iexp = newop*10;*/		        
		        if (navigator.appName.indexOf('Microsoft') == 0)
			    {
			        /*if (typeof document.body.style.maxHeight == "undefined") {
			            ob.style.display = 'block';
			            //ob.style.filter = 'alpha(opacity='+100+')';
			        }
			        else
			        {				            		            
			            ob.style.display = 'block';
			            //ob.style.filter = '';
		                //ob.style.opacity = 1;
			        }*/
			        ob.style.display = 'block';
		        }
		        else
		        {
		            ob.style.opacity = 1;
		        }
		    }
			//var lastobj;
			var offleft;						
			function mlEffectOver(ob,parent){					    				    						
						//var testdim;
						ob.style.opacity = 0;
						var screenwidth = (screen.width-1000)/2;
						var parentwidth = parent.offsetLeft;
						if (parentwidth != 0)
			                {
				                //lastobj = ob;
				               /* testdim = false;*/
				                offleft = screenwidth + parentwidth;					        
				            }
				        else
				            {   
				                /*if (lastobj != ob)
				                    {
				                        lastobj = ob;*/
				                        offleft = screenwidth;
				                    //}
				            }					    	
				      /*  if (offleft > screen.width)	
				            {
				                testdim = true;
				            }
				        if (testdim == true)
				            {					    			    
				                if (navigator.appName.indexOf('Microsoft') == 0)
				                    {
				                        if (typeof document.body.style.maxHeight == "undefined") {
			                                ob.style.left = '-556px';					            
			                            }
				                        
				                    }
				                else
				                    {				                        
				                        ob.style.right = '278px'; 
				                    }
				            }*/
				        if (navigator.appName.indexOf('Microsoft') == 0)
			            {
			                ob.style.display = 'none';
			                ob.style.left = offleft;
			                /*if (typeof document.body.style.maxHeight == "undefined") {				    
				                ob.style.display = 'none';
				            }
				            else
				            {
				                ob.style.display = 'none';
				            }*/				            
				        }
				        else
				        {
				            ob.style.display = 'block';
				        }
						for(var i = 1;i<2;i++){
							    var opac= i/10;
							    //delay time
							    setTimeout(function(){mldelay(ob,0)},500);							
						}
						if (navigator.appName.indexOf('Microsoft') == 0)
			            {
			                ob.style.filter = '';    
			            }
						
							/*if(typeof document.body.style.maxHeight == "undefined"){
							//setTimeout(function(){ob.style.filter = ''},500);
							ob.style.filter = '';
							}
							else 
							{
							    ob.style.filter = '';
							}*/
							
			}
			function mlEffectOut(ob){
			    /*if ((lastobj != ob) && (lastobj.offsetLeft == 0))
			        {
			            offleft -= 278;
			        }*/				    
					ob.style.opacity = 0;
					if (navigator.appName.indexOf('Microsoft') == 0)
				    {
					    ob.style.filter = 'alpha(opacity='+0+')';
			        }
					ob.style.display = 'none';					
			}
			function mlEffectLoad(ob){
				var parent = ob.parentNode;
				while(parent.parentNode && parent.className.indexOf('mlmenu') == -1){
					parent = parent.parentNode;
				}
				if(parent.className.indexOf('fade') != -1){
						ob.style.display = 'none';
						ob.className = 'fade';
						ob.style.opacity = 0;
						if (navigator.appName.indexOf('Microsoft') == 0)
				        {	
				            ob.style.filter = 'alpha(opacity='+0+')';
			            }
				}				
				else{
					ob.className = 'none';
					ob.style.display = 'none';
				}
			}
			function ancestor(child, parent){
				if(child==null)return false;//Saves checking elsewhere
				//This is a fix for a Firefox bug *gasp*
				//Aparantly causes a bug in Opera!
				//I see no choice but a browser detect. *sigh* I didn't want to have to do this.
				if(navigator.userAgent.indexOf('Gecko') != -1 && navigator.userAgent.indexOf('Opera') == -1){
					//This should only be run by Gecko based browsers. this code should be fine in everything but Opera so forge away browsers.
					var allc = parent.getElementsByTagName('*');
					for(var i= 0;i<allc.length;i++){
						if(allc[i] == child){
							return true;
						}
					}
				}
				else{
					//http://www.dynamicdrive.com/forums/showthread.php?t=12341 Thanks Twey!
					for(; child.parentNode; child = child.parentNode){
						if(child.parentNode === parent) return true;
					}
				}
				return false;
			}