function email(name, domain, suffix, text)
{
   var address = name + "\u0040" + "pmtexarch" + "." + "com";
   var url = "mailto:" + address;

   if( ! text )
   {
      text = address;
   }

   document.write("<a href=\"" + url + "\">" + text + "</a>");
}


function validate() {
  validity = true; // assume valid
  var colore = "#ffcc00"
  
    if (!check_empty(document.formcontatti.nome.value))
        { 	validity = false;	
			check_nome.style.display = "block";
			document.formcontatti.elements["nome"].style.backgroundColor = colore; 
			document.formcontatti.elements["nome"].focus(); return false;}

    if (!check_empty(document.formcontatti.cognome.value))
        { 	validity = false;	
			check_cognome.style.display = "block";
			document.formcontatti.elements["cognome"].style.backgroundColor = colore; 
			document.formcontatti.elements["cognome"].focus(); return false;}

    if (!check_empty(document.formcontatti.citta.value))
        { 	validity = false;	
			check_citta.style.display = "block";
			document.formcontatti.elements["citta"].style.backgroundColor = colore; 
			document.formcontatti.elements["citta"].focus(); return false;}			

	if (!check_email(document.formcontatti.mail.value))
        { 	
			validity = false;	
			check_lettera.style.display = "block";
			document.formcontatti.elements["mail"].style.backgroundColor = colore; 
			document.formcontatti.elements["mail"].focus(); return false;}					

  if (validity)
		return validity;
}

function check_empty(text) {
  check_nome.style.display = "none";
  check_cognome.style.display = "none";
  check_citta.style.display = "none";  
  check_lettera.style.display = "none";  
  return (text.length > 0); // returns false if empty 
	
}

function check_email(address) {
  if ((address == "")
    || (address.indexOf ('@') == -1)
    || (address.indexOf ('.') == -1))
      return false;
  return true;
}

 function PopupCentrata() {
   var w = 500;
   var h = 650;
   var l = Math.floor((screen.width-w)/2);
   var t = Math.floor((screen.height-h)/2);
   var stile = "top=10, left=10, width=" + w + ", height="+ h +",top=" + t + ",left=" + l +", status=no, menubar=no, toolbar=no, scrollbar=auto";
   window.open("/legal.htm","",stile);
	  
 }
 
 
 
	function paginaLegal(num) {
		window.open("/legal.htm","","height=350,width=550,left=120,top=120");
	}
