

  // set up unique name for httpobject: i.e. change all occurences of FOO
    var xmlGalleryHttp
    
    // call this function from the page
    function show_latest_galleries()
    {
        // show a loading message
        document.getElementById("gallery_list").innerHTML="Loading lastest galleries" 
        // call the URL you are interested in..
        var url="/gallery/latest_pics.php"
        // send the name of the function that will handle the response (???stateChanged)
        xmlGalleryHttp=GetXmlHttpObject(GalleryStateChanged)
        xmlGalleryHttp.open("GET", url , true)
        xmlGalleryHttp.send(null)
    } 



    // deal with the response
    function GalleryStateChanged() 
    { 
      // test tos ee if a response has been recieved
        if (xmlGalleryHttp.readyState==4 || xmlGalleryHttp.readyState=="complete")
        { 
          // do stuff with the returned stuff:
          document.getElementById("gallery_list").innerHTML=xmlGalleryHttp.responseText
        } 
    } 


    // do not change this ....
    function GetXmlHttpObject(handler)
    { 
        var objXmlHttp=null
        if (navigator.userAgent.indexOf("Opera")>=0)
        {
            
            objXmlHttp=new XMLHttpRequest()
            objXmlHttp.onload=handler
            objXmlHttp.onerror=handler 
            return objXmlHttp
            
        }
        if (navigator.userAgent.indexOf("MSIE")>=0)
        { 
            var strName="Msxml2.XMLHTTP"
            if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
            {
                strName="Microsoft.XMLHTTP"
            } 
            try
            { 
                objXmlHttp=new ActiveXObject(strName)
                objXmlHttp.onreadystatechange=handler 
                return objXmlHttp
            } 
            catch(e)
            { 
                alert("Error. Scripting for ActiveX might be disabled") 
                return 
            } 
        } 
        if (navigator.userAgent.indexOf("Mozilla")>=0)
        {
            objXmlHttp=new XMLHttpRequest()
            objXmlHttp.onload=handler
            objXmlHttp.onerror=handler 
            return objXmlHttp
        }
    } 
     
