
/* MEGA MENU LOAD AND HANDLER */
var megamenu_info = Array();
function load_megamenu(){
	var megamenu = document.getElementById('richmegamenu');
	for(var z = 0; z < megamenu.childNodes[0].childNodes.length; z++){
		if(megamenu.childNodes[0].childNodes[z].nodeName.toUpperCase() == 'LI'){
			var span = null;
			var ul = null;
			var div = null;
			for(var y = 0; y < megamenu.childNodes[0].childNodes[z].childNodes.length; y++){
				if(megamenu.childNodes[0].childNodes[z].childNodes[y].nodeName.toUpperCase() == 'SPAN'){
					span = megamenu.childNodes[0].childNodes[z].childNodes[y];
				}else if(megamenu.childNodes[0].childNodes[z].childNodes[y].nodeName.toUpperCase() == 'DIV' && megamenu.childNodes[0].childNodes[z].childNodes[y].childNodes.length > 0){
					ul = megamenu.childNodes[0].childNodes[z].childNodes[y];					
				}
			}
			if(span != null){
				if(ul != null){
					ul.style.display = 'none';
					span.ul = ul;
					span.count = z;
					span.ul.count = z;
					span.show = function(){
						this.id = 'currentmega';
						this.ul.style.display = 'block';
					}
					span.hide = function(){
						this.id = '';
						this.ul.style.display = 'none';
					}
					span.onmouseover = function(){
						/*clearTimeout(megamenu_info[this.count].display);
						megamenu_info[this.count].display = setTimeout('*/megamenu_info[this.count].show();/*',500);*/
					}
					span.onmouseout = function(){
						/*clearTimeout(megamenu_info[this.count].display);
						megamenu_info[this.count].display = setTimeout('*/megamenu_info[this.count].hide();/*',500);*/
					}
					span.ul.onmouseover = span.onmouseover;
					span.ul.onmouseout = span.onmouseout;
				}
				megamenu_info[z] = span;
			}			
		}
	}
}


if(typeof window.onload == 'function'){
	var tmponload = window.onload;
	window.onload = function(){
		tmponload();
		load_megamenu();
	};
}else{
	window.onload = load_megamenu;
}
