function e(id) { return document.getElementById(id); }

function change_proptype(type) {
  load_dyn_data('/dyn/change_ptyp?ptyp='+type);
}

function fetch_counts(field, value) {


}


function ProcServletData() {
 if (req.readyState == 4) {
  if (req.status == 200)
   eval(req.responseText);
 }
}

function load_dyn_data(url) {

  if(window.XMLHttpRequest) {
    req = new XMLHttpRequest();
    req.onreadystatechange = ProcServletData;
    req.open("GET", url, true);
    req.send(null);
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    if (req) {
      req.onreadystatechange = ProcServletData;
      req.open("GET", url, true);
      req.send();
    }
  }
}

function sel_county(v) {
  var n = e("cou_"+v.value);
  var c = e(v.value).checked;
  n = n.children[0];
  for(var m = n.firstChild; m != null; m = m.nextSibling) {
    if(m.type == 'checkbox')
      m.checked = c;
  }
}

function sel_city(v) {
  e(v.parentNode.id.substring(4, 100)).checked = false;
}

function pop_cou(c) {
  window.open('/mls/mappop?cou='+c, c+' County');
}

function pop_city(c) {
  window.open('/mls/mappop?city='+c, c);
}

function bookmark(ln,s) {
  load_dyn_data('/dyn/bookmark?add='+ln+'&ico='+s);
}

function debookmark(ln,s) {
  load_dyn_data('/dyn/bookmark?remove='+ln+'&ico='+s);
}

function include_js(script_filename) {
  var html_doc = document.getElementsByTagName('head').item(0);
  var js = document.createElement('script');
  js.setAttribute('language', 'javascript');
  js.setAttribute('type', 'text/javascript');
  js.setAttribute('src', script_filename);
  html_doc.appendChild(js);
  return false;
}
