function TabLayout(x, y, width, height) {
	this.x = x;
	this.y = y;
	this.width = width;
	this.height = height;

	this.activeTabIndex = 0;

	this.tabGroup = new Array();
};

TabLayout.prototype.add = function(tab) {
	tab.setTabLayout(this);
	this.tabGroup.push(tab);
}

TabLayout.prototype.getX = function() {
	return this.x;
}

TabLayout.prototype.getY = function() {
	return this.y;
}

TabLayout.prototype.getTabWidth = function() {
	return this.width / this.tabGroup.length;
}

TabLayout.prototype.getTabHeight = function() {
	return this.height;
}

TabLayout.prototype.createTabs = function() {
	var count = this.tabGroup.length;
	for(var i = 0; i < count; i++) {
		this.tabGroup[i].createTab(i);
	}

	this.updateActiveLine();
}

TabLayout.prototype.applyLoadedFont = function() {
	var count = this.tabGroup.length;
	for(var i = 0; i < count; i++) {
		this.tabGroup[i].applyLoadedFont();
	}
}

TabLayout.prototype.selectedTab = function(tab) {
	var count = this.tabGroup.length;
	for(var i = 0; i < count; i++) {
		if(this.tabGroup[i] === tab)
			this.activeTabIndex = i;
	}

	this.updateActiveLine();
}

TabLayout.prototype.updateActiveLine = function() {
	var count = this.tabGroup.length;
	for(var i = 0; i < count; i++)
		this.tabGroup[i].setActive(false);

	this.tabGroup[this.activeTabIndex].setActive(true);
}


TabLayout.prototype.show = function() {
	var count = this.tabGroup.length;
	for(var i = 0; i < count; i++)
		this.tabGroup[i].show();
}

TabLayout.prototype.hide = function() {
	var count = this.tabGroup.length;
	for(var i = 0; i < count; i++)
		this.tabGroup[i].hide();
}
