function region_map(site_root) {
  window.open(site_root + "jobs/region_map.html", "region_map", 'width=450,height=450');
}
function sendmail(id,what) {
  mailto=window.open("mailto.php?id=" + id, "sendmail", 'width=400,height=525');
}
function refine(qs) {
  ref=window.open("refine.php?" + qs, "refine_search", 'width=400,height=475');
}
function cost(site_root) {
  window.open(site_root + "jobs/cost_popup.php", "cost", 'width=450,height=450');
}
function benefits(site_root) {
  bene=window.open(site_root + "jobs/benefits_popup.php", "benefits", 'width=300,height=325');
}
function refineNow() {
  if (window.opener) {
    var url = "list.php?";
    url += "search_title=" + document.theForm.elements['search_title'].value;
    url += "&search_denom=" + document.theForm.elements['search_denom'].value;
    url += "&search_state=" + document.theForm.elements['search_state'].value;
    url += "&search_country=" + document.theForm.elements['search_country'].value;
    url += "&search_region=" + document.theForm.elements['search_region'].value;
    url += "&search_keyword=" + document.theForm.elements['search_keyword'].value;
    url += "&search_criteria=" + document.theForm.elements['search_criteria'].value;
    if (document.theForm.elements['search_lastvisit']) {
      url += "&search_lastvisit=" + document.theForm.elements['search_lastvisit'].value;
    }
    if (document.theForm.elements['search_date']) {
      url += "&search_date=" + document.theForm.elements['search_date'].value;
    }
    if (document.theForm.elements['search_daterange']) {
      url += "&search_daterange=" + document.theForm.elements['search_daterange'].value;
      url += "&fromyear=" + document.theForm.elements['fromyear'].value;
      url += "&frommonth=" + document.theForm.elements['frommonth'].value;
      url += "&fromday=" + document.theForm.elements['fromday'].value;
      url += "&toyear=" + document.theForm.elements['toyear'].value;
      url += "&tomonth=" + document.theForm.elements['tomonth'].value;
      url += "&today=" + document.theForm.elements['today'].value;
    }
    url += "&search_now=Submit";
    window.opener.location = url;
    window.opener.ref.close();
    return false;
  }
}
function enterSubmit(frm, event) {
  if ((event && event.which == 13) || (window.event && window.event.keyCode == 13)) {
    // this doesn't work
    //if (document.theForm.search_now) {
    //  document.theForm.search_now.value='Submit';
    //}
    // this doesn't either
    //document.theForm.action += '?search_now=Submit';
    document.theForm.submit();
  }
  else
    return true;
}
function chgs(i) {
  if (i == "lv") {
    document.getElementById('_d').value = "";
    document.getElementById('_lv').value = 1;
    document.getElementById('span7').style.fontWeight = "normal";
    document.getElementById('span30').style.fontWeight = "normal";
    document.getElementById('spanLV').style.fontWeight = "bold";
  }
  else {
    document.getElementById('_d').value = i;
    document.getElementById('_lv').value = "";
    if (i == "7") {
      document.getElementById('span7').style.fontWeight = "bold";
      document.getElementById('span30').style.fontWeight = "normal";
    }
    else {
      document.getElementById('span7').style.fontWeight = "normal";
      document.getElementById('span30').style.fontWeight = "bold";
    }
    document.getElementById('spanLV').style.fontWeight = "normal";
  }
  // fix fm/fd/fy/tm/td/ty selects
  document.getElementById('fm').value = 0;
  document.getElementById('fd').value = 0;
  document.getElementById('fy').value = 0;
  document.getElementById('tm').value = 0;
  document.getElementById('td').value = 0;
  document.getElementById('ty').value = 0;
  return false;
}
function chgd(i) {
  if (document.getElementById('_d')) {
    document.getElementById('_d').value = "";
  }
  if (document.getElementById('_lv')) {
    document.getElementById('_lv').value = "";
  }
  if (document.getElementById('span7')) {
    document.getElementById('span7').style.fontWeight = "normal";
  }
  if (document.getElementById('span30')) {
    document.getElementById('span30').style.fontWeight = "normal";
  }
  if (document.getElementById('spanLV')) {
    document.getElementById('spanLV').style.fontWeight = "normal";
  }
}

