/*======================================================================*\
|| #################################################################### ||
|| # Mark Threads 1.1.0
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2007 Surviver
|| # This file may not be redistributed in whole or significant part. # ||
|| # http://vbulletin.pytalhost.org/hacks/index.php?productid=mark_threads&show=supporturl
|| #################################################################### ||
\*======================================================================*/

function send_mark_thread(threadid)
{
	mark_thread_handler = new vB_AJAX_Handler(true);
	if (!mark_thread_handler.is_compatible())
	{
		return true;
	}
	mark_thread_handler.threadid = threadid;
	mark_thread_handler.onreadystatechange(handle_mark_thread);
	mark_thread_handler.send('ajax.php?' + SESSIONURL + 'do=mark_thread', 'do=mark_thread&threadid=' + mark_thread_handler.threadid + '&ajax=1');
	return false;
}

function handle_mark_thread()
{
	if (mark_thread_handler.handler.readyState == 4 && mark_thread_handler.handler.status == 200)
	{
		if (mark_thread_handler.handler.responseXML)
		{
			if(fetch_tags(mark_thread_handler.handler.responseXML, 'error').length)
			{
				alert(mark_thread_handler.fetch_data(fetch_tags(mark_thread_handler.handler.responseXML, 'error')[0]));
			}
			else if(fetch_tags(mark_thread_handler.handler.responseXML, 'imagesrc').length)
			{
				mtb_1 = fetch_object('markimage_1');
				mtb_2 = fetch_object('markimage_2');
				
				if (mtb_1)
				{
					mtb_1.src = mark_thread_handler.fetch_data(fetch_tags(mark_thread_handler.handler.responseXML, 'imagesrc')[0]);
				}
				
				if (mtb_2)
				{
					mtb_2.src = mark_thread_handler.fetch_data(fetch_tags(mark_thread_handler.handler.responseXML, 'imagesrc')[0]);
				}
				
				return false;
			}
		}
	}
}

function send_mark_threadbit(threadid)
{
	mark_thread_handler = new vB_AJAX_Handler(true);
	if (!mark_thread_handler.is_compatible())
	{
		return true;
	}
	mark_thread_handler.threadid = threadid;
	mark_thread_handler.onreadystatechange(handle_mark_threadbit);
	mark_thread_handler.send('ajax.php?' + SESSIONURL + 'do=mark_thread', 'do=mark_threadbit&threadid=' + mark_thread_handler.threadid + '&ajax=1');
	return false;
}

function handle_mark_threadbit()
{
	if (mark_thread_handler.handler.readyState == 4 && mark_thread_handler.handler.status == 200)
	{
		if (mark_thread_handler.handler.responseXML)
		{
			if(fetch_tags(mark_thread_handler.handler.responseXML, 'error').length)
			{
				alert(mark_thread_handler.fetch_data(fetch_tags(mark_thread_handler.handler.responseXML, 'error')[0]));
			}
			else
			{
				obj = fetch_object('mtthreadbit_' + mark_thread_handler.threadid);
				if (obj)
				{
					obj.innerHTML = mark_thread_handler.fetch_data(fetch_tags(mark_thread_handler.handler.responseXML, 'markprefix')[0]);
				}
				
				//opencloseimg = fetch_object('thread_statusicon_' + mark_thread_handler.threadid);
				
				return false;
			}
		}
	}
}

//File vbulletin_mark_threads.js, Created: 06/16/2007 23:07