var xmlHttp

function showFriends(page, top){
 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null){
  alert ("Browser does not support HTTP Request")
  return
 }
 var exclude = ToolMan.junkdrawer().serializeList(document.getElementById('boxes'));
 exclude = exclude.replace(/\|/g, "&exclude[]=");
 
 var url="/user_top_friends_ajax.php";
 url=url+"?exclude[]="+exclude+"&page="+page+"&top="+top;
 url=url+"&sid="+Math.random();
 xmlHttp.onreadystatechange=stateChanged ;
 xmlHttp.open("GET",url,true);
 xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 var existingHTML = document.getElementById("boxes").innerHTML;
 document.getElementById("boxes").innerHTML = existingHTML + xmlHttp.responseText;
 dragsort.makeListSortable(document.getElementById("boxes"), saveOrder)
 } 
}

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;
}