
function js_setBg (str) {
	$('menupreviewpic').style.backgroundImage = "url("+str+")";
}


function js_newmenufy () {

	//	check for the menu - if not present avoid the try to connect it
	if (!$('menu2') || $('menu2') == null) {
		return (false);
	}

	var els = getElementsBySelector ('#menu2 li a');

	forEach (els, function (e) {		
		connect (e, 'onmouseover', function (evt) {
			$('menupreviewpic').style.display = 'block';
			$('mhead').style.backgroundColor = '#FF9E01';
			$('mhead').style.color = '#FFFFFF';

			if (!evt.src) {
				return (false);
			}

			var id = evt.src ().id;


			if (!id || id == "") {
				return (false);
			}
			
			js_setBg ('/images/menu/'+id+".jpg");
		});
		
		connect (e, 'onmouseout', function (evt) {
			// $('menupreviewpic').style.display = 'none';
			js_setBg ('/images/menu/m_default.jpg');
			$('mhead').style.backgroundColor = '#DCDCDC';
			$('mhead').style.color = '#646464';
		});		
		
	});

	connect ($('menupreviewpic'), 'onmouseover', function (evt) {
		$('menupreviewpic').style.display = 'block';
		$('mhead').style.backgroundColor = '#FF9E01';
		$('mhead').style.color = '#FFFFFF';
	});
	connect ($('menupreviewpic'), 'onmouseout', function (evt) {
//			$('menupreviewpic').style.display = 'none';
			$('mhead').style.backgroundColor = '#DCDCDC';
			$('mhead').style.color = '#646464';
	});
};

js_newmenufy ();
