//--------------------------------------------------------------------------------
//
// Name: dhtml_funcs.js
//
// Find distributors based on the state selection.
//
// Version: 1.0
// Library: dhtml
// Requires: none
// Author: Brian McWilliams
// Modified by: Nathan Cahill
//
//--------------------------------------------------------------------------------

//-----------------------------------------------------------
// 
// findDistributors
//
//-----------------------------------------------------------
function find_distributors(state)
{
   if (window.XMLHttpRequest)
   {  // code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp = new XMLHttpRequest();
      //alert("NOT IE6");
   }
   else
   {  // code for IE6, IE5
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      //alert("IE6");
   }

   xmlhttp.onreadystatechange = function()
   {
      //alert("readyState: " + xmlhttp.readyState + " , status: " + xmlhttp.status);

      if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
      {
         //alert(xmlhttp.responseText);
         document.getElementById("distributors_found").innerHTML = xmlhttp.responseText;
      }
   }

   xmlhttp.open("GET", "/includes/distributor_ajax_v2.php?state=" + state, true);
   xmlhttp.send();
}

