// JavaScript Document
// All the javascript functions and methods will be managed from here
// Unless there is some elaborate set that will require/suggest its own set of files and headers

function setOther()
{
   	document.getElementById('wideMenu').style.background = 'url(../images/menuB.gif)';
	document.getElementById('wideMenu').style.backgroundPostion = 'center';
	document.getElementById('wideMenu').style.backgroundPostion = 'top';
	document.getElementById('wideMenu').style.backgroundRepeat = 'no-repeat';
	document.getElementById('wideBottom').style.top = '-24px';
	return;
}

function setProtection()
{
   	document.getElementById('wideMenu').style.background = 'url(../images/menuA.gif)';
	document.getElementById('wideMenu').style.backgroundPostion = 'center';
	document.getElementById('wideMenu').style.backgroundPostion = 'top';
	document.getElementById('wideMenu').style.backgroundRepeat = 'no-repeat';
	document.getElementById('wideBottom').style.top = '0px';
	return;

}



function valfunction(str){
	strfield1 = document.contact_form.interest.value;
	strfield2 = document.contact_form.msg.value;
	strfield3 = document.contact_form.nome.value;
	strfield4 = document.contact_form.azienda.value; 
	strfield6 = document.contact_form.citta.value;
	strfield7 = document.contact_form.privacy.checked; 
	
	if (strfield1 == "" || strfield1 == null || strfield1.charAt(0) == ' ')
    {
   		alert("\"Area di interesse\" è un campo richiesto. ")
   		return false;
	} 
	
	if (strfield2 == "" || strfield2 == null || strfield2.charAt(0) == ' ')
    {
   	 alert("\"Messaggio\" è un campo richiesto.")
   		return false;
	}
	
	    if (strfield3 == "" || strfield3 == null || strfield3.charAt(0) == ' ')
    {
    alert("\"Nome e Cognome\" sono campi richiesti.")
    return false;
    }
	
    if (strfield4 == "" || strfield4 == null || strfield4.charAt(0) == ' ')
    {
    alert("\"Azienda\" è un campo richiesto.")
    return false;
    }
	
    if (strfield6 == "" || strfield6 == null || strfield6.charAt(0) == ' ')
    {
    alert("\"Citt&aacute;\" è un campo richiesto.")
    return false;
    }
	
    if (document.contact_form.privacy.checked ==false)
    {
    alert("É necessario accettare la legge sulla privacy")
    return false;
    }
	
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  	strEmail = document.contact_form.email.value;
    if (strEmail == "" || strEmail == null || strEmail.charAt(0) == ' ')
    {
    alert('Un indirizzo email valido è richiesto.')
    return false;
    }

   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      alert('Un indirizzo email valido è richiesto.');
      return false;
    } 
	
	//alert("hello out");
	return true
}

