LanguageTab.prototype = Object.create(BasicTab.prototype);
LanguageTab.constructor = LanguageTab;

function LanguageTab(clickEvent) {
	BasicTab.call(this);

	this.reservedClickEvent = clickEvent;

	this.tabLayout = null;
	this.reservedMainText = "";
	this.reservedSubText = "";
	this.reservedIconName = "";
}

LanguageTab.prototype.setTabLayout = function(tabLayout) {
	this.tabLayout = tabLayout;
}

LanguageTab.prototype.reserveMainText = function(text) {
	this.reservedMainText = text;
}

LanguageTab.prototype.reserveIcon = function(iconName) {
	this.reservedIconName = iconName;
}

LanguageTab.prototype.reserveSubText = function(text) {
	this.reservedSubText = text;
}

LanguageTab.prototype.createTab = function(index) {
	var width = this.tabLayout.getTabWidth();
	var height = this.tabLayout.getTabHeight();
	var x = this.tabLayout.getX() + width / 2 + width * index;
	var y = this.tabLayout.getY() + height / 2;

	var setting = new TabSetting(x, y, width, height);
	// setting.setFont("Nanum Pen Script");
	setting.setFont("Nanum Gothic");
	setting.setMainFontSize(16);
	setting.setSubFontSize(16);
	setting.setButtonColor(
		LanguageTab.BUTTON_COLOR_OUT_HEX,
		LanguageTab.BUTTON_COLOR_OVER_HEX,
		LanguageTab.BUTTON_COLOR_DOWN_HEX,
		LanguageTab.BUTTON_COLOR_DISABLED_HEX
	);
	setting.setActiveLineColor(
		LanguageTab.ACTIVE_LINE_COLOR_OUT_HEX,
		LanguageTab.ACTIVE_LINE_COLOR_OVER_HEX,
		LanguageTab.ACTIVE_LINE_COLOR_DOWN_HEX,
		LanguageTab.ACTIVE_LINE_COLOR_DISABLED_HEX
	);
	setting.setIconColor(
		LanguageTab.ICON_COLOR_OUT_HEX,
		LanguageTab.ICON_COLOR_OVER_HEX,
		LanguageTab.ICON_COLOR_DOWN_HEX,
		LanguageTab.ICON_COLOR_DISABLED_HEX
	);
	setting.setTextColor(
		LanguageTab.TEXT_COLOR_OUT_STRING,
		LanguageTab.TEXT_COLOR_OVER_STRING,
		LanguageTab.TEXT_COLOR_DOWN_STRING,
		LanguageTab.TEXT_COLOR_DISABLED_STRING
	);


	this.createButton(
		setting,
		(function() {
			this.tabLayout.selectedTab(this);
			this.reservedClickEvent();
		}).bind(this)
	);
	this.setMainTextFontWeight("normal");
	this.mainText.fontSize = 18;
	this.transformActiveLine();

	if(this.reservedMainText.length > 0)
		this.setMainText(this.reservedMainText);

	if(this.reservedIconName.length > 0)
		this.addIcon(this.reservedIconName);

	if(this.reservedSubText.length > 0)
		this.setSubText(this.reservedSubText);
}

LanguageTab.prototype.transformActiveLine = function() {
	this.activeLineSprite.y = 3;
	var height = this.tabLayout.getTabHeight();
	this.activeLineSprite.y = height - 6;
}


LanguageTab.BUTTON_COLOR_OUT_HEX			= MainColor.DARKER_CHOCO_HEX;
LanguageTab.BUTTON_COLOR_OVER_HEX			= MainColor.DARK_CHOCO_HEX;
LanguageTab.BUTTON_COLOR_DOWN_HEX			= MainColor.LIGHTER_CHOCO_HEX;
LanguageTab.BUTTON_COLOR_DISABLED_HEX		= MainColor.BLACK_HEX;

LanguageTab.ACTIVE_LINE_COLOR_OUT_HEX		= MainColor.LIGHTER_CHOCO_HEX;
LanguageTab.ACTIVE_LINE_COLOR_OVER_HEX		= MainColor.DARKER_CHOCO_HEX;
LanguageTab.ACTIVE_LINE_COLOR_DOWN_HEX		= MainColor.CHOCO_HEX;
LanguageTab.ACTIVE_LINE_COLOR_DISABLED_HEX	= MainColor.BLACK_HEX;

LanguageTab.ICON_COLOR_OUT_HEX				= MainColor.LIGHT_CHOCO_HEX;
LanguageTab.ICON_COLOR_OVER_HEX				= MainColor.CHOCO_HEX;
LanguageTab.ICON_COLOR_DOWN_HEX				= MainColor.LIGHT_CHOCO_HEX;
LanguageTab.ICON_COLOR_DISABLED_HEX			= MainColor.DARKER_CHOCO_HEX;

LanguageTab.TEXT_COLOR_OUT_STRING			= MainColor.WHITE_STRING;
LanguageTab.TEXT_COLOR_OVER_STRING			= MainColor.LIGHTER_CHOCO_STRING;
LanguageTab.TEXT_COLOR_DOWN_STRING			= MainColor.CHOCO_STRING;
LanguageTab.TEXT_COLOR_DISABLED_STRING		= MainColor.DARKER_CHOCO_STRING;