//alternativa al target _blank STRICT
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}

window.onload = externalLinks;

function SelectAll(id)
{
    document.getElementById(id).focus();
    document.getElementById(id).select();
}

//INGRANDIRE RIDURRE FONT-SIZE
function ingrandisci (){
document.body.style.fontSize = "1.1em";
}
function riduci (){
document.body.style.fontSize = "0.9em";
}
function normale (){
document.body.style.fontSize = "1em";
}

function check_email(address, msg_txt)
  {
  if (msg_txt == null)
    msg_txt = "Attenzione, indirizzo e-mail non corretto.";
  re = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
  if (!re.test(address))
    {
    if (msg_txt != "")
      alert(msg_txt);
    return false;
    }
  else
    return true;
  }

// Controlla il numero di caratteri di un certo input
function CheckCharsNum(th, max , msg_txt)
  {
  if (th.value.length > max)
    {
    th.value = th.value.substring(0, max);
    rest = 0;
    if (msg_txt != null)
      alert(msg_txt);
    }
  }
  
  // POP UP 
  function aprifin (file)
    {
    var win = null;
    if (win && win.open) win.close();
    win = window.open(file, "nome", "resizable=yes,scrollbars=YES,width=600,height=500,top=10,left=8");
    return false;
    }
