function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf('@')
dotpos=value.lastIndexOf('.')
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false}
else {return true}
}
}

function validate_form(thisform)
{
with (thisform)
{
if (validate_email(email,'Indirizzo e-mail sintatticamente non  valido!')==false)
  {email.focus();return false}
}
}

function ReverseContentDisplay(d) {
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}

function historyback()
{
    history.go(-1);
    return true;
}

function popup(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=680,left = 0,top = 0');");
}

var xmlhttp;
function loadXMLDoc(url,cfunc)
{
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
//  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");  
  xmlhttp=new ActiveXObject("MSXML2.XMLHTTP.3.0");
  }
xmlhttp.onreadystatechange=cfunc;
xmlhttp.open("GET",url,true);
xmlhttp.send();
}






function agglibro(str)
{
var xmlhttp;
   var libro = str;
   
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
//  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  xmlhttp=new ActiveXObject("MSXML2.XMLHTTP.3.0");  
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("dispcarrello").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","aggcarrello.php?libro="+libro,true);
xmlhttp.send();
}





