
	function fav(threadId)
	{
 		var errorWarning = 'There was a problem while marking the thread as your favourite';
		$.ajax({
 			url: '/ajax/bb_fav.php',
			data: {'threadId':threadId},
			type: 'post',
			error: function(){alert(errorWarning)},
			success: function(text){
				var e = $('#favourite-' + threadId);
				if (text == 'removed' || text == 'added')
					e.toggleClass('favourite');
				else
					alert(errorWarning);
			}
		});
	}

// Kick the form highlighting into action
if(window.attachEvent)
	window.attachEvent("onload", init);

function init() {
/*
       	var tags = new Array("textarea", "input");
       	for(var i = 0; i < tags.length; i++) {
               	var objs = document.getElementsByTagName(tags[i]);
               	for(var x = 0; x < objs.length; x++) {
                       	objs[x].onfocus = focused;
                       	objs[x].onblur = blurred;
               	}

       	}
*/
	var table = document.getElementById("threadlist");
	if(table) {
		var trs = table.getElementsByTagName("tr");
		for(var i = 0; i < trs.length; i++) {
			if(trs[i].id != "threadlistheader") {
				trs[i].onmouseover = highlighton;
				trs[i].onmouseout = highlightoff;
			}
		}
	}
}

function focused(e) {
        this.oldclass = this.className;
        this.className = "focus";
}
function blurred(e) {
        this.className = this.oldclass;
}

function highlighton(e) {
	this.oldclass = this.className;
	this.className = "mouseover";
}
function highlightoff(e) {
	this.className = this.oldclass;
}


