// JavaScript Document

	window.addEvent("domready",function(){
										
		// To make the mouseovers as smooth as possible, the first thing we'll do is to preload on
		// the background ALL the mouseover images for the horizontal menu. ONLY when preloading is
		// finished will the addEventHandlers function be called which will assign the mouseover / mouseout
		// functionality to the menu.
		var myImages = new Asset.images([
			'images/menu/menu_home_over.gif', 
			'images/menu/menu_etairia_over.gif',
			'images/menu/menu_useful_information_over.gif',
			'images/menu/menu_products_over.gif',
			'images/menu/menu_scientific_news_over.gif',
			'images/menu/menu_contact_over.gif'
		], {
											
			onComplete: addEventHandlers

		});
		
		function addEventHandlers() {
			// Mouse overs for the menu links, and all buttons
			$$('div.header a img').each(function(img){
				var src = img.getProperty('src');  
				var extension = src.substring(src.lastIndexOf('.'),src.length);
				if (src.indexOf("_over") == -1) {
					img.addEvent('mouseenter', function() { img.setProperty('src',src.replace(extension,'_over' + extension)); });
					img.addEvent('mouseleave', function() { img.setProperty('src',src); });  
				}
			});
		}
										
	});