
   var http_request = false;
   var resultNum = 2065;

function switchMenu(obj) {
   var el = document.getElementById(obj);
   if ( el.style.display != "none" ) {
      el.style.display = 'none';
   }
   else {
      el.style.display = '';
   }
}
   function checkForm()
   {
      if (resultNum > 99)
      {
         return confirm("You have requested results for " + resultNum + " properties.  \nThis will cause your browser to load the next page \nvery slowly so your results will be limited to the \ntop 99.  I recommend that you click 'Cancel' and revise \nyour search criteria to be more specific.");
      } else if (resultNum == 0)
      {
         return confirm("You've been so restrictive with your search criteria that there \n" +
                        "aren't ANY homes that meet your requirements!  If you really want \n" +
                        "to see an empty search result, click 'OK'.  Otherwise, click \n" +
                        "'Cancel' and revise your search criteria to be less specific. \n\n" +
                        "NOTE:  If you are specifying a street name, be sure to ONLY give the\n" +
                        "street name.  Not the number, not the city, not the North or the South.");
      }
      return true;
   }

   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            // set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            resultNum = http_request.responseText.replace(/[^0-9]/g, ''); 
            if (resultNum > 99 || resultNum == 0) {
               resultNumText = "<FONT style='color:red;'>" + resultNum + "</FONT>";
            } else {
               resultNumText = resultNum;
            }
            document.getElementById('resultspan').innerHTML = "Matching properties: " + resultNumText;
         } else {
            document.getElementById('resultspan').innerHTML = "";
         }
      }
   }

   function getNum(obj)
   {
      var poststr = "sub=true" + (document.qSearchForm.CHAMPAIGN && document.qSearchForm.CHAMPAIGN.checked?"&CHAMPAIGN=true":"")+(document.qSearchForm.URBANA && document.qSearchForm.URBANA.checked?"&URBANA=true":"")+(document.qSearchForm.RANTOUL && document.qSearchForm.RANTOUL.checked?"&RANTOUL=true":"")+(document.qSearchForm.MAHOMET && document.qSearchForm.MAHOMET.checked?"&MAHOMET=true":"")+(document.qSearchForm.MONTICELLO && document.qSearchForm.MONTICELLO.checked?"&MONTICELLO=true":"")+(document.qSearchForm.SAVOY && document.qSearchForm.SAVOY.checked?"&SAVOY=true":"")+(document.qSearchForm.STJOSEPH && document.qSearchForm.STJOSEPH.checked?"&STJOSEPH=true":"")+(document.qSearchForm.PAXTON && document.qSearchForm.PAXTON.checked?"&PAXTON=true":"")+(document.qSearchForm.TOLONO && document.qSearchForm.TOLONO.checked?"&TOLONO=true":"")+(document.qSearchForm.TUSCOLA && document.qSearchForm.TUSCOLA.checked?"&TUSCOLA=true":"")+(document.qSearchForm.FARMERCITY && document.qSearchForm.FARMERCITY.checked?"&FARMERCITY=true":"")+(document.qSearchForm.FISHER && document.qSearchForm.FISHER.checked?"&FISHER=true":"")+(document.qSearchForm.GIBSONCITY && document.qSearchForm.GIBSONCITY.checked?"&GIBSONCITY=true":"")+(document.qSearchForm.SIDNEY && document.qSearchForm.SIDNEY.checked?"&SIDNEY=true":"")+(document.qSearchForm.VILLAGROVE && document.qSearchForm.VILLAGROVE.checked?"&VILLAGROVE=true":"")+(document.qSearchForm.HOMER && document.qSearchForm.HOMER.checked?"&HOMER=true":"")+(document.qSearchForm.BEMENT && document.qSearchForm.BEMENT.checked?"&BEMENT=true":"")+(document.qSearchForm.GIFFORD && document.qSearchForm.GIFFORD.checked?"&GIFFORD=true":"")+(document.qSearchForm.THOMASBORO && document.qSearchForm.THOMASBORO.checked?"&THOMASBORO=true":"")+(document.qSearchForm.ARCOLA && document.qSearchForm.ARCOLA.checked?"&ARCOLA=true":"")+(document.qSearchForm.MANSFIELD && document.qSearchForm.MANSFIELD.checked?"&MANSFIELD=true":"")+(document.qSearchForm.ARTHUR && document.qSearchForm.ARTHUR.checked?"&ARTHUR=true":"")+(document.qSearchForm.ATWOOD && document.qSearchForm.ATWOOD.checked?"&ATWOOD=true":"")+(document.qSearchForm.BROADLANDS && document.qSearchForm.BROADLANDS.checked?"&BROADLANDS=true":"")+(document.qSearchForm.LODA && document.qSearchForm.LODA.checked?"&LODA=true":"")+(document.qSearchForm.OGDEN && document.qSearchForm.OGDEN.checked?"&OGDEN=true":"")+(document.qSearchForm.PESOTUM && document.qSearchForm.PESOTUM.checked?"&PESOTUM=true":"")+(document.qSearchForm.DEWEY && document.qSearchForm.DEWEY.checked?"&DEWEY=true":"")+(document.qSearchForm.FITHIAN && document.qSearchForm.FITHIAN.checked?"&FITHIAN=true":"")+(document.qSearchForm.HOOPESTON && document.qSearchForm.HOOPESTON.checked?"&HOOPESTON=true":"")+(document.qSearchForm.LUDLOW && document.qSearchForm.LUDLOW.checked?"&LUDLOW=true":"")+(document.qSearchForm.PENFIELD && document.qSearchForm.PENFIELD.checked?"&PENFIELD=true":"")+(document.qSearchForm.ALLERTON && document.qSearchForm.ALLERTON.checked?"&ALLERTON=true":"")+(document.qSearchForm.FAIRMOUNT && document.qSearchForm.FAIRMOUNT.checked?"&FAIRMOUNT=true":"")+(document.qSearchForm.PHILO && document.qSearchForm.PHILO.checked?"&PHILO=true":"")+(document.qSearchForm.CISCO && document.qSearchForm.CISCO.checked?"&CISCO=true":"")+(document.qSearchForm.NEWMAN && document.qSearchForm.NEWMAN.checked?"&NEWMAN=true":"")+(document.qSearchForm.RANKIN && document.qSearchForm.RANKIN.checked?"&RANKIN=true":"")+(document.qSearchForm.BELLFLOWER && document.qSearchForm.BELLFLOWER.checked?"&BELLFLOWER=true":"")+(document.qSearchForm.BUCKLEY && document.qSearchForm.BUCKLEY.checked?"&BUCKLEY=true":"")+(document.qSearchForm.DELAND && document.qSearchForm.DELAND.checked?"&DELAND=true":"")+(document.qSearchForm.HAMMOND && document.qSearchForm.HAMMOND.checked?"&HAMMOND=true":"")+(document.qSearchForm.WELDON && document.qSearchForm.WELDON.checked?"&WELDON=true":"")+(document.qSearchForm.WHITEHEATH && document.qSearchForm.WHITEHEATH.checked?"&WHITEHEATH=true":"")+(document.qSearchForm.CAMARGO && document.qSearchForm.CAMARGO.checked?"&CAMARGO=true":"")+(document.qSearchForm.DANVILLE && document.qSearchForm.DANVILLE.checked?"&DANVILLE=true":"")+(document.qSearchForm.IVESDALE && document.qSearchForm.IVESDALE.checked?"&IVESDALE=true":"")+(document.qSearchForm.SADORUS && document.qSearchForm.SADORUS.checked?"&SADORUS=true":"")+(document.qSearchForm.SIDELL && document.qSearchForm.SIDELL.checked?"&SIDELL=true":"")+(document.qSearchForm.FOOSLAND && document.qSearchForm.FOOSLAND.checked?"&FOOSLAND=true":"")+(document.qSearchForm.MELVIN && document.qSearchForm.MELVIN.checked?"&MELVIN=true":"")+(document.qSearchForm.ROBERTS && document.qSearchForm.ROBERTS.checked?"&ROBERTS=true":"")+(document.qSearchForm.ARROWSMITH && document.qSearchForm.ARROWSMITH.checked?"&ARROWSMITH=true":"")+(document.qSearchForm.CISSNAPARK && document.qSearchForm.CISSNAPARK.checked?"&CISSNAPARK=true":"")+(document.qSearchForm.LEROY && document.qSearchForm.LEROY.checked?"&LEROY=true":"")+(document.qSearchForm.LONGVIEW && document.qSearchForm.LONGVIEW.checked?"&LONGVIEW=true":"")+(document.qSearchForm.LOVINGTON && document.qSearchForm.LOVINGTON.checked?"&LOVINGTON=true":"")+(document.qSearchForm.MUNCIE && document.qSearchForm.MUNCIE.checked?"&MUNCIE=true":"")+(document.qSearchForm.PARIS && document.qSearchForm.PARIS.checked?"&PARIS=true":"")+(document.qSearchForm.ROSSVILLE && document.qSearchForm.ROSSVILLE.checked?"&ROSSVILLE=true":"")+(document.qSearchForm.SEYMOUR && document.qSearchForm.SEYMOUR.checked?"&SEYMOUR=true":"")+(document.qSearchForm.SIBLEY && document.qSearchForm.SIBLEY.checked?"&SIBLEY=true":"")+(document.qSearchForm.ANCHOR && document.qSearchForm.ANCHOR.checked?"&ANCHOR=true":"")+(document.qSearchForm.ATLANTA && document.qSearchForm.ATLANTA.checked?"&ATLANTA=true":"")+(document.qSearchForm.BONDVILLE && document.qSearchForm.BONDVILLE.checked?"&BONDVILLE=true":"")+(document.qSearchForm.CABERY && document.qSearchForm.CABERY.checked?"&CABERY=true":"")+(document.qSearchForm.CATLIN && document.qSearchForm.CATLIN.checked?"&CATLIN=true":"")+(document.qSearchForm.CHARLESTON && document.qSearchForm.CHARLESTON.checked?"&CHARLESTON=true":"")+(document.qSearchForm.CHRISMAN && document.qSearchForm.CHRISMAN.checked?"&CHRISMAN=true":"")+(document.qSearchForm.CLARENCE && document.qSearchForm.CLARENCE.checked?"&CLARENCE=true":"")+(document.qSearchForm.CRESCENTCITY && document.qSearchForm.CRESCENTCITY.checked?"&CRESCENTCITY=true":"")+(document.qSearchForm.ELLIOTT && document.qSearchForm.ELLIOTT.checked?"&ELLIOTT=true":"")+(document.qSearchForm.ELLSWORTH && document.qSearchForm.ELLSWORTH.checked?"&ELLSWORTH=true":"")+(document.qSearchForm.GEORGETOWN && document.qSearchForm.GEORGETOWN.checked?"&GEORGETOWN=true":"")+(document.qSearchForm.GILMAN && document.qSearchForm.GILMAN.checked?"&GILMAN=true":"")+(document.qSearchForm.GREENUP && document.qSearchForm.GREENUP.checked?"&GREENUP=true":"")+(document.qSearchForm.HEYWORTH && document.qSearchForm.HEYWORTH.checked?"&HEYWORTH=true":"")+(document.qSearchForm.MATTOON && document.qSearchForm.MATTOON.checked?"&MATTOON=true":"")+(document.qSearchForm.NORMAL && document.qSearchForm.NORMAL.checked?"&NORMAL=true":"")+(document.qSearchForm.OAKLAND && document.qSearchForm.OAKLAND.checked?"&OAKLAND=true":"")+(document.qSearchForm.PIPERCITY && document.qSearchForm.PIPERCITY.checked?"&PIPERCITY=true":"")+(document.qSearchForm.ROYAL && document.qSearchForm.ROYAL.checked?"&ROYAL=true":"")+(document.qSearchForm.SAYBROOK && document.qSearchForm.SAYBROOK.checked?"&SAYBROOK=true":"")+(document.qSearchForm.SULLIVAN && document.qSearchForm.SULLIVAN.checked?"&SULLIVAN=true":"")+(document.qSearchForm.WELLINGTON && document.qSearchForm.WELLINGTON.checked?"&WELLINGTON=true":"")+
              (document.qSearchForm.ptSFH && document.qSearchForm.ptSFH.checked ?  "&ptSFH=true" : "") +
              (document.qSearchForm.ptCONDO && document.qSearchForm.ptCONDO.checked ?  "&ptCONDO=true" : "") +
              (document.qSearchForm.din && document.qSearchForm.din.checked ?  "&din=true" : "") +
              (document.qSearchForm.gar && document.qSearchForm.gar.checked ?  "&gar=true" : "") +
              (document.qSearchForm.vtOnly && document.qSearchForm.vtOnly.checked ?  "&vtOnly=true" : "") +
              (document.qSearchForm.fr && document.qSearchForm.fr.checked ?  "&fr=true" : "") +
              (document.qSearchForm.fp && document.qSearchForm.fp.checked ?  "&fp=true" : "") +
              (document.qSearchForm.zip && document.qSearchForm.zip.value != "" ?  "&zip=" + encodeURI(document.qSearchForm.zip.value) : "") +
              (document.qSearchForm.stName && document.qSearchForm.stName.value != "" ?  "&stName=" + encodeURI(document.qSearchForm.stName.value) : "") +
                   "&found=" + encodeURI( document.qSearchForm.found.options[document.qSearchForm.found.selectedIndex].value ) +
                   (document.qSearchForm.houseStyle ? "&houseStyle=" + encodeURI( document.qSearchForm.houseStyle.options[document.qSearchForm.houseStyle.selectedIndex].value ) : "") +
                   (document.qSearchForm.age ? "&age=" + encodeURI( document.qSearchForm.age.options[document.qSearchForm.age.selectedIndex].value ) : "") +
                   "&sqft=" + encodeURI( document.qSearchForm.sqft.options[document.qSearchForm.sqft.selectedIndex].value ) +
                   "&minimum_price=" + encodeURI( document.qSearchForm.minimum_price.options[document.qSearchForm.minimum_price.selectedIndex].value ) +
                   "&maximum_price=" + encodeURI( document.qSearchForm.maximum_price.value ) +
              (document.qSearchForm.bed.value != "" ?  "&bed=" + document.qSearchForm.bed.value : "") +
              (document.qSearchForm.bath.value != "" ?  "&bath=" + document.qSearchForm.bath.value : "");
      makePOSTRequest('/getNum',poststr);
   }
