/*-------------------*/
/*  3 Piece H2 Code  */
/*  By Choco, 2007   */
/* Do Not Re-Release */
/* No Editing Either */
/*-------------------*/

//!~: Start code. Had to fix the toggle function.
function Toggle(c){var d=$(c).attr("class");$(c).attr("class","collapse uncollapse").removeClass(d).parents("div.h2wrap").next("table").slideToggle("slow",function(){$(c).one("click",function(){Toggle($(this))})});var e=$(c).parents("div.category").attr("id");var f=(e=="stats")?[0,0]:e.split('-');if(d=="collapse"){d=1}else{d=2}$.post(main_url+"tasks/",{"task":d,"cat":f[1]},function(a){var b=true;$(c).html(a);if(typeof fixPNG=='function'){fixPNG()}})};

ff=(navigator.userAgent.indexOf("Firefox")!=-1)?" style='margin-left:-1px;'":"";
if(!window.location.href.match(/calendar|\/profile\//i)) {
//!~: Category loop.
$("table.cat_head").each(function() {
	elz = this.parentNode;
	y=this.innerHTML;
	//!~: Weird RegExp for handling h2.special.
	y=y.split(/\<h2.*?\>/i)[1];
	if(y) y=y.split(/\<\/h2\>/i)[0];
	this.parentNode.removeChild(this);
	elz.innerHTML="<div class=\"h2wrap\""+ff+"><div class=\"h2left\"><div class=\"h2right\"><div class=\"h2center\">"+y+"</div></div></div></div>"+elz.innerHTML;
});

//!~: Stats.
$("#stats h2.special").each(function() {x=$(this);x.parent().prepend("<div class='h2wrap'"+ff+"><div class='h2left'><div class='h2right'><div class='h2center'>"+x.html()+"</div></div></div></div>");x.remove();});

//!~: Forum view loop.
$("thead th").each(function() {$(this).parent().html("<td colspan='7'><div class='h2wrap'"+ff+"><div class='h2left'><div class='h2right'><div class='h2center'>"+$(this).text()+"</div></div></div></div></td>");});
}
//!~: Complete!

