//该文件为js基本类库

function OnTabClickedTab(instance, method)
{
	return function () {
		return method.apply(instance, [arguments[0], this]);
	}
}

function TabControl(tabctrlname)
{
	this.TabCtrlName = tabctrlname;
	this.TabSelClass = "selected";
	this.HitTest = "click";
	this.OnTabSel = null;
}

TabControl.prototype.Init = function () {
	if(this.HitTest == "click")
	{
		$(this.TabCtrlName + " > .newsboxheader > a").click(OnTabClickedTab(this, function () {
			thiscontrol = arguments[1];
			$(this.TabCtrlName + " > .newsboxheader > a").removeClass(this.TabSelClass);
			$(thiscontrol).addClass(this.TabSelClass);
			$(this.TabCtrlName + " > .tabpanel").hide();
			if($(thiscontrol).attr("id") != null)
				$("#" + $(thiscontrol).attr("id") + "_panel").show();

			if(typeof(this.OnTabSel) == "function")
				this.OnTabSel($(thiscontrol).attr("id"));
			return false;
		}));
	}
	if(this.HitTest == "mouseover")
	{
		$(this.TabCtrlName + " > .newsboxheader > a").mouseover(OnTabClickedTab(this, function () {
			thiscontrol = arguments[1];
			$(this.TabCtrlName + " > .newsboxheader > a").removeClass(this.TabSelClass);
			$(thiscontrol).addClass(this.TabSelClass);
			$(this.TabCtrlName + " > .tabpanel").hide();
			if($(thiscontrol).attr("id") != null)
				$("#" + $(thiscontrol).attr("id") + "_panel").show();

			if(typeof(this.OnTabSel) == "function")
				this.OnTabSel($(thiscontrol).attr("id"));
			return false;
		}));
	}
};

function FaqListCtrl(faqlstctrl)
{
	this.ListCtrlName = faqlstctrl;
	this.ListCtrlSelClass = "selected";
}

FaqListCtrl.prototype.Init = function () {
	$(this.ListCtrlName + " > dt").click(function () {
		if($(this).children("a").attr("class").indexOf("selected") >= 0)
		{
			$(this).children("a").removeClass("selected");
			$(this).next("dd").css("display", "none");
		}
		else
		{
			$(this).children("a").addClass("selected");
			$(this).next("dd").css("display", "");
		}
		window.focus();
		return false;
	});
}