// GMap2 object definition -- assigned to in gmap.js
var map;
       
// Cleanup code
window.onunload = UnhookUnload;
function UnhookUnload()
{
    //alert('Unhooking...');
    
    // unhook dom elements from js code - is window mapped to DOM or just JS?
    window.onunload = null;

    // Cleanup function for google maps
    GUnload();
}

// Called from default.aspx inline in event attribute
function FindPlaces_CallBack(response){ showResultsPane(response.value); }

// Fade code called when FindPlaces_CallBack fires to show new location matches
var fadeAjaxAmt = 1;
var ajaxImage;
function fadeOutAjax()
{
    if(fadeAjaxAmt <= 0)
    {
        // reset
        ajaxImage.style.display = 'none'; 
        fadeAjaxAmt = 1;  
    }
    else
    {
        // Decriment and schedule loop
        fadeAjaxAmt = parseFloat(fadeAjaxAmt - 0.05).toFixed(2);
        window.setTimeout("fadeOutAjax()", 200);
    }
    fadeBy(fadeAjaxAmt, ajaxImage );
}

// Imported from fade.js
function showResultsPane(resultsString)
{
    if(!ajaxImage)
        ajaxImage = document.getElementById("ajaxlogo");
        
    document.getElementById("locateMatches").innerHTML = resultsString;
    document.getElementById("resultsPane").style.display = '';
    window.setTimeout("fadeOutAjax()", 200);
    
    fadeAjaxAmt = 1;
    fadeBy(fadeAjaxAmt, ajaxImage);
    ajaxImage.style.display = '';   
    
}
function fadeBy(opacity, obj)
{
      if (document.all) {
        if(obj.style.filter == null || obj.style.filter != "alpha")
        {
            obj.style.filter = "alpha";
        }
	    obj.filters.alpha.opacity=opacity * 100;
      }
      else
      {
          obj.style.MozOpacity = opacity;
      }

}
function fadeOut(obj) { 
    obj.className='boom'; 
    //fadeBy(0.4, obj); 
}
function fadeIn(obj) { 
    obj.className=''; 
    //fadeBy(1, obj); 
}


