$(document).ready(function()
{
	initTabs();
});
function initTabs()
{
	$(".tab-block").each(function(j, item)
	{
		var buttons = $(item).find(".tabset li a");
		$(buttons).each(function(i, el)
		{
			var _url = this.href;
			if($(this).hasClass("active"))
			{
				loadData(_url, item);
			}
			this.onclick = function()
			{
				loadData(_url, item);
				$(buttons).removeClass("active")
				$(el).addClass("active")
				return false;
			}
		});
	});
}
function loadData(_url, box)
{
	var holder = $(box).find(".tab-content-holder");
	$.ajax({
		url: _url,
		dataType: "html",
		success: function(_html)
		{
			$(holder).html(_html);
			if (typeof document.body.style.maxHeight != 'undefined')
			{
				$(holder).css({"opacity": 0});
				setTimeout(function() { $(holder).animate({"opacity": 1}); }, 400);
			}
		}
	});
}