simplexhr={
  doxhr:function(container,url){
    if(!document.getElementById || !document.createTextNode){return;}
    simplexhr.outputContainer=document.getElementById(container);
    if(!simplexhr.outputContainer){return;}
    var request;
    try{
      request = new XMLHttpRequest();
    }catch(error){
      try{
        request = new ActiveXObject("Microsoft.XMLHTTP");
      }catch(error){
        return true;
      }
    }
    request.open('get',url,true);
    request.onreadystatechange=function(){
      if(request.readyState == 1){
        simplexhr.outputContainer.innerHTML='loading...';
      }
      if(request.readyState == 4){
        if (request.status && /200|304/.test(request.status))
        {
          simplexhr.retrieved(request);
        } else{
          simplexhr.failed(request);
        }
      }
    }
    request.setRequestHeader('If-Modified-Since','Wed, 05 Apr 2006 00:00:00 GMT');
    request.send(null);
    return false;
  },
  retrieved:function(requester){
    simplexhr.outputContainer.removeChild(simplexhr.outputContainer.firstChild);
    var data=requester.responseText;
    var headrow='<tr><th>ID</th><th>Artist</th><th>Title</th><th>Comment</th></tr>';
    data=data.replace(/<\?.*\?>/g,'')
    data=data.replace(/<(\/*)id>/g,'<$1th>')
    data=data.replace(/<(\/*)(artist|title|comment)>/g,'<$1td>')
    data=data.replace(/<(\/*)albums>/g,'<$1table>')
    data=data.replace(/<(\/*)album>/g,'<$1tr>');
    data=data.replace(/<table>/g,'<table>'+headrow);
    simplexhr.outputContainer.innerHTML=data;
	alert(data);
    return false;
  },
  failed:function(requester){
    alert('The XMLHttpRequest failed. Status: '+requester.status);
    return true;
  }
}
