xmlHttp = createRequestObject();

function checkSubscribe()
{
  if (document.getElementById("want_subs").checked)
    return true;
  var email = document.getElementById("email").value;
  if (!email)
  {
    alert("Email address required.");
    return false;
  }
  xmlHttp.open("GET", "/subscribe/check.html?email=" + escape(email), false);
  xmlHttp.onreadystatechange = confirmSubscribe;
  xmlHttp.send(null);
  if (xmlHttp.readyState == 4)
  {
    return true;
  }
  else
  {
    alert("An error occurred while processing your request.");
    return false;
  }
}

function confirmSubscribe()
{
  if (xmlHttp.readyState == 4)
  {
    var chkResult = xmlHttp.responseText;
    if ((chkResult == "1") && confirm(
        "We identified that you have subscribed to the newsletters on the site.\n" +
        "Would you like to save these settings ?")) 
    {
      document.getElementById("want_subs").checked = true;        
    }
  }
}