var xmlhttpRss;
//window.onload=tester;
/*
The way this works is relatively simple: 
if window.onload has not already been assigned a 
function, the function passed to addLoadEvent 
is simply assigned to window.onload. 
If window.onload has already been set, 
a brand new function is created which first calls the original onload handler, 
then calls the new handler afterwards.

So, if you already have a script that uses the onload event handler, 
you don't need to dig it out and change it, 
unless you want to. It also allows for extra code. 
Here's an example that calls two functions and adds a third, 
independent addLoadEvent:

*/

function RSStabAddLoadEvent(func)
{   
    var oldonload = window.onload;   
    if (typeof window.onload != 'function') 
    {   
      window.onload = func;   
    } 
    else 
    {   
      window.onload = function() 
      {   
        if (oldonload) {   
          oldonload();   
      }   
    func();   
    }   
  }   
}   

//Call load function
 RSStabAddLoadEvent(InitRSStab);   

//Add a custorm third function if needed
RSStabAddLoadEvent(function() {   
    /* more code to run on page load */  
 });   
 
 
 function InitRSStab()
 {

    //Set variable for location
      city_loc = gl_RSStab_city_loc;
    
    //Set file location
    fileloc = '/controls/AjaxCalls/SmartNeighbors/RSStab_Control.aspx?location=' + city_loc  
    
    //Start the ajax process
    InitRSStabAjaxCall(fileloc)
 }
 
 
 //Initalize RSStab Ajax Call
function InitRSStabAjaxCall(url)
{

    xmlhttpRss=null;
    if (window.XMLHttpRequest)
    {   // code for Firefox, Opera, IE7, etc.
        xmlhttpRss=new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
      // code for IE6, IE5
      xmlhttpRss=new ActiveXObject("Microsoft.XMLHTTP");
    }
    if(xmlhttpRss!=null)
    {
      xmlhttpRss.onreadystatechange=CallRSStab;
      xmlhttpRss.open("GET",url,true);
      xmlhttpRss.send(null);
    }
    else
    {
        alert("Your browser does not support xmlhttpRss.");
    }
}

function CallRSStab()
{
    if (xmlhttpRss.readyState==4)
        {// 4 = "loaded"
        if (xmlhttpRss.status==200)
        {// 200 = "OK"
       
            document.getElementById('recent_listings').innerHTML=xmlhttpRss.responseText;
           
            document.getElementById('recent_listings').style.display = "";
             
             //If no results are found, collapse module
            if(xmlhttpRss.responseText.indexOf("<table />") != -1 )
            {
                document.getElementById('recent_listings').style.display = "none";
            }
        }
        else
        {
            alert("Problem retrieving RSS data:" + xmlhttpRss.statusText);
        }
    }
}






























