//adatto l'altezza del div con i banner
window.onload = function() {
	if (document.getElementById('banner')) {
		if (document.getElementById('banner').clientHeight <= document.getElementById('corpoBanner').clientHeight){
			document.getElementById('banner').style.height = document.getElementById('corpoBanner').clientHeight + 'px';
		}
	}
}
var myimages=new Array()
function preloadimages(){
	for (i=0;i<preloadimages.arguments.length;i++){
	myimages[i]=new Image()
	myimages[i].src=preloadimages.arguments[i]
	}
}
preloadimages("img/menu_trasparent.gif","img/prodotti.gif","img/azienda.gif","img/ricette.gif","img/tradizioni.gif","img/notizie.gif","img/eventi.gif","img/scarica.gif","img/guarda.gif","img/acquista.gif","img/contattaci.gif")
function evidenziaMenu(id){
	img = document.getElementById("menuBertolin");
	img.src = "img/" + id + ".gif";
}
function ripristinaMenu(){
	img = document.getElementById("menuBertolin");
	img.src = "img/menu_trasparent.gif";
}
function cambiaTesto(){
	mail = document.getElementById("email");
	if (mail.value == "e-mail"){
		mail.value = "";
		mail.focus();
	}
}
function ripristinaTesto(){
	mail = document.getElementById("email");
	if (mail.value == ""){
		mail.value = "e-mail";
	}
}
function controlloMail(){
	var email = document.getElementById("email").value;
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("Inserire un indirizzo email corretto.");
           document.modulo.email.select();
		   return false;
	}else {
    	return true;    
	}
}
function controlloMail_1(){
	var email = document.getElementById("email").value;
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("Inserire un indirizzo email corretto.");
           document.modulo.email.select();
	}else {
		  document.modulo.submit();
}
}
