// JavaScript Document
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    } 
  } 
}
return req;
}

var http = getXMLHTTPRequest();
  
function checkPostnr() {
  var postnr = document.form1.postnr.value
  var myurl = 'inc/execute/response_postnr.asp';
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand+"&postnr="+postnr;
  http.open("GET", modurl, true);
  http.onreadystatechange = useHttpResponse;
  http.send(null);
}

// Funktion inväntar response från ajax anrop
function useHttpResponse() {
   if (http.readyState == 4) {
    if(http.status == 200) { 
       document.getElementById('voteBox').innerHTML = http.responseText;
    }
  } else {
  document.getElementById('voteBox').innerHTML = '<div align="center"><img src="bilder/animations/indicator_medium.gif" vspace="25"></div>';
  }
}