function Tabs() {
	var This = this;
	This.ScrollValue = "0";
	This.Hrefs = new Array();
	This.BlockElement = "";
	This.CurrentHref = null;
	This.Timer = null;
	This.TimerInterval = "10000";
	This.MaxScroll = "0";

	this.Init = function (blockElement) {
		This.BlockElement = blockElement;

		$(This.BlockElement + " ul li").bind("click", This.TabClick);
		$(This.BlockElement + " #tab-scrollup").bind("click", This.UpDownClick);
		$(This.BlockElement + " #tab-scrollup").bind("mouseup", This.UpDownClickStop);
		$(This.BlockElement + " #tab-scrollup").bind("mousedown", This.UpClickStart);
		$(This.BlockElement + " #tab-scrolldown").bind("click", This.UpDownClick);
		$(This.BlockElement + " #tab-scrolldown").bind("mouseup", This.UpDownClickStop);
		$(This.BlockElement + " #tab-scrolldown").bind("mousedown", This.DownClickStart);

		This.SetScrollValue();

		if (This.Hrefs.length != 0) {
			This.CurrentHref = This.Hrefs[0];
		}
		//выставить таймер на автообновление
		This.Timer = setInterval(This.UpdateContent, This.TimerInterval);
		//обновить содержимое
		This.UpdateContent();
	};

	this.TabClick = function () {
		if (!$(this).hasClass("active")) {
			//обнуляем скролл
			This.ScrollValue = 0;
			This.SetScrollValue();
			//удаляем выделение
			$(This.BlockElement + " ul li").each(function () {
				$(this).removeClass("active");
			});
			//выделяем нажатый
			$(this).addClass("active");
			//изменяем путь
			This.CurrentHref = This.Hrefs[$(this).attr("id")];
			//выставить таймер на автообновление
			This.Timer = setInterval(This.UpdateContent, This.TimerInterval);
			//обновить содержимое
			This.UpdateContent();
		}
		return false;
	}

	this.SetScrollValue = function () {
		$(This.BlockElement + " .tab-scrollblock p").css("top", This.ScrollValue + "px");
	}

	this.UpdateContent = function () {
		$.get(This.CurrentHref, function(data){ 
			$(This.BlockElement + " .tab-scrollblock p").html(data);
			block1Height = $(This.BlockElement + " .tab-scrollblock p").attr("offsetHeight");
			blockHeight = $(This.BlockElement + " .tab-scrollblock").attr("offsetHeight");
			This.MaxScroll = block1Height - blockHeight;
			if (This.MaxScroll < 0) {
				This.MaxScroll = 0;
				$(This.BlockElement + " #tab-scrollup").addClass("disabledup");
				$(This.BlockElement + " #tab-scrolldown").addClass("disableddown");
			}
		});
		$.get("/services/tabnews.php?ctype=1", function(data){ 
			$("#tabs-totalnews").html(data);
		});
	}

	this.ScrollUp = function () {
		if (This.ScrollValue >= 0) {
			This.ScrollValue = 0;
			This.SetScrollValue();
			clearInterval(This.TimerScroll);
			$(This.BlockElement + " #tab-scrollup").addClass("disabledup");
			return;
		}
		$(This.BlockElement + " #tab-scrolldown").removeClass("disableddown");
		This.ScrollValue = (This.ScrollValue * 1) + 4;
		This.SetScrollValue();
	}

	this.ScrollDown = function () {
		if (This.ScrollValue <= (This.MaxScroll * (-1))) {
			This.ScrollValue = (This.MaxScroll * (-1));
			This.SetScrollValue();
			clearInterval(This.TimerScroll);
			$(This.BlockElement + " #tab-scrolldown").addClass("disableddown");
			return;
		}
		$(This.BlockElement + " #tab-scrollup").removeClass("disabledup");
		This.ScrollValue = (This.ScrollValue * 1) - 4;
		This.SetScrollValue();
	}

	this.UpDownClick = function () {
		return false;
	}

	this.UpClickStart = function () {
		This.TimerScroll = setInterval(This.ScrollUp, 10);
	}

	this.DownClickStart = function () {
		This.TimerScroll = setInterval(This.ScrollDown, 10);
	}

	this.UpDownClickStop = function () {
		clearInterval(This.TimerScroll);
	}
}