function mready(el) {
	$('#' + el + ' li').each(function(i,o) {
		try {
			$('#' + o.id).hoverIntent({sensitivity:20, interval:1, over:mshow, out:mhide});
		} catch(e) {}
	});

	// catch mouse out of window and hide all menus open
	$('body').mouseleave(function() {
		$('#' + el + ' li').each(function(i,o) {
			var relid = 'c_' + o.id;
			var obj = $('#' + relid); 
			dohide( obj,  o.id );
		});
	});
}
function mshow(e) {
	var relid = '#c_' + this.id;
	var left = $(this).position().left;
	$(relid).css({'top':221, 'left':left + -3});
	$(relid).slideDown(70);
	$(this).find('a').addClass('forceHover');
	
}

function dohide(obj, menu_id) {
	obj.hide(); // hide the content div
	$('#' + menu_id).find('a').removeClass('forceHover');
}

function mhide(e) {
	var menu_id = this.id;
	var relid = 'c_' + this.id;  
	var obj = $('#' + relid); 
	if(obj[0] && e.relatedTarget && e.relatedTarget.id != obj[0].id) { // focus not on the content div, safe to hide content div
		obj.unbind('mouseleave'); // remove the mouse binding fron the content div
		dohide(obj, menu_id);
	} else {
		obj.bind('mouseleave', function(ev) {	// create an event triggered by mouse leaving the content div
			if(ev.relatedTarget.id != menu_id) { // the focus is not on the triggering menu element
				dohide(obj, menu_id);
			} else { 	// focus is on the triggering menu class
				$('#' + menu_id).bind('mouseleave', mhide);
			}
		});
	}
}
