$(document).ready(function(){
	initTabs(".tabset");
	
});

function initTabs(h_list) {
	$(h_list).each(function(_ind, _el)
	{
		var btn_h = $(_el);
		var _btn = $(_el).find('a.tab');
		var _a = 0;
		_btn.each(function(_ind, _el)
		{
			this._box = $('#'+_el.href.substr(_el.href.indexOf("#") + 1));
			if($(_el).hasClass('active'))
			{
				this._box.show();
				_a = _ind;
			}
			else {
				this._box.hide();
				this._box.css({"display": "none", "opacity": 0})
			}
			_el.onclick = function()
			{
				if(!$(this).hasClass('active'))
				{
					_btn.get(_a)._box.css({"display": "none", "opacity": 0})
					_btn.eq(_a).removeClass('active');
					this._box.css({"display": "block"})
					this._box.fadeTo("slow", 0.99);
					$(this).addClass('active');
					_a = _ind;
				}
				return false;
			}
		});
	});
}
