/*---- Ahah script for Management_V3 Body Content -----------------*/
/* --- see http://microformats.org/wiki/rest/ahah for details -----*/
/*--------12/5/2006   JGP -----------------------------------------*/

function DivContent(URL, Target, NCResult)
{
	this.url=URL;
	this.target=Target;
		
	argu = (typeof NCResult == 'undefined') ? '' : NCResult;
	this.ncresult=argu;
}


ahah_Gen= function() 
{
	var Loader=this;
    document.getElementById(this.target).innerHTML = 'loading data...';
    if (window.XMLHttpRequest) {
        this.req = new XMLHttpRequest();
		this.req.onreadystatechange = function(){ahahDone_Gen(Loader)};
		this.req.open("GET", this.url, true);
        this.req.send(null);
    } else if (window.ActiveXObject) {
        this.req = new ActiveXObject("Microsoft.XMLHTTP");
        if (this.req) {
            this.req.onreadystatechange = function(){ahahDone_Gen(Loader)};
            this.req.open("GET", this.url, true);
            this.req.send();
        }
    }
} 



ahahDone_Gen = function(thisobj) 
{

thisreq = thisobj.req; 
 
   // only if this.req is "loaded"
   if (thisreq.readyState == 4) 
   {
	// only if "OK"
       if (thisreq.status == 200 || thisreq.status == 0) 
	   {
           results = thisreq.responseText; 
           document.getElementById(thisobj.target).innerHTML = results + " " + thisobj.ncresult;
       } else {
           document.getElementById(thisobj.target).innerHTML="Error receiving content from url:\n" + thisreq.url + "-" + thisreq.statusText;
       }
 
   }
}


DivContent.prototype.newreq=ahah_Gen;
DivContent.prototype.upddiv=ahahDone_Gen;


