

function check_mail(id_obj, msg_txt)
  {
  el = document.getElementById(id_obj);
  if(el)
    {
    address = el.value;

    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;
    }
  else
    {
    alert("Errore: impossibile trovare ID="+id_obj);
    return false;
    }
  }

// XHTML 1.0 non permette attributo target nel tag A
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";
  }
}

function popUp(href)
  {
  window.open(href, 'foto', 'width=900px, height=700px, scrollbars=1, menubar=0, toolbar=0');
  return false;
  }


function MyReset()
  {
  $$('input[type=text]').each(function(el){
    el.setProperty('value', '');
  });

  $$('option[selected=selected]').each(function(el){
    el.removeProperty('selected');
  });

  $$('input[type=radio]').each(function(el){
    if (el.getProperty('value') == '')
      el.setProperty('checked', 'checked');
    else
      el.removeProperty('checked');
  });

  return false;
  }
