xmlhttp=null
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
	xmlhttp=new XMLHttpRequest()
}
// code for IE
else if (window.ActiveXObject)
{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
}

function thxFunction(pid)
{
	var ajaxDisplay = "displayThx_"+pid;
	var ajaxLink = "a_"+pid;
	var ajaxImage = "img_"+pid;
	var ajaxBackup = "backup_"+pid;
	
	if(xmlhttp)
	{ 
		var queryString = "&pid="+pid;
		xmlhttp.open("GET", "xmlhttp.php?action=thankyou"+queryString, true);
  		xmlhttp.onreadystatechange= function()
  		{
  			if(xmlhttp.readyState==4)
 			{
 				document.getElementById(ajaxBackup).innerHTML = document.getElementById(ajaxLink).href;
 				document.getElementById(ajaxImage).src = "http://atheistforums.org/images/english/postbit_unthx.gif";
 				document.getElementById(ajaxDisplay).style.display = "";
				document.getElementById(ajaxDisplay).style.visibility = "visible";
				document.getElementById(ajaxDisplay).innerHTML = '<td class="trow1 post_buttons">'+xmlhttp.responseText+'</td>';
				document.getElementById(ajaxLink).href = document.getElementById(ajaxDisplay).children[0].children[2].children[1].href;
			}
			else
			{
				document.getElementById(ajaxDisplay).style.display = "";
				document.getElementById(ajaxDisplay).style.visibility = "visible";
				document.getElementById(ajaxDisplay).innerHTML = '<td class="trow1 post_buttons"><div><img src="./images/spinner.gif" /></div></td>';
			}
 		}
		xmlhttp.send(null)
 	}
}
function thxDelete(pid,id,rid)
{
	var ajaxDisplay = "displayThx_"+pid;
	var ajaxLink = "a_"+pid;
	var ajaxImage = "img_"+pid;
	var ajaxBackup = "backup_"+pid;
	
	if(xmlhttp)
	{ 
		var queryString = "&pid="+pid+"&txid="+id+"&rid="+rid;
		xmlhttp.open("GET", "xmlhttp.php?action=thankyou&type=delete"+queryString, true);
  		xmlhttp.onreadystatechange= function()
  		{
  			if(xmlhttp.readyState==4)
 			{
 				document.getElementById(ajaxImage).src = "http://atheistforums.org/images/english/postbit_thx.gif";
 				document.getElementById(ajaxDisplay).style.display = "";
				document.getElementById(ajaxDisplay).style.visibility = "visible";
				document.getElementById(ajaxDisplay).innerHTML = '<td class="trow1 post_buttons">'+xmlhttp.responseText+'</td>';
				document.getElementById(ajaxLink).href = document.getElementById(ajaxBackup).innerHTML;
			}
			else
			{
				document.getElementById(ajaxDisplay).style.display = "";
				document.getElementById(ajaxDisplay).style.visibility = "visible";
				document.getElementById(ajaxDisplay).innerHTML = '<td class="trow1 post_buttons"><div><img src="./images/spinner.gif" /></div></td>';
			}
 		}
		xmlhttp.send(null)
 	}
}
function getAllThx(id)
{
	document.getElementById(id).style.display = "block";
	document.getElementById(id).style.visibility = "visible";
}
function hideAllThx(id)
{
	document.getElementById(id).style.display = "none";
	document.getElementById(id).style.visibility = "hidden";
}
