var map = null;
var geocoder = null;

function location_map_load(address) {
   if (GBrowserIsCompatible()) {
     map = new GMap2(document.getElementById("map"));
     geocoder = new GClientGeocoder();
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
							map.addControl(new GSmallZoomControl());
							map.addControl(new GMapTypeControl());
              map.setCenter(point, 15);
              var marker = new GMarker(point);
              map.addOverlay(marker);
//              marker.openInfoWindowHtml('New house');
            }
          }
        );
      }
    }
}
function bookmarkLink(t,u)
	{
	if (window.sidebar)
		{
		// Mozilla Firefox Bookmark
		window.sidebar.addPanel(t, u,"");
		}
	else if( window.external )
		{
		// IE Favorite
		window.external.AddFavorite( u, t);
		}
	else if(window.opera && window.print)
		{
		// Opera Hotlist
		return true; 
		}
	}

function clearOtherSearches(w)
{
if(w=='uniqueID') document.search.region.options[0].selected = true;
if(w=='uniqueID') document.search.state.options[0].selected = true;
if(w=='uniqueID') document.search.bedrooms.options[0].selected = true;
if(w=='region') document.search.uniqueID.options[0].selected = true;
if(w=='state') document.search.uniqueID.options[0].selected = true;
if(w=='bedrooms') document.search.uniqueID.options[0].selected = true;
return true;
}

function loadStates(thisValue) {
	var target = document.getElementById('state');
	if(target.hasChildNodes()) while (target.childNodes.length>=1) target.removeChild(target.firstChild);
    var option = document.createElement('option');
	option.text = 'All Districts';
    option.value = 'All Districts';
  	target.appendChild(option);
	if(typeof state_list[thisValue] != 'undefined') {
		var obj = state_list[thisValue];
		for (var i = 0 ; i < state_list[thisValue].length ; i++){
    	    var option = document.createElement('option');
    		option.innerHTML = obj[i];
		    option.value = obj[i];
    	  	target.appendChild(option);
		}
	}
}
