
// Callback function to process the data returned by the Ajax request

function processGetPost(){
  var myajax=ajaxpack.ajaxobj
  var myfiletype=ajaxpack.filetype
  if (myajax.readyState == 4){ //if request of file completed
    if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
      if (myfiletype=='txt' && myajax.responseText && myajax.responseText.length > 1 ) {
        trimmedhash=myajax.responseText.replace(/^\s+|\s+$/g, '') ; // trim stray linebreak!
        document.getElementById('captchaimg').src='captcha.cfm?hash='+trimmedhash;
        document.getElementById('hash').value=trimmedhash
      }
      else {
        alert('Error getting new captcha details')
      }
    }
  }
}
