// create the http object
function createAjaxObj()
{
  var httprequest=false;
  if (window.XMLHttpRequest)
  {
    // if Mozilla, Safari etc
    httprequest = new XMLHttpRequest();
    if (httprequest.overrideMimeType)
    {
      httprequest.overrideMimeType('text/xml')
    }
  }
  else if (window.ActiveXObject)
  {
    // if IE
    try
    {
      httprequest=new ActiveXObject("Msxml2.XMLHTTP");
    } 
    catch (e)
    {
      try
      {
        httprequest=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e){}
    }
  }
  return httprequest;
}

function reportImage(id)
{
  var http = createAjaxObj();
  http.open("GET", "report_image.php?id=" + id, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      alert(http.responseText);
    }
  }
  http.send(null);
}

function verifyUpload(invoice, filename, email, zipcode, captcha, button)
{
  var http = createAjaxObj();
  var url = "image_upload_verify.php?invoice=" + invoice + "&filename=" + filename + "&email=" + email + "&zipcode=" + zipcode + "&captcha=" + captcha;
  //alert(url);
  http.open("GET", url, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      if (http.responseText == "1")
      {
        alert("Validation success. Click upload button.");
        
        button.disabled = false;
      }
      else
      {
        button.disabled = true;
        alert(http.responseText);
      }
    }
  }
  http.send(null);
}