var xmlHttp

 function GetXmlHttpObject()
{
var xmlHttp=null;

try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
 

function upd(content_type,page) {
	 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
	
	var theUL = document.getElementById(content_type); // the UL
	
	// switch UL with a loading div
	theUL.innerHTML = '<img src="images/working.gif" border="0" width="150" height="15">';
	
	xmlHttp.open('get', 'mod_index_ajax.php?content_type='+content_type+'&page='+page, true);
	xmlHttp.onreadystatechange = handleResponse;
	xmlHttp.send(null);	
}



function handleResponse() {
  if(xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){

       	
        var response = xmlHttp.responseText;
        var update = new Array();

        if(response.indexOf('|') != -1) {
            update = response.split('|');
            changeDiv(update[0], update[1]);
        }

    }
}

function changeDiv(div,text) {
    // Detect Browser
    var IE = (document.all) ? 1 : 0;
    var DOM = 0; 
    if (parseInt(navigator.appVersion) >=5) {DOM=1};

    // Grab the content from the requested "div" and show it in the "container"
    if (DOM) {
        var viewer = document.getElementById(div);
        viewer.innerHTML = text;
    }  else if(IE) {
        document.all[div].innerHTML = text;
    }
}

