var xmlHttp


function showAlbumButton(medium,what,albumid,userid)
{ 
var div = document.getElementById('returnTXT'+albumid);


//alert ("showCustomer"+albumid+"/"+str+"/"+userid);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
} 

if (what=='wantitnrg')
{	
alert("You tried to view a page that requires you to log in.");
return;
}
if (what=='ownitnrg')
{	
alert("You tried to view a page that requires you to log in.");
return;
}

xmlHttp.onreadystatechange=function() {
var response;
var ownorwant;

	if (xmlHttp.readyState==4)
	{ 
		setTimeout(function(){ 
			response = xmlHttp.responseText; 
			if(response=='Inserted') 
			{
			
			if (what=='ownit')
			{	
				div.innerHTML='';
				div.innerHTML="I Own It";
			}
			if (what=='wantit')
			{	
				div.innerHTML='';
				div.innerHTML="I Want It";
			}
			
			
				document.getElementById('ownItBtn'+albumid).style.display='none';
				document.getElementById('wantItBtn'+albumid).style.display='none';
				document.getElementById('deleteItBtn'+albumid).style.display='block';
			}
			
			if(response=='NOT Inserted') div.innerHTML="Already Done";
			
			if(response=='Deleted') { 
			
				div.innerHTML="Deleted";
				div.innerHTML='';
				document.getElementById('ownItBtn'+albumid).style.display='block';
				document.getElementById('wantItBtn'+albumid).style.display='block';
				document.getElementById('deleteItBtn'+albumid).style.display='none';
			}
			
		},500);
		
		//setTimeout(function(){
		//	div.innerHTML='';
		//},2000);
		
	}
}

xmlHttp.open("POST",live_site+"mysafmdb/"+medium+"/"+albumid+"/"+what+"/"+userid,true);
xmlHttp.send(null);
}


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;
}