var ajax = null;
function get_cities(s) {
  var cid, oid, fid, f_s;
  cid = s.options[s.selectedIndex].value;
  if (cid != "" && cid != "all") {





    f_s = document.getElementById("City");
    fid = f_s.getAttribute("name");
    oid = s.getAttribute("name");

    f_s.options.length = 0;
    f_s.options[0] = new Option("LOADING ... ", "");
    ajax.open("post", "http://www.jobsearchusa.org/_dynamicCities.php", true);
    ajax.send("cid="+ cid +"&fid="+ fid +"&oid="+ oid);  
    ajax.onSuccess = function()
    {
      var i, len, text;
      var arr = eval(this.data);
      var f_s = document.getElementById("City");
      f_s.options.length = 0;
      f_s.options[0] = new Option("[ Select ]", "all");
      f_s.options[1] = new Option("Select All", "all");
      f_s.options[2] = new Option("-", "");
      len = arr.length;
      for (i = 0; i < len; i++) {
        if (arr[i].state_code)
          text = arr[i].name +" ("+ arr[i].state_code +", "+ arr[i].num +")";
        else
          text = arr[i].name +" ("+ arr[i].num +")";
        
        f_s.options[f_s.options.length] = new Option(text, arr[i].cid);
      }
    }
  }
}
function get_classifieds(s) {
  var cid, oid, fid, f_s;

  if ((cid = s.options[s.selectedIndex].value) != "") {
    f_s = document.getElementById("Career Type Classified");
    fid = f_s.getAttribute("name");
    oid = s.getAttribute("name");

    ajax.open("post", "http://www.jobsearchusa.org/_dynamicCareerTypes.php", true);
    ajax.send("cid="+ cid +"&fid="+ fid +"&oid="+ oid);
    
    f_s.options.length = 0;
    f_s.options[0] = new Option("LOADING ... ", "");
    
    ajax.onSuccess = function()
    {
      var i, len;
      var arr = eval(this.data);
      var f_s = document.getElementById("Career Type Classified");

      f_s.options.length = 0;
      f_s.options[0] = new Option("[ Select ]", "");
      f_s.options[1] = new Option("Select All", "all");
      f_s.options[2] = new Option("-", "");

      len = arr.length;
      for (i = 0; i < len; i++)
        f_s.options[f_s.options.length] = new Option(arr[i].name, arr[i].cid);
    }
  }
}
window.onload = function()
{
  ajax = new AJAXConnection();
  ajax.onError = function(e) { alert("Error with connection\n\n"+ this.error); }
}