/*=====================================*\
|| ################################### ||
|| # Post Thank You Hack version 7.7 # ||
|| ################################### ||
\*=====================================*/
var post_thanks_handleSuccess = function(o)
{
	if(o.responseText !== undefined)
	{
		if (post_thanks_callback.object_name[o.tId] !== undefined)
		{
			fetch_object(post_thanks_callback.object_name[o.tId]).innerHTML = o.responseText;
		}
	}
}
var post_thanks_handleFailure = function(o)
{
	if(o.responseText !== undefined)
	{
		alert(o.responseText);
	}
}
var post_thanks_callback =
{
	success: post_thanks_handleSuccess,
	failure: post_thanks_handleFailure,
	timeout: vB_Default_Timeout,
	cache: false,
	object_name: new Array()
};
function post_thanks_give(postid, integrate)
{
	fetch_object('post_thanks_button_' + postid).style.display = 'none';

	if (integrate == true)
	{
		fetch_object('post_groan_button_' + postid).style.display = 'none';
	}

	var sUrl = 'post_thanks.php';
	var postData = 'do=post_thanks_add&using_ajax=1&p=' + postid + '&securitytoken=' + SECURITYTOKEN;

	var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, post_thanks_callback, postData);

	post_thanks_callback.object_name[request.tId] = 'post_thanks_box_' + postid;

	return false;
}
function post_thanks_remove_all(postid, integrate)
{
	var sUrl = 'post_thanks.php';
	var postData = 'do=post_thanks_remove_all&using_ajax=1&p=' + postid + '&securitytoken=' + SECURITYTOKEN;

	var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, post_thanks_callback, postData);

	post_thanks_callback.object_name[request.tId] = 'post_thanks_box_' + postid;

	fetch_object('post_thanks_button_' + postid).style.display = ''

	if (integrate == true)
	{
		fetch_object('post_groan_button_' + postid).style.display = '';
	}

	return false;
}
function post_thanks_remove_user(postid, integrate)
{
	var sUrl = 'post_thanks.php';
	var postData = 'do=post_thanks_remove_user&using_ajax=1&p=' + postid + '&securitytoken=' + SECURITYTOKEN;

	var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, post_thanks_callback, postData);

	post_thanks_callback.object_name[request.tId] = 'post_thanks_box_' + postid;

	fetch_object('post_thanks_button_' + postid).style.display = ''

	if (integrate == true)
	{
		fetch_object('post_groan_button_' + postid).style.display = '';
	}

	return false;	
}

function opendroplist()
{
	var prefixbox = fetch_object('prefixidlist');
	
	prefixbox.style.display = "block";
	
	prefixbox.style.border = 1;
}

function closedroplist()
{
	var prefixbox = fetch_object('prefixidlist');
	
	prefixbox.style.display = "none";
}

function nochange_pre () {
	alert('You are not enought permission to change the prefix');
}

function post_prefix_give(threadid)
{
		
	var prefixbox = fetch_object('prefixidlist');
	
	index0 = prefixbox.selectedIndex;
	
	var sUrl = 'change_prefix.php';
	
	var postData = 'do=edit&t='+threadid + '&prefixid=' + prefixbox.options[index0].value + '&securitytoken=' + SECURITYTOKEN;

	var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, post_thanks_callback, postData);
	
	
	var imgbox = fetch_object('processimg');
	
	imgbox.src = "images/misc/13x13progress.gif";
	
	
	clearInterval('',0);
	
	var t = setTimeout("updateobj()",2000);
	
		


}

function updateobj () {
	
	var prefixbox = fetch_object('prefixidlist');
	var imgbox = fetch_object('processimg');
	prefixbox.selectedIndex = index0;
	var currentprefix = fetch_object('currentprefix');
	
	
	var myprefixs = new Array();
	
	myprefixs['Answered'] = '<span style="color: rgb(51, 153, 255); font-weight: bold;">Answered</span>';
	myprefixs['Solved'] = '<span style="color: rgb(0, 97, 0); font-weight: bold;">Solved</span>';
	myprefixs['Question'] = '<span style="color: rgb(153, 153, 153); font-weight: bold; font-style: italic;">Question</span>';
	myprefixs['Tips'] = '<span style="font-weight: bold; color: rgb(204, 102, 0);">Tips</span>';
	myprefixs['Problem'] = '<span style="color: rgb(153, 153, 153); font-weight: bold; font-style: italic;">Problem</span>';
	myprefixs['Joomla 1.0'] = '<span style="color: rgb(0, 102, 0); font-weight: bold;">Joomla 1.0</span>';
	myprefixs['Joomla 1.5'] = '<span style="color: rgb(255, 102, 0); font-weight: bold;">Joomla 1.5</span>';
	myprefixs['Quesion_Feedback'] = '<span style="color: rgb(153, 153, 153); font-weight: bold; font-style: italic;">Question</span>';
	myprefixs['Suggestion'] = '<span style="color: rgb(51, 153, 255); font-weight: bold;">Suggestion</span>';
	myprefixs['Answered_Feedback'] = '<span style="color: #3399FF; font-weight: bold;">Answered</span>';
	myprefixs['Presales_Answered'] = '<span style="color: #3399FF; font-weight: bold;">Answered</span>';
	myprefixs['Prsales_question'] = '<span style="color:#999999; font-weight:bold; font-style:italic">Question</span>';
	
	
	if(prefixbox.options[index0].value=='Answered') {
		
		pre_label	= myprefixs['Answered'];	
		
	} else if (prefixbox.options[index0].value=='Solved') {
		
		pre_label	= myprefixs['Solved'];
		
	} else if(prefixbox.options[index0].value=='Question'){
		
		pre_label	= myprefixs['Question'];
		
	} else if(prefixbox.options[index0].value=='Tips') {
		
		pre_label	= myprefixs['Tips'];
		
	} else if(prefixbox.options[index0].value=='Problem') {
		
		pre_label	= myprefixs['Problem'];
		
	} else if(prefixbox.options[index0].value=='video') {
		
		pre_label	= myprefixs['Joomla 1.5'];
		
	} else if(prefixbox.options[index0].value=='picture') {
		
		pre_label	= myprefixs['Joomla 1.0'];
					
	} else if(prefixbox.options[index0].value=='Quesion_Feedback') {
		
		pre_label	= myprefixs['Quesion_Feedback'];
	
	} else if(prefixbox.options[index0].value=='Suggestion') {
		
		pre_label	= myprefixs['Suggestion'];
			
	} else if(prefixbox.options[index0].value=='Answered_Feedback') {
		
		pre_label	= myprefixs['Answered_Feedback'];
	
	} else if(prefixbox.options[index0].value=='Presales_Answered') {
		
		pre_label	= myprefixs['Presales_Answered'];
	
	} else if(prefixbox.options[index0].value=='Prsales_question') {
		
		pre_label	= myprefixs['Prsales_question'];
			
	} else {
		
		pre_label = prefixbox.options[index0].value;
		
	}
	
	currentprefix.innerHTML = pre_label;
	
	imgbox.src = "images/misc/13x13arrowdown.gif";
	
	return false;
}

