  /*function addItemUpdater() { }
  var ac = new Ajax.Autocompleter("placeName", "autocomplete_choices", "/"+dirOnly+"/mapping3/ajaxplaces.php", {
    //parameters: "ajaxpropertytype=<?php echo $_SESSION['ajaxpropertytype']; ?>", 
    parameters: "type="+type+"&show="+show,
    minChars: 3, 
    updateElement: addItemToList, 
    indicator: 'indicator1', 
    afterUpdateElement: addItemUpdater
  });*/

var base_x = lat;
var base_y = lng;

function addItemToList() {
    //for(var j in arguments) { console.log(j + " => " + arguments[j]); }
    //var place = arguments[0].innerHTML.split(" (");
    var place = arguments[0];
    //$('placeName').value = place[0];
}

  var lt = url_parameters("lat");
  var ln = url_parameters("lng");
  var county = "";
  var mainplace = "";
  var subplace = "";
  var farmcount = "";

  var handlerFunc = function(t) {
     var rt = t.responseText;
     rt = rt.split("::");
     county = rt[0];
     mainplace = rt[1];
     subplace = rt[2];
     farmcount = rt[3];
     //farmpoptext += "\nNumber of Farms: " + farmcount + "\n";
  }
  var errFunc = function(t) {
      alert('Error ' + t.status + ' -- ' + t.statusText);
  }

  new Ajax.Request('ajax_getcity.php', {method:'post', postBody:'lat='+lt+'&lng='+ln, onSuccess:handlerFunc, onFailure:errFunc});

if (window.addEventListener) {
  window.addEventListener("unload",GUnload,false);
} else if (window.attachEvent){
  window.attachEvent("onunload",GUnload);
}


//SIDE EVENT HANDLING
var mousetimer;

$("more_section").onmouseover = function () {
                if ($('more_icons').innerHTML == "") {
                      div = this;
                      this.style.background = "#eee url('../images/down_arrow.gif') no-repeat left center";
                      
                      mousetimer = window.setTimeout (function () { 
                            var more = $('more_icons');
                            div.innerHTML = "Hide stores";
                            div.style.background = "#eee url('../images/up_arrow.gif') no-repeat left center";
                            
                            for (i =0; i < EXTRAS.length; i++ ) {
                                more.appendChild (EXTRAS [i]);
                            }
                            
                            $('change_store').style.display = "none";
                            
                      },800);
                }
}

$("more_section").onmouseout = function () {
                if ($('more_icons').innerHTML == "") {
                      this.style.background = "#fff url('../images/down_arrow.gif') no-repeat left center";
                      window.clearTimeout (mousetimer);
                      //this.innHTML = "Show more stores";
                }
}

$("more_section").onclick = function () {
              $('more_icons').innerHTML = "";
              this.style.background = "#fff url('../images/down_arrow.gif') no-repeat left center";
              this.innerHTML = "Show more stores";
              $('change_store').style.display = "block";
}

$("branch_options").onmouseout= function () {
          this.style.background = "#fff url('../images/down_arrow.gif') no-repeat left center";
          window.clearTimeout (mousetimer);
         
}
$("branch_options").onmouseover = function () {
          this.style.background = "#eee url('../images/down_arrow.gif') no-repeat left center";
          //mousetimer = window.setTimeout (function () {
          //    $('filter_facilities').style.display = "block";
          //}, 800);
}

$("branch_options").onclick = function () {
          window.clearTimeout (mousetimer);
          $('filter_facilities').style.display = "block";
}


$("search_again_link").onclick = function () {
		$('garmin').style.display =  ($('garmin').style.display == "block") ?  'none' : 'block';
		$('on_map_search').style.display =  ($('on_map_search').style.display == "block") ?  'none' : 'block';
		// $('search_arrow').src =  ($('on_map_search').style.display == "block") ?  '../images/link_icon_large_down.gif' : '../images/link_icon_large.gif';
}


$('btnCloseSearch').onclick = function() {
		$('garmin').style.display =  ($('garmin').style.display == "block") ?  'none' : 'block';
		$('on_map_search').style.display =  ($('on_map_search').style.display == "block") ?  'none' : 'block';
		// $('search_arrow').src =  ($('on_map_search').style.display == "block") ?  '../images/link_icon_large_down.gif' : '../images/link_icon_large.gif';
}

function Update_Search_Image() {
	// $('search_arrow').src = '../images/link_icon_large.gif';
}
