function ajaxFunction(div,type,url,spin)
{	
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("Sorry but your browser does not support 'ajax', and therefore some sections of the site may not work correctly. Please update your browser - visit http://www.firefox.com");
      return false;
      }
    }
  }
  
  xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState==1)
      {
	  		if(spin!=0){ document.getElementById(div).innerHTML="<img src='Images/ajax_loading.gif' width='16' height='16' border='0' />";}
      }
		if(xmlHttp.readyState==2)
      {
	  //document.getElementById(div).innerHTML="<img src='Images/loading.gif' width='16' height='16' border='0' />";
      }
	if(xmlHttp.readyState==3)
      {
	  //document.getElementById(div).innerHTML="<img src='Images/loading.gif' width='16' height='16' border='0' />";
      }
    if(xmlHttp.readyState==4)
      {
		  if (xmlHttp.status == 200) {
			document.getElementById(div).innerHTML=xmlHttp.responseText;
			//alert("an error occoured while trying to use ajax to access this file: "+url);
		  }else{
			  //alert("an error occoured while trying to use ajax to access this file: "+url);
		  }
	  	  
	  //review sent
	  if(xmlHttp.responseText == "imageUpdated"){
		  document.getElementById("editWindow").innerHTML="<div class='msg-success'>The image has been updated. Refreshing list below...</div><br />";
		  ajaxFunction('frontCoverCurrent', 'GET', 'admin_frontpage_grab.php',0);
	  }
	  	  //album updated
	  if(xmlHttp.responseText == "albumUpdated"){
		  document.getElementById("editWindow").innerHTML="<div class='msg-success'>The album has been updated. Refreshing list below...</div><br />";
		  ajaxFunction('viewAlbum', 'GET', 'admin_addContent_a_grab.php',0);
	  }
	  //blank reset
	  if(url == "reset"){
		  document.getElementById(div).innerHTML="";
	  }	
      }
    }
  
  xmlHttp.open(type,url,true);
  xmlHttp.send(null);
  }