
  thisDate = new Date();
  var months = new Array("Jan", "Feb",
  "Mar", "Apr", "May", "Jun", "Jul", "Aug",
  "Sep", "Oct", "Nov", "Dec");

  function setCurrentDate() {
    document.write('<option value = "'+thisDate.getDate()+'" selected>' + thisDate.getDate());
    }

  function setCurrentMonth() {
    document.write('<option value = "'+ (thisDate.getMonth()+1)+'" selected>' + months[thisDate.getMonth()]);
    }

  function setCurrentYear() {
    document.write('<option value = "'+thisDate.getFullYear()+'" selected>' + thisDate.getFullYear());
    }


  function query(queryType) {

    var xmlHttp;
    var queryType;
    
    // create the query object based on the browser

    try {xmlHttp=new XMLHttpRequest();}  // Firefox, Opera 8.0+, Safari
    catch (e){
      try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}     // Internet Explorer
      catch (e){
        try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
        catch (e) {alert("Your browser does not support AJAX!");return false;}
        }
      }

    // create the database queries

/*
    if(selection == "1"){
      selection = document.getElementById("COUNTRY").value;
      query = "/cgi-bin/getstates?Country=" + selection;
      }
*/

    if(queryType == "cities"){
      query = "http://www.thegln.com/cgi-bin/getcities?State=";
      }

    if(queryType == "neighborhoods"){
      selection = document.getElementById("CITY").value;
      query = "http://www.thegln.com/cgi-bin/getnbds?Search=Global&&City=" + selection;
      }

    // do the query

    try {xmlHttp.open("POST",query,true);}
    catch (e) {alert(e)};

    xmlHttp.onreadystatechange=function() {

      if(xmlHttp.readyState==4) {

        // stuff the query results into an array

        var tmpArr = new Array();
        tmpArr = xmlHttp.responseText.split("\n");

        var lines = new Array();

        for(i=0;i<(tmpArr.length-1);i++) {

          // parse the response

          if(tmpArr[i].match(/HTML/i)) {continue;}
          if(tmpArr[i].match(/NAME/i)) {continue;}

          if(tmpArr[i].match(/SELECT/i)) {tmpArr[i] = tmpArr[i].replace(/..SELECT./i,"");}

          lines = tmpArr[i].split('\"');
          var value = lines[1];
          var label = lines[2].replace(/\>/,"");

          // stuff it into the select list

//          if(fromList == ""){document.forms[0].STATE.options[i-3] = new Option(label, value, true, false);}
          if(queryType == "cities")       {document.forms[0].CITY.options[i-3] = new Option(label, value, true, false);}
          if(queryType == "neighborhoods"){document.forms[0].NEIGHBORHOOD.options[i-3] = new Option(label, value, true, false);}
          }
      }
    }
    xmlHttp.send(null);
  }

  function clearLists() {
//    if(fromList == "2"){document.searchForm.STATE.options.length = 0;}
    if(queryType == "cities"){document.searchForm.CITY.options.length = 0;}
    if(queryType == "3"){document.searchForm.NEIGHBORHOOD.options.length = 0;}
    }



function contact(mailtoID,rhs,lhs,innerhtml) {
  document.getElementById(mailtoID).href = 'mailto://' + rhs + '@' + lhs;
  document.getElementById(mailtoID).innerHTML = innerhtml;
  }


