// JavaScript Document
<!--
function fun_service_contatta(CODICE_DIPARTIMENTO)
{
	str_alert = "WARNING !!\n";
	str_alert = str_alert + "-------------------------------------------\n\n";
	int_alert = 0;
	
	if (document.contatta.con_cognome.value.length < 1)
		{
		int_alert++;
		str_alert += int_alert + ".  First Name required\n";
		}
	if (document.contatta.con_nome.value.length < 1)
		{
		int_alert++;
		str_alert += int_alert + ".  Last Name required\n";
		}
	if (document.contatta.con_email.value.length < 1)
		{
		int_alert++;
		str_alert += int_alert + ".  Email required\n";
		}
	else if (document.contatta.con_email.value.length > 0)
		{
		var regMail=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$"); 
		if (!regMail.test(document.contatta.con_email.value))
			{
        	int_alert++;
			str_alert += int_alert + ".  Email format : xxxxx@xxxx.xx\n";
        	}
		}
		if (document.contatta.con_verify_email.value.length < 1)
		{
		int_alert++;
		str_alert += int_alert + ".  Verify email required\n";
		}
	else if (document.contatta.con_verify_email.value.length > 0)
		{ 
		if (document.contatta.con_email.value !== document.contatta.con_verify_email.value)
			{
        	int_alert++;
			str_alert += int_alert + ".  Email not verified\n";
        	}
		}
	
	if (CODICE_DIPARTIMENTO == "-")
		{
        int_alert++;
		str_alert += int_alert + ".  Select a valid department\n";
        }
		
	if (document.contatta.con_testo.value == "")
		{
        int_alert++;
		str_alert += int_alert + ".  Type any question or comments in the box\n";
        }
	
	if (int_alert > 0)
		{
		str_alert = str_alert + "\n";
		str_alert = str_alert + "-------------------------------------------\n";
		str_alert = str_alert + "Total errors: " + int_alert + "\n";
		alert (str_alert);
		return false;
		}
		
	else if (int_alert == 0)
		{
		document.contatta.method = "post";
		document.contatta.action = "contatta_sendmail.asp?dept=" + CODICE_DIPARTIMENTO;
		document.contatta.submit();
		return true;
		}
}
//-->
