// JavaScript Document



//<![CDATA[
function inizializza() {
a = document.getElementsByTagName('A');
for(i=0;a[i];i++) if(a[i].className.indexOf('blank') != -1) {
  a[i].title += " [new window]";
  a[i].onclick = function () {window.open(this.href, '_blank');return false;};
  a[i].onkeypress = function (e) {
    k = (e) ? e.keyCode : window.event.keyCode;
    if(k==13) {
      window.open(this.href, '_blank');
      return false;
    }
  }
}
}
window.onload = function() {inizializza();}

function check(campo, tipo, label) {
  switch(tipo) {
    case "txt":
      if(document.getElementById(campo).value == '') {
        alert('Manca il campo ' + label);
        document.getElementById(campo).focus();
        return false;
      }
      break;
    case "chk":
      if(document.getElementById(campo).checked == '') {
        alert('Manca il campo ' + label);
        document.getElementById(campo).focus();
        return false;
      }
      break;
  }
  return true;
}

function checkEmail(campo) {
  var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(!filter.test(document.getElementById(campo).value)) {
    alert('Non e stata specificata un\'email valida');
    document.getElementById(campo).focus();
    return false;
  }
  return true;
}

function checkUguali(campo1, campo2) {
  if(document.getElementById(campo1).value != document.getElementById(campo1).value) {
    alert('Le due email sono diverse');
    document.getElementById(campo1).focus();
    return false;
  }
  return true;
}

//]]>