function ajaxFunction(id, url)
{
    var xmlHttp;
    try {// Firefox, Opera 8.0+, Safari
        xmlHttp = new XMLHttpRequest(); 
    } catch (e) {// Internet Explorer
        try {
        xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
            alert("Your browser does not support AJAX!");
            return false;
        }
    }
    }

xmlHttp.onreadystatechange = function(){
if (xmlHttp.readyState == 4) {
//Get the response from the server and extract the section that comes in the body section of the second html page avoid inserting the header part of the second page in your first page's element
var respText = xmlHttp.responseText.split('<body>');
elem.innerHTML = respText[1].split('</body>')[0];

}
}

var elem = document.getElementById(id);

if (!elem) {
alert('The element with the passed ID doesn\'t exists in your page');
return false;
}
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
} 

function ahah(url, target) {
//  document.getElementById(target).innerHTML = '';
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone(url, target);};
    req.open("GET", url, true);
    req.send("");
  }
}  

function ahahDone(url, target) {

  if (req.readyState == 4) { // only if req is "loaded"  
    if (req.status == 200) { // only if "OK"    
      document.getElementById(target).innerHTML = req.responseText;
      //document.write(req.responseText)
    } else {
      document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
    }
  }
}
function ahah1(url, target) {
 document.getElementById(target).innerHTML = "<img src='./images/loading17.gif' />";
 
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone(url, target);};
    req.open("GET", url, true);
    req.send("");
  }
}  


