/**
  * Thank you 3.0.2
  * written by Arash.j13@gmail.com
  * website  WWW.CodeCorona.com
*/
var pid=-1;
var spinner='';
function thx_action(response)
{
	xml=response.responseXML;
	table=document.getElementById('thx'+pid);
	list=document.getElementById('thx_list'+pid);
	table.style.display=xml.getElementsByTagName('display').item(0).firstChild.data!=0 ?
		'' : 'none';
		
	list.innerHTML=xml.getElementsByTagName('list').item(0).firstChild.data;
	
	lin=document.getElementById('a'+pid);
	lin.onclick= new Function("","return rthx("+pid+");");
		
	lin.href='showthread.php?action=remove_thank&pid='+pid;
	
	img=document.getElementById('i'+pid);
	
	img.src=xml.getElementsByTagName('image').item(0).firstChild.data;
	
	spinner.destroy();
	spinner='';
}

function rthx_action(response)
{
	xml=response.responseXML;
	table=document.getElementById('thx'+pid);
	list=document.getElementById('thx_list'+pid);
	table.style.display=xml.getElementsByTagName('display').item(0).firstChild.data!=0 ?
		'' : 'none';
		
	list.innerHTML=xml.getElementsByTagName('list').item(0).firstChild.data;
	
	lin=document.getElementById('a'+pid);
	lin.onclick= new Function("","return thx("+pid+");");
	lin.href='showthread.php?action=thank&pid='+pid;
	
	img=document.getElementById('i'+pid);
	
	img.src=xml.getElementsByTagName('image').item(0).firstChild.data;
	
	spinner.destroy();
	spinner='';
}

function thx(id)
{
	spinner = new ActivityIndicator("body", {image: "images/spinner_big.gif"});
	pid=id;
	b="pid="+pid;
	new ajax('xmlhttp.php?action=thankyou',{postBody:b,onComplete:thx_action});
	return false;
}

function rthx(id)
{
	spinner = new ActivityIndicator("body", {image: "images/spinner_big.gif"});
	pid=id;
	b="pid="+pid;
	new ajax('xmlhttp.php?action=remove_thankyou',{postBody:b,onComplete:rthx_action});
	return false;
}